[Scummvm-cvs-logs] scummvm master -> d757b5b94a0b180ce8e2e59617898a322f8ee0d5

bluegr md5 at scummvm.org
Wed Jul 4 00:03:32 CEST 2012


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
72c59baf24 SCI: Merge and simplify the code that sets the kernel functions
e0a3cfd21c SCI: FileIO subop 19 checks for directory validity
43224076e7 SCI: Handle the autosave call of Torin's Passage
d757b5b94a SCI: Update some version checks in kernelFrameout() to work with SCI3 too


Commit: 72c59baf247e09c7b40afd1c48221827ef1d64df
    https://github.com/scummvm/scummvm/commit/72c59baf247e09c7b40afd1c48221827ef1d64df
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-07-03T15:02:15-07:00

Commit Message:
SCI: Merge and simplify the code that sets the kernel functions

Changed paths:
    engines/sci/engine/kernel.cpp
    engines/sci/engine/kernel.h
    engines/sci/engine/kernel_tables.h



diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index c8fe47d..924641c 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -757,13 +757,26 @@ bool Kernel::debugSetFunction(const char *kernelName, int logging, int breakpoin
 	return true;
 }
 
-void Kernel::setDefaultKernelNames(GameFeatures *features) {
-	_kernelNames = Common::StringArray(s_defaultKernelNames, ARRAYSIZE(s_defaultKernelNames));
+#ifdef ENABLE_SCI32
+enum {
+	kKernelEntriesSci2 = 0x8b,
+	kKernelEntriesGk2Demo = 0xa0,
+	kKernelEntriesSci21 = 0x9d,
+	kKernelEntriesSci3 = 0xa1
+};
+#endif
+
+void Kernel::loadKernelNames(GameFeatures *features) {
+	_kernelNames.clear();
 
-	// Some (later) SCI versions replaced CanBeHere by CantBeHere
-	// If vocab.999 exists, the kernel function is still named CanBeHere
-	if (_selectorCache.cantBeHere != -1)
-		_kernelNames[0x4d] = "CantBeHere";
+	if (getSciVersion() <= SCI_VERSION_1_1) {
+		_kernelNames = Common::StringArray(s_defaultKernelNames, ARRAYSIZE(s_defaultKernelNames));
+
+		// Some (later) SCI versions replaced CanBeHere by CantBeHere
+		// If vocab.999 exists, the kernel function is still named CanBeHere
+		if (_selectorCache.cantBeHere != -1)
+			_kernelNames[0x4d] = "CantBeHere";
+	}
 
 	switch (getSciVersion()) {
 	case SCI_VERSION_0_EARLY:
@@ -817,66 +830,60 @@ void Kernel::setDefaultKernelNames(GameFeatures *features) {
 			_kernelNames[0x7c] = "Message";
 		break;
 
-	default:
-		// Use default table for the other versions
-		break;
-	}
-}
-
 #ifdef ENABLE_SCI32
+	case SCI_VERSION_2:
+		_kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesSci2);
+		break;
 
-enum {
-	kKernelEntriesSci2 = 0x8b,
-	kKernelEntriesGk2Demo = 0xa0,
-	kKernelEntriesSci21 = 0x9d,
-	kKernelEntriesSci3 = 0xa1
-};
-
-void Kernel::setKernelNamesSci2() {
-	_kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesSci2);
-}
+	case SCI_VERSION_2_1:
+		if (features->detectSci21KernelType() == SCI_VERSION_2) {
+			// Some late SCI2.1 games use a modified SCI2 kernel table instead of
+			// the SCI2.1 kernel table. We detect which version to use based on
+			// how kDoSound is called from Sound::play().
+			// Known games that use this:
+			// GK2 demo
+			// KQ7 1.4
+			// PQ4 SWAT demo
+			// LSL6
+			// PQ4CD
+			// QFG4CD
+
+			// 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.
+
+			_kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesGk2Demo);
+			// OnMe is IsOnMe here, but they should be compatible
+			_kernelNames[0x23] = "Robot"; // Graph in SCI2
+			_kernelNames[0x2e] = "Priority"; // DisposeTextBitmap in SCI2
+		} else {
+			// Normal SCI2.1 kernel table
+			_kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci21);
+		}
+		break;
 
-void Kernel::setKernelNamesSci21(GameFeatures *features) {
-	// Some SCI games use a modified SCI2 kernel table instead of the
-	// SCI2.1 kernel table. We detect which version to use based on
-	// how kDoSound is called from Sound::play().
-	// Known games that use this:
-	// GK2 demo
-	// KQ7 1.4
-	// PQ4 SWAT demo
-	// LSL6
-	// PQ4CD
-	// QFG4CD
-
-	// 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 (getSciVersion() != SCI_VERSION_3 && 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
-		_kernelNames[0x2e] = "Priority"; // DisposeTextBitmap in SCI2
-	} else if (getSciVersion() != SCI_VERSION_3) {
-		_kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci21);
-	} else if (getSciVersion() == SCI_VERSION_3) {
+	case SCI_VERSION_3:
 		_kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci3);
