diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/guest_additions.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/kernel.cpp | 31 | ||||
-rw-r--r-- | engines/sci/engine/kernel.h | 5 | ||||
-rw-r--r-- | engines/sci/engine/kernel_tables.h | 4 | ||||
-rw-r--r-- | engines/sci/engine/script_patches.cpp | 12 |
5 files changed, 43 insertions, 17 deletions
diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp index 6477e3284b..8ac780ac17 100644 --- a/engines/sci/engine/guest_additions.cpp +++ b/engines/sci/engine/guest_additions.cpp @@ -315,10 +315,10 @@ void GuestAdditions::patchGameSaveRestoreSCI16() const { #ifdef ENABLE_SCI32 static const byte SRDialogPatch[] = { - 0x76, // push0 - 0x59, 0x00, // &rest 0 - 0x43, 0x57, 0x00, 0x00, // callk kScummVMSaveLoad, 0 - 0x48 // ret + 0x76, // push0 + 0x59, 0x01, // &rest 1 + 0x43, kScummVMSaveLoadId, 0x00, 0x00, // callk kScummVMSaveLoad, 0 + 0x48 // ret }; void GuestAdditions::patchGameSaveRestoreSCI32(Script &script) const { diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 13a836ab77..68a09e9935 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -905,11 +905,6 @@ void Kernel::loadKernelNames(GameFeatures *features) { } else { // Normal SCI2.1 kernel table _kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci21); - - // Used by script patcher to remove CPU spinning on kGetTime - if (g_sci->getGameId() == GID_HOYLE5) { - _kernelNames[0x4f] = "Wait"; - } } break; @@ -936,6 +931,32 @@ void Kernel::loadKernelNames(GameFeatures *features) { break; } +#ifdef ENABLE_SCI32 + // Reserve a high range of kernel call IDs (0xe0 to 0xef) that can be used + // by ScummVM to improve integration and fix bugs in games that require + // more help than can be provided by a simple script patch (e.g. spinloops + // in Hoyle5). + // Using a new high range instead of just replacing dummied kernel calls in + // the normal kernel range is intended to avoid any conflicts with fangames + // that might try to add their own kernel calls in the same manner. It also + // helps to separate ScummVM interpreter's kernel calls from SSCI's standard + // kernel calls. + if (getSciVersion() >= SCI_VERSION_2) { + const uint kernelListSize = _kernelNames.size(); + _kernelNames.resize(0xe2); + for (uint id = kernelListSize; id < 0xe0; ++id) { + _kernelNames[id] = "Dummy"; + } + + // Used by Hoyle5 script patches to remove CPU spinning on kGetTime + // (this repurposes the existing SCI16 kWait call that was removed in SCI32) + _kernelNames[kScummVMWaitId] = "Wait"; + + // Used by GuestAdditions to support integrated save/load dialogue + _kernelNames[kScummVMSaveLoadId] = "ScummVMSaveLoad"; + } +#endif + mapFunctions(); } diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index e5b84dd089..2b61a9e0d9 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -98,6 +98,11 @@ struct SciWorkaroundEntry; // from workarounds.h // ---- Kernel signatures ----------------------------------------------------- +enum { + kScummVMWaitId = 0xe0, + kScummVMSaveLoadId = 0xe1 +}; + // internal kernel signature data enum { SIG_TYPE_NULL = 0x01, // may be 0:0 [0] diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index 5dbd5a5f46..f075da3005 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -1264,7 +1264,7 @@ static const char *const sci2_default_knames[] = { /*0x54*/ "Dummy", /*0x55*/ "DeleteKey", /*0x56*/ "Dummy", - /*0x57*/ "ScummVMSaveLoad", // Dummy in SSCI + /*0x57*/ "Dummy", /*0x58*/ "ListAt", /*0x59*/ "ListIndexOf", /*0x5a*/ "ListEachElementDo", @@ -1428,7 +1428,7 @@ static const char *const sci21_default_knames[] = { /*0x54*/ "HaveMouse", /*0x55*/ "SetCursor", /*0x56*/ "VibrateMouse", // Dummy in SCI3 - /*0x57*/ "ScummVMSaveLoad", // Dummy in SSCI + /*0x57*/ "Dummy", /*0x58*/ "Dummy", /*0x59*/ "Dummy", /*0x5a*/ "List", diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index 97e53a0742..82a10d5e31 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -704,8 +704,8 @@ static const SciScriptPatcherEntry freddypharkasSignatures[] = { // Several scripts in Hoyle5 contain a subroutine which spins on kGetTime until // a certain number of ticks elapse. Since this wastes CPU and makes ScummVM // unresponsive, the kWait kernel function (which was removed in SCI2) is -// reintroduced at 0x4f in kernel.cpp only for Hoyle5, and the spin subroutines -// are patched here to call that function instead. +// reintroduced for Hoyle5, and the spin subroutines are patched here to call +// that function instead. // Applies to at least: English Demo static const uint16 hoyle5SignatureSpinLoop[] = { SIG_MAGICDWORD, @@ -719,10 +719,10 @@ static const uint16 hoyle5SignatureSpinLoop[] = { }; static const uint16 hoyle5PatchSpinLoop[] = { - 0x78, // push1 - 0x8f, 0x01, // lsp param[1] - 0x43, 0x4f, PATCH_UINT16(0x02), // callk Wait, $2 - 0x48, // ret + 0x78, // push1 + 0x8f, 0x01, // lsp param[1] + 0x43, kScummVMWaitId, PATCH_UINT16(0x02), // callk Wait, $2 + 0x48, // ret PATCH_END }; |