[Scummvm-cvs-logs] SF.net SVN: scummvm:[49546] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Jun 9 20:42:22 CEST 2010


Revision: 49546
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49546&view=rev
Author:   thebluegr
Date:     2010-06-09 18:42:21 +0000 (Wed, 09 Jun 2010)

Log Message:
-----------
Fixed crash in SCI2.1 games

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kernel.h
    scummvm/trunk/engines/sci/engine/kernel32.cpp
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2010-06-09 17:04:03 UTC (rev 49545)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2010-06-09 18:42:21 UTC (rev 49546)
@@ -394,7 +394,6 @@
 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::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

Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h	2010-06-09 17:04:03 UTC (rev 49545)
+++ scummvm/trunk/engines/sci/engine/kernel.h	2010-06-09 18:42:21 UTC (rev 49546)
@@ -207,7 +207,6 @@
 	 */
 	Common::String lookupText(reg_t address, int index);
 
-private:
 	/**
 	 * Loads the kernel function names.
 	 *
@@ -216,8 +215,9 @@
 	 * 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 @@
 	/**
 	 * Sets the default kernel function names to the SCI2.1 kernel functions
 	 */
-	void setKernelNamesSci21();
+	void setKernelNamesSci21(GameFeatures *features);
 #endif
 
 	/**

Modified: scummvm/trunk/engines/sci/engine/kernel32.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-06-09 17:04:03 UTC (rev 49545)
+++ scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-06-09 18:42:21 UTC (rev 49546)
@@ -378,7 +378,7 @@
 	_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 @@
 	// 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

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-06-09 17:04:03 UTC (rev 49545)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-06-09 18:42:21 UTC (rev 49546)
@@ -141,6 +141,9 @@
 		return Common::kNoGameDataFoundError;
 	}
 
+	// Add the after market GM patches for the specified game, if they exist
+	_resMan->addNewGMPatch(getGameID());
+
 	SegManager *segMan = new SegManager(_resMan);
 
 	// Scale the screen, if needed
@@ -170,6 +173,8 @@
 	else
 		_gfxScreen = new GfxScreen(_resMan, 320, 200, upscaledHires);
 
+	_gfxScreen->debugUnditherSetState(ConfMan.getBool("undither"));
+
 	if (_resMan->isSci11Mac() && getSciVersion() == SCI_VERSION_1_1)
 		_gfxMacIconBar = new GfxMacIconBar();
 
@@ -181,10 +186,10 @@
 	_console = new Console(this);
 
 	_kernel = new Kernel(_resMan, segMan);
+	_features = new GameFeatures(segMan, _kernel);
 	// Only SCI0 and SCI01 games used a parser
 	_vocabulary = (getSciVersion() <= SCI_VERSION_1_EGA) ? new Vocabulary(_resMan) : NULL;
 	_audio = new AudioPlayer(_resMan);
-	_features = new GameFeatures(segMan, _kernel);
 	_gamestate = new EngineState(segMan);
 	_eventMan = new EventManager(_resMan);
 
@@ -207,14 +212,13 @@
 	}
 #endif
 
-	// Add the after market GM patches for the specified game, if they exist
-	_resMan->addNewGMPatch(getGameID());
-
 	if (game_init(_gamestate)) { /* Initialize */
 		warning("Game initialization failed: Aborting...");
 		// TODO: Add an "init failed" error?
 		return Common::kUnknownError;
 	}
+	
+	_kernel->loadKernelNames(_features);	// Must be called after game_init()
 
 	script_adjust_opcode_formats(_gamestate);
 
@@ -222,8 +226,6 @@
 
 	_gamestate->_soundCmd = new SoundCommandParser(_resMan, segMan, _kernel, _audio, soundVersion);
 
-	_gfxScreen->debugUnditherSetState(ConfMan.getBool("undither"));
-
 #ifdef USE_OLD_MUSIC_FUNCTIONS
 	if (game_init_sound(_gamestate, 0, soundVersion)) {
 		warning("Game initialization failed: Error in sound subsystem. Aborting...");


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list