-	}
-}
 
-#endif
-
-void Kernel::loadKernelNames(GameFeatures *features) {
-	_kernelNames.clear();
+		// In SCI3, some kernel functions have been removed, and others have been added
+		_kernelNames[0x18] = "Dummy";	// AddMagnify in SCI2.1
+		_kernelNames[0x19] = "Dummy";	// DeleteMagnify in SCI2.1
+		_kernelNames[0x30] = "Dummy";	// SetScroll in SCI2.1
+		_kernelNames[0x39] = "Dummy";	// ShowMovie in SCI2.1
+		_kernelNames[0x4c] = "Dummy";	// ScrollWindow in SCI2.1
+		_kernelNames[0x56] = "Dummy";	// VibrateMouse in SCI2.1 (only used in QFG4 floppy)
+		_kernelNames[0x64] = "Dummy";	// AvoidPath in SCI2.1
+		_kernelNames[0x66] = "Dummy";	// MergePoly in SCI2.1
+		_kernelNames[0x8d] = "MessageBox";	// Dummy in SCI2.1
+		_kernelNames[0x9b] = "Minimize";	// Dummy in SCI2.1
 
-#ifdef ENABLE_SCI32
-	if (getSciVersion() >= SCI_VERSION_2_1)
-		setKernelNamesSci21(features);
-	else if (getSciVersion() == SCI_VERSION_2)
-		setKernelNamesSci2();
-	else
+		break;
 #endif
-		setDefaultKernelNames(features);
+
+	default:
+		// Use default table for the other versions
+		break;
+	}
 
 	mapFunctions();
 }
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 677b790..c3fcdd0 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -224,23 +224,6 @@ public:
 
 private:
 	/**
-	 * Sets the default kernel function names, based on the SCI version used.
-	 */
-	void setDefaultKernelNames(GameFeatures *features);
-
-#ifdef ENABLE_SCI32
-	/**
-	 * Sets the default kernel function names to the SCI2 kernel functions.
-	 */
-	void setKernelNamesSci2();
-
-	/**
-	 * Sets the default kernel function names to the SCI2.1 kernel functions.
-	 */
-	void setKernelNamesSci21(GameFeatures *features);
-#endif
-
-	/**
 	 * Loads the kernel selector names.
 	 */
 	void loadSelectorNames();
@@ -556,6 +539,7 @@ reg_t kFileIOWriteByte(EngineState *s, int argc, reg_t *argv);
 reg_t kFileIOReadWord(EngineState *s, int argc, reg_t *argv);
 reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv);
 reg_t kFileIOCreateSaveSlot(EngineState *s, int argc, reg_t *argv);
