aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2010-08-24 09:11:53 +0000
committerMartin Kiewitz2010-08-24 09:11:53 +0000
commitb192de5423f0823b2431b102fe1d1b752f30b29e (patch)
tree68c3d1ab5ae57f4f68088e1d5ad6af6ad553a088 /engines/sci
parentd828b36d766af974c0ba3655730e2703ad588f5b (diff)
downloadscummvm-rg350-b192de5423f0823b2431b102fe1d1b752f30b29e.tar.gz
scummvm-rg350-b192de5423f0823b2431b102fe1d1b752f30b29e.tar.bz2
scummvm-rg350-b192de5423f0823b2431b102fe1d1b752f30b29e.zip
SCI: changing signature of kRestoreGame
and changing patch code accordingly svn-id: r52320
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kernel_tables.h2
-rw-r--r--engines/sci/engine/kfile.cpp2
-rw-r--r--engines/sci/sci.cpp7
3 files changed, 7 insertions, 4 deletions
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 187dcae576..53853e29b3 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -412,7 +412,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(ResCheck), SIG_EVERYWHERE, "ii(iiii)", NULL, NULL },
{ MAP_CALL(RespondsTo), SIG_EVERYWHERE, ".i", NULL, NULL },
{ MAP_CALL(RestartGame), SIG_EVERYWHERE, "", NULL, NULL },
- { MAP_CALL(RestoreGame), SIG_EVERYWHERE, "[r0]i(r)", NULL, NULL },
+ { MAP_CALL(RestoreGame), SIG_EVERYWHERE, "[r0]i[r0]", NULL, NULL },
{ MAP_CALL(Said), SIG_EVERYWHERE, "[r0]", NULL, NULL },
{ MAP_CALL(SaveGame), SIG_EVERYWHERE, "rir(r)", NULL, NULL },
{ MAP_CALL(ScriptID), SIG_EVERYWHERE, "[io](i)", NULL, NULL },
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index cb6985adaf..629efd905a 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -655,6 +655,8 @@ reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
}
// don't adjust ID of the saved game, it's already correct
} else {
+ if (argv[2].isNull())
+ error("kRestoreGame: called with parameter 2 being NULL");
// Real call from script, we need to adjust ID
if ((savegameId < SAVEGAMEID_OFFICIALRANGE_START) || (savegameId > SAVEGAMEID_OFFICIALRANGE_END)) {
warning("Savegame ID %d is not allowed", savegameId);
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 7f262416a0..a190bbb7d2 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -331,10 +331,11 @@ Common::Error SciEngine::run() {
}
static byte patchGameRestore[] = {
- 0x39, 0x02, // pushi 02
+ 0x39, 0x03, // pushi 03
0x76, // push0
0x38, 0xff, 0xff, // pushi -1
- 0x43, 0xff, 0x04, // call kRestoreGame (will get fixed directly)
+ 0x76, // push0
+ 0x43, 0xff, 0x06, // call kRestoreGame (will get fixed directly)
0x48, // ret
};
@@ -382,7 +383,7 @@ void SciEngine::patchGameSaveRestore(SegManager *segMan) {
// Now patch in our code
byte *patchPtr = (byte *)scriptRestorePtr;
memcpy(patchPtr, patchGameRestore, sizeof(patchGameRestore));
- patchPtr[7] = kernelIdRestore;
+ patchPtr[8] = kernelIdRestore;
}
}