mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 22:28:10 +00:00
SCI: changing signature of kRestoreGame
and changing patch code accordingly svn-id: r52320
This commit is contained in:
parent
d828b36d76
commit
b192de5423
@ -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 },
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user