+reg_t kFileIOIsValidDirectory(EngineState *s, int argc, reg_t *argv);
 #endif
 
 //@}
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 6965a5d..322d82e 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -1099,7 +1099,7 @@ static const char *const sci21_default_knames[] = {
 	/*0x8a*/ "LoadChunk",
 	/*0x8b*/ "SetPalStyleRange",
 	/*0x8c*/ "AddPicAt",
-	/*0x8d*/ "MessageBox",	// SCI3, was Dummy in SCI2.1
+	/*0x8d*/ "Dummy",	// MessageBox in SCI3
 	/*0x8e*/ "NewRoom",		// debug function
 	/*0x8f*/ "Dummy",
 	/*0x90*/ "Priority",
@@ -1113,7 +1113,7 @@ static const char *const sci21_default_knames[] = {
 	/*0x98*/ "GetWindowsOption", // Windows only
 	/*0x99*/ "WinDLL", // Windows only
 	/*0x9a*/ "Dummy",
-	/*0x9b*/ "Minimize",	// SCI3, was Dummy in SCI2.1
+	/*0x9b*/ "Dummy",	// Minimize in SCI3
 	/*0x9c*/ "DeletePic",
 	// == SCI3 only ===============
 	/*0x9d*/ "Dummy",


Commit: e0a3cfd21c607afd0fe9781b5d0a7d8407393d3f
    https://github.com/scummvm/scummvm/commit/e0a3cfd21c607afd0fe9781b5d0a7d8407393d3f
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-07-03T15:02:17-07:00

Commit Message:
SCI: FileIO subop 19 checks for directory validity

This is used in Torin's Passage and LSL7 when autosaving

Changed paths:
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/kfile.cpp



diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 322d82e..69baa1c 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -240,7 +240,7 @@ static const SciKernelMapSubEntry kFileIO_subops[] = {
 	{ SIG_SCI32,          16, MAP_CALL(FileIOWriteWord),           "ii",                   NULL },
 	{ SIG_SCI32,          17, MAP_CALL(FileIOCreateSaveSlot),      "ir",                   NULL },
 	{ SIG_SCI32,          18, MAP_EMPTY(FileIOChangeDirectory),    "r",                    NULL }, // for SQ6, when changing the savegame directory in the save/load dialog
-	{ SIG_SCI32,          19, MAP_CALL(Stub),                      "r",                    NULL }, // for Torin / Torin demo
+	{ SIG_SCI32,          19, MAP_CALL(FileIOIsValidDirectory),    "r",                    NULL }, // for Torin / Torin demo
 #endif
 	SCI_SUBOPENTRY_TERMINATOR
 };
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index a21e198..7862762 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -688,6 +688,13 @@ reg_t kFileIOCreateSaveSlot(EngineState *s, int argc, reg_t *argv) {
 	return TRUE_REG;	// slot creation was successful
 }
 
+reg_t kFileIOIsValidDirectory(EngineState *s, int argc, reg_t *argv) {
+	// Used in Torin's Passage and LSL7 to determine if the directory passed as
+	// a parameter (usually the save directory) is valid. We always return true
+	// here.
+	return TRUE_REG;
+}
+
 #endif
 
 // ---- Save operations -------------------------------------------------------
@@ -1002,7 +1009,7 @@ reg_t kAutoSave(EngineState *s, int argc, reg_t *argv) {
 	// the elapsed time from the timer object)
 
 	// This function has to return something other than 0 to proceed
-	return s->r_acc;
+	return TRUE_REG;
 }
 
 #endif


Commit: 43224076e785e615d3ab3a5de53c3aff659a64f2
    https://github.com/scummvm/scummvm/commit/43224076e785e615d3ab3a5de53c3aff659a64f2
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-07-03T15:02:19-07:00

Commit Message:
SCI: Handle the autosave call of Torin's Passage

Changed paths:
    engines/sci/engine/kernel_tables.h



diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 69baa1c..126e972 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -248,7 +248,7 @@ static const SciKernelMapSubEntry kFileIO_subops[] = {
 #ifdef ENABLE_SCI32
 
 static const SciKernelMapSubEntry kSave_subops[] = {
-	{ SIG_SCI32,           0, MAP_CALL(SaveGame),                  "[r0]i[r0](r)",         NULL },
+	{ SIG_SCI32,           0, MAP_CALL(SaveGame),                  "[r0]i[r0](r0)",        NULL },
 	{ SIG_SCI32,           1, MAP_CALL(RestoreGame),               "[r0]i[r0]",            NULL },
 	{ SIG_SCI32,           2, MAP_CALL(GetSaveDir),                "(r*)",                 NULL },
 	{ SIG_SCI32,           3, MAP_CALL(CheckSaveGame),             ".*",                   NULL },


Commit: d757b5b94a0b180ce8e2e59617898a322f8ee0d5
    https://github.com/scummvm/scummvm/commit/d757b5b94a0b180ce8e2e59617898a322f8ee0d5
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-07-03T15:02:21-07:00

Commit Message:
SCI: Update some version checks in kernelFrameout() to work with SCI3 too

Changed paths:
    engines/sci/graphics/frameout.cpp



diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 265a175..5703579 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -653,7 +653,7 @@ void GfxFrameout::kernelFrameout() {
 				if (view && view->isSci2Hires()) {
 					view->adjustToUpscaledCoordinates(itemEntry->y, itemEntry->x);
 					view->adjustToUpscaledCoordinates(itemEntry->z, dummyX);
-				} else if (getSciVersion() == SCI_VERSION_2_1) {
+				} else if (getSciVersion() >= SCI_VERSION_2_1) {
 					_coordAdjuster->fromScriptToDisplay(itemEntry->y, itemEntry->x);
 					_coordAdjuster->fromScriptToDisplay(itemEntry->z, dummyX);
 				}
@@ -691,7 +691,7 @@ void GfxFrameout::kernelFrameout() {
 					if (view && view->isSci2Hires()) {
 						view->adjustBackUpscaledCoordinates(nsRect.top, nsRect.left);
 						view->adjustBackUpscaledCoordinates(nsRect.bottom, nsRect.right);
-					} else if (getSciVersion() == SCI_VERSION_2_1) {
+					} else if (getSciVersion() >= SCI_VERSION_2_1) {
 						_coordAdjuster->fromDisplayToScript(nsRect.top, nsRect.left);
 						_coordAdjuster->fromDisplayToScript(nsRect.bottom, nsRect.right);
 					}






More information about the Scummvm-git-logs mailing list