From 9eb5d23a5e0b9ec5137101ab9c33f329d53341b4 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 28 Apr 2013 14:47:15 -0400 Subject: SCI: Fix patched save/load dialogs in SCI32 Mac games --- engines/sci/sci.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 14baa400a3..c1aadc3622 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -455,10 +455,19 @@ static byte patchGameRestoreSaveSci21[] = { static void patchGameSaveRestoreCode(SegManager *segMan, reg_t methodAddress, byte id) { Script *script = segMan->getScript(methodAddress.getSegment()); byte *patchPtr = const_cast(script->getBuf(methodAddress.getOffset())); - if (getSciVersion() <= SCI_VERSION_1_1) + + if (getSciVersion() <= SCI_VERSION_1_1) { memcpy(patchPtr, patchGameRestoreSave, sizeof(patchGameRestoreSave)); - else // SCI2+ + } else { // SCI2+ memcpy(patchPtr, patchGameRestoreSaveSci2, sizeof(patchGameRestoreSaveSci2)); + + if (g_sci->isBE()) { + // LE -> BE + patchPtr[9] = 0x00; + patchPtr[10] = 0x06; + } + } + patchPtr[8] = id; } @@ -466,8 +475,16 @@ static void patchGameSaveRestoreCodeSci21(SegManager *segMan, reg_t methodAddres Script *script = segMan->getScript(methodAddress.getSegment()); byte *patchPtr = const_cast(script->getBuf(methodAddress.getOffset())); memcpy(patchPtr, patchGameRestoreSaveSci21, sizeof(patchGameRestoreSaveSci21)); + if (doRestore) patchPtr[2] = 0x78; // push1 + + if (g_sci->isBE()) { + // LE -> BE + patchPtr[10] = 0x00; + patchPtr[11] = 0x08; + } + patchPtr[9] = id; } -- cgit v1.2.3