[Scummvm-cvs-logs] scummvm master -> 20b677080881580706652b17dd5a4c3ed3e36c07
bluegr
md5 at scummvm.org
Sat Jun 23 20:47:27 CEST 2012
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f06eb05e8c SCI: Implement kPlayVMD subop 23 (set palette range)
d78ed6f6ad SCI: Remove a duplicate sanity check
c075aafddb SCI: Add support for the debug opcode "file" in our script dissassembler
c1eb93bc5a SCI: Clean up validateExportFunc() and related functions
20b6770808 SCI: Change the program counter (PC) to be a 32-bit variable
Commit: f06eb05e8c554a3462a98d18c04d5f5695074b26
https://github.com/scummvm/scummvm/commit/f06eb05e8c554a3462a98d18c04d5f5695074b26
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-06-23T11:45:18-07:00
Commit Message:
SCI: Implement kPlayVMD subop 23 (set palette range)
Fixes the wrong palette during video sequences in GK2 and the demo of RAMA
Changed paths:
engines/sci/engine/kvideo.cpp
engines/sci/engine/state.cpp
engines/sci/engine/state.h
diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index dd2bca1..2456ba1 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -32,6 +32,7 @@
#include "common/str.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "graphics/palette.h"
#include "graphics/pixelformat.h"
#include "graphics/surface.h"
#include "video/video_decoder.h"
@@ -86,9 +87,12 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
}
bool skipVideo = false;
+ EngineState *s = g_sci->getEngineState();
- if (videoDecoder->hasDirtyPalette())
- videoDecoder->setSystemPalette();
+ if (videoDecoder->hasDirtyPalette()) {
+ byte *palette = (byte *)videoDecoder->getPalette() + s->_vmdPalStart * 3;
+ g_system->getPaletteManager()->setPalette(palette, s->_vmdPalStart, s->_vmdPalEnd - s->_vmdPalStart);
+ }
while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
if (videoDecoder->needsUpdate()) {
@@ -103,8 +107,10 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
g_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, width, height);
}
- if (videoDecoder->hasDirtyPalette())
- videoDecoder->setSystemPalette();
+ if (videoDecoder->hasDirtyPalette()) {
+ byte *palette = (byte *)videoDecoder->getPalette() + s->_vmdPalStart * 3;
+ g_system->getPaletteManager()->setPalette(palette, s->_vmdPalStart, s->_vmdPalEnd - s->_vmdPalStart);
+ }
g_system->updateScreen();
}
@@ -361,6 +367,10 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) {
if (reshowCursor)
g_sci->_gfxCursor->kernelShow();
break;
+ case 23: // set video palette range
+ s->_vmdPalStart = argv[1].toUint16();
+ s->_vmdPalEnd = argv[2].toUint16();
+ break;
case 14:
// Takes an additional integer parameter (e.g. 3)
case 16:
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 237c6b5..94a3fe3 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -122,6 +122,8 @@ void EngineState::reset(bool isRestoring) {
_videoState.reset();
_syncedAudioOptions = false;
+ _vmdPalStart = 0;
+ _vmdPalEnd = 256;
}
void EngineState::speedThrottler(uint32 neededSleep) {
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index 78a8a5b..9ae6299 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -196,6 +196,7 @@ public:
byte _memorySegment[kMemorySegmentMax];
VideoState _videoState;
+ uint16 _vmdPalStart, _vmdPalEnd;
bool _syncedAudioOptions;
/**
Commit: d78ed6f6ad2c27732f1e36759303b0fa9d310190
https://github.com/scummvm/scummvm/commit/d78ed6f6ad2c27732f1e36759303b0fa9d310190
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-06-23T11:45:20-07:00
Commit Message:
SCI: Remove a duplicate sanity check
Changed paths:
engines/sci/engine/kscripts.cpp
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index c9e94a5..2c115be 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -226,11 +226,6 @@ reg_t kScriptID(EngineState *s, int argc, reg_t *argv) {
return NULL_REG;
}
- if (index > scr->getExportsNr()) {
- error("Dispatch index too big: %d > %d", index, scr->getExportsNr());
- return NULL_REG;
- }
-
uint16 address = scr->validateExportFunc(index, true);
// Point to the heap for SCI1.1 - SCI2.1 games
Commit: c075aafddb0dba00878f6382a6e277dbaab45e10
https://github.com/scummvm/scummvm/commit/c075aafddb0dba00878f6382a6e277dbaab45e10
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-06-23T11:45:22-07:00
Commit Message:
SCI: Add support for the debug opcode "file" in our script dissassembler
Also set the correct name for the debug opcode "line"
Changed paths:
engines/sci/engine/scriptdebug.cpp
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index d8c05ab..04cbf1d 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -50,7 +50,7 @@ const char *opcodeNames[] = {
"lea", "selfID", "dummy", "pprev", "pToa",
"aTop", "pTos", "sTop", "ipToa", "dpToa",
"ipTos", "dpTos", "lofsa", "lofss", "push0",
- "push1", "push2", "pushSelf", "dummy", "lag",
+ "push1", "push2", "pushSelf", "line", "lag",
"lal", "lat", "lap", "lsg", "lsl",
"lst", "lsp", "lagi", "lali", "lati",
"lapi", "lsgi", "lsli", "lsti", "lspi",
@@ -97,10 +97,19 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
uint bytecount = readPMachineInstruction(scr + pos.getOffset(), opsize, opparams);
const byte opcode = opsize >> 1;
- opsize &= 1; // byte if true, word if false
-
debugN("%04x:%04x: ", PRINT_REG(pos));
+ if (opcode == op_pushSelf) { // 0x3e (62)
+ if ((opsize & 1) && g_sci->getGameId() != GID_FANMADE) {
+ // Debug opcode op_file
+ debugN("file \"%s\"\n", scr + pos.getOffset() + 1); // +1: op_pushSelf size
+ retval.incOffset(bytecount - 1);
+ return retval;
+ }
+ }
+
+ opsize &= 1; // byte if true, word if false
+
if (printBytecode) {
if (pos.getOffset() + bytecount > scr_size) {
warning("Operation arguments extend beyond end of script");
Commit: c1eb93bc5a9866787f27add5ca1d821e1470a4be
https://github.com/scummvm/scummvm/commit/c1eb93bc5a9866787f27add5ca1d821e1470a4be
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-06-23T11:45:24-07:00
Commit Message:
SCI: Clean up validateExportFunc() and related functions
Also renamed some SCI3 related code to indicate when it's SCI3 specific
Changed paths:
engines/sci/engine/script.cpp
engines/sci/engine/script.h
engines/sci/engine/vm.cpp
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 897cecc..80aaedf 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -385,7 +385,7 @@ void Script::setLockers(int lockers) {
_lockers = lockers;
}
-uint16 Script::validateExportFunc(int pubfunct, bool relocate) {
+uint16 Script::validateExportFunc(int pubfunct, bool relocateSci3) {
bool exportsAreWide = (g_sci->_features->detectLofsType() == SCI_VERSION_1_MIDDLE);
if (_numExports <= pubfunct) {
@@ -398,15 +398,15 @@ uint16 Script::validateExportFunc(int pubfunct, bool relocate) {
uint16 offset;
- if (getSciVersion() != SCI_VERSION_3 || !relocate) {
+ if (getSciVersion() != SCI_VERSION_3) {
offset = READ_SCI11ENDIAN_UINT16(_exportTable + pubfunct);
} else {
- offset = relocateOffsetSci3(pubfunct * 2 + 22);
+ if (!relocateSci3)
+ offset = READ_SCI11ENDIAN_UINT16(_exportTable + pubfunct) + getCodeBlockOffsetSci3();
+ else
+ offset = relocateOffsetSci3(pubfunct * 2 + 22);
}
- if (offset >= _bufSize)
- error("Invalid export function pointer");
-
// Check if the offset found points to a second export table (e.g. script 912
// in Camelot and script 306 in KQ4). Such offsets are usually small (i.e. < 10),
// thus easily distinguished from actual code offsets.
@@ -419,11 +419,23 @@ uint16 Script::validateExportFunc(int pubfunct, bool relocate) {
if (secondExportTable) {
secondExportTable += 3; // skip header plus 2 bytes (secondExportTable is a uint16 pointer)
offset = READ_SCI11ENDIAN_UINT16(secondExportTable + pubfunct);
- if (offset >= _bufSize)
- error("Invalid export function pointer");
}
}
+ if (!offset) {
+#ifdef ENABLE_SCI32
+ // WORKAROUNDS for invalid (empty) exports
+ if (g_sci->getGameId() == GID_TORIN && _nr == 64036) {
+ } else if (g_sci->getGameId() == GID_RAMA && _nr == 64908) {
+ } else
+#endif
+ error("Request for invalid exported function 0x%x of script %d", pubfunct, _nr);
+ return NULL;
+ }
+
+ if (offset >= _bufSize)
+ error("Invalid export function pointer");
+
return offset;
}
@@ -551,7 +563,7 @@ void Script::initializeClasses(SegManager *segMan) {
if (getSciVersion() <= SCI_VERSION_1_LATE && !marker)
break;
- if (getSciVersion() >= SCI_VERSION_1_1 && marker != 0x1234)
+ if (getSciVersion() >= SCI_VERSION_1_1 && marker != SCRIPT_OBJECT_MAGIC_NUMBER)
break;
if (getSciVersion() <= SCI_VERSION_1_LATE) {
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index 0c99f13..9747f07 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -197,11 +197,11 @@ public:
* Validate whether the specified public function is exported by
* the script in the specified segment.
* @param pubfunct Index of the function to validate
- * @param relocate Decide whether to relocate this public function or not
+ * @param relocateSci3 Decide whether to relocate this SCI3 public function or not
* @return NULL if the public function is invalid, its
* offset into the script's segment otherwise
*/
- uint16 validateExportFunc(int pubfunct, bool relocate);
+ uint16 validateExportFunc(int pubfunct, bool relocateSci3);
/**
* Marks the script as deleted.
@@ -249,7 +249,7 @@ public:
/**
* Gets an offset to the beginning of the code block in a SCI3 script
*/
- int getCodeBlockOffset() { return READ_SCI11ENDIAN_UINT32(_buf); }
+ int getCodeBlockOffsetSci3() { return READ_SCI11ENDIAN_UINT32(_buf); }
private:
/**
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 89f59ea..a42606a 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -225,30 +225,15 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackP
scr = s->_segMan->getScript(seg);
}
- int temp = scr->validateExportFunc(pubfunct, false);
-
- if (getSciVersion() == SCI_VERSION_3)
- temp += scr->getCodeBlockOffset();
-
- if (!temp) {
-#ifdef ENABLE_SCI32
- if (g_sci->getGameId() == GID_TORIN && script == 64036) {
- // Script 64036 in Torin's Passage is empty and contains an invalid
- // (empty) export
- } else if (g_sci->getGameId() == GID_RAMA && script == 64908) {
- // Script 64908 in the demo of RAMA contains an invalid (empty)
- // export
- } else
-#endif
- error("Request for invalid exported function 0x%x of script %d", pubfunct, script);
+ uint32 exportAddr = scr->validateExportFunc(pubfunct, false);
+ if (!exportAddr)
return NULL;
- }
-
+
// Check if a breakpoint is set on this method
g_sci->checkExportBreakpoint(script, pubfunct);
ExecStack xstack(calling_obj, calling_obj, sp, argc, argp,
- seg, make_reg(seg, temp), -1, pubfunct, -1,
+ seg, make_reg(seg, exportAddr), -1, pubfunct, -1,
s->_executionStack.size() - 1, EXEC_STACK_TYPE_CALL);
s->_executionStack.push_back(xstack);
return &(s->_executionStack.back());
Commit: 20b677080881580706652b17dd5a4c3ed3e36c07
https://github.com/scummvm/scummvm/commit/20b677080881580706652b17dd5a4c3ed3e36c07
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-06-23T11:45:26-07:00
Commit Message:
SCI: Change the program counter (PC) to be a 32-bit variable
This is needed for future support of large SCI3 scripts. The program
counter is isolated and does not interfere with other parts of the VM,
plus it does not get stored in saved games, so it's pretty straightforward
to convert
Changed paths:
engines/sci/console.cpp
engines/sci/console.h
engines/sci/engine/script.cpp
engines/sci/engine/script.h
engines/sci/engine/scriptdebug.cpp
engines/sci/engine/vm.cpp
engines/sci/engine/vm.h
engines/sci/engine/vm_types.h
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index b0ed7e6..40a6fd1 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -2913,7 +2913,8 @@ bool Console::cmdDisassemble(int argc, const char **argv) {
if (jumpTarget > farthestTarget)
farthestTarget = jumpTarget;
}
- addr = disassemble(_engine->_gamestate, addr, printBWTag, printBytecode);
+ // TODO: Use a true 32-bit reg_t for the position (addr)
+ addr = disassemble(_engine->_gamestate, make_reg32(addr.getSegment(), addr.getOffset()), printBWTag, printBytecode);
if (addr.isNull() && prevAddr < farthestTarget)
addr = prevAddr + 1; // skip past the ret
} while (addr.getOffset() > 0);
@@ -2961,7 +2962,8 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) {
}
do {
- vpc = disassemble(_engine->_gamestate, vpc, printBWTag, printBytes);
+ // TODO: Use a true 32-bit reg_t for the position (vpc)
+ vpc = disassemble(_engine->_gamestate, make_reg32(vpc.getSegment(), vpc.getOffset()), printBWTag, printBytes);
} while ((vpc.getOffset() > 0) && (vpc.getOffset() + 6 < size) && (--opCount));
return true;
@@ -3652,10 +3654,14 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
relativeOffset = true;
if (!scumm_strnicmp(str + 1, "PC", 2)) {
- *dest = s->_executionStack.back().addr.pc;
+ // TODO: Handle 32-bit PC addresses
+ reg32_t pc = s->_executionStack.back().addr.pc;
+ *dest = make_reg(pc.getSegment(), (uint16)pc.getOffset());
offsetStr = str + 3;
} else if (!scumm_strnicmp(str + 1, "P", 1)) {
- *dest = s->_executionStack.back().addr.pc;
+ // TODO: Handle 32-bit PC addresses
+ reg32_t pc = s->_executionStack.back().addr.pc;
+ *dest = make_reg(pc.getSegment(), (uint16)pc.getOffset());
offsetStr = str + 2;
} else if (!scumm_strnicmp(str + 1, "PREV", 4)) {
*dest = s->r_prev;
diff --git a/engines/sci/console.h b/engines/sci/console.h
index be17fdb..1c54748 100644
--- a/engines/sci/console.h
+++ b/engines/sci/console.h
@@ -33,7 +33,7 @@ namespace Sci {
class SciEngine;
struct List;
-reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode);
+reg_t disassemble(EngineState *s, reg32_t pos, bool printBWTag, bool printBytecode);
bool isJumpOpcode(EngineState *s, reg_t pos, reg_t& jumpOffset);
class Console : public GUI::Debugger {
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 80aaedf..57334b8 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -385,7 +385,7 @@ void Script::setLockers(int lockers) {
_lockers = lockers;
}
-uint16 Script::validateExportFunc(int pubfunct, bool relocateSci3) {
+uint32 Script::validateExportFunc(int pubfunct, bool relocateSci3) {
bool exportsAreWide = (g_sci->_features->detectLofsType() == SCI_VERSION_1_MIDDLE);
if (_numExports <= pubfunct) {
@@ -396,7 +396,7 @@ uint16 Script::validateExportFunc(int pubfunct, bool relocateSci3) {
if (exportsAreWide)
pubfunct *= 2;
- uint16 offset;
+ uint32 offset;
if (getSciVersion() != SCI_VERSION_3) {
offset = READ_SCI11ENDIAN_UINT16(_exportTable + pubfunct);
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index 9747f07..1fc8caf 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -201,7 +201,7 @@ public:
* @return NULL if the public function is invalid, its
* offset into the script's segment otherwise
*/
- uint16 validateExportFunc(int pubfunct, bool relocateSci3);
+ uint32 validateExportFunc(int pubfunct, bool relocateSci3);
/**
* Marks the script as deleted.
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 04cbf1d..d3abb9f 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -68,7 +68,7 @@ const char *opcodeNames[] = {
#endif // REDUCE_MEMORY_USAGE
// Disassembles one command from the heap, returns address of next command or 0 if a ret was encountered.
-reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode) {
+reg_t disassemble(EngineState *s, reg32_t pos, bool printBWTag, bool printBytecode) {
SegmentObj *mobj = s->_segMan->getSegment(pos.getSegment(), SEG_TYPE_SCRIPT);
Script *script_entity = NULL;
const byte *scr;
@@ -347,7 +347,7 @@ void SciEngine::scriptDebug() {
}
if (_debugState.seeking != kDebugSeekNothing) {
- const reg_t pc = s->xs->addr.pc;
+ const reg32_t pc = s->xs->addr.pc;
SegmentObj *mobj = s->_segMan->getSegment(pc.getSegment(), SEG_TYPE_SCRIPT);
if (mobj) {
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index a42606a..5a2a39d 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -233,7 +233,7 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackP
g_sci->checkExportBreakpoint(script, pubfunct);
ExecStack xstack(calling_obj, calling_obj, sp, argc, argp,
- seg, make_reg(seg, exportAddr), -1, pubfunct, -1,
+ seg, make_reg32(seg, exportAddr), -1, pubfunct, -1,
s->_executionStack.size() - 1, EXEC_STACK_TYPE_CALL);
s->_executionStack.push_back(xstack);
return &(s->_executionStack.back());
@@ -289,11 +289,12 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
ExecStackType stackType = EXEC_STACK_TYPE_VARSELECTOR;
StackPtr curSP = NULL;
- reg_t curFP = NULL_REG;
+ reg32_t curFP = make_reg32(0, 0);
if (selectorType == kSelectorMethod) {
stackType = EXEC_STACK_TYPE_CALL;
curSP = sp;
- curFP = funcp;
+ // TODO: Will this offset suffice for large SCI3 scripts?
+ curFP = make_reg32(funcp.getSegment(), funcp.getOffset());
sp = CALL_SP_CARRY; // Destroy sp, as it will be carried over
}
@@ -327,7 +328,7 @@ static void addKernelCallToExecStack(EngineState *s, int kernelCallNr, int argc,
// Add stack frame to indicate we're executing a callk.
// This is useful in debugger backtraces if this
// kernel function calls a script itself.
- ExecStack xstack(NULL_REG, NULL_REG, NULL, argc, argv - 1, 0xFFFF, NULL_REG,
+ ExecStack xstack(NULL_REG, NULL_REG, NULL, argc, argv - 1, 0xFFFF, make_reg32(0, 0),
kernelCallNr, -1, -1, s->_executionStack.size() - 1, EXEC_STACK_TYPE_KERNEL);
s->_executionStack.push_back(xstack);
}
@@ -818,11 +819,11 @@ void run_vm(EngineState *s) {
StackPtr call_base = s->xs->sp - argc;
s->xs->sp[1].incOffset(s->r_rest);
- uint16 localCallOffset = s->xs->addr.pc.getOffset() + opparams[0];
+ uint32 localCallOffset = s->xs->addr.pc.getOffset() + opparams[0];
ExecStack xstack(s->xs->objp, s->xs->objp, s->xs->sp,
(call_base->requireUint16()) + s->r_rest, call_base,
- s->xs->local_segment, make_reg(s->xs->addr.pc.getSegment(), localCallOffset),
+ s->xs->local_segment, make_reg32(s->xs->addr.pc.getSegment(), localCallOffset),
NULL_SELECTOR, -1, localCallOffset, s->_executionStack.size() - 1,
EXEC_STACK_TYPE_CALL);
@@ -1117,7 +1118,7 @@ void run_vm(EngineState *s) {
switch (g_sci->_features->detectLofsType()) {
case SCI_VERSION_0_EARLY:
- r_temp.setOffset(s->xs->addr.pc.getOffset() + opparams[0]);
+ r_temp.setOffset((uint16)s->xs->addr.pc.getOffset() + opparams[0]);
break;
case SCI_VERSION_1_MIDDLE:
r_temp.setOffset(opparams[0]);
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index f2d225b..a0fd668 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -82,7 +82,7 @@ struct ExecStack {
union {
ObjVarRef varp; // Variable pointer for r/w access
- reg_t pc; // Pointer to the initial program counter. Not accurate for the TOS element
+ reg32_t pc; // Pointer to the initial program counter. Not accurate for the TOS element
} addr;
StackPtr fp; // Frame pointer
@@ -102,7 +102,7 @@ struct ExecStack {
reg_t* getVarPointer(SegManager *segMan) const;
ExecStack(reg_t objp_, reg_t sendp_, StackPtr sp_, int argc_, StackPtr argp_,
- SegmentId localsSegment_, reg_t pc_, Selector debugSelector_,
+ SegmentId localsSegment_, reg32_t pc_, Selector debugSelector_,
int debugExportId_, int debugLocalCallOffset_, int debugOrigin_,
ExecStackType type_) {
objp = objp_;
diff --git a/engines/sci/engine/vm_types.h b/engines/sci/engine/vm_types.h
index 2995ba3..9a7589e 100644
--- a/engines/sci/engine/vm_types.h
+++ b/engines/sci/engine/vm_types.h
@@ -169,6 +169,49 @@ static inline reg_t make_reg(SegmentId segment, uint16 offset) {
#define PRINT_REG(r) (0xffff) & (unsigned) (r).getSegment(), (unsigned) (r).getOffset()
+// A true 32-bit reg_t
+struct reg32_t {
+ // Segment and offset. These should never be accessed directly
+ SegmentId _segment;
+ uint32 _offset;
+
+ inline SegmentId getSegment() const {
+ return _segment;
+ }
+
+ inline void setSegment(SegmentId segment) {
+ _segment = segment;
+ }
+
+ inline uint32 getOffset() const {
+ return _offset;
+ }
+
+ inline void setOffset(uint32 offset) {
+ _offset = offset;
+ }
+
+ inline void incOffset(int32 offset) {
+ setOffset(getOffset() + offset);
+ }
+
+ // Comparison operators
+ bool operator==(const reg32_t &x) const {
+ return (getOffset() == x.getOffset()) && (getSegment() == x.getSegment());
+ }
+
+ bool operator!=(const reg32_t &x) const {
+ return (getOffset() != x.getOffset()) || (getSegment() != x.getSegment());
+ }
+};
+
+static inline reg32_t make_reg32(SegmentId segment, uint32 offset) {
+ reg32_t r;
+ r.setSegment(segment);
+ r.setOffset(offset);
+ return r;
+}
+
// Stack pointer type
typedef reg_t *StackPtr;
More information about the Scummvm-git-logs
mailing list