SCI: Move ScummVM kernel calls to 0xe0
This commit is contained in:
parent
c8486395fa
commit
4c0f2a3738
5 changed files with 43 additions and 17 deletions
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue