SCI: Changed typedef struct -> struct
svn-id: r38752
This commit is contained in:
parent
da190b30fc
commit
8430b662a9
48 changed files with 353 additions and 356 deletions
|
@ -615,8 +615,10 @@ int game_init(EngineState *s) {
|
||||||
|
|
||||||
// Initialize send_calls buffer
|
// Initialize send_calls buffer
|
||||||
|
|
||||||
if (!send_calls_allocated)
|
if (!send_calls_allocated) {
|
||||||
send_calls = (calls_struct_t*)sci_calloc(sizeof(calls_struct_t), send_calls_allocated = 16);
|
send_calls_allocated = 16;
|
||||||
|
send_calls = (calls_struct_t*)sci_calloc(sizeof(calls_struct_t), send_calls_allocated);
|
||||||
|
}
|
||||||
|
|
||||||
if (s->gfx_state && _reset_graphics_input(s))
|
if (s->gfx_state && _reset_graphics_input(s))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -32,11 +32,11 @@ namespace Sci {
|
||||||
//#define DEBUG_GC
|
//#define DEBUG_GC
|
||||||
//#define DEBUG_GC_VERBOSE
|
//#define DEBUG_GC_VERBOSE
|
||||||
|
|
||||||
typedef struct _worklist {
|
struct worklist_t {
|
||||||
int used;
|
int used;
|
||||||
reg_t entries[WORKLIST_CHUNK_SIZE];
|
reg_t entries[WORKLIST_CHUNK_SIZE];
|
||||||
struct _worklist *next;
|
worklist_t *next;
|
||||||
} worklist_t;
|
};
|
||||||
|
|
||||||
static worklist_t *fresh_worklist(worklist_t *old) {
|
static worklist_t *fresh_worklist(worklist_t *old) {
|
||||||
worklist_t *retval = (worklist_t*)sci_malloc(sizeof(worklist_t));
|
worklist_t *retval = (worklist_t*)sci_malloc(sizeof(worklist_t));
|
||||||
|
@ -118,10 +118,10 @@ static reg_t_hash_map * normalise_hashmap_ptrs(reg_t_hash_map *nonnormal_map, se
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct worklist_manager_t {
|
||||||
reg_t_hash_map *nonnormal_map;
|
reg_t_hash_map *nonnormal_map;
|
||||||
worklist_t **worklist_ref;
|
worklist_t **worklist_ref;
|
||||||
} worklist_manager_t;
|
};
|
||||||
|
|
||||||
void add_outgoing_refs(void *pre_wm, reg_t addr) {
|
void add_outgoing_refs(void *pre_wm, reg_t addr) {
|
||||||
worklist_manager_t *wm = (worklist_manager_t *) pre_wm;
|
worklist_manager_t *wm = (worklist_manager_t *) pre_wm;
|
||||||
|
@ -228,14 +228,14 @@ reg_t_hash_map *find_all_used_references(EngineState *s) {
|
||||||
return normal_map;
|
return normal_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
struct deallocator_t {
|
||||||
seg_interface_t *interfce;
|
seg_interface_t *interfce;
|
||||||
#ifdef DEBUG_GC
|
#ifdef DEBUG_GC
|
||||||
char *segnames[MEM_OBJ_MAX + 1];
|
char *segnames[MEM_OBJ_MAX + 1];
|
||||||
int segcount[MEM_OBJ_MAX + 1];
|
int segcount[MEM_OBJ_MAX + 1];
|
||||||
#endif
|
#endif
|
||||||
reg_t_hash_map *use_map;
|
reg_t_hash_map *use_map;
|
||||||
} deallocator_t;
|
};
|
||||||
|
|
||||||
void free_unless_used(void *pre_use_map, reg_t addr) {
|
void free_unless_used(void *pre_use_map, reg_t addr) {
|
||||||
deallocator_t *deallocator = (deallocator_t *)pre_use_map;
|
deallocator_t *deallocator = (deallocator_t *)pre_use_map;
|
||||||
|
|
|
@ -34,12 +34,12 @@ namespace Sci {
|
||||||
|
|
||||||
typedef uint16 heap_ptr;
|
typedef uint16 heap_ptr;
|
||||||
|
|
||||||
typedef struct {
|
struct heap_t {
|
||||||
byte *start;
|
byte *start;
|
||||||
byte *base;
|
byte *base;
|
||||||
unsigned int first_free;
|
unsigned int first_free;
|
||||||
int old_ff;
|
int old_ff;
|
||||||
} heap_t;
|
};
|
||||||
|
|
||||||
heap_t *heap_new();
|
heap_t *heap_new();
|
||||||
/* Allocates a new heap.
|
/* Allocates a new heap.
|
||||||
|
|
|
@ -427,10 +427,10 @@ reg_t kDeleteKey(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
return make_reg(0, 1); // Signal success
|
return make_reg(0, 1); // Signal success
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
struct sort_temp_t {
|
||||||
reg_t key, value;
|
reg_t key, value;
|
||||||
reg_t order;
|
reg_t order;
|
||||||
} sort_temp_t;
|
};
|
||||||
|
|
||||||
int sort_temp_cmp(const void *p1, const void *p2) {
|
int sort_temp_cmp(const void *p1, const void *p2) {
|
||||||
sort_temp_t *st1 = (sort_temp_t *)p1;
|
sort_temp_t *st1 = (sort_temp_t *)p1;
|
||||||
|
|
|
@ -27,18 +27,18 @@
|
||||||
|
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
typedef struct {
|
struct message_tuple_t {
|
||||||
int noun;
|
int noun;
|
||||||
int verb;
|
int verb;
|
||||||
int cond;
|
int cond;
|
||||||
int seq;
|
int seq;
|
||||||
} message_tuple_t;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct index_record_cursor_t {
|
||||||
byte *index_record;
|
byte *index_record;
|
||||||
int index;
|
int index;
|
||||||
byte *resource_beginning;
|
byte *resource_beginning;
|
||||||
} index_record_cursor_t;
|
};
|
||||||
|
|
||||||
typedef int index_record_size_t();
|
typedef int index_record_size_t();
|
||||||
typedef void parse_index_record_t(index_record_cursor_t *index_record, message_tuple_t *t);
|
typedef void parse_index_record_t(index_record_cursor_t *index_record, message_tuple_t *t);
|
||||||
|
@ -46,7 +46,7 @@ typedef int get_talker_t(index_record_cursor_t *cursor);
|
||||||
typedef void get_text_t(index_record_cursor_t *cursor, char *buffer, int buffer_size);
|
typedef void get_text_t(index_record_cursor_t *cursor, char *buffer, int buffer_size);
|
||||||
typedef int index_record_count_t(byte *header);
|
typedef int index_record_count_t(byte *header);
|
||||||
|
|
||||||
typedef struct {
|
struct message_handler_t {
|
||||||
int version_id;
|
int version_id;
|
||||||
parse_index_record_t *parse;
|
parse_index_record_t *parse;
|
||||||
get_talker_t *get_talker;
|
get_talker_t *get_talker;
|
||||||
|
@ -55,9 +55,9 @@ typedef struct {
|
||||||
|
|
||||||
int header_size;
|
int header_size;
|
||||||
int index_record_size;
|
int index_record_size;
|
||||||
} message_handler_t;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct message_state_t {
|
||||||
int initialized;
|
int initialized;
|
||||||
message_handler_t *handler;
|
message_handler_t *handler;
|
||||||
ResourceManager *resmgr;
|
ResourceManager *resmgr;
|
||||||
|
@ -66,7 +66,7 @@ typedef struct {
|
||||||
int record_count;
|
int record_count;
|
||||||
byte *index_records;
|
byte *index_records;
|
||||||
index_record_cursor_t engine_cursor;
|
index_record_cursor_t engine_cursor;
|
||||||
} message_state_t;
|
};
|
||||||
|
|
||||||
int message_get_specific(message_state_t *state, message_tuple_t *t);
|
int message_get_specific(message_state_t *state, message_tuple_t *t);
|
||||||
int message_get_next(message_state_t *state);
|
int message_get_next(message_state_t *state);
|
||||||
|
|
|
@ -51,21 +51,21 @@ static int c_selectornames(EngineState *s); // Displays all selector names
|
||||||
static int c_kernelnames(EngineState *s); // Displays all kernel function names
|
static int c_kernelnames(EngineState *s); // Displays all kernel function names
|
||||||
static int c_dissectscript(EngineState *s); // Splits a script into objects and explains them
|
static int c_dissectscript(EngineState *s); // Splits a script into objects and explains them
|
||||||
|
|
||||||
typedef struct {
|
struct cmd_mm_entry_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *description;
|
const char *description;
|
||||||
} cmd_mm_entry_t; // All later structures must "extend" this
|
}; // All later structures must "extend" this
|
||||||
|
|
||||||
typedef cmd_mm_entry_t cmd_page_t; // Simple info page
|
typedef cmd_mm_entry_t cmd_page_t; // Simple info page
|
||||||
|
|
||||||
typedef struct {
|
struct cmd_command_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *description;
|
const char *description;
|
||||||
int (*command)(EngineState *);
|
int (*command)(EngineState *);
|
||||||
const char *param;
|
const char *param;
|
||||||
} cmd_command_t;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct cmd_var_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *description;
|
const char *description;
|
||||||
union {
|
union {
|
||||||
|
@ -73,19 +73,19 @@ typedef struct {
|
||||||
char **charpp;
|
char **charpp;
|
||||||
reg_t *reg;
|
reg_t *reg;
|
||||||
} var;
|
} var;
|
||||||
} cmd_var_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef void printfunc_t(cmd_mm_entry_t *data, int full);
|
typedef void printfunc_t(cmd_mm_entry_t *data, int full);
|
||||||
|
|
||||||
typedef struct {
|
struct cmd_mm_struct_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
void *data; // cmd_mm_entry_t
|
void *data; // cmd_mm_entry_t
|
||||||
size_t size_per_entry;
|
size_t size_per_entry;
|
||||||
printfunc_t *print;
|
printfunc_t *print;
|
||||||
int entries; // Number of used entries
|
int entries; // Number of used entries
|
||||||
int allocated; // Number of allocated entries
|
int allocated; // Number of allocated entries
|
||||||
} cmd_mm_struct_t;
|
};
|
||||||
|
|
||||||
#define CMD_MM_ENTRIES 3 // command console memory and manual page manager
|
#define CMD_MM_ENTRIES 3 // command console memory and manual page manager
|
||||||
#define CMD_MM_DEFAULT_ALLOC 4 // Number of table entries to allocate per default
|
#define CMD_MM_DEFAULT_ALLOC 4 // Number of table entries to allocate per default
|
||||||
|
|
|
@ -49,7 +49,7 @@ int _debug_seeking = 0; // Stepping forward until some special condition is met
|
||||||
int _debug_seek_level = 0; // Used for seekers that want to check their exec stack depth
|
int _debug_seek_level = 0; // Used for seekers that want to check their exec stack depth
|
||||||
int _debug_seek_special = 0; // Used for special seeks(1)
|
int _debug_seek_special = 0; // Used for special seeks(1)
|
||||||
int _weak_validations = 1; // Some validation errors are reduced to warnings if non-0
|
int _weak_validations = 1; // Some validation errors are reduced to warnings if non-0
|
||||||
reg_t _debug_seek_reg = NULL_REG_INITIALIZER; // Used for special seeks(2)
|
reg_t _debug_seek_reg = NULL_REG; // Used for special seeks(2)
|
||||||
|
|
||||||
#define _DEBUG_SEEK_NOTHING 0
|
#define _DEBUG_SEEK_NOTHING 0
|
||||||
#define _DEBUG_SEEK_CALLK 1 // Step forward until callk is found
|
#define _DEBUG_SEEK_CALLK 1 // Step forward until callk is found
|
||||||
|
@ -338,7 +338,7 @@ static void print_obj_head(EngineState *s, object_t *obj) {
|
||||||
|
|
||||||
static void print_list(EngineState *s, list_t *l) {
|
static void print_list(EngineState *s, list_t *l) {
|
||||||
reg_t pos = l->first;
|
reg_t pos = l->first;
|
||||||
reg_t my_prev = NULL_REG_INITIALIZER;
|
reg_t my_prev = NULL_REG;
|
||||||
|
|
||||||
sciprintf("\t<\n");
|
sciprintf("\t<\n");
|
||||||
|
|
||||||
|
@ -2223,11 +2223,11 @@ static int c_listclones(EngineState *s) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
struct generic_config_flag_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char option;
|
const char option;
|
||||||
unsigned int flag;
|
unsigned int flag;
|
||||||
} generic_config_flag_t;
|
};
|
||||||
|
|
||||||
static void handle_config_update(const generic_config_flag_t *flags_list, int flags_nr, const char *subsystem,
|
static void handle_config_update(const generic_config_flag_t *flags_list, int flags_nr, const char *subsystem,
|
||||||
int *active_options_p, char *changestring /* or NULL to display*/) {
|
int *active_options_p, char *changestring /* or NULL to display*/) {
|
||||||
|
|
|
@ -452,39 +452,39 @@ byte *sm_dereference(SegManager *self, reg_t reg, int *size);
|
||||||
|
|
||||||
// 11. Segment interface, primarily for GC
|
// 11. Segment interface, primarily for GC
|
||||||
|
|
||||||
typedef struct _seg_interface {
|
struct seg_interface_t {
|
||||||
SegManager *segmgr;
|
SegManager *segmgr;
|
||||||
mem_obj_t *mobj;
|
mem_obj_t *mobj;
|
||||||
seg_id_t seg_id;
|
seg_id_t seg_id;
|
||||||
mem_obj_enum type_id; // Segment type
|
mem_obj_enum type_id; // Segment type
|
||||||
const char *type; // String description of the segment type
|
const char *type; // String description of the segment type
|
||||||
|
|
||||||
reg_t (*find_canonic_address)(struct _seg_interface *self, reg_t sub_addr);
|
reg_t (*find_canonic_address)(seg_interface_t *self, reg_t sub_addr);
|
||||||
// Finds the canonic address associated with sub_reg
|
// Finds the canonic address associated with sub_reg
|
||||||
// Parameters: (reg_t) sub_addr: The base address whose canonic address is to be found
|
// Parameters: (reg_t) sub_addr: The base address whose canonic address is to be found
|
||||||
// For each valid address a, there exists a canonic address c(a) such that c(a) = c(c(a)).
|
// For each valid address a, there exists a canonic address c(a) such that c(a) = c(c(a)).
|
||||||
// This address "governs" a in the sense that deallocating c(a) will deallocate a.
|
// This address "governs" a in the sense that deallocating c(a) will deallocate a.
|
||||||
|
|
||||||
void (*free_at_address)(struct _seg_interface *self, reg_t sub_addr);
|
void (*free_at_address)(seg_interface_t *self, reg_t sub_addr);
|
||||||
// Deallocates all memory associated with the specified address
|
// Deallocates all memory associated with the specified address
|
||||||
// Parameters: (reg_t) sub_addr: The address (within the given segment) to deallocate
|
// Parameters: (reg_t) sub_addr: The address (within the given segment) to deallocate
|
||||||
|
|
||||||
void (*list_all_deallocatable)(struct _seg_interface *self, void *param, void (*note)(void *param, reg_t addr));
|
void (*list_all_deallocatable)(seg_interface_t *self, void *param, void (*note)(void *param, reg_t addr));
|
||||||
// Iterates over and reports all addresses within the current segment
|
// Iterates over and reports all addresses within the current segment
|
||||||
// Parameters: note : (voidptr * addr) -> (): Invoked for each address on which free_at_address()
|
// Parameters: note : (voidptr * addr) -> (): Invoked for each address on which free_at_address()
|
||||||
// makes sense
|
// makes sense
|
||||||
// (void *) param: Parameter passed to 'note'
|
// (void *) param: Parameter passed to 'note'
|
||||||
|
|
||||||
void (*list_all_outgoing_references)(struct _seg_interface *self, EngineState *s, reg_t object, void *param, void (*note)(void *param, reg_t addr));
|
void (*list_all_outgoing_references)(seg_interface_t *self, EngineState *s, reg_t object, void *param, void (*note)(void *param, reg_t addr));
|
||||||
// Iterates over all references reachable from the specified object
|
// Iterates over all references reachable from the specified object
|
||||||
// Parameters: (reg_t) object: The object (within the current segment) to analyse
|
// Parameters: (reg_t) object: The object (within the current segment) to analyse
|
||||||
// (void *) param: Parameter passed to 'note'
|
// (void *) param: Parameter passed to 'note'
|
||||||
// note : (voidptr * addr) -> (): Invoked for each outgoing reference within the object
|
// note : (voidptr * addr) -> (): Invoked for each outgoing reference within the object
|
||||||
// Note: This function may also choose to report numbers (segment 0) as adresses
|
// Note: This function may also choose to report numbers (segment 0) as adresses
|
||||||
|
|
||||||
void (*deallocate_self)(struct _seg_interface *self);
|
void (*deallocate_self)(seg_interface_t *self);
|
||||||
// Deallocates the segment interface
|
// Deallocates the segment interface
|
||||||
} seg_interface_t;
|
};
|
||||||
|
|
||||||
seg_interface_t *get_seg_interface(SegManager *self, seg_id_t segid);
|
seg_interface_t *get_seg_interface(SegManager *self, seg_id_t segid);
|
||||||
// Retrieves the segment interface to the specified segment
|
// Retrieves the segment interface to the specified segment
|
||||||
|
|
|
@ -57,18 +57,18 @@ extern int _weak_validations;
|
||||||
calls_struct_t *send_calls = NULL;
|
calls_struct_t *send_calls = NULL;
|
||||||
int send_calls_allocated = 0;
|
int send_calls_allocated = 0;
|
||||||
int bp_flag = 0;
|
int bp_flag = 0;
|
||||||
static reg_t _dummy_register = NULL_REG_INITIALIZER;
|
static reg_t _dummy_register;
|
||||||
|
|
||||||
// validation functionality
|
// validation functionality
|
||||||
|
|
||||||
#ifndef DISABLE_VALIDATIONS
|
#ifndef DISABLE_VALIDATIONS
|
||||||
|
|
||||||
static inline reg_t *validate_property(object_t *obj, int index) {
|
static inline reg_t &validate_property(object_t *obj, int index) {
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
if (sci_debug_flags & 4)
|
if (sci_debug_flags & 4)
|
||||||
sciprintf("[VM] Sending to disposed object!\n");
|
sciprintf("[VM] Sending to disposed object!\n");
|
||||||
_dummy_register = NULL_REG;
|
_dummy_register = NULL_REG;
|
||||||
return &_dummy_register;
|
return _dummy_register;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < 0 || index >= obj->variables_nr) {
|
if (index < 0 || index >= obj->variables_nr) {
|
||||||
|
@ -77,10 +77,10 @@ static inline reg_t *validate_property(object_t *obj, int index) {
|
||||||
obj->variables_nr);
|
obj->variables_nr);
|
||||||
|
|
||||||
_dummy_register = NULL_REG;
|
_dummy_register = NULL_REG;
|
||||||
return &_dummy_register;
|
return _dummy_register;
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj->variables + index;
|
return obj->variables[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline stack_ptr_t validate_stack_addr(EngineState *s, stack_ptr_t sp) {
|
static inline stack_ptr_t validate_stack_addr(EngineState *s, stack_ptr_t sp) {
|
||||||
|
@ -175,7 +175,7 @@ static inline void validate_write_var(reg_t *r, reg_t *stack_base, int type, int
|
||||||
# define validate_variable(r, sb, t, m, i, l)
|
# define validate_variable(r, sb, t, m, i, l)
|
||||||
# define validate_read_var(r, sb, t, m, i, l) ((r)[i])
|
# define validate_read_var(r, sb, t, m, i, l) ((r)[i])
|
||||||
# define validate_write_var(r, sb, t, m, i, l, v) ((r)[i] = (v))
|
# define validate_write_var(r, sb, t, m, i, l, v) ((r)[i] = (v))
|
||||||
# define validate_property(o, p) (&((o)->variables[p]))
|
# define validate_property(o, p) ((o)->variables[p])
|
||||||
# define ASSERT_ARITHMETIC(v) (v).offset
|
# define ASSERT_ARITHMETIC(v) (v).offset
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -188,7 +188,7 @@ static inline void validate_write_var(reg_t *r, reg_t *stack_base, int type, int
|
||||||
#define ACC_AUX_LOAD() aux_acc = signed_validate_arithmetic(s->r_acc)
|
#define ACC_AUX_LOAD() aux_acc = signed_validate_arithmetic(s->r_acc)
|
||||||
#define ACC_AUX_STORE() s->r_acc = make_reg(0, aux_acc)
|
#define ACC_AUX_STORE() s->r_acc = make_reg(0, aux_acc)
|
||||||
|
|
||||||
#define OBJ_PROPERTY(o, p) (*validate_property(o, p))
|
#define OBJ_PROPERTY(o, p) (validate_property(o, p))
|
||||||
|
|
||||||
int script_error(EngineState *s, const char *file, int line, const char *reason) {
|
int script_error(EngineState *s, const char *file, int line, const char *reason) {
|
||||||
sciprintf("Script error in file %s, line %d: %s\n", file, line, reason);
|
sciprintf("Script error in file %s, line %d: %s\n", file, line, reason);
|
||||||
|
@ -368,8 +368,10 @@ exec_stack_t *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, stac
|
||||||
sciprintf("Send to "PREG", selector %04x (%s):", PRINT_REG(send_obj), selector, s->selector_names[selector]);
|
sciprintf("Send to "PREG", selector %04x (%s):", PRINT_REG(send_obj), selector, s->selector_names[selector]);
|
||||||
#endif // VM_DEBUG_SEND
|
#endif // VM_DEBUG_SEND
|
||||||
|
|
||||||
if (++send_calls_nr == (send_calls_allocated - 1))
|
if (++send_calls_nr == (send_calls_allocated - 1)) {
|
||||||
send_calls = (calls_struct_t *)sci_realloc(send_calls, sizeof(calls_struct_t) * (send_calls_allocated *= 2));
|
send_calls_allocated *= 2;
|
||||||
|
send_calls = (calls_struct_t *)sci_realloc(send_calls, sizeof(calls_struct_t) * send_calls_allocated);
|
||||||
|
}
|
||||||
|
|
||||||
switch (lookup_selector(s, send_obj, selector, &varp, &funcp)) {
|
switch (lookup_selector(s, send_obj, selector, &varp, &funcp)) {
|
||||||
case SELECTOR_NONE:
|
case SELECTOR_NONE:
|
||||||
|
@ -2052,8 +2054,10 @@ static EngineState *_game_run(EngineState *s, int restoring) {
|
||||||
free(s);
|
free(s);
|
||||||
s = successor;
|
s = successor;
|
||||||
|
|
||||||
if (!send_calls_allocated)
|
if (!send_calls_allocated) {
|
||||||
send_calls = (calls_struct_t *)sci_calloc(sizeof(calls_struct_t), send_calls_allocated = 16);
|
send_calls_allocated = 16;
|
||||||
|
send_calls = (calls_struct_t *)sci_calloc(sizeof(calls_struct_t), 16);
|
||||||
|
}
|
||||||
|
|
||||||
if (script_abort_flag == SCRIPT_ABORT_WITH_REPLAY) {
|
if (script_abort_flag == SCRIPT_ABORT_WITH_REPLAY) {
|
||||||
sciprintf("Restarting with replay()\n");
|
sciprintf("Restarting with replay()\n");
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct _scummvm_driver_state {
|
||||||
#define S ((struct _scummvm_driver_state *)(drv->state))
|
#define S ((struct _scummvm_driver_state *)(drv->state))
|
||||||
|
|
||||||
static int
|
static int
|
||||||
scummvm_init_specific(struct _gfx_driver *drv, int xfact, int yfact, int bytespp) {
|
scummvm_init_specific(gfx_driver_t *drv, int xfact, int yfact, int bytespp) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!drv->state) // = S
|
if (!drv->state) // = S
|
||||||
|
@ -83,11 +83,11 @@ scummvm_init_specific(struct _gfx_driver *drv, int xfact, int yfact, int bytespp
|
||||||
return GFX_OK;
|
return GFX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scummvm_init(struct _gfx_driver *drv) {
|
static int scummvm_init(gfx_driver_t *drv) {
|
||||||
return scummvm_init_specific(drv, 1, 1, GFX_COLOR_MODE_INDEX);
|
return scummvm_init_specific(drv, 1, 1, GFX_COLOR_MODE_INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scummvm_exit(struct _gfx_driver *drv) {
|
static void scummvm_exit(gfx_driver_t *drv) {
|
||||||
int i;
|
int i;
|
||||||
if (S) {
|
if (S) {
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
|
@ -156,7 +156,7 @@ static void lineColor2(byte *dst, int16 x1, int16 y1, int16 x2, int16 y2, uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scummvm_draw_line(struct _gfx_driver *drv, Common::Point start, Common::Point end,
|
static int scummvm_draw_line(gfx_driver_t *drv, Common::Point start, Common::Point end,
|
||||||
gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
|
gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
|
||||||
uint32 scolor = color.visual.global_index;
|
uint32 scolor = color.visual.global_index;
|
||||||
int xsize = S->xsize;
|
int xsize = S->xsize;
|
||||||
|
@ -180,7 +180,7 @@ static int scummvm_draw_line(struct _gfx_driver *drv, Common::Point start, Commo
|
||||||
return GFX_OK;
|
return GFX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scummvm_draw_filled_rect(struct _gfx_driver *drv, rect_t rect, gfx_color_t color1, gfx_color_t color2,
|
static int scummvm_draw_filled_rect(gfx_driver_t *drv, rect_t rect, gfx_color_t color1, gfx_color_t color2,
|
||||||
gfx_rectangle_fill_t shade_mode) {
|
gfx_rectangle_fill_t shade_mode) {
|
||||||
if (color1.mask & GFX_MASK_VISUAL) {
|
if (color1.mask & GFX_MASK_VISUAL) {
|
||||||
for (int i = rect.y; i < rect.y + rect.yl; i++) {
|
for (int i = rect.y; i < rect.y + rect.yl; i++) {
|
||||||
|
@ -196,7 +196,7 @@ static int scummvm_draw_filled_rect(struct _gfx_driver *drv, rect_t rect, gfx_co
|
||||||
|
|
||||||
// Pixmap operations
|
// Pixmap operations
|
||||||
|
|
||||||
static int scummvm_draw_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm, int priority,
|
static int scummvm_draw_pixmap(gfx_driver_t *drv, gfx_pixmap_t *pxm, int priority,
|
||||||
rect_t src, rect_t dest, gfx_buffer_t buffer) {
|
rect_t src, rect_t dest, gfx_buffer_t buffer) {
|
||||||
int bufnr = (buffer == GFX_BUFFER_STATIC) ? 2 : 1;
|
int bufnr = (buffer == GFX_BUFFER_STATIC) ? 2 : 1;
|
||||||
int pribufnr = bufnr - 1;
|
int pribufnr = bufnr - 1;
|
||||||
|
@ -212,7 +212,7 @@ static int scummvm_draw_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm, int p
|
||||||
return GFX_OK;
|
return GFX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scummvm_grab_pixmap(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t *pxm, gfx_map_mask_t map) {
|
static int scummvm_grab_pixmap(gfx_driver_t *drv, rect_t src, gfx_pixmap_t *pxm, gfx_map_mask_t map) {
|
||||||
if (src.x < 0 || src.y < 0) {
|
if (src.x < 0 || src.y < 0) {
|
||||||
printf("Attempt to grab pixmap from invalid coordinates (%d,%d)\n", src.x, src.y);
|
printf("Attempt to grab pixmap from invalid coordinates (%d,%d)\n", src.x, src.y);
|
||||||
return GFX_ERROR;
|
return GFX_ERROR;
|
||||||
|
@ -247,7 +247,7 @@ static int scummvm_grab_pixmap(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t
|
||||||
|
|
||||||
// Buffer operations
|
// Buffer operations
|
||||||
|
|
||||||
static int scummvm_update(struct _gfx_driver *drv, rect_t src, Common::Point dest, gfx_buffer_t buffer) {
|
static int scummvm_update(gfx_driver_t *drv, rect_t src, Common::Point dest, gfx_buffer_t buffer) {
|
||||||
//TODO
|
//TODO
|
||||||
int data_source = (buffer == GFX_BUFFER_BACK) ? 2 : 1;
|
int data_source = (buffer == GFX_BUFFER_BACK) ? 2 : 1;
|
||||||
int data_dest = data_source - 1;
|
int data_dest = data_source - 1;
|
||||||
|
@ -289,7 +289,7 @@ static int scummvm_update(struct _gfx_driver *drv, rect_t src, Common::Point des
|
||||||
return GFX_OK;
|
return GFX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scummvm_set_static_buffer(struct _gfx_driver *drv, gfx_pixmap_t *pic, gfx_pixmap_t *priority) {
|
static int scummvm_set_static_buffer(gfx_driver_t *drv, gfx_pixmap_t *pic, gfx_pixmap_t *priority) {
|
||||||
memcpy(S->visual[2], pic->data, S->xsize * S->ysize);
|
memcpy(S->visual[2], pic->data, S->xsize * S->ysize);
|
||||||
/*gfx_crossblit_pixmap(drv->mode, pic, 0, rect, rect, S->visual[2], S->xsize, S->priority[1]->index_data,
|
/*gfx_crossblit_pixmap(drv->mode, pic, 0, rect, rect, S->visual[2], S->xsize, S->priority[1]->index_data,
|
||||||
S->priority[1]->index_xl, 1, 0);*/
|
S->priority[1]->index_xl, 1, 0);*/
|
||||||
|
@ -301,7 +301,7 @@ static int scummvm_set_static_buffer(struct _gfx_driver *drv, gfx_pixmap_t *pic,
|
||||||
|
|
||||||
// Mouse pointer operations
|
// Mouse pointer operations
|
||||||
|
|
||||||
static int scummvm_set_pointer(struct _gfx_driver *drv, gfx_pixmap_t *pointer) {
|
static int scummvm_set_pointer(gfx_driver_t *drv, gfx_pixmap_t *pointer) {
|
||||||
if (pointer == NULL) {
|
if (pointer == NULL) {
|
||||||
g_system->showMouse(false);
|
g_system->showMouse(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -316,7 +316,7 @@ static int scummvm_set_pointer(struct _gfx_driver *drv, gfx_pixmap_t *pointer) {
|
||||||
|
|
||||||
// Palette operations
|
// Palette operations
|
||||||
|
|
||||||
static int scummvm_set_palette(struct _gfx_driver *drv, int index, byte red, byte green, byte blue) {
|
static int scummvm_set_palette(gfx_driver_t *drv, int index, byte red, byte green, byte blue) {
|
||||||
if (index < 0 || index > 255) {
|
if (index < 0 || index > 255) {
|
||||||
GFXERROR("Attempt to set invalid palette entry %d\n", index);
|
GFXERROR("Attempt to set invalid palette entry %d\n", index);
|
||||||
return GFX_ERROR;
|
return GFX_ERROR;
|
||||||
|
@ -330,7 +330,7 @@ static int scummvm_set_palette(struct _gfx_driver *drv, int index, byte red, byt
|
||||||
|
|
||||||
// Event management
|
// Event management
|
||||||
|
|
||||||
static sci_event_t scummvm_get_event(struct _gfx_driver *drv) {
|
static sci_event_t scummvm_get_event(gfx_driver_t *drv) {
|
||||||
sci_event_t input = { SCI_EVT_NONE, 0, 0, 0 };
|
sci_event_t input = { SCI_EVT_NONE, 0, 0, 0 };
|
||||||
|
|
||||||
Common::EventManager *em = g_system->getEventManager();
|
Common::EventManager *em = g_system->getEventManager();
|
||||||
|
@ -480,7 +480,7 @@ static sci_event_t scummvm_get_event(struct _gfx_driver *drv) {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scummvm_usec_sleep(struct _gfx_driver *drv, long usecs) {
|
static int scummvm_usec_sleep(gfx_driver_t *drv, long usecs) {
|
||||||
g_system->delayMillis(usecs / 1000);
|
g_system->delayMillis(usecs / 1000);
|
||||||
return GFX_OK;
|
return GFX_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ typedef enum {
|
||||||
** must use a reasonable default value.
|
** must use a reasonable default value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _gfx_driver { /* Graphics driver */
|
struct gfx_driver_t { /* Graphics driver */
|
||||||
|
|
||||||
gfx_mode_t *mode; /* Currently active mode, NULL if no mode is active */
|
gfx_mode_t *mode; /* Currently active mode, NULL if no mode is active */
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
|
|
||||||
/*** Initialization ***/
|
/*** Initialization ***/
|
||||||
|
|
||||||
int (*set_parameter)(struct _gfx_driver *drv, char *attribute, char *value);
|
int (*set_parameter)(gfx_driver_t *drv, char *attribute, char *value);
|
||||||
/* Sets a driver-specific parameter
|
/* Sets a driver-specific parameter
|
||||||
** Parameters: (gfx_driver_t *) drv: Pointer to the affected driver
|
** Parameters: (gfx_driver_t *) drv: Pointer to the affected driver
|
||||||
** (char *) attribute: Name of the attribute/parameter to set
|
** (char *) attribute: Name of the attribute/parameter to set
|
||||||
|
@ -110,7 +110,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
** console).
|
** console).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*init_specific)(struct _gfx_driver *drv, int xres, int yres,
|
int (*init_specific)(gfx_driver_t *drv, int xres, int yres,
|
||||||
int bytespp);
|
int bytespp);
|
||||||
/* Attempts to initialize a specific graphics mode
|
/* Attempts to initialize a specific graphics mode
|
||||||
** Parameters: (gfx_driver_t *) drv: The affected driver
|
** Parameters: (gfx_driver_t *) drv: The affected driver
|
||||||
|
@ -128,7 +128,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
** specified in gfx_tools.h.
|
** specified in gfx_tools.h.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*init)(struct _gfx_driver *drv);
|
int (*init)(gfx_driver_t *drv);
|
||||||
/* Initialize any graphics mode
|
/* Initialize any graphics mode
|
||||||
** Parameters: (gfx_driver_t *) drv: The affected driver
|
** Parameters: (gfx_driver_t *) drv: The affected driver
|
||||||
** Returns : (int) GFX_OK on success, GFX_FATAL otherwise.
|
** Returns : (int) GFX_OK on success, GFX_FATAL otherwise.
|
||||||
|
@ -140,7 +140,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
** specified in gfx_tools.h.
|
** specified in gfx_tools.h.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void (*exit)(struct _gfx_driver *drv);
|
void (*exit)(gfx_driver_t *drv);
|
||||||
/* Uninitializes the current graphics mode
|
/* Uninitializes the current graphics mode
|
||||||
** Paramters: (gfx_driver_t *) drv: The driver to uninitialize
|
** Paramters: (gfx_driver_t *) drv: The driver to uninitialize
|
||||||
** Return : (void)
|
** Return : (void)
|
||||||
|
@ -154,7 +154,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
|
|
||||||
/*** Drawing operations ***/
|
/*** Drawing operations ***/
|
||||||
|
|
||||||
int (*draw_line)(struct _gfx_driver *drv,
|
int (*draw_line)(gfx_driver_t *drv,
|
||||||
Common::Point start, Common::Point end,
|
Common::Point start, Common::Point end,
|
||||||
gfx_color_t color,
|
gfx_color_t color,
|
||||||
gfx_line_mode_t line_mode, gfx_line_style_t line_style);
|
gfx_line_mode_t line_mode, gfx_line_style_t line_style);
|
||||||
|
@ -175,7 +175,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
** set.
|
** set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*draw_filled_rect)(struct _gfx_driver *drv, rect_t rect,
|
int (*draw_filled_rect)(gfx_driver_t *drv, rect_t rect,
|
||||||
gfx_color_t color1, gfx_color_t color2,
|
gfx_color_t color1, gfx_color_t color2,
|
||||||
gfx_rectangle_fill_t shade_mode);
|
gfx_rectangle_fill_t shade_mode);
|
||||||
/* Draws a single filled and possibly shaded rectangle to the back buffer.
|
/* Draws a single filled and possibly shaded rectangle to the back buffer.
|
||||||
|
@ -192,7 +192,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
|
|
||||||
/*** Pixmap operations ***/
|
/*** Pixmap operations ***/
|
||||||
|
|
||||||
int (*draw_pixmap)(struct _gfx_driver *drv, gfx_pixmap_t *pxm, int priority,
|
int (*draw_pixmap)(gfx_driver_t *drv, gfx_pixmap_t *pxm, int priority,
|
||||||
rect_t src, rect_t dest, gfx_buffer_t buffer);
|
rect_t src, rect_t dest, gfx_buffer_t buffer);
|
||||||
/* Draws part of a pixmap to the static or back buffer
|
/* Draws part of a pixmap to the static or back buffer
|
||||||
** Parameters: (gfx_driver_t *) drv: The affected driver
|
** Parameters: (gfx_driver_t *) drv: The affected driver
|
||||||
|
@ -207,7 +207,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
** (but should have been) registered.
|
** (but should have been) registered.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*grab_pixmap)(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t *pxm,
|
int (*grab_pixmap)(gfx_driver_t *drv, rect_t src, gfx_pixmap_t *pxm,
|
||||||
gfx_map_mask_t map);
|
gfx_map_mask_t map);
|
||||||
/* Grabs an image from the visual or priority back buffer
|
/* Grabs an image from the visual or priority back buffer
|
||||||
** Parameters: (gfx_driver_t *) drv: The affected driver
|
** Parameters: (gfx_driver_t *) drv: The affected driver
|
||||||
|
@ -224,7 +224,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
|
|
||||||
/*** Buffer operations ***/
|
/*** Buffer operations ***/
|
||||||
|
|
||||||
int (*update)(struct _gfx_driver *drv, rect_t src, Common::Point dest,
|
int (*update)(gfx_driver_t *drv, rect_t src, Common::Point dest,
|
||||||
gfx_buffer_t buffer);
|
gfx_buffer_t buffer);
|
||||||
/* Updates the front buffer or the back buffers
|
/* Updates the front buffer or the back buffers
|
||||||
** Parameters: (gfx_driver_t *) drv: The affected driver
|
** Parameters: (gfx_driver_t *) drv: The affected driver
|
||||||
|
@ -240,7 +240,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
** If they aren't, the priority map will not be required to be copied.
|
** If they aren't, the priority map will not be required to be copied.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*set_static_buffer)(struct _gfx_driver *drv, gfx_pixmap_t *pic,
|
int (*set_static_buffer)(gfx_driver_t *drv, gfx_pixmap_t *pic,
|
||||||
gfx_pixmap_t *priority);
|
gfx_pixmap_t *priority);
|
||||||
/* Sets the contents of the static visual and priority buffers
|
/* Sets the contents of the static visual and priority buffers
|
||||||
** Parameters: (gfx_driver_t *) drv: The affected driver
|
** Parameters: (gfx_driver_t *) drv: The affected driver
|
||||||
|
@ -262,7 +262,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
|
|
||||||
/*** Mouse pointer operations ***/
|
/*** Mouse pointer operations ***/
|
||||||
|
|
||||||
int (*set_pointer)(struct _gfx_driver *drv, gfx_pixmap_t *pointer);
|
int (*set_pointer)(gfx_driver_t *drv, gfx_pixmap_t *pointer);
|
||||||
/* Sets a new mouse pointer.
|
/* Sets a new mouse pointer.
|
||||||
** Parameters: (gfx_driver_t *) drv: The driver to modify
|
** Parameters: (gfx_driver_t *) drv: The driver to modify
|
||||||
** (gfx_pixmap_t *) pointer: The pointer to set, or NULL to set
|
** (gfx_pixmap_t *) pointer: The pointer to set, or NULL to set
|
||||||
|
@ -278,7 +278,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
|
|
||||||
/*** Palette operations ***/
|
/*** Palette operations ***/
|
||||||
|
|
||||||
int (*set_palette)(struct _gfx_driver *drv, int index, byte red, byte green,
|
int (*set_palette)(gfx_driver_t *drv, int index, byte red, byte green,
|
||||||
byte blue);
|
byte blue);
|
||||||
/* Manipulates a palette index in the hardware palette
|
/* Manipulates a palette index in the hardware palette
|
||||||
** Parameters: (gfx_driver_t *) drv: The driver affected
|
** Parameters: (gfx_driver_t *) drv: The driver affected
|
||||||
|
@ -295,14 +295,14 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
|
|
||||||
/*** Event management ***/
|
/*** Event management ***/
|
||||||
|
|
||||||
sci_event_t (*get_event)(struct _gfx_driver *drv);
|
sci_event_t (*get_event)(gfx_driver_t *drv);
|
||||||
/* Returns the next event in the event queue for this driver
|
/* Returns the next event in the event queue for this driver
|
||||||
** Parameters: (gfx_driver_t *) drv: The driver to query
|
** Parameters: (gfx_driver_t *) drv: The driver to query
|
||||||
** Returns : (sci_event_t) The oldest event still in the driver's event
|
** Returns : (sci_event_t) The oldest event still in the driver's event
|
||||||
** queue, or the null event if there is none.
|
** queue, or the null event if there is none.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*usec_sleep)(struct _gfx_driver *drv, long usecs);
|
int (*usec_sleep)(gfx_driver_t *drv, long usecs);
|
||||||
/* Sleeps the specified amount of microseconds, or until the mouse moves
|
/* Sleeps the specified amount of microseconds, or until the mouse moves
|
||||||
** Parameters: (gfx_driver_t *) drv: The relevant driver
|
** Parameters: (gfx_driver_t *) drv: The relevant driver
|
||||||
** (long) usecs: Amount of microseconds to sleep
|
** (long) usecs: Amount of microseconds to sleep
|
||||||
|
@ -315,7 +315,7 @@ typedef struct _gfx_driver { /* Graphics driver */
|
||||||
|
|
||||||
void *state; /* Reserved for internal use */
|
void *state; /* Reserved for internal use */
|
||||||
|
|
||||||
} gfx_driver_t;
|
};
|
||||||
|
|
||||||
} // End of namespace Sci
|
} // End of namespace Sci
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace Sci {
|
||||||
*/
|
*/
|
||||||
#define GFXOP_ALPHA_THRESHOLD 0xff
|
#define GFXOP_ALPHA_THRESHOLD 0xff
|
||||||
|
|
||||||
typedef struct {
|
struct gfx_text_handle_t {
|
||||||
char *text; /* Copy of the actual text */
|
char *text; /* Copy of the actual text */
|
||||||
|
|
||||||
int lines_nr;
|
int lines_nr;
|
||||||
|
@ -56,7 +56,7 @@ typedef struct {
|
||||||
|
|
||||||
int priority, control;
|
int priority, control;
|
||||||
gfx_alignment_t halign, valign;
|
gfx_alignment_t halign, valign;
|
||||||
} gfx_text_handle_t;
|
};
|
||||||
|
|
||||||
/* Unless individually stated otherwise, the following applies:
|
/* Unless individually stated otherwise, the following applies:
|
||||||
** All operations herein apply to the standard 320x200 coordinate system.
|
** All operations herein apply to the standard 320x200 coordinate system.
|
||||||
|
@ -81,18 +81,18 @@ typedef enum {
|
||||||
} gfx_box_shade_t;
|
} gfx_box_shade_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _dirty_rect {
|
struct gfx_dirty_rect_t {
|
||||||
rect_t rect;
|
rect_t rect;
|
||||||
struct _dirty_rect *next;
|
gfx_dirty_rect_t *next;
|
||||||
} gfx_dirty_rect_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct _gfx_event {
|
struct gfx_input_event_t {
|
||||||
sci_event_t event;
|
sci_event_t event;
|
||||||
struct _gfx_event *next;
|
gfx_input_event_t *next;
|
||||||
} gfx_input_event_t;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct gfx_state_t {
|
||||||
int version; /* Interpreter version */
|
int version; /* Interpreter version */
|
||||||
|
|
||||||
gfx_options_t *options;
|
gfx_options_t *options;
|
||||||
|
@ -143,11 +143,11 @@ typedef struct {
|
||||||
|
|
||||||
gfxr_pic_t *pic, *pic_unscaled; /* The background picture and its unscaled equivalent */
|
gfxr_pic_t *pic, *pic_unscaled; /* The background picture and its unscaled equivalent */
|
||||||
|
|
||||||
struct _dirty_rect *dirty_rects; /* Dirty rectangles */
|
gfx_dirty_rect_t *dirty_rects; /* Dirty rectangles */
|
||||||
|
|
||||||
void *internal_state; /* Internal interpreter information */
|
void *internal_state; /* Internal interpreter information */
|
||||||
|
|
||||||
} gfx_state_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
/**************************/
|
/**************************/
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace Sci {
|
||||||
#define GFXOP_DIRTY_FRAMES_CLUSTERS 2
|
#define GFXOP_DIRTY_FRAMES_CLUSTERS 2
|
||||||
|
|
||||||
|
|
||||||
typedef struct _gfx_options {
|
struct gfx_options_t {
|
||||||
/* gfx_options_t: Contains all user options to the rendering pipeline */
|
/* gfx_options_t: Contains all user options to the rendering pipeline */
|
||||||
/* See note in sci_conf.h for config_entry_t before changing types of
|
/* See note in sci_conf.h for config_entry_t before changing types of
|
||||||
** variables */
|
** variables */
|
||||||
|
@ -76,7 +76,7 @@ typedef struct _gfx_options {
|
||||||
int workarounds; /* Workaround flags- see below */
|
int workarounds; /* Workaround flags- see below */
|
||||||
|
|
||||||
rect_t pic_port_bounds;
|
rect_t pic_port_bounds;
|
||||||
} gfx_options_t;
|
};
|
||||||
|
|
||||||
/* SQ3 counts whitespaces towards the total text size, as does gfxop_get_text_params() if this is set: */
|
/* SQ3 counts whitespaces towards the total text size, as does gfxop_get_text_params() if this is set: */
|
||||||
#define GFX_WORKAROUND_WHITESPACE_COUNT (1 << 0)
|
#define GFX_WORKAROUND_WHITESPACE_COUNT (1 << 0)
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct gfx_res_pattern_t {
|
||||||
|
|
||||||
/* GFX resource assignments */
|
/* GFX resource assignments */
|
||||||
|
|
||||||
typedef struct {
|
struct gfx_res_assign_t {
|
||||||
short type; /* GFX_RES_ASSIGN_TYPE_* */
|
short type; /* GFX_RES_ASSIGN_TYPE_* */
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
@ -48,23 +48,23 @@ typedef struct {
|
||||||
gfx_pixmap_color_t *colors;
|
gfx_pixmap_color_t *colors;
|
||||||
} palette;
|
} palette;
|
||||||
} assign;
|
} assign;
|
||||||
} gfx_res_assign_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
/* GFX resource modifications */
|
/* GFX resource modifications */
|
||||||
|
|
||||||
#define GFX_RES_MULTIPLY_FIXED 0 /* Linear palette update */
|
#define GFX_RES_MULTIPLY_FIXED 0 /* Linear palette update */
|
||||||
|
|
||||||
typedef struct {
|
struct gfx_res_mod_t {
|
||||||
short type; /* GFX_RES_ASSIGN_TYPE_* */
|
short type; /* GFX_RES_ASSIGN_TYPE_* */
|
||||||
|
|
||||||
union {
|
union {
|
||||||
byte factor[3]; /* divide by 16 to retrieve factor */
|
byte factor[3]; /* divide by 16 to retrieve factor */
|
||||||
} mod;
|
} mod;
|
||||||
} gfx_res_mod_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct _gfx_res_conf {
|
struct gfx_res_conf_t {
|
||||||
int type; /* Resource type-- only one allowed */
|
int type; /* Resource type-- only one allowed */
|
||||||
|
|
||||||
/* If any of the following is 0, it means that there is no restriction.
|
/* If any of the following is 0, it means that there is no restriction.
|
||||||
|
@ -80,22 +80,21 @@ typedef struct _gfx_res_conf {
|
||||||
gfx_res_mod_t mod;
|
gfx_res_mod_t mod;
|
||||||
} conf; /* The actual configuration */
|
} conf; /* The actual configuration */
|
||||||
|
|
||||||
struct _gfx_res_conf *next;
|
gfx_res_conf_t *next;
|
||||||
} gfx_res_conf_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef gfx_res_conf_t *gfx_res_conf_p_t;
|
typedef gfx_res_conf_t *gfx_res_conf_p_t;
|
||||||
|
|
||||||
typedef struct {
|
struct gfx_res_fullconf_t {
|
||||||
gfx_res_conf_p_t assign[GFX_RESOURCE_TYPES_NR];
|
gfx_res_conf_p_t assign[GFX_RESOURCE_TYPES_NR];
|
||||||
gfx_res_conf_p_t mod[GFX_RESOURCE_TYPES_NR];
|
gfx_res_conf_p_t mod[GFX_RESOURCE_TYPES_NR];
|
||||||
} gfx_res_fullconf_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
struct _gfx_options;
|
struct gfx_options_t;
|
||||||
|
|
||||||
int gfx_get_res_config(struct _gfx_options *options,
|
int gfx_get_res_config(gfx_options_t *options, gfx_pixmap_t *pxm);
|
||||||
gfx_pixmap_t *pxm);
|
|
||||||
/* Configures a graphical pixmap according to config options
|
/* Configures a graphical pixmap according to config options
|
||||||
** Parameters: (gfx_options_t *) options: The options according to which
|
** Parameters: (gfx_options_t *) options: The options according to which
|
||||||
** configuration should be performed
|
** configuration should be performed
|
||||||
|
|
|
@ -75,11 +75,11 @@ struct gfx_resource_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct _gfx_options;
|
struct gfx_options_t;
|
||||||
|
|
||||||
typedef struct {
|
struct gfx_resstate_t {
|
||||||
int version; /* Interpreter version */
|
int version; /* Interpreter version */
|
||||||
struct _gfx_options *options;
|
gfx_options_t *options;
|
||||||
gfx_driver_t *driver;
|
gfx_driver_t *driver;
|
||||||
gfx_pixmap_color_t *static_palette;
|
gfx_pixmap_color_t *static_palette;
|
||||||
int static_palette_entries;
|
int static_palette_entries;
|
||||||
|
@ -91,11 +91,11 @@ typedef struct {
|
||||||
|
|
||||||
sbtree_t *resource_trees[GFX_RESOURCE_TYPES_NR];
|
sbtree_t *resource_trees[GFX_RESOURCE_TYPES_NR];
|
||||||
void *misc_payload;
|
void *misc_payload;
|
||||||
} gfx_resstate_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gfx_resstate_t *gfxr_new_resource_manager(int version, struct _gfx_options *options,
|
gfx_resstate_t *gfxr_new_resource_manager(int version, gfx_options_t *options,
|
||||||
gfx_driver_t *driver, void *misc_payload);
|
gfx_driver_t *driver, void *misc_payload);
|
||||||
/* Allocates and initializes a new resource manager
|
/* Allocates and initializes a new resource manager
|
||||||
** Parameters: (int) version: Interpreter version
|
** Parameters: (int) version: Interpreter version
|
||||||
|
@ -218,7 +218,7 @@ gfx_pixmap_color_t *gfxr_get_palette(gfx_resstate_t *state, int nr);
|
||||||
|
|
||||||
|
|
||||||
int gfxr_interpreter_options_hash(gfx_resource_type_t type, int version,
|
int gfxr_interpreter_options_hash(gfx_resource_type_t type, int version,
|
||||||
struct _gfx_options *options, void *internal, int palette);
|
gfx_options_t *options, void *internal, int palette);
|
||||||
/* Calculates a unique hash value for the specified options/type setup
|
/* Calculates a unique hash value for the specified options/type setup
|
||||||
** Parameters: (gfx_resource_type_t) type: The type the hash is to be generated for
|
** Parameters: (gfx_resource_type_t) type: The type the hash is to be generated for
|
||||||
** (int) version: The interpreter type and version
|
** (int) version: The interpreter type and version
|
||||||
|
|
|
@ -66,13 +66,13 @@ extern gfx_pixmap_color_t gfx_sci0_image_colors[][16];
|
||||||
extern gfx_pixmap_color_t gfx_sci0_pic_colors[];
|
extern gfx_pixmap_color_t gfx_sci0_pic_colors[];
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct gfxr_pic0_params_t {
|
||||||
gfx_line_mode_t line_mode; /* one of GFX_LINE_MODE_* */
|
gfx_line_mode_t line_mode; /* one of GFX_LINE_MODE_* */
|
||||||
gfx_brush_mode_t brush_mode;
|
gfx_brush_mode_t brush_mode;
|
||||||
rect_t pic_port_bounds;
|
rect_t pic_port_bounds;
|
||||||
} gfxr_pic0_params_t;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct gfxr_pic_t {
|
||||||
int ID; /* pic number (NOT resource ID, just number) */
|
int ID; /* pic number (NOT resource ID, just number) */
|
||||||
gfx_mode_t *mode;
|
gfx_mode_t *mode;
|
||||||
gfx_pixmap_t *visual_map;
|
gfx_pixmap_t *visual_map;
|
||||||
|
@ -96,16 +96,16 @@ typedef struct {
|
||||||
void *internal; /* Interpreter information, or NULL. Will be freed
|
void *internal; /* Interpreter information, or NULL. Will be freed
|
||||||
** automatically when the pic is freed! */
|
** automatically when the pic is freed! */
|
||||||
|
|
||||||
} gfxr_pic_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct gfxr_loop_t {
|
||||||
int cels_nr;
|
int cels_nr;
|
||||||
gfx_pixmap_t **cels;
|
gfx_pixmap_t **cels;
|
||||||
} gfxr_loop_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct gfxr_view_t {
|
||||||
int ID;
|
int ID;
|
||||||
|
|
||||||
int flags;
|
int flags;
|
||||||
|
@ -116,7 +116,7 @@ typedef struct {
|
||||||
gfxr_loop_t *loops;
|
gfxr_loop_t *loops;
|
||||||
|
|
||||||
int translation[GFX_SCI0_IMAGE_COLORS_NR];
|
int translation[GFX_SCI0_IMAGE_COLORS_NR];
|
||||||
} gfxr_view_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -124,10 +124,10 @@ typedef enum {
|
||||||
} gfxr_font_scale_filter_t;
|
} gfxr_font_scale_filter_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct text_fragment_t {
|
||||||
const char *offset;
|
const char *offset;
|
||||||
int length;
|
int length;
|
||||||
} text_fragment_t;
|
};
|
||||||
|
|
||||||
/* unscaled color index mode: Used in addition to a scaled mode
|
/* unscaled color index mode: Used in addition to a scaled mode
|
||||||
** to render the pic resource twice. See gfxr_remove_artifacts_pic0().
|
** to render the pic resource twice. See gfxr_remove_artifacts_pic0().
|
||||||
|
|
|
@ -43,10 +43,10 @@ namespace Sci {
|
||||||
#define GFXW_FLAG_IMMUNE_TO_SNAPSHOTS (1<<6) /* Snapshot restoring doesn't kill this widget, and +5 bonus to saving throws vs. Death Magic */
|
#define GFXW_FLAG_IMMUNE_TO_SNAPSHOTS (1<<6) /* Snapshot restoring doesn't kill this widget, and +5 bonus to saving throws vs. Death Magic */
|
||||||
#define GFXW_FLAG_NO_IMPLICIT_SWITCH (1<<7) /* Ports: Don't implicitly switch to this port when disposing windows */
|
#define GFXW_FLAG_NO_IMPLICIT_SWITCH (1<<7) /* Ports: Don't implicitly switch to this port when disposing windows */
|
||||||
|
|
||||||
typedef struct {
|
struct gfxw_snapshot_t {
|
||||||
int serial; /* The first serial number to kill */
|
int serial; /* The first serial number to kill */
|
||||||
rect_t area;
|
rect_t area;
|
||||||
} gfxw_snapshot_t;
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GFXW_, /* Base widget */
|
GFXW_, /* Base widget */
|
||||||
|
@ -77,15 +77,16 @@ typedef enum {
|
||||||
|
|
||||||
#define GFXW_NO_ID -1
|
#define GFXW_NO_ID -1
|
||||||
|
|
||||||
struct _gfxw_widget;
|
struct gfxw_widget_t;
|
||||||
struct _gfxw_container_widget;
|
struct gfxw_container_t;
|
||||||
struct _gfxw_visual;
|
struct gfxw_visual_t;
|
||||||
|
struct gfxw_port_t;
|
||||||
|
|
||||||
typedef int gfxw_point_op(struct _gfxw_widget *, Common::Point);
|
typedef int gfxw_point_op(gfxw_widget_t *, Common::Point);
|
||||||
typedef int gfxw_visual_op(struct _gfxw_widget *, struct _gfxw_visual *);
|
typedef int gfxw_visual_op(gfxw_widget_t *, gfxw_visual_t *);
|
||||||
typedef int gfxw_op(struct _gfxw_widget *);
|
typedef int gfxw_op(gfxw_widget_t *);
|
||||||
typedef int gfxw_op_int(struct _gfxw_widget *, int);
|
typedef int gfxw_op_int(gfxw_widget_t *, int);
|
||||||
typedef int gfxw_bin_op(struct _gfxw_widget *, struct _gfxw_widget *);
|
typedef int gfxw_bin_op(gfxw_widget_t *, gfxw_widget_t *);
|
||||||
|
|
||||||
#define WIDGET_COMMON \
|
#define WIDGET_COMMON \
|
||||||
int magic; /* Extra check after typecasting */ \
|
int magic; /* Extra check after typecasting */ \
|
||||||
|
@ -93,11 +94,11 @@ typedef int gfxw_bin_op(struct _gfxw_widget *, struct _gfxw_widget *);
|
||||||
int flags; /* Widget flags */ \
|
int flags; /* Widget flags */ \
|
||||||
gfxw_widget_type_t type; \
|
gfxw_widget_type_t type; \
|
||||||
rect_t bounds; /* Boundaries */ \
|
rect_t bounds; /* Boundaries */ \
|
||||||
struct _gfxw_widget *next; /* Next widget in widget list */ \
|
gfxw_widget_t *next; /* Next widget in widget list */ \
|
||||||
int ID; /* Unique ID or GFXW_NO_ID */ \
|
int ID; /* Unique ID or GFXW_NO_ID */ \
|
||||||
int subID; /* A 'sub-ID', or GFXW_NO_ID */ \
|
int subID; /* A 'sub-ID', or GFXW_NO_ID */ \
|
||||||
struct _gfxw_container_widget *parent; /* The parent widget, or NULL if not owned */ \
|
gfxw_container_t *parent; /* The parent widget, or NULL if not owned */ \
|
||||||
struct _gfxw_visual *visual; /* The owner visual */ \
|
gfxw_visual_t *visual; /* The owner visual */ \
|
||||||
int widget_priority; /* Drawing priority, or -1 */ \
|
int widget_priority; /* Drawing priority, or -1 */ \
|
||||||
gfxw_point_op *draw; /* Draw widget (if dirty) and anything else required for the display to be consistant */ \
|
gfxw_point_op *draw; /* Draw widget (if dirty) and anything else required for the display to be consistant */ \
|
||||||
gfxw_op *widfree; /* Remove widget (and any sub-widgets it may contain) */ \
|
gfxw_op *widfree; /* Remove widget (and any sub-widgets it may contain) */ \
|
||||||
|
@ -109,26 +110,26 @@ typedef int gfxw_bin_op(struct _gfxw_widget *, struct _gfxw_widget *);
|
||||||
gfxw_bin_op *superarea_of; /* a superarea_of b <=> for each pixel of b there exists an opaque pixel in a at the same location */ \
|
gfxw_bin_op *superarea_of; /* a superarea_of b <=> for each pixel of b there exists an opaque pixel in a at the same location */ \
|
||||||
gfxw_visual_op *set_visual /* Sets the visual the widget belongs to */
|
gfxw_visual_op *set_visual /* Sets the visual the widget belongs to */
|
||||||
|
|
||||||
typedef struct _gfxw_widget {
|
struct gfxw_widget_t {
|
||||||
WIDGET_COMMON;
|
WIDGET_COMMON;
|
||||||
} gfxw_widget_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
#define GFXW_IS_BOX(widget) ((widget)->type == GFXW_BOX)
|
#define GFXW_IS_BOX(widget) ((widget)->type == GFXW_BOX)
|
||||||
typedef struct {
|
struct gfxw_box_t {
|
||||||
WIDGET_COMMON;
|
WIDGET_COMMON;
|
||||||
gfx_color_t color1, color2;
|
gfx_color_t color1, color2;
|
||||||
gfx_box_shade_t shade_type;
|
gfx_box_shade_t shade_type;
|
||||||
} gfxw_box_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
#define GFXW_IS_PRIMITIVE(widget) ((widget)->type == GFXW_RECT || (widget)->type == GFXW_LINE || (widget->type == GFXW_INVERSE_LINE))
|
#define GFXW_IS_PRIMITIVE(widget) ((widget)->type == GFXW_RECT || (widget)->type == GFXW_LINE || (widget->type == GFXW_INVERSE_LINE))
|
||||||
typedef struct {
|
struct gfxw_primitive_t {
|
||||||
WIDGET_COMMON;
|
WIDGET_COMMON;
|
||||||
gfx_color_t color;
|
gfx_color_t color;
|
||||||
gfx_line_mode_t line_mode;
|
gfx_line_mode_t line_mode;
|
||||||
gfx_line_style_t line_style;
|
gfx_line_style_t line_style;
|
||||||
} gfxw_primitive_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,12 +142,12 @@ typedef struct {
|
||||||
|
|
||||||
#define GFXW_IS_VIEW(widget) ((widget)->type == GFXW_VIEW || (widget)->type == GFXW_STATIC_VIEW \
|
#define GFXW_IS_VIEW(widget) ((widget)->type == GFXW_VIEW || (widget)->type == GFXW_STATIC_VIEW \
|
||||||
|| (widget)->type == GFXW_DYN_VIEW || (widget)->type == GFXW_PIC_VIEW)
|
|| (widget)->type == GFXW_DYN_VIEW || (widget)->type == GFXW_PIC_VIEW)
|
||||||
typedef struct {
|
struct gfxw_view_t {
|
||||||
VIEW_COMMON;
|
VIEW_COMMON;
|
||||||
} gfxw_view_t;
|
};
|
||||||
|
|
||||||
#define GFXW_IS_DYN_VIEW(widget) ((widget)->type == GFXW_DYN_VIEW || (widget)->type == GFXW_PIC_VIEW)
|
#define GFXW_IS_DYN_VIEW(widget) ((widget)->type == GFXW_DYN_VIEW || (widget)->type == GFXW_PIC_VIEW)
|
||||||
typedef struct {
|
struct gfxw_dyn_view_t {
|
||||||
VIEW_COMMON;
|
VIEW_COMMON;
|
||||||
/* fixme: This code is specific to SCI */
|
/* fixme: This code is specific to SCI */
|
||||||
rect_t draw_bounds; /* The correct position to draw to */
|
rect_t draw_bounds; /* The correct position to draw to */
|
||||||
|
@ -155,12 +156,12 @@ typedef struct {
|
||||||
int z; /* The z coordinate: Added to y, but used for sorting */
|
int z; /* The z coordinate: Added to y, but used for sorting */
|
||||||
int sequence; /* Sequence number: For sorting */
|
int sequence; /* Sequence number: For sorting */
|
||||||
int force_precedence; /* Precedence enforcement variable for sorting- defaults to 0 */
|
int force_precedence; /* Precedence enforcement variable for sorting- defaults to 0 */
|
||||||
} gfxw_dyn_view_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define GFXW_IS_TEXT(widget) ((widget)->type == GFXW_TEXT)
|
#define GFXW_IS_TEXT(widget) ((widget)->type == GFXW_TEXT)
|
||||||
typedef struct {
|
struct gfxw_text_t {
|
||||||
WIDGET_COMMON;
|
WIDGET_COMMON;
|
||||||
int font_nr;
|
int font_nr;
|
||||||
int lines_nr, lineheight, lastline_width;
|
int lines_nr, lineheight, lastline_width;
|
||||||
|
@ -170,14 +171,14 @@ typedef struct {
|
||||||
int text_flags;
|
int text_flags;
|
||||||
int width, height; /* Real text width and height */
|
int width, height; /* Real text width and height */
|
||||||
gfx_text_handle_t *text_handle;
|
gfx_text_handle_t *text_handle;
|
||||||
} gfxw_text_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Container widgets */
|
/* Container widgets */
|
||||||
|
|
||||||
typedef int gfxw_unary_container_op(struct _gfxw_container_widget *);
|
typedef int gfxw_unary_container_op(gfxw_container_t *);
|
||||||
typedef int gfxw_container_op(struct _gfxw_container_widget *, gfxw_widget_t *);
|
typedef int gfxw_container_op(gfxw_container_t *, gfxw_widget_t *);
|
||||||
typedef int gfxw_rect_op(struct _gfxw_container_widget *, rect_t, int);
|
typedef int gfxw_rect_op(gfxw_container_t *, rect_t, int);
|
||||||
|
|
||||||
#define WIDGET_CONTAINER \
|
#define WIDGET_CONTAINER \
|
||||||
WIDGET_COMMON; \
|
WIDGET_COMMON; \
|
||||||
|
@ -192,9 +193,9 @@ typedef int gfxw_rect_op(struct _gfxw_container_widget *, rect_t, int);
|
||||||
gfxw_container_op *add /* Append widget to an appropriate position (for view and control lists) */
|
gfxw_container_op *add /* Append widget to an appropriate position (for view and control lists) */
|
||||||
|
|
||||||
|
|
||||||
typedef struct _gfxw_container_widget {
|
struct gfxw_container_t {
|
||||||
WIDGET_CONTAINER;
|
WIDGET_CONTAINER;
|
||||||
} gfxw_container_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
#define GFXW_IS_CONTAINER(widget) ((widget)->type == GFXW_PORT || (widget)->type == GFXW_VISUAL || \
|
#define GFXW_IS_CONTAINER(widget) ((widget)->type == GFXW_PORT || (widget)->type == GFXW_VISUAL || \
|
||||||
|
@ -205,16 +206,16 @@ typedef struct _gfxw_container_widget {
|
||||||
typedef gfxw_container_t gfxw_list_t;
|
typedef gfxw_container_t gfxw_list_t;
|
||||||
|
|
||||||
#define GFXW_IS_VISUAL(widget) ((widget)->type == GFXW_VISUAL)
|
#define GFXW_IS_VISUAL(widget) ((widget)->type == GFXW_VISUAL)
|
||||||
typedef struct _gfxw_visual {
|
struct gfxw_visual_t {
|
||||||
WIDGET_CONTAINER;
|
WIDGET_CONTAINER;
|
||||||
struct _gfxw_port **port_refs; /* References to ports */
|
gfxw_port_t **port_refs; /* References to ports */
|
||||||
int port_refs_nr;
|
int port_refs_nr;
|
||||||
int font_nr; /* Default font */
|
int font_nr; /* Default font */
|
||||||
gfx_state_t *gfx_state;
|
gfx_state_t *gfx_state;
|
||||||
} gfxw_visual_t;
|
};
|
||||||
|
|
||||||
#define GFXW_IS_PORT(widget) ((widget)->type == GFXW_PORT)
|
#define GFXW_IS_PORT(widget) ((widget)->type == GFXW_PORT)
|
||||||
typedef struct _gfxw_port {
|
struct gfxw_port_t {
|
||||||
WIDGET_CONTAINER;
|
WIDGET_CONTAINER;
|
||||||
|
|
||||||
gfxw_list_t *decorations; /* optional window decorations- drawn before the contents */
|
gfxw_list_t *decorations; /* optional window decorations- drawn before the contents */
|
||||||
|
@ -228,7 +229,7 @@ typedef struct _gfxw_port {
|
||||||
int port_flags; /* interpreter-dependant flags */
|
int port_flags; /* interpreter-dependant flags */
|
||||||
const char *title_text;
|
const char *title_text;
|
||||||
byte gray_text; /* Whether text is 'grayed out' (dithered) */
|
byte gray_text; /* Whether text is 'grayed out' (dithered) */
|
||||||
} gfxw_port_t;
|
};
|
||||||
|
|
||||||
#undef WIDGET_COMMON
|
#undef WIDGET_COMMON
|
||||||
#undef WIDGET_CONTAINER
|
#undef WIDGET_CONTAINER
|
||||||
|
|
|
@ -240,7 +240,7 @@ static inline rect_t gfx_rect_translate(rect_t rect, Common::Point offset) {
|
||||||
|
|
||||||
#define GFX_PIXMAP_COLOR_KEY_NONE -1 /* No transpacency colour key */
|
#define GFX_PIXMAP_COLOR_KEY_NONE -1 /* No transpacency colour key */
|
||||||
|
|
||||||
typedef struct { /* gfx_pixmap_t: Pixel map */
|
struct gfx_pixmap_t { /* gfx_pixmap_t: Pixel map */
|
||||||
|
|
||||||
/*** Meta information ***/
|
/*** Meta information ***/
|
||||||
int ID; /* Resource ID, or GFX_RESID_NONE for anonymous graphical data */
|
int ID; /* Resource ID, or GFX_RESID_NONE for anonymous graphical data */
|
||||||
|
@ -285,13 +285,13 @@ typedef struct { /* gfx_pixmap_t: Pixel map */
|
||||||
void *info; /* initialized to NULL */
|
void *info; /* initialized to NULL */
|
||||||
} internal;
|
} internal;
|
||||||
|
|
||||||
} gfx_pixmap_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
#define GFX_FONT_BUILTIN_5x8 -1
|
#define GFX_FONT_BUILTIN_5x8 -1
|
||||||
#define GFX_FONT_BUILTIN_6x10 -2
|
#define GFX_FONT_BUILTIN_6x10 -2
|
||||||
|
|
||||||
typedef struct { /* gfx_bitmap_font_t: Bitmap font information */
|
struct gfx_bitmap_font_t { /* gfx_bitmap_font_t: Bitmap font information */
|
||||||
int ID; /* Unique resource ID */
|
int ID; /* Unique resource ID */
|
||||||
|
|
||||||
int chars_nr; /* Numer of available characters */
|
int chars_nr; /* Numer of available characters */
|
||||||
|
@ -312,7 +312,7 @@ typedef struct { /* gfx_bitmap_font_t: Bitmap font information */
|
||||||
** its pixel width is widths[ch], provided that (ch < chars_nr).
|
** its pixel width is widths[ch], provided that (ch < chars_nr).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
} gfx_bitmap_font_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -413,10 +413,10 @@ static inline int _gfxop_update_box(gfx_state_t *state, rect_t box) {
|
||||||
return GFX_OK;
|
return GFX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct _dirty_rect *_rect_create(rect_t box) {
|
static gfx_dirty_rect_t *_rect_create(rect_t box) {
|
||||||
struct _dirty_rect *rect;
|
gfx_dirty_rect_t *rect;
|
||||||
|
|
||||||
rect = (struct _dirty_rect *)sci_malloc(sizeof(struct _dirty_rect));
|
rect = (gfx_dirty_rect_t *)sci_malloc(sizeof(gfx_dirty_rect_t));
|
||||||
rect->next = NULL;
|
rect->next = NULL;
|
||||||
rect->rect = box;
|
rect->rect = box;
|
||||||
|
|
||||||
|
@ -450,11 +450,11 @@ gfx_dirty_rect_t *gfxdr_add_dirty(gfx_dirty_rect_t *base, rect_t box, int strate
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GFXOP_DIRTY_FRAMES_CLUSTERS: {
|
case GFXOP_DIRTY_FRAMES_CLUSTERS: {
|
||||||
struct _dirty_rect **rectp = &(base);
|
gfx_dirty_rect_t **rectp = &(base);
|
||||||
|
|
||||||
while (*rectp) {
|
while (*rectp) {
|
||||||
if (gfx_rects_overlap((*rectp)->rect, box)) {
|
if (gfx_rects_overlap((*rectp)->rect, box)) {
|
||||||
struct _dirty_rect *next = (*rectp)->next;
|
gfx_dirty_rect_t *next = (*rectp)->next;
|
||||||
box = gfx_rects_merge((*rectp)->rect, box);
|
box = gfx_rects_merge((*rectp)->rect, box);
|
||||||
free(*rectp);
|
free(*rectp);
|
||||||
*rectp = next;
|
*rectp = next;
|
||||||
|
@ -496,7 +496,7 @@ static inline void _gfxop_add_dirty_x(gfx_state_t *state, rect_t box) {
|
||||||
_gfxop_add_dirty(state, box);
|
_gfxop_add_dirty(state, box);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxop_clear_dirty_rec(gfx_state_t *state, struct _dirty_rect *rect) {
|
static int _gfxop_clear_dirty_rec(gfx_state_t *state, gfx_dirty_rect_t *rect) {
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
if (!rect)
|
if (!rect)
|
||||||
|
|
|
@ -33,10 +33,10 @@ namespace Sci {
|
||||||
|
|
||||||
#define NOT_A_KEY -1
|
#define NOT_A_KEY -1
|
||||||
|
|
||||||
typedef struct {
|
struct sbcell_t {
|
||||||
int key;
|
int key;
|
||||||
void *value;
|
void *value;
|
||||||
} sbcell_t;
|
};
|
||||||
|
|
||||||
int int_compar(const void *a, const void *b) {
|
int int_compar(const void *a, const void *b) {
|
||||||
return (*((int *)a)) - (*((int *)b));
|
return (*((int *)a)) - (*((int *)b));
|
||||||
|
|
|
@ -38,14 +38,14 @@
|
||||||
|
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
typedef struct {
|
struct sbtree_t {
|
||||||
int entries_nr;
|
int entries_nr;
|
||||||
int min_entry;
|
int min_entry;
|
||||||
int max_entry;
|
int max_entry;
|
||||||
int levels;
|
int levels;
|
||||||
int alloced_entries;
|
int alloced_entries;
|
||||||
void *data;
|
void *data;
|
||||||
} sbtree_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
sbtree_t *sbtree_new(int size, int *keys);
|
sbtree_t *sbtree_new(int size, int *keys);
|
||||||
|
|
|
@ -1643,7 +1643,8 @@ gfxw_visual_t *gfxw_new_visual(gfx_state_t *state, int font) {
|
||||||
visual->font_nr = font;
|
visual->font_nr = font;
|
||||||
visual->gfx_state = state;
|
visual->gfx_state = state;
|
||||||
|
|
||||||
visual->port_refs = (struct _gfxw_port **)sci_calloc(sizeof(gfxw_port_t), visual->port_refs_nr = 16);
|
visual->port_refs_nr = 16;
|
||||||
|
visual->port_refs = (gfxw_port_t **)sci_calloc(sizeof(gfxw_port_t), visual->port_refs_nr);
|
||||||
|
|
||||||
_gfxw_set_ops_VISUAL(GFXWC(visual));
|
_gfxw_set_ops_VISUAL(GFXWC(visual));
|
||||||
|
|
||||||
|
@ -1658,7 +1659,8 @@ static int _visual_find_free_ID(gfxw_visual_t *visual) {
|
||||||
id++;
|
id++;
|
||||||
|
|
||||||
if (id == visual->port_refs_nr) { // Out of ports?
|
if (id == visual->port_refs_nr) { // Out of ports?
|
||||||
visual->port_refs = (struct _gfxw_port**)sci_realloc(visual->port_refs, visual->port_refs_nr += newports);
|
visual->port_refs_nr += newports;
|
||||||
|
visual->port_refs = (gfxw_port_t**)sci_realloc(visual->port_refs, visual->port_refs_nr);
|
||||||
memset(visual->port_refs + id, 0, newports * sizeof(gfxw_port_t *)); // Clear new port refs
|
memset(visual->port_refs + id, 0, newports * sizeof(gfxw_port_t *)); // Clear new port refs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,10 +79,10 @@ namespace Sci {
|
||||||
#define SCI_GAME_IS_RESTARTING_NOW 2
|
#define SCI_GAME_IS_RESTARTING_NOW 2
|
||||||
#define SCI_GAME_WAS_RESTARTED_AT_LEAST_ONCE 4
|
#define SCI_GAME_WAS_RESTARTED_AT_LEAST_ONCE 4
|
||||||
|
|
||||||
typedef struct {
|
struct drawn_pic_t {
|
||||||
int nr;
|
int nr;
|
||||||
int palette;
|
int palette;
|
||||||
} drawn_pic_t;
|
};
|
||||||
|
|
||||||
// Savegame metadata
|
// Savegame metadata
|
||||||
struct SavegameMetadata {
|
struct SavegameMetadata {
|
||||||
|
|
|
@ -47,9 +47,9 @@ extern int _debug_step_running;
|
||||||
#define AVOIDPATH_DYNMEM_STRING "AvoidPath polyline"
|
#define AVOIDPATH_DYNMEM_STRING "AvoidPath polyline"
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct abs_rect_t {
|
||||||
int x, y, xend, yend;
|
int x, y, xend, yend;
|
||||||
} abs_rect_t;
|
};
|
||||||
|
|
||||||
/* Formerly, the heap macros were here; they have been deprecated, however. */
|
/* Formerly, the heap macros were here; they have been deprecated, however. */
|
||||||
|
|
||||||
|
@ -315,22 +315,22 @@ typedef reg_t kfunct(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
||||||
|
|
||||||
#define FREESCI_KFUNCT_GLUTTON 1
|
#define FREESCI_KFUNCT_GLUTTON 1
|
||||||
|
|
||||||
typedef struct {
|
struct kfunct_sig_pair_t {
|
||||||
kfunct *fun; /* The actual function */
|
kfunct *fun; /* The actual function */
|
||||||
const char *signature; /* kfunct signature */
|
const char *signature; /* kfunct signature */
|
||||||
const char *orig_name; /* Original name, in case we couldn't map it */
|
const char *orig_name; /* Original name, in case we couldn't map it */
|
||||||
} kfunct_sig_pair_t;
|
};
|
||||||
|
|
||||||
#define KF_OLD 0
|
#define KF_OLD 0
|
||||||
#define KF_NEW 1
|
#define KF_NEW 1
|
||||||
#define KF_NONE -1 /* No mapping, but name is known */
|
#define KF_NONE -1 /* No mapping, but name is known */
|
||||||
#define KF_TERMINATOR -42 /* terminates kfunct_mappers */
|
#define KF_TERMINATOR -42 /* terminates kfunct_mappers */
|
||||||
|
|
||||||
typedef struct {
|
struct sci_kernel_function_t {
|
||||||
int type; /* KF_* */
|
int type; /* KF_* */
|
||||||
const char *name;
|
const char *name;
|
||||||
kfunct_sig_pair_t sig_pair;
|
kfunct_sig_pair_t sig_pair;
|
||||||
} sci_kernel_function_t;
|
};
|
||||||
|
|
||||||
extern sci_kernel_function_t kfunct_mappers[];
|
extern sci_kernel_function_t kfunct_mappers[];
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace Sci {
|
||||||
#define MENU_ATTRIBUTE_FLAGS_KEY 0x01
|
#define MENU_ATTRIBUTE_FLAGS_KEY 0x01
|
||||||
#define MENU_ATTRIBUTE_FLAGS_SAID 0x02
|
#define MENU_ATTRIBUTE_FLAGS_SAID 0x02
|
||||||
|
|
||||||
typedef struct {
|
struct menu_item_t {
|
||||||
int type; /* Normal or hbar */
|
int type; /* Normal or hbar */
|
||||||
char *keytext; /* right-centered part of the text (the key) */
|
char *keytext; /* right-centered part of the text (the key) */
|
||||||
int keytext_size; /* Width of the right-centered text */
|
int keytext_size; /* Width of the right-centered text */
|
||||||
|
@ -96,10 +96,10 @@ typedef struct {
|
||||||
int enabled;
|
int enabled;
|
||||||
int tag;
|
int tag;
|
||||||
|
|
||||||
} menu_item_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct menu_t {
|
||||||
char *title;
|
char *title;
|
||||||
|
|
||||||
int title_width; /* Width of the title in pixels */
|
int title_width; /* Width of the title in pixels */
|
||||||
|
@ -108,16 +108,16 @@ typedef struct {
|
||||||
int items_nr; /* Window height equals to intems_nr * 10 */
|
int items_nr; /* Window height equals to intems_nr * 10 */
|
||||||
menu_item_t *items; /* Actual entries into the menu */
|
menu_item_t *items; /* Actual entries into the menu */
|
||||||
|
|
||||||
} menu_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct menubar_t {
|
||||||
|
|
||||||
int menus_nr;
|
int menus_nr;
|
||||||
menu_t *menus; /* The actual menus */
|
menu_t *menus; /* The actual menus */
|
||||||
|
|
||||||
} menubar_t;
|
};
|
||||||
|
|
||||||
struct gfx_port;
|
struct gfx_port;
|
||||||
struct gfx_picture; /* forward declarations for graphics.h */
|
struct gfx_picture; /* forward declarations for graphics.h */
|
||||||
|
|
|
@ -51,11 +51,11 @@ extern FILE *con_file;
|
||||||
** directly to the con_file variable.
|
** directly to the con_file variable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef union {
|
union cmd_param_t {
|
||||||
int32 val;
|
int32 val;
|
||||||
char *str;
|
char *str;
|
||||||
reg_t reg;
|
reg_t reg;
|
||||||
} cmd_param_t;
|
};
|
||||||
|
|
||||||
extern unsigned int cmd_paramlength;
|
extern unsigned int cmd_paramlength;
|
||||||
/* The number of parameters passed to a function called from the parser */
|
/* The number of parameters passed to a function called from the parser */
|
||||||
|
|
|
@ -106,10 +106,10 @@ namespace Sci {
|
||||||
#define SELECTOR_METHOD 2
|
#define SELECTOR_METHOD 2
|
||||||
/* Types of selectors as returned by grep_selector() below */
|
/* Types of selectors as returned by grep_selector() below */
|
||||||
|
|
||||||
typedef struct {
|
struct class_t {
|
||||||
int script; /* number of the script the class is in, -1 for non-existing */
|
int script; /* number of the script the class is in, -1 for non-existing */
|
||||||
reg_t reg; /* offset; script-relative offset, segment: 0 if not instantiated */
|
reg_t reg; /* offset; script-relative offset, segment: 0 if not instantiated */
|
||||||
} class_t;
|
};
|
||||||
|
|
||||||
#define RAW_GET_CLASS_INDEX(scr, reg) ((scr)->obj_indices->check_value(reg.offset, false))
|
#define RAW_GET_CLASS_INDEX(scr, reg) ((scr)->obj_indices->check_value(reg.offset, false))
|
||||||
#define RAW_IS_OBJECT(datablock) (getUInt16(((byte *) datablock) + SCRIPT_OBJECT_MAGIC_OFFSET) == SCRIPT_OBJECT_MAGIC_NUMBER)
|
#define RAW_IS_OBJECT(datablock) (getUInt16(((byte *) datablock) + SCRIPT_OBJECT_MAGIC_OFFSET) == SCRIPT_OBJECT_MAGIC_NUMBER)
|
||||||
|
@ -117,7 +117,7 @@ typedef struct {
|
||||||
#define IS_CLASS(obj) (obj->variables[SCRIPT_INFO_SELECTOR].offset & SCRIPT_INFO_CLASS)
|
#define IS_CLASS(obj) (obj->variables[SCRIPT_INFO_SELECTOR].offset & SCRIPT_INFO_CLASS)
|
||||||
|
|
||||||
/* This struct is used to buffer the list of send calls in send_selector() */
|
/* This struct is used to buffer the list of send calls in send_selector() */
|
||||||
typedef struct {
|
struct calls_struct_t {
|
||||||
union {
|
union {
|
||||||
reg_t func;
|
reg_t func;
|
||||||
reg_t *var;
|
reg_t *var;
|
||||||
|
@ -127,17 +127,17 @@ typedef struct {
|
||||||
selector_t selector;
|
selector_t selector;
|
||||||
stack_ptr_t sp; /* Stack pointer */
|
stack_ptr_t sp; /* Stack pointer */
|
||||||
int type; /* Same as exec_stack_t.type */
|
int type; /* Same as exec_stack_t.type */
|
||||||
} calls_struct_t;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct local_variables_t {
|
||||||
int script_id; /* Script ID this local variable block belongs to */
|
int script_id; /* Script ID this local variable block belongs to */
|
||||||
reg_t *locals;
|
reg_t *locals;
|
||||||
int nr;
|
int nr;
|
||||||
} local_variables_t;
|
};
|
||||||
|
|
||||||
#define OBJECT_FLAG_FREED (0x1 << 0) /* Clone has been marked as 'freed' */
|
#define OBJECT_FLAG_FREED (0x1 << 0) /* Clone has been marked as 'freed' */
|
||||||
|
|
||||||
typedef struct {
|
struct object_t {
|
||||||
int flags;
|
int flags;
|
||||||
reg_t pos; /* Object offset within its script; for clones, this is their base */
|
reg_t pos; /* Object offset within its script; for clones, this is their base */
|
||||||
int variables_nr;
|
int variables_nr;
|
||||||
|
@ -148,12 +148,12 @@ typedef struct {
|
||||||
uint16 *base_method; /* Pointer to the method selector area for this object */
|
uint16 *base_method; /* Pointer to the method selector area for this object */
|
||||||
uint16 *base_vars; /* Pointer to the varselector area for this object */
|
uint16 *base_vars; /* Pointer to the varselector area for this object */
|
||||||
reg_t *variables;
|
reg_t *variables;
|
||||||
} object_t;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct code_block_t {
|
||||||
reg_t pos;
|
reg_t pos;
|
||||||
int size;
|
int size;
|
||||||
} code_block_t;
|
};
|
||||||
|
|
||||||
#define VM_OBJECT_GET_VARSELECTOR(obj, i) \
|
#define VM_OBJECT_GET_VARSELECTOR(obj, i) \
|
||||||
(s->version < SCI_VERSION(1,001,000) ? \
|
(s->version < SCI_VERSION(1,001,000) ? \
|
||||||
|
@ -180,7 +180,7 @@ typedef struct {
|
||||||
//#define VM_OBJECT_SET_INDEX(ptr, index) { ((byte *) (ptr))[0] = (index) & 0xff; ((byte *) (ptr))[1] = ((index) >> 8) & 0xff; }
|
//#define VM_OBJECT_SET_INDEX(ptr, index) { ((byte *) (ptr))[0] = (index) & 0xff; ((byte *) (ptr))[1] = ((index) >> 8) & 0xff; }
|
||||||
//#define VM_OBJECT_GET_INDEX(scr, reg) (int_hash_map_check_value(scr->obj_indices, reg.offset, 0, NULL))
|
//#define VM_OBJECT_GET_INDEX(scr, reg) (int_hash_map_check_value(scr->obj_indices, reg.offset, 0, NULL))
|
||||||
|
|
||||||
typedef struct {
|
struct script_t {
|
||||||
int nr; /* Script number */
|
int nr; /* Script number */
|
||||||
byte* buf; /* Static data buffer, or NULL if not used */
|
byte* buf; /* Static data buffer, or NULL if not used */
|
||||||
size_t buf_size;
|
size_t buf_size;
|
||||||
|
@ -212,34 +212,34 @@ typedef struct {
|
||||||
int code_blocks_allocated;
|
int code_blocks_allocated;
|
||||||
int relocated;
|
int relocated;
|
||||||
int marked_as_deleted;
|
int marked_as_deleted;
|
||||||
} script_t;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct dstack_t {
|
||||||
int nr; /* Number of stack entries */
|
int nr; /* Number of stack entries */
|
||||||
reg_t *entries;
|
reg_t *entries;
|
||||||
} dstack_t; /* Data stack */
|
}; /* Data stack */
|
||||||
|
|
||||||
#define CLONE_USED -1
|
#define CLONE_USED -1
|
||||||
#define CLONE_NONE -1
|
#define CLONE_NONE -1
|
||||||
|
|
||||||
typedef object_t clone_t;
|
typedef object_t clone_t;
|
||||||
|
|
||||||
typedef struct _node_struct {
|
struct node_t {
|
||||||
reg_t pred, succ; /* Predecessor, successor */
|
reg_t pred, succ; /* Predecessor, successor */
|
||||||
reg_t key;
|
reg_t key;
|
||||||
reg_t value;
|
reg_t value;
|
||||||
} node_t; /* List nodes */
|
}; /* List nodes */
|
||||||
|
|
||||||
typedef struct _list_struct {
|
struct list_t {
|
||||||
reg_t first;
|
reg_t first;
|
||||||
reg_t last;
|
reg_t last;
|
||||||
} list_t;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct hunk_t {
|
||||||
void *mem;
|
void *mem;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
const char *type;
|
const char *type;
|
||||||
} hunk_t;
|
};
|
||||||
|
|
||||||
/* clone_table_t */
|
/* clone_table_t */
|
||||||
DECLARE_HEAPENTRY(clone)
|
DECLARE_HEAPENTRY(clone)
|
||||||
|
@ -250,13 +250,13 @@ DECLARE_HEAPENTRY(list) /* list entries */
|
||||||
/* hunk_table_t */
|
/* hunk_table_t */
|
||||||
DECLARE_HEAPENTRY(hunk)
|
DECLARE_HEAPENTRY(hunk)
|
||||||
|
|
||||||
typedef struct {
|
struct dynmem_t {
|
||||||
int size;
|
int size;
|
||||||
const char *description;
|
const char *description;
|
||||||
byte *buf;
|
byte *buf;
|
||||||
} dynmem_t; /* Free-style memory */
|
}; /* Free-style memory */
|
||||||
|
|
||||||
typedef struct _mem_obj {
|
struct mem_obj_t {
|
||||||
int type;
|
int type;
|
||||||
int segmgr_id; /* Internal value used by the seg_manager's hash map */
|
int segmgr_id; /* Internal value used by the seg_manager's hash map */
|
||||||
union {
|
union {
|
||||||
|
@ -271,11 +271,11 @@ typedef struct _mem_obj {
|
||||||
dynmem_t dynmem;
|
dynmem_t dynmem;
|
||||||
char *reserved;
|
char *reserved;
|
||||||
} data;
|
} data;
|
||||||
} mem_obj_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct selector_map_t {
|
||||||
selector_t init; /* Init function */
|
selector_t init; /* Init function */
|
||||||
selector_t play; /* Play function (first function to be called) */
|
selector_t play; /* Play function (first function to be called) */
|
||||||
selector_t replay; /* Replay function */
|
selector_t replay; /* Replay function */
|
||||||
|
@ -347,9 +347,9 @@ typedef struct {
|
||||||
selector_t flags;
|
selector_t flags;
|
||||||
|
|
||||||
selector_t points; /* Used by AvoidPath() */
|
selector_t points; /* Used by AvoidPath() */
|
||||||
} selector_map_t; /* Contains selector IDs for a few selected selectors */
|
}; /* Contains selector IDs for a few selected selectors */
|
||||||
|
|
||||||
typedef struct {
|
struct view_object_t {
|
||||||
reg_t obj;
|
reg_t obj;
|
||||||
reg_t *signalp; /* Used only indirectly */
|
reg_t *signalp; /* Used only indirectly */
|
||||||
reg_t *underBitsp; /* The same goes for the handle storage */
|
reg_t *underBitsp; /* The same goes for the handle storage */
|
||||||
|
@ -361,7 +361,7 @@ typedef struct {
|
||||||
int view_nr, loop, cel; /* view_nr is ised for save/restore */
|
int view_nr, loop, cel; /* view_nr is ised for save/restore */
|
||||||
int nsTop, nsLeft, nsRight, nsBottom;
|
int nsTop, nsLeft, nsRight, nsBottom;
|
||||||
int real_y, z, index_nr; /* Used for sorting */
|
int real_y, z, index_nr; /* Used for sorting */
|
||||||
} view_object_t;
|
};
|
||||||
|
|
||||||
#define VAR_GLOBAL 0
|
#define VAR_GLOBAL 0
|
||||||
#define VAR_LOCAL 1
|
#define VAR_LOCAL 1
|
||||||
|
@ -372,7 +372,7 @@ typedef struct {
|
||||||
#define EXEC_STACK_TYPE_KERNEL 1
|
#define EXEC_STACK_TYPE_KERNEL 1
|
||||||
#define EXEC_STACK_TYPE_VARSELECTOR 2
|
#define EXEC_STACK_TYPE_VARSELECTOR 2
|
||||||
|
|
||||||
typedef struct {
|
struct exec_stack_t {
|
||||||
reg_t objp;
|
reg_t objp;
|
||||||
reg_t sendp; /* Pointer to the object containing the invoked method */
|
reg_t sendp; /* Pointer to the object containing the invoked method */
|
||||||
union {
|
union {
|
||||||
|
@ -392,16 +392,16 @@ typedef struct {
|
||||||
** was the initial call. */
|
** was the initial call. */
|
||||||
byte type; /* EXEC_STACK_TYPE* */
|
byte type; /* EXEC_STACK_TYPE* */
|
||||||
|
|
||||||
} exec_stack_t;
|
};
|
||||||
|
|
||||||
typedef struct _breakpoint {
|
struct breakpoint_t {
|
||||||
int type;
|
int type;
|
||||||
union {
|
union {
|
||||||
uint32 address; /* Breakpoints on exports */
|
uint32 address; /* Breakpoints on exports */
|
||||||
char *name; /* Breakpoints on selector names */
|
char *name; /* Breakpoints on selector names */
|
||||||
} data;
|
} data;
|
||||||
struct _breakpoint *next;
|
breakpoint_t *next;
|
||||||
} breakpoint_t;
|
};
|
||||||
|
|
||||||
#define BREAK_SELECTOR 1
|
#define BREAK_SELECTOR 1
|
||||||
/* Break when selector is executed. data contains (char *) selector name
|
/* Break when selector is executed. data contains (char *) selector name
|
||||||
|
|
|
@ -23,16 +23,13 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SCI_VM_TYPES_H_
|
#ifndef SCI_VM_TYPES_H
|
||||||
#define _SCI_VM_TYPES_H_
|
#define SCI_VM_TYPES_H
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
|
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
#define SCI_REG_SIZE 16;
|
|
||||||
#define SCI_SEG_SIZE 16;
|
|
||||||
|
|
||||||
typedef int seg_id_t; /* Segment ID type */
|
typedef int seg_id_t; /* Segment ID type */
|
||||||
|
|
||||||
struct reg_t {
|
struct reg_t {
|
||||||
|
@ -64,4 +61,4 @@ extern reg_t NULL_REG;
|
||||||
|
|
||||||
} // End of namespace Sci
|
} // End of namespace Sci
|
||||||
|
|
||||||
#endif /* !_SCI_VM_TYPES_H_ */
|
#endif // SCI_VM_TYPES_H
|
||||||
|
|
|
@ -110,32 +110,32 @@ extern const char *class_names[]; /* Vocabulary class names */
|
||||||
|
|
||||||
#define SAID_LONG(x) ((x) << 8)
|
#define SAID_LONG(x) ((x) << 8)
|
||||||
|
|
||||||
typedef struct {
|
struct word_t {
|
||||||
|
|
||||||
int w_class; /* Word class */
|
int w_class; /* Word class */
|
||||||
int group; /* Word group */
|
int group; /* Word group */
|
||||||
char word[1]; /* The actual word */
|
char word[1]; /* The actual word */
|
||||||
|
|
||||||
} word_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct parse_rule_t {
|
||||||
int id; /* non-terminal ID */
|
int id; /* non-terminal ID */
|
||||||
int first_special; /* first terminal or non-terminal */
|
int first_special; /* first terminal or non-terminal */
|
||||||
int specials_nr; /* number of terminals and non-terminals */
|
int specials_nr; /* number of terminals and non-terminals */
|
||||||
int length;
|
int length;
|
||||||
int data[1]; /* actual data (size 1 to avoid compiler warnings) */
|
int data[1]; /* actual data (size 1 to avoid compiler warnings) */
|
||||||
} parse_rule_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct _parse_rule_list {
|
struct parse_rule_list_t {
|
||||||
int terminal; /* Terminal character this rule matches against or 0 for a non-terminal rule */
|
int terminal; /* Terminal character this rule matches against or 0 for a non-terminal rule */
|
||||||
parse_rule_t *rule;
|
parse_rule_t *rule;
|
||||||
struct _parse_rule_list *next;
|
parse_rule_list_t *next;
|
||||||
} parse_rule_list_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct suffix_t {
|
||||||
|
|
||||||
int class_mask; /* the word class this suffix applies to */
|
int class_mask; /* the word class this suffix applies to */
|
||||||
int result_class; /* the word class a word is morphed to if it doesn't fail this check */
|
int result_class; /* the word class a word is morphed to if it doesn't fail this check */
|
||||||
|
@ -146,36 +146,36 @@ typedef struct {
|
||||||
char *alt_suffix; /* The alternative suffix */
|
char *alt_suffix; /* The alternative suffix */
|
||||||
char *word_suffix; /* The suffix as used in the word vocabulary */
|
char *word_suffix; /* The suffix as used in the word vocabulary */
|
||||||
|
|
||||||
} suffix_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct result_word_t {
|
||||||
|
|
||||||
int w_class; /* Word class */
|
int w_class; /* Word class */
|
||||||
int group; /* Word group */
|
int group; /* Word group */
|
||||||
|
|
||||||
} result_word_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct synonym_t {
|
||||||
int replaceant; /* The word group to replace */
|
int replaceant; /* The word group to replace */
|
||||||
int replacement; /* The replacement word group for this one */
|
int replacement; /* The replacement word group for this one */
|
||||||
} synonym_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct parse_tree_branch_t {
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
int data[10];
|
int data[10];
|
||||||
|
|
||||||
} parse_tree_branch_t;
|
};
|
||||||
|
|
||||||
#define PARSE_TREE_NODE_LEAF 0
|
#define PARSE_TREE_NODE_LEAF 0
|
||||||
#define PARSE_TREE_NODE_BRANCH 1
|
#define PARSE_TREE_NODE_BRANCH 1
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct parse_tree_node_t {
|
||||||
|
|
||||||
short type; /* leaf or branch */
|
short type; /* leaf or branch */
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ typedef struct {
|
||||||
|
|
||||||
} content;
|
} content;
|
||||||
|
|
||||||
} parse_tree_node_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Sci {
|
||||||
|
|
||||||
#define ADLIB_VOICES 12
|
#define ADLIB_VOICES 12
|
||||||
|
|
||||||
typedef struct _sci_adlib_def {
|
struct adlib_def {
|
||||||
uint8 keyscale1; /* 0-3 !*/
|
uint8 keyscale1; /* 0-3 !*/
|
||||||
uint8 freqmod1; /* 0-15 !*/
|
uint8 freqmod1; /* 0-15 !*/
|
||||||
uint8 feedback1; /* 0-7 !*/
|
uint8 feedback1; /* 0-7 !*/
|
||||||
|
@ -62,7 +62,7 @@ typedef struct _sci_adlib_def {
|
||||||
uint8 algorithm2; /* 0,1 UNUSED */
|
uint8 algorithm2; /* 0,1 UNUSED */
|
||||||
uint8 waveform1; /* 0-3 !*/
|
uint8 waveform1; /* 0-3 !*/
|
||||||
uint8 waveform2; /* 0-3 !*/
|
uint8 waveform2; /* 0-3 !*/
|
||||||
} adlib_def;
|
};
|
||||||
|
|
||||||
typedef unsigned char adlib_instr[12];
|
typedef unsigned char adlib_instr[12];
|
||||||
|
|
||||||
|
|
|
@ -583,7 +583,7 @@ static song_iterator_t *_sci0_handle_message(sci0_song_iterator_t *self, song_it
|
||||||
#ifdef DEBUG_VERBOSE
|
#ifdef DEBUG_VERBOSE
|
||||||
fprintf(stderr, "** CLONE INCREF for new %p from %p at %p\n", mem, self, mem->data);
|
fprintf(stderr, "** CLONE INCREF for new %p from %p at %p\n", mem, self, mem->data);
|
||||||
#endif
|
#endif
|
||||||
return (struct _song_iterator *) mem; /* Assume caller has another copy of this */
|
return (song_iterator_t *) mem; /* Assume caller has another copy of this */
|
||||||
}
|
}
|
||||||
|
|
||||||
case _SIMSG_BASEMSG_STOP: {
|
case _SIMSG_BASEMSG_STOP: {
|
||||||
|
@ -1072,7 +1072,7 @@ static int _sci1_process_next_command(sci1_song_iterator_t *self,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct _song_iterator *
|
static song_iterator_t *
|
||||||
_sci1_handle_message(sci1_song_iterator_t *self,
|
_sci1_handle_message(sci1_song_iterator_t *self,
|
||||||
song_iterator_message_t msg) {
|
song_iterator_message_t msg) {
|
||||||
if (msg.recipient == _SIMSG_BASE) { /* May extend this in the future */
|
if (msg.recipient == _SIMSG_BASE) { /* May extend this in the future */
|
||||||
|
@ -1114,7 +1114,7 @@ static struct _song_iterator *
|
||||||
samplep = &(newsample->next);
|
samplep = &(newsample->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (struct _song_iterator *) mem; /* Assume caller has another copy of this */
|
return (song_iterator_t *) mem; /* Assume caller has another copy of this */
|
||||||
}
|
}
|
||||||
|
|
||||||
case _SIMSG_BASEMSG_STOP: {
|
case _SIMSG_BASEMSG_STOP: {
|
||||||
|
|
|
@ -153,9 +153,9 @@ int dev_output(sfx_pcm_device_t *self, byte *buf, int count) {
|
||||||
|
|
||||||
/* Feeds for debugging */
|
/* Feeds for debugging */
|
||||||
|
|
||||||
typedef struct {
|
struct int_struct {
|
||||||
int i;
|
int i;
|
||||||
} int_struct;
|
};
|
||||||
|
|
||||||
int feed_poll(sfx_pcm_feed_t *self, byte *dest, int size);
|
int feed_poll(sfx_pcm_feed_t *self, byte *dest, int size);
|
||||||
void feed_destroy(sfx_pcm_feed_t *self);
|
void feed_destroy(sfx_pcm_feed_t *self);
|
||||||
|
@ -173,11 +173,11 @@ int_struct private_bits[10] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct sample_feed_t {
|
||||||
int start;
|
int start;
|
||||||
int samples_nr;
|
int samples_nr;
|
||||||
byte *data;
|
byte *data;
|
||||||
} sample_feed_t;
|
};
|
||||||
|
|
||||||
#define FEEDS_NR 4
|
#define FEEDS_NR 4
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,11 @@ namespace Sci {
|
||||||
static int pi_poll(sfx_pcm_feed_t *self, byte *dest, int size);
|
static int pi_poll(sfx_pcm_feed_t *self, byte *dest, int size);
|
||||||
static void pi_destroy(sfx_pcm_feed_t *self);
|
static void pi_destroy(sfx_pcm_feed_t *self);
|
||||||
|
|
||||||
typedef struct {
|
struct pcm_data_internal_t {
|
||||||
byte *base_data;
|
byte *base_data;
|
||||||
byte *data;
|
byte *data;
|
||||||
int frames_left;
|
int frames_left;
|
||||||
} pcm_data_internal_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
static sfx_pcm_feed_t pcm_it_prototype = {
|
static sfx_pcm_feed_t pcm_it_prototype = {
|
||||||
|
|
|
@ -23,17 +23,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include "sci/tools.h"
|
||||||
#include <string.h>
|
#include "sci/sfx/sequencer.h"
|
||||||
#include <assert.h>
|
#include "sci/sfx/device.h"
|
||||||
#include <stdio.h>
|
#include "sci/sfx/seq/instrument-map.h"
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
# include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#include "../sequencer.h"
|
|
||||||
#include "../device.h"
|
|
||||||
#include "instrument-map.h"
|
|
||||||
#include <resource.h>
|
|
||||||
|
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
|
|
|
@ -214,13 +214,13 @@ sfx_instrument_map_load_sci(byte *data, size_t size) {
|
||||||
#define MIDI_CHANNELS_NR 0x10
|
#define MIDI_CHANNELS_NR 0x10
|
||||||
|
|
||||||
// FIXME: Replace this ugly hack with simple subclassing once converting to C++
|
// FIXME: Replace this ugly hack with simple subclassing once converting to C++
|
||||||
typedef struct decorated_midi_writer {
|
struct decorated_midi_writer_t {
|
||||||
MIDI_WRITER_BODY
|
MIDI_WRITER_BODY
|
||||||
|
|
||||||
midi_writer_t *writer;
|
midi_writer_t *writer;
|
||||||
sfx_patch_map_t patches[MIDI_CHANNELS_NR];
|
sfx_patch_map_t patches[MIDI_CHANNELS_NR];
|
||||||
sfx_instrument_map_t *map;
|
sfx_instrument_map_t *map;
|
||||||
} decorated_midi_writer_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -51,12 +51,12 @@ namespace Sci {
|
||||||
/* Maximum velocity (used for scaling) */
|
/* Maximum velocity (used for scaling) */
|
||||||
#define SFX_MAX_VELOCITY 128
|
#define SFX_MAX_VELOCITY 128
|
||||||
|
|
||||||
typedef struct {
|
struct sfx_patch_map_t {
|
||||||
int patch; /* Native instrument, SFX_UNMAPPED or SFX_MAPPED_TO_RHYTHM */
|
int patch; /* Native instrument, SFX_UNMAPPED or SFX_MAPPED_TO_RHYTHM */
|
||||||
int rhythm; /* Rhythm key when patch == SFX_MAPPED_TO_RHYTHM */
|
int rhythm; /* Rhythm key when patch == SFX_MAPPED_TO_RHYTHM */
|
||||||
} sfx_patch_map_t;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct sfx_instrument_map_t {
|
||||||
sfx_patch_map_t patch_map[SFX_INSTRUMENTS_NR]; /* Map patch nr to which native instrument or rhythm key */
|
sfx_patch_map_t patch_map[SFX_INSTRUMENTS_NR]; /* Map patch nr to which native instrument or rhythm key */
|
||||||
int patch_key_shift[SFX_INSTRUMENTS_NR]; /* Shift patch key by how much? */
|
int patch_key_shift[SFX_INSTRUMENTS_NR]; /* Shift patch key by how much? */
|
||||||
int patch_volume_adjust[SFX_INSTRUMENTS_NR]; /* Adjust controller 7 by how much? */
|
int patch_volume_adjust[SFX_INSTRUMENTS_NR]; /* Adjust controller 7 by how much? */
|
||||||
|
@ -73,7 +73,7 @@ typedef struct {
|
||||||
|
|
||||||
size_t initialisation_block_size;
|
size_t initialisation_block_size;
|
||||||
byte *initialisation_block; /* Initial MIDI commands to set up the device */
|
byte *initialisation_block; /* Initial MIDI commands to set up the device */
|
||||||
} sfx_instrument_map_t;
|
};
|
||||||
|
|
||||||
sfx_instrument_map_t *
|
sfx_instrument_map_t *
|
||||||
sfx_instrument_map_new(int velocity_maps_nr);
|
sfx_instrument_map_new(int velocity_maps_nr);
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Sci {
|
||||||
|
|
||||||
#define SFX_SEQ_PATCHFILE_NONE -1
|
#define SFX_SEQ_PATCHFILE_NONE -1
|
||||||
|
|
||||||
typedef struct _sfx_sequencer {
|
struct sfx_sequencer_t {
|
||||||
const char *name; /* Sequencer name */
|
const char *name; /* Sequencer name */
|
||||||
const char *version; /* Sequencer version */
|
const char *version; /* Sequencer version */
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ typedef struct _sfx_sequencer {
|
||||||
int min_write_ahead_ms; /* Minimal write-ahead, in milliseconds */
|
int min_write_ahead_ms; /* Minimal write-ahead, in milliseconds */
|
||||||
/* Note that write-ahead is tuned automatically; this enforces a lower limit */
|
/* Note that write-ahead is tuned automatically; this enforces a lower limit */
|
||||||
|
|
||||||
} sfx_sequencer_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
sfx_sequencer_t *sfx_find_sequencer(char *name);
|
sfx_sequencer_t *sfx_find_sequencer(char *name);
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Sci {
|
||||||
#define SFX_DEBUG_CUES (1 << 1) /* Debug cues, loops, and
|
#define SFX_DEBUG_CUES (1 << 1) /* Debug cues, loops, and
|
||||||
** song completions */
|
** song completions */
|
||||||
|
|
||||||
typedef struct {
|
struct sfx_state_t {
|
||||||
song_iterator_t *it; /* The song iterator at the heart of things */
|
song_iterator_t *it; /* The song iterator at the heart of things */
|
||||||
unsigned int flags; /* SFX_STATE_FLAG_* */
|
unsigned int flags; /* SFX_STATE_FLAG_* */
|
||||||
songlib_t songlib; /* Song library */
|
songlib_t songlib; /* Song library */
|
||||||
|
@ -55,7 +55,7 @@ typedef struct {
|
||||||
int suspended; /* Whether we are suspended */
|
int suspended; /* Whether we are suspended */
|
||||||
unsigned int debug; /* Debug flags */
|
unsigned int debug; /* Debug flags */
|
||||||
|
|
||||||
} sfx_state_t;
|
};
|
||||||
|
|
||||||
/***********/
|
/***********/
|
||||||
/* General */
|
/* General */
|
||||||
|
|
|
@ -44,12 +44,12 @@ namespace Sci {
|
||||||
#define FADE_ACTION_FADE_AND_STOP 1
|
#define FADE_ACTION_FADE_AND_STOP 1
|
||||||
#define FADE_ACTION_FADE_AND_CONT 2
|
#define FADE_ACTION_FADE_AND_CONT 2
|
||||||
|
|
||||||
typedef struct {
|
struct fade_params_t {
|
||||||
int ticks_per_step;
|
int ticks_per_step;
|
||||||
int final_volume;
|
int final_volume;
|
||||||
int step_size;
|
int step_size;
|
||||||
int action;
|
int action;
|
||||||
} fade_params_t;
|
};
|
||||||
|
|
||||||
#define SONG_ITERATOR_MESSAGE_ARGUMENTS_NR 2
|
#define SONG_ITERATOR_MESSAGE_ARGUMENTS_NR 2
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ struct listener_t {
|
||||||
|
|
||||||
typedef unsigned long songit_id_t;
|
typedef unsigned long songit_id_t;
|
||||||
|
|
||||||
typedef struct {
|
struct song_iterator_message_t {
|
||||||
songit_id_t ID;
|
songit_id_t ID;
|
||||||
unsigned int recipient; /* Type of iterator supposed to receive this */
|
unsigned int recipient; /* Type of iterator supposed to receive this */
|
||||||
unsigned int type;
|
unsigned int type;
|
||||||
|
@ -104,7 +104,7 @@ typedef struct {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
void * p;
|
void * p;
|
||||||
} args[SONG_ITERATOR_MESSAGE_ARGUMENTS_NR];
|
} args[SONG_ITERATOR_MESSAGE_ARGUMENTS_NR];
|
||||||
} song_iterator_message_t;
|
};
|
||||||
|
|
||||||
#define INHERITS_SONG_ITERATOR \
|
#define INHERITS_SONG_ITERATOR \
|
||||||
songit_id_t ID; \
|
songit_id_t ID; \
|
||||||
|
@ -115,15 +115,15 @@ typedef struct {
|
||||||
int (*next) (song_iterator_t *self, unsigned char *buf, int *buf_size); \
|
int (*next) (song_iterator_t *self, unsigned char *buf, int *buf_size); \
|
||||||
sfx_pcm_feed_t * (*get_pcm_feed) (song_iterator_t *s); \
|
sfx_pcm_feed_t * (*get_pcm_feed) (song_iterator_t *s); \
|
||||||
song_iterator_t * (* handle_message)(song_iterator_t *self, song_iterator_message_t msg); \
|
song_iterator_t * (* handle_message)(song_iterator_t *self, song_iterator_message_t msg); \
|
||||||
void (*init) (struct _song_iterator *self); \
|
void (*init) (song_iterator_t *self); \
|
||||||
void (*cleanup) (struct _song_iterator *self); \
|
void (*cleanup) (song_iterator_t *self); \
|
||||||
int (*get_timepos) (struct _song_iterator *self); \
|
int (*get_timepos) (song_iterator_t *self); \
|
||||||
listener_t death_listeners[SONGIT_MAX_LISTENERS]; \
|
listener_t death_listeners[SONGIT_MAX_LISTENERS]; \
|
||||||
int death_listeners_nr \
|
int death_listeners_nr \
|
||||||
|
|
||||||
#define SONGIT_MAX_LISTENERS 2
|
#define SONGIT_MAX_LISTENERS 2
|
||||||
|
|
||||||
typedef struct _song_iterator {
|
struct song_iterator_t {
|
||||||
|
|
||||||
songit_id_t ID;
|
songit_id_t ID;
|
||||||
uint16 channel_mask; /* Bitmask of all channels this iterator will use */
|
uint16 channel_mask; /* Bitmask of all channels this iterator will use */
|
||||||
|
@ -131,7 +131,7 @@ typedef struct _song_iterator {
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
int priority;
|
int priority;
|
||||||
|
|
||||||
int (*next)(struct _song_iterator *self,
|
int (*next)(song_iterator_t *self,
|
||||||
unsigned char *buf, int *result);
|
unsigned char *buf, int *result);
|
||||||
/* Reads the next MIDI operation _or_ delta time
|
/* Reads the next MIDI operation _or_ delta time
|
||||||
** Parameters: (song_iterator_t *) self
|
** Parameters: (song_iterator_t *) self
|
||||||
|
@ -150,7 +150,7 @@ typedef struct _song_iterator {
|
||||||
** PCM, but this must be done before any subsequent calls to next().
|
** PCM, but this must be done before any subsequent calls to next().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sfx_pcm_feed_t * (*get_pcm_feed)(struct _song_iterator *self);
|
sfx_pcm_feed_t * (*get_pcm_feed)(song_iterator_t *self);
|
||||||
/* Checks for the presence of a pcm sample
|
/* Checks for the presence of a pcm sample
|
||||||
** Parameters: (song_iterator_t *) self
|
** Parameters: (song_iterator_t *) self
|
||||||
** Returns : (sfx_pcm_feed_t *) NULL if no PCM data was found, a
|
** Returns : (sfx_pcm_feed_t *) NULL if no PCM data was found, a
|
||||||
|
@ -158,8 +158,8 @@ typedef struct _song_iterator {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
struct _song_iterator *
|
song_iterator_t *
|
||||||
(* handle_message)(struct _song_iterator *self, song_iterator_message_t msg);
|
(* handle_message)(song_iterator_t *self, song_iterator_message_t msg);
|
||||||
/* Handles a message to the song iterator
|
/* Handles a message to the song iterator
|
||||||
** Parameters: (song_iterator_t *) self
|
** Parameters: (song_iterator_t *) self
|
||||||
** (song_iterator_messag_t) msg: The message to handle
|
** (song_iterator_messag_t) msg: The message to handle
|
||||||
|
@ -174,20 +174,20 @@ typedef struct _song_iterator {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void (*init)(struct _song_iterator *self);
|
void (*init)(song_iterator_t *self);
|
||||||
/* Resets/initializes the sound iterator
|
/* Resets/initializes the sound iterator
|
||||||
** Parameters: (song_iterator_t *) self
|
** Parameters: (song_iterator_t *) self
|
||||||
** Returns : (void)
|
** Returns : (void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void (*cleanup)(struct _song_iterator *self);
|
void (*cleanup)(song_iterator_t *self);
|
||||||
/* Frees any content of the iterator structure
|
/* Frees any content of the iterator structure
|
||||||
** Parameters: (song_iterator_t *) self
|
** Parameters: (song_iterator_t *) self
|
||||||
** Does not physically free(self) yet. May be NULL if nothing needs to be done.
|
** Does not physically free(self) yet. May be NULL if nothing needs to be done.
|
||||||
** Must not recurse on its delegate.
|
** Must not recurse on its delegate.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*get_timepos)(struct _song_iterator *self);
|
int (*get_timepos)(song_iterator_t *self);
|
||||||
/* Gets the song position to store in a savegame
|
/* Gets the song position to store in a savegame
|
||||||
** Parameters: (song_iterator_t *) self
|
** Parameters: (song_iterator_t *) self
|
||||||
*/
|
*/
|
||||||
|
@ -199,7 +199,7 @@ typedef struct _song_iterator {
|
||||||
|
|
||||||
/* See songit_* for the constructor and non-virtual member functions */
|
/* See songit_* for the constructor and non-virtual member functions */
|
||||||
|
|
||||||
} song_iterator_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Song iterator flags */
|
/* Song iterator flags */
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Sci {
|
||||||
#define SIPFX __FILE__" : "
|
#define SIPFX __FILE__" : "
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct song_iterator_channel_t {
|
||||||
int state; /* SI_STATE_* */
|
int state; /* SI_STATE_* */
|
||||||
int offset; /* Offset into the data chunk */
|
int offset; /* Offset into the data chunk */
|
||||||
int end; /* Last allowed byte in track */
|
int end; /* Last allowed byte in track */
|
||||||
|
@ -73,7 +73,7 @@ typedef struct {
|
||||||
|
|
||||||
int saw_notes; /* Bitmask of channels we have currently played notes on */
|
int saw_notes; /* Bitmask of channels we have currently played notes on */
|
||||||
byte last_cmd; /* Last operation executed, for running status */
|
byte last_cmd; /* Last operation executed, for running status */
|
||||||
} song_iterator_channel_t;
|
};
|
||||||
|
|
||||||
#define INHERITS_BASE_SONG_ITERATOR \
|
#define INHERITS_BASE_SONG_ITERATOR \
|
||||||
INHERITS_SONG_ITERATOR; /* aka "extends song iterator" */ \
|
INHERITS_SONG_ITERATOR; /* aka "extends song iterator" */ \
|
||||||
|
@ -92,19 +92,19 @@ typedef struct {
|
||||||
int loops; /* Number of loops remaining */ \
|
int loops; /* Number of loops remaining */ \
|
||||||
int recover_delay
|
int recover_delay
|
||||||
|
|
||||||
typedef struct _base_song_iterator {
|
struct base_song_iterator_t {
|
||||||
INHERITS_BASE_SONG_ITERATOR;
|
INHERITS_BASE_SONG_ITERATOR;
|
||||||
} base_song_iterator_t;
|
};
|
||||||
|
|
||||||
/********************************/
|
/********************************/
|
||||||
/*--------- SCI 0 --------------*/
|
/*--------- SCI 0 --------------*/
|
||||||
/********************************/
|
/********************************/
|
||||||
|
|
||||||
typedef struct {
|
struct sci0_song_iterator_t {
|
||||||
INHERITS_BASE_SONG_ITERATOR;
|
INHERITS_BASE_SONG_ITERATOR;
|
||||||
song_iterator_channel_t channel;
|
song_iterator_channel_t channel;
|
||||||
int delay_remaining; /* Number of ticks that haven't been polled yet */
|
int delay_remaining; /* Number of ticks that haven't been polled yet */
|
||||||
} sci0_song_iterator_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
/********************************/
|
/********************************/
|
||||||
|
@ -112,17 +112,17 @@ typedef struct {
|
||||||
/********************************/
|
/********************************/
|
||||||
|
|
||||||
|
|
||||||
typedef struct _sci1_sample {
|
struct sci1_sample_t {
|
||||||
int delta; /* Time left-- initially, this is 'Sample point 1'.
|
int delta; /* Time left-- initially, this is 'Sample point 1'.
|
||||||
** After initialisation, it is 'sample point 1 minus the sample point of the previous sample' */
|
** After initialisation, it is 'sample point 1 minus the sample point of the previous sample' */
|
||||||
int size;
|
int size;
|
||||||
int announced; /* Announced for download (SI_PCM) */
|
int announced; /* Announced for download (SI_PCM) */
|
||||||
sfx_pcm_config_t format;
|
sfx_pcm_config_t format;
|
||||||
byte *data;
|
byte *data;
|
||||||
struct _sci1_sample *next;
|
sci1_sample_t *next;
|
||||||
} sci1_sample_t;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct sci1_song_iterator_t {
|
||||||
INHERITS_BASE_SONG_ITERATOR;
|
INHERITS_BASE_SONG_ITERATOR;
|
||||||
song_iterator_channel_t channels[MIDI_CHANNELS];
|
song_iterator_channel_t channels[MIDI_CHANNELS];
|
||||||
|
|
||||||
|
@ -136,8 +136,7 @@ typedef struct {
|
||||||
|
|
||||||
int delay_remaining; /* Number of ticks that haven't been polled yet */
|
int delay_remaining; /* Number of ticks that haven't been polled yet */
|
||||||
int hold;
|
int hold;
|
||||||
\
|
};
|
||||||
} sci1_song_iterator_t;
|
|
||||||
|
|
||||||
#define PLAYMASK_NONE 0x0
|
#define PLAYMASK_NONE 0x0
|
||||||
|
|
||||||
|
@ -164,11 +163,11 @@ int is_cleanup_iterator(song_iterator_t *it);
|
||||||
/*--------- Fast Forward ---------*/
|
/*--------- Fast Forward ---------*/
|
||||||
/**********************************/
|
/**********************************/
|
||||||
|
|
||||||
typedef struct {
|
struct fast_forward_song_iterator_t {
|
||||||
INHERITS_SONG_ITERATOR;
|
INHERITS_SONG_ITERATOR;
|
||||||
song_iterator_t *delegate;
|
song_iterator_t *delegate;
|
||||||
int delta; /* Remaining time */
|
int delta; /* Remaining time */
|
||||||
} fast_forward_song_iterator_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
song_iterator_t *new_fast_forward_iterator(song_iterator_t *it, int delta);
|
song_iterator_t *new_fast_forward_iterator(song_iterator_t *it, int delta);
|
||||||
|
@ -198,7 +197,7 @@ song_iterator_t *new_fast_forward_iterator(song_iterator_t *it, int delta);
|
||||||
#define TEE_MORPH_NONE 0 /* Not waiting to self-morph */
|
#define TEE_MORPH_NONE 0 /* Not waiting to self-morph */
|
||||||
#define TEE_MORPH_READY 1 /* Ready to self-morph */
|
#define TEE_MORPH_READY 1 /* Ready to self-morph */
|
||||||
|
|
||||||
typedef struct {
|
struct tee_song_iterator_t {
|
||||||
INHERITS_SONG_ITERATOR;
|
INHERITS_SONG_ITERATOR;
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
|
@ -217,7 +216,7 @@ typedef struct {
|
||||||
/* Remapping for channels */
|
/* Remapping for channels */
|
||||||
|
|
||||||
} children[2];
|
} children[2];
|
||||||
} tee_song_iterator_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
sfx_pcm_feed_t *sfx_iterator_make_feed(byte *base_data, int offset,
|
sfx_pcm_feed_t *sfx_iterator_make_feed(byte *base_data, int offset,
|
||||||
|
|
|
@ -64,19 +64,19 @@ namespace Sci {
|
||||||
#define SFX_PCM_FRAME_SIZE(conf) ((conf).stereo? 2 : 1) * (((conf).format & SFX_PCM_FORMAT_16)? 2 : 1)
|
#define SFX_PCM_FRAME_SIZE(conf) ((conf).stereo? 2 : 1) * (((conf).format & SFX_PCM_FORMAT_16)? 2 : 1)
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct sfx_pcm_config_t {
|
||||||
int rate; /* Sampling rate */
|
int rate; /* Sampling rate */
|
||||||
int stereo; /* The stereo mode used (SFX_PCM_MONO or SFX_PCM_STEREO_*) */
|
int stereo; /* The stereo mode used (SFX_PCM_MONO or SFX_PCM_STEREO_*) */
|
||||||
unsigned int format; /* Sample format (SFX_PCM_FORMAT_*) */
|
unsigned int format; /* Sample format (SFX_PCM_FORMAT_*) */
|
||||||
} sfx_pcm_config_t;
|
};
|
||||||
|
|
||||||
typedef struct _sfx_pcm_device {
|
struct sfx_pcm_device_t {
|
||||||
/* SFX devices are PCM players, i.e. output drivers for digitalised audio (sequences of audio samples).
|
/* SFX devices are PCM players, i.e. output drivers for digitalised audio (sequences of audio samples).
|
||||||
** Implementors are (in general) allowed to export specifics of these devices and let the mixer handle
|
** Implementors are (in general) allowed to export specifics of these devices and let the mixer handle
|
||||||
** endianness/signedness/bit size/mono-vs-stereo conversions.
|
** endianness/signedness/bit size/mono-vs-stereo conversions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*init)(struct _sfx_pcm_device *self);
|
int (*init)(sfx_pcm_device_t *self);
|
||||||
/* Initializes the device
|
/* Initializes the device
|
||||||
** Parameters: (sfx_pcm_device_t *) self: Self reference
|
** Parameters: (sfx_pcm_device_t *) self: Self reference
|
||||||
** Returns : (int) SFX_OK on success, SFX_ERROR if the device could not be
|
** Returns : (int) SFX_OK on success, SFX_ERROR if the device could not be
|
||||||
|
@ -85,7 +85,7 @@ typedef struct _sfx_pcm_device {
|
||||||
** specified beforehand.
|
** specified beforehand.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*output)(struct _sfx_pcm_device *self, byte *buf,
|
int (*output)(sfx_pcm_device_t *self, byte *buf,
|
||||||
int count, sfx_timestamp_t *timestamp);
|
int count, sfx_timestamp_t *timestamp);
|
||||||
/* Writes output to the device
|
/* Writes output to the device
|
||||||
** Parameters: (sfx_pcm_device_t *) self: Self reference
|
** Parameters: (sfx_pcm_device_t *) self: Self reference
|
||||||
|
@ -103,7 +103,7 @@ typedef struct _sfx_pcm_device {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sfx_timestamp_t
|
sfx_timestamp_t
|
||||||
(*get_output_timestamp)(struct _sfx_pcm_device *self);
|
(*get_output_timestamp)(sfx_pcm_device_t *self);
|
||||||
/* Determines the timestamp for 'output'
|
/* Determines the timestamp for 'output'
|
||||||
** Parameters: (sfx_pcm_device_t *) self: Self reference
|
** Parameters: (sfx_pcm_device_t *) self: Self reference
|
||||||
** Returns : (sfx_timestamp_t) A timestamp (with the device's conf.rate)
|
** Returns : (sfx_timestamp_t) A timestamp (with the device's conf.rate)
|
||||||
|
@ -121,14 +121,14 @@ typedef struct _sfx_pcm_device {
|
||||||
** output() will block or fail, drained according
|
** output() will block or fail, drained according
|
||||||
** to conf.rate */
|
** to conf.rate */
|
||||||
|
|
||||||
} sfx_pcm_device_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
#define PCM_FEED_TIMESTAMP 0 /* New timestamp available */
|
#define PCM_FEED_TIMESTAMP 0 /* New timestamp available */
|
||||||
#define PCM_FEED_IDLE 1 /* No sound ATM, but new timestamp may be available later */
|
#define PCM_FEED_IDLE 1 /* No sound ATM, but new timestamp may be available later */
|
||||||
#define PCM_FEED_EMPTY 2 /* Feed is finished, can be destroyed */
|
#define PCM_FEED_EMPTY 2 /* Feed is finished, can be destroyed */
|
||||||
|
|
||||||
typedef struct _sfx_pcm_feed_t {
|
struct sfx_pcm_feed_t {
|
||||||
/* PCM feeds are sources of input for the PCM mixer. Their member functions
|
/* PCM feeds are sources of input for the PCM mixer. Their member functions
|
||||||
** are invoked as callbacks on demand, to provide the mixer with input it
|
** are invoked as callbacks on demand, to provide the mixer with input it
|
||||||
** (in turn) passes on to PCM output devices.
|
** (in turn) passes on to PCM output devices.
|
||||||
|
@ -136,7 +136,7 @@ typedef struct _sfx_pcm_feed_t {
|
||||||
** to be considered.
|
** to be considered.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*poll)(struct _sfx_pcm_feed_t *self, byte *dest, int size);
|
int (*poll)(sfx_pcm_feed_t *self, byte *dest, int size);
|
||||||
/* Asks the PCM feed to write out the next stuff it would like to have written
|
/* Asks the PCM feed to write out the next stuff it would like to have written
|
||||||
** Parameters: (sfx_pcm_feed_t *) self: Self reference
|
** Parameters: (sfx_pcm_feed_t *) self: Self reference
|
||||||
** (byte *) dest: The destination buffer to write to
|
** (byte *) dest: The destination buffer to write to
|
||||||
|
@ -148,14 +148,14 @@ typedef struct _sfx_pcm_feed_t {
|
||||||
** is available.
|
** is available.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void (*destroy)(struct _sfx_pcm_feed_t *self);
|
void (*destroy)(sfx_pcm_feed_t *self);
|
||||||
/* Asks the PCM feed to free all resources it occupies
|
/* Asks the PCM feed to free all resources it occupies
|
||||||
** Parameters: (sfx_pcm_feed_t *) self: Self reference
|
** Parameters: (sfx_pcm_feed_t *) self: Self reference
|
||||||
** free(self) should be part of this function, if applicable.
|
** free(self) should be part of this function, if applicable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
(*get_timestamp)(struct _sfx_pcm_feed_t *self, sfx_timestamp_t *timestamp);
|
(*get_timestamp)(sfx_pcm_feed_t *self, sfx_timestamp_t *timestamp);
|
||||||
/* Determines the timestamp of the next frame-to-read
|
/* Determines the timestamp of the next frame-to-read
|
||||||
** Returns : (sfx_timestamp_t) timestamp: The timestamp of the next frame
|
** Returns : (sfx_timestamp_t) timestamp: The timestamp of the next frame
|
||||||
** (int) PCM_FEED_*
|
** (int) PCM_FEED_*
|
||||||
|
@ -171,7 +171,7 @@ typedef struct _sfx_pcm_feed_t {
|
||||||
** (print in hex) */
|
** (print in hex) */
|
||||||
int frame_size; /* Frame size, computed by the mixer for the feed */
|
int frame_size; /* Frame size, computed by the mixer for the feed */
|
||||||
|
|
||||||
} sfx_pcm_feed_t;
|
};
|
||||||
|
|
||||||
int sfx_pcm_available();
|
int sfx_pcm_available();
|
||||||
/* Determines whether a PCM device is available and has been initialised
|
/* Determines whether a PCM device is available and has been initialised
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace Sci {
|
||||||
|
|
||||||
typedef void tell_synth_func(int buf_nr, byte *buf);
|
typedef void tell_synth_func(int buf_nr, byte *buf);
|
||||||
|
|
||||||
typedef struct {
|
struct sfx_player_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *version;
|
const char *version;
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ typedef struct {
|
||||||
|
|
||||||
int polyphony; /* Number of voices that can play simultaneously */
|
int polyphony; /* Number of voices that can play simultaneously */
|
||||||
|
|
||||||
} sfx_player_t;
|
};
|
||||||
|
|
||||||
sfx_player_t *sfx_find_player(char *name);
|
sfx_player_t *sfx_find_player(char *name);
|
||||||
/* Looks up a player by name or finds the default player
|
/* Looks up a player by name or finds the default player
|
||||||
|
|
|
@ -50,7 +50,7 @@ typedef enum {
|
||||||
RESTORE_BEHAVIOR_RESTART /* continue it from where it was */
|
RESTORE_BEHAVIOR_RESTART /* continue it from where it was */
|
||||||
} RESTORE_BEHAVIOR;
|
} RESTORE_BEHAVIOR;
|
||||||
|
|
||||||
typedef struct _song {
|
struct song_t {
|
||||||
song_handle_t handle;
|
song_handle_t handle;
|
||||||
int resource_num; /* Resource number */
|
int resource_num; /* Resource number */
|
||||||
int priority; /* Song priority (more important if priority is higher) */
|
int priority; /* Song priority (more important if priority is higher) */
|
||||||
|
@ -70,18 +70,18 @@ typedef struct _song {
|
||||||
** Playing -> time at which 'delay' has elapsed
|
** Playing -> time at which 'delay' has elapsed
|
||||||
** Suspended/Waiting -> stopping time */
|
** Suspended/Waiting -> stopping time */
|
||||||
|
|
||||||
struct _song *next; /* Next song or NULL if this is the last one */
|
song_t *next; /* Next song or NULL if this is the last one */
|
||||||
struct _song *next_playing; /* Next playing song; used by the
|
song_t *next_playing; /* Next playing song; used by the
|
||||||
** core song system */
|
** core song system */
|
||||||
struct _song *next_stopping; /* Next song pending stopping; used exclusively by
|
song_t *next_stopping; /* Next song pending stopping; used exclusively by
|
||||||
** the core song system's _update_multi_song() */
|
** the core song system's _update_multi_song() */
|
||||||
} song_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct songlib_t {
|
||||||
song_t **lib;
|
song_t **lib;
|
||||||
song_t *_s;
|
song_t *_s;
|
||||||
} songlib_t;
|
};
|
||||||
|
|
||||||
/**************************/
|
/**************************/
|
||||||
/* Song library commands: */
|
/* Song library commands: */
|
||||||
|
|
|
@ -28,13 +28,13 @@
|
||||||
|
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
typedef struct {
|
struct sfx_timestamp_t {
|
||||||
long secs;
|
long secs;
|
||||||
long usecs;
|
long usecs;
|
||||||
int frame_rate;
|
int frame_rate;
|
||||||
int frame_offset;
|
int frame_offset;
|
||||||
/* Total time: secs + usecs + frame_offset/frame_rate */
|
/* Total time: secs + usecs + frame_offset/frame_rate */
|
||||||
} sfx_timestamp_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
sfx_timestamp_t sfx_new_timestamp(long secs, long usecs, int frame_rate);
|
sfx_timestamp_t sfx_new_timestamp(long secs, long usecs, int frame_rate);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
typedef struct {
|
struct sfx_timer_t {
|
||||||
int delay_ms; /* Approximate delay (in milliseconds) between calls */
|
int delay_ms; /* Approximate delay (in milliseconds) between calls */
|
||||||
|
|
||||||
int (*init)(void (*callback)(void *data), void *data);
|
int (*init)(void (*callback)(void *data), void *data);
|
||||||
|
@ -49,7 +49,7 @@ typedef struct {
|
||||||
** All resources allocated with the timer should be freed as an effect
|
** All resources allocated with the timer should be freed as an effect
|
||||||
** of this.
|
** of this.
|
||||||
*/
|
*/
|
||||||
} sfx_timer_t;
|
};
|
||||||
|
|
||||||
} // End of namespace Sci
|
} // End of namespace Sci
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,11 @@
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
/* Software sequencer */
|
/* Software sequencer */
|
||||||
typedef struct sfx_softseq {
|
struct sfx_softseq_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *version;
|
const char *version;
|
||||||
|
|
||||||
int (*set_option)(struct sfx_softseq *self, const char *name, const char *value);
|
int (*set_option)(sfx_softseq_t *self, const char *name, const char *value);
|
||||||
/* Sets an option for the sequencer
|
/* Sets an option for the sequencer
|
||||||
** Parameters: (sfx_softseq_t *) self: Self reference
|
** Parameters: (sfx_softseq_t *) self: Self reference
|
||||||
** (const char *) name: Name of the option to set
|
** (const char *) name: Name of the option to set
|
||||||
|
@ -46,7 +46,7 @@ typedef struct sfx_softseq {
|
||||||
** Returns : (int) GFX_OK on success, or GFX_ERROR if not supported
|
** Returns : (int) GFX_OK on success, or GFX_ERROR if not supported
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*init)(struct sfx_softseq *self, byte *res_data, int res_size,
|
int (*init)(sfx_softseq_t *self, byte *res_data, int res_size,
|
||||||
byte *res2_data, int res2_size);
|
byte *res2_data, int res2_size);
|
||||||
/* Initialises the sequencer
|
/* Initialises the sequencer
|
||||||
** Parameters: (sfx_softseq_t *) self: Self reference
|
** Parameters: (sfx_softseq_t *) self: Self reference
|
||||||
|
@ -61,18 +61,18 @@ typedef struct sfx_softseq {
|
||||||
** /even if/ patch_nr is set.
|
** /even if/ patch_nr is set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void (*exit)(struct sfx_softseq *self);
|
void (*exit)(sfx_softseq_t *self);
|
||||||
/* Uninitialises the sequencer and frees all used resources
|
/* Uninitialises the sequencer and frees all used resources
|
||||||
** Parameters: (sfx_softseq_t *) self: Self reference
|
** Parameters: (sfx_softseq_t *) self: Self reference
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void (*set_volume)(struct sfx_softseq *self, int new_volume);
|
void (*set_volume)(sfx_softseq_t *self, int new_volume);
|
||||||
/* Sets the sequencer volume
|
/* Sets the sequencer volume
|
||||||
** Parameters: (sfx_softseq_t *) self: Self reference
|
** Parameters: (sfx_softseq_t *) self: Self reference
|
||||||
** (int) new_volume: A volume, between 0 (quiet) and 127 (max)
|
** (int) new_volume: A volume, between 0 (quiet) and 127 (max)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void (*handle_command)(struct sfx_softseq *self, byte cmd, int argc, byte *argv);
|
void (*handle_command)(sfx_softseq_t *self, byte cmd, int argc, byte *argv);
|
||||||
/* Handle a MIDI command
|
/* Handle a MIDI command
|
||||||
** Parameters: (sfx_softseq_t *) self: Self reference
|
** Parameters: (sfx_softseq_t *) self: Self reference
|
||||||
** (byte) cmd: Basic MIDI command, always includes command and channel
|
** (byte) cmd: Basic MIDI command, always includes command and channel
|
||||||
|
@ -80,14 +80,14 @@ typedef struct sfx_softseq {
|
||||||
** (byte *) argv: Additional arguments to 'cmd'
|
** (byte *) argv: Additional arguments to 'cmd'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void (*poll)(struct sfx_softseq *self, byte *dest, int len);
|
void (*poll)(sfx_softseq_t *self, byte *dest, int len);
|
||||||
/* Asks the software sequencer to fill in parts of a buffer
|
/* Asks the software sequencer to fill in parts of a buffer
|
||||||
** Parameters: (sfx_softseq_t *) self: Self reference
|
** Parameters: (sfx_softseq_t *) self: Self reference
|
||||||
** (int) len: Number of _frames_ to write
|
** (int) len: Number of _frames_ to write
|
||||||
** Returns : (byte) *dest: 'len' frames must be written to this buffer
|
** Returns : (byte) *dest: 'len' frames must be written to this buffer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void (*allstop)(struct sfx_softseq *self);
|
void (*allstop)(sfx_softseq_t *self);
|
||||||
/* Stops all sound generation
|
/* Stops all sound generation
|
||||||
** Parameters: (sfx_softseq_t *) self: Self reference
|
** Parameters: (sfx_softseq_t *) self: Self reference
|
||||||
*/
|
*/
|
||||||
|
@ -111,7 +111,7 @@ typedef struct sfx_softseq {
|
||||||
|
|
||||||
sfx_pcm_config_t pcm_conf; /* Setup of the channel the sequencer writes to */
|
sfx_pcm_config_t pcm_conf; /* Setup of the channel the sequencer writes to */
|
||||||
|
|
||||||
} sfx_softseq_t;
|
};
|
||||||
|
|
||||||
|
|
||||||
sfx_softseq_t *sfx_find_softseq(const char *name);
|
sfx_softseq_t *sfx_find_softseq(const char *name);
|
||||||
|
|
|
@ -48,19 +48,19 @@ namespace Sci {
|
||||||
|
|
||||||
/* #define DEBUG */
|
/* #define DEBUG */
|
||||||
|
|
||||||
typedef struct envelope {
|
struct envelope_t {
|
||||||
/* Phase period length in samples */
|
/* Phase period length in samples */
|
||||||
int length;
|
int length;
|
||||||
/* Velocity delta per period */
|
/* Velocity delta per period */
|
||||||
int delta;
|
int delta;
|
||||||
/* Target velocity */
|
/* Target velocity */
|
||||||
int target;
|
int target;
|
||||||
} envelope_t;
|
};
|
||||||
|
|
||||||
/* Fast decay envelope */
|
/* Fast decay envelope */
|
||||||
static envelope_t env_decay = {FREQUENCY / (32 * 64), 1, 0};
|
static envelope_t env_decay = {FREQUENCY / (32 * 64), 1, 0};
|
||||||
|
|
||||||
typedef struct instrument {
|
struct instrument_t {
|
||||||
char name[30];
|
char name[30];
|
||||||
int mode;
|
int mode;
|
||||||
/* Size of non-looping part in bytes */
|
/* Size of non-looping part in bytes */
|
||||||
|
@ -73,15 +73,15 @@ typedef struct instrument {
|
||||||
envelope_t envelope[4];
|
envelope_t envelope[4];
|
||||||
int8 *samples;
|
int8 *samples;
|
||||||
int8 *loop;
|
int8 *loop;
|
||||||
} instrument_t;
|
};
|
||||||
|
|
||||||
typedef struct bank {
|
struct bank_t {
|
||||||
char name[30];
|
char name[30];
|
||||||
int size;
|
int size;
|
||||||
instrument_t *instruments[256];
|
instrument_t *instruments[256];
|
||||||
} bank_t;
|
};
|
||||||
|
|
||||||
typedef struct channel {
|
struct channel_t {
|
||||||
int instrument;
|
int instrument;
|
||||||
int note;
|
int note;
|
||||||
int note_velocity;
|
int note_velocity;
|
||||||
|
@ -94,13 +94,13 @@ typedef struct channel {
|
||||||
int hw_channel;
|
int hw_channel;
|
||||||
frac_t offset;
|
frac_t offset;
|
||||||
frac_t rate;
|
frac_t rate;
|
||||||
} channel_t;
|
};
|
||||||
|
|
||||||
typedef struct hw_channel {
|
struct hw_channel_t {
|
||||||
int instrument;
|
int instrument;
|
||||||
int volume;
|
int volume;
|
||||||
int pan;
|
int pan;
|
||||||
} hw_channel_t;
|
};
|
||||||
|
|
||||||
/* Instrument bank */
|
/* Instrument bank */
|
||||||
static bank_t bank;
|
static bank_t bank;
|
||||||
|
|
|
@ -83,12 +83,12 @@
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
struct GTimeVal {
|
||||||
long tv_sec;
|
long tv_sec;
|
||||||
long tv_usec;
|
long tv_usec;
|
||||||
} GTimeVal;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct sci_dir_t {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
long search;
|
long search;
|
||||||
struct _finddata_t fileinfo;
|
struct _finddata_t fileinfo;
|
||||||
|
@ -96,7 +96,7 @@ typedef struct {
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
char *mask_copy;
|
char *mask_copy;
|
||||||
#endif
|
#endif
|
||||||
} sci_dir_t; /* used by sci_find_first and friends */
|
}; /* used by sci_find_first and friends */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue