aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/game.cpp2
-rw-r--r--engines/sci/engine/kernel.cpp6
-rw-r--r--engines/sci/engine/kernel.h10
-rw-r--r--engines/sci/engine/savegame.cpp8
-rw-r--r--engines/sci/engine/scriptdebug.cpp4
-rw-r--r--engines/sci/engine/seg_manager.cpp10
-rw-r--r--engines/sci/engine/seg_manager.h6
-rw-r--r--engines/sci/engine/vm.h6
8 files changed, 25 insertions, 27 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index e35386dbd4..23e6d5eb64 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -549,7 +549,7 @@ void script_free_breakpoints(EngineState *s) {
int game_init(EngineState *s) {
// FIXME Use new VM instantiation code all over the place"
reg_t game_obj; // Address of the game object
- dstack_t *stack;
+ DataStack *stack;
stack = s->seg_manager->allocateStack(VM_STACK_SIZE, &s->stack_segment);
s->stack_base = stack->entries;
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index a08b31effe..2c4ebdb68e 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -629,10 +629,6 @@ int script_map_kernel(EngineState *s) {
s->_kfuncTable[functnr].orig_name = sought_name;
} else
switch (kfunct_mappers[found].type) {
- case KF_OLD:
- sciprintf("Emulated kernel function found.\nThis shouldn't happen anymore.");
- return 1;
-
case KF_NONE:
s->_kfuncTable[functnr].signature = NULL;
++ignored;
@@ -697,7 +693,7 @@ int determine_reg_type(EngineState *s, reg_t reg, int allow_invalid) {
return KSIG_REF | KSIG_INVALID;
case MEM_OBJ_STACK:
- if (allow_invalid || reg.offset < (*(dstack_t *)mobj).nr * sizeof(reg_t))
+ if (allow_invalid || reg.offset < (*(DataStack *)mobj).nr * sizeof(reg_t))
return KSIG_REF;
else
return KSIG_REF | KSIG_INVALID;
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 3975df5f0f..e9ec6922b1 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -310,10 +310,12 @@ struct kfunct_sig_pair_t {
Common::String orig_name; /* Original name, in case we couldn't map it */
};
-#define KF_OLD 0
-#define KF_NEW 1
-#define KF_NONE -1 /* No mapping, but name is known */
-#define KF_TERMINATOR -42 /* terminates kfunct_mappers */
+
+enum {
+ KF_NEW = 1,
+ KF_NONE = -1, /* No mapping, but name is known */
+ KF_TERMINATOR = -42 /* terminates kfunct_mappers */
+};
struct SciKernelFunction {
int type; /* KF_* */
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index a8f803c259..3c9ccdcfc0 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -439,10 +439,10 @@ static void sync_MemObjPtr(Common::Serializer &s, MemObject *&mobj) {
break;
case MEM_OBJ_STACK:
// TODO: Switch this stack to use class Common::Stack?
- s.syncAsUint32LE((*(dstack_t *)mobj).nr);
+ s.syncAsUint32LE((*(DataStack *)mobj).nr);
if (s.isLoading()) {
- //free((*(dstack_t *)mobj).entries);
- (*(dstack_t *)mobj).entries = (reg_t *)sci_calloc((*(dstack_t *)mobj).nr, sizeof(reg_t));
+ //free((*(DataStack *)mobj).entries);
+ (*(DataStack *)mobj).entries = (reg_t *)sci_calloc((*(DataStack *)mobj).nr, sizeof(reg_t));
}
break;
case MEM_OBJ_HUNK:
@@ -539,7 +539,7 @@ static byte *find_unique_script_block(EngineState *s, byte *buf, int type) {
// FIXME: This should probably be turned into an EngineState method
static void reconstruct_stack(EngineState *retval) {
SegmentId stack_seg = find_unique_seg_by_type(retval->seg_manager, MEM_OBJ_STACK);
- dstack_t *stack = (dstack_t *)(retval->seg_manager->_heap[stack_seg]);
+ DataStack *stack = (DataStack *)(retval->seg_manager->_heap[stack_seg]);
retval->stack_segment = stack_seg;
retval->stack_base = stack->entries;
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index b60b73b324..5c8af33b4c 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -305,7 +305,7 @@ int c_segtable(EngineState *s) {
break;
case MEM_OBJ_STACK:
- sciprintf("D data stack (%d)", (*(dstack_t *)mobj).nr);
+ sciprintf("D data stack (%d)", (*(DataStack *)mobj).nr);
break;
case MEM_OBJ_SYS_STRINGS:
@@ -419,7 +419,7 @@ static void _c_single_seg_info(EngineState *s, MemObject *mobj) {
break;
case MEM_OBJ_STACK: {
- dstack_t *stack = (dstack_t *)mobj;
+ DataStack *stack = (DataStack *)mobj;
sciprintf("stack\n");
sciprintf(" %d (0x%x) entries\n", stack->nr, stack->nr);
}
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 6effe8d881..97f9c799c4 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -313,7 +313,7 @@ MemObject *MemObject::createMemObject(MemObjectType type) {
mem = new SystemStrings();
break;
case MEM_OBJ_STACK:
- mem = new dstack_t();
+ mem = new DataStack();
break;
case MEM_OBJ_HUNK:
mem = new HunkTable();
@@ -939,9 +939,9 @@ static char *SegManager::dynprintf(char *msg, ...) {
}
*/
-dstack_t *SegManager::allocateStack(int size, SegmentId *segid) {
+DataStack *SegManager::allocateStack(int size, SegmentId *segid) {
MemObject *mobj = allocNonscriptSegment(MEM_OBJ_STACK, segid);
- dstack_t *retval = (dstack_t *)mobj;
+ DataStack *retval = (DataStack *)mobj;
retval->entries = (reg_t *)sci_calloc(size, sizeof(reg_t));
retval->nr = size;
@@ -1091,7 +1091,7 @@ byte *LocalVariables::dereference(reg_t pointer, int *size) {
return base + pointer.offset;
}
-byte *dstack_t::dereference(reg_t pointer, int *size) {
+byte *DataStack::dereference(reg_t pointer, int *size) {
int count = nr * sizeof(reg_t);
byte *base = (byte *)entries;
@@ -1374,7 +1374,7 @@ reg_t SegInterfaceStack::findCanonicAddress(reg_t addr) {
return addr;
}
-void dstack_t::listAllOutgoingReferences(EngineState *s, reg_t addr, void *param, NoteCallback note) {
+void DataStack::listAllOutgoingReferences(EngineState *s, reg_t addr, void *param, NoteCallback note) {
fprintf(stderr, "Emitting %d stack entries\n", nr);
for (int i = 0; i < nr; i++)
(*note)(param, entries[i]);
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index 8729500c7f..c7ae3235c9 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -278,15 +278,15 @@ public:
// Allocates a data stack
// Parameters: (int) size: Number of stack entries to reserve
- // Returns : (dstack_t *): The physical stack
+ // Returns : (DataStack *): The physical stack
// (SegmentId) segid: Segment ID of the stack
- dstack_t *allocateStack(int size, SegmentId *segid);
+ DataStack *allocateStack(int size, SegmentId *segid);
// 5. System Strings
// Allocates a system string table
- // Returns : (dstack_t *): The physical stack
+ // Returns : (DataStack *): The physical stack
// (SegmentId) segid: Segment ID of the stack
// See also sys_string_acquire();
SystemStrings *allocateSysStrings(SegmentId *segid);
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 912145c982..d57e667b38 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -369,16 +369,16 @@ public:
};
/** Data stack */
-struct dstack_t : MemObject {
+struct DataStack : MemObject {
int nr; /**< Number of stack entries */
reg_t *entries;
public:
- dstack_t() {
+ DataStack() {
nr = 0;
entries = NULL;
}
- ~dstack_t() {
+ ~DataStack() {
free(entries);
entries = NULL;
}