From c486b77bb7d96908d7df1e00b6a61b92fbd176ee Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 9 Jun 2010 18:42:21 +0000 Subject: Fixed crash in SCI2.1 games svn-id: r49546 --- engines/sci/engine/kernel.cpp | 5 ++--- engines/sci/engine/kernel.h | 6 +++--- engines/sci/engine/kernel32.cpp | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'engines/sci/engine') diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 08aa65aa6d..2315dc384f 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -394,7 +394,6 @@ SciKernelFunction kfunct_mappers[] = { Kernel::Kernel(ResourceManager *resMan, SegManager *segMan) : _resMan(resMan), _segMan(segMan) { loadSelectorNames(); mapSelectors(); // Map a few special selectors for later use - loadKernelNames(); // must be called after the selectors are set } Kernel::~Kernel() { @@ -748,12 +747,12 @@ void Kernel::setDefaultKernelNames() { } } -void Kernel::loadKernelNames() { +void Kernel::loadKernelNames(GameFeatures *features) { _kernelNames.clear(); #ifdef ENABLE_SCI32 if (getSciVersion() >= SCI_VERSION_2_1) - setKernelNamesSci21(); + setKernelNamesSci21(features); else if (getSciVersion() == SCI_VERSION_2) setKernelNamesSci2(); else diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index b79ba8caaa..990e2aff17 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -207,7 +207,6 @@ public: */ Common::String lookupText(reg_t address, int index); -private: /** * Loads the kernel function names. * @@ -216,8 +215,9 @@ private: * The resulting list has the same format regardless of the format of the * name table of the resource (the format changed between version 0 and 1). */ - void loadKernelNames(); + void loadKernelNames(GameFeatures *features); +private: /** * Sets the default kernel function names, based on the SCI version used */ @@ -232,7 +232,7 @@ private: /** * Sets the default kernel function names to the SCI2.1 kernel functions */ - void setKernelNamesSci21(); + void setKernelNamesSci21(GameFeatures *features); #endif /** diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index 0afdc3f2eb..f279d9a66f 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -378,7 +378,7 @@ void Kernel::setKernelNamesSci2() { _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesSci2); } -void Kernel::setKernelNamesSci21() { +void Kernel::setKernelNamesSci21(GameFeatures *features) { // Some SCI games use a modified SCI2 kernel table instead of the SCI2.1/SCI3 kernel table. // The GK2 demo does this as well as at least one version of KQ7. We detect which version // to use based on where kDoSound is called from Sound::play(). @@ -386,7 +386,7 @@ void Kernel::setKernelNamesSci21() { // This is interesting because they all have the same interpreter version (2.100.002), yet // they would not be compatible with other games of the same interpreter. - if (g_sci->_features->detectSci21KernelType() == SCI_VERSION_2) { + if (features->detectSci21KernelType() == SCI_VERSION_2) { _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesGk2Demo); // OnMe is IsOnMe here, but they should be compatible _kernelNames[0x23] = "Robot"; // Graph in SCI2 -- cgit v1.2.3