[Scummvm-cvs-logs] scummvm master -> 1bdc6db980ffb72c4466d3b1a37f631f78ef59b9

bluegr md5 at scummvm.org
Thu Mar 3 23:27:42 CET 2011


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

Summary:
aaa6c9a071 SCI: Improved debug output of validate_property()
c8225c9c0e SCI: Amiga SCI1 middle games use the new PC SCI1 late transition effects
e286b1b5f1 SCI: Removed a hack for SCI1 Amiga games in setOnScreen()
9cc12cfc97 SCI21: kSave(1) is kRestoreGame
1bdc6db980 SCI21: Now replacing save/restore dialogs in SCI2.1 and newer games


Commit: aaa6c9a071f7ed91370934779b63511151b936be
    https://github.com/scummvm/scummvm/commit/aaa6c9a071f7ed91370934779b63511151b936be
Author: md5 (md5 at scummvm.org)
Date: 2011-03-03T14:25:19-08:00

Commit Message:
SCI: Improved debug output of validate_property()

Changed paths:
    engines/sci/engine/vm.cpp



diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index e00ec59..24f3c96 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -118,8 +118,8 @@ static reg_t &validate_property(EngineState *s, Object *obj, int index) {
 	if (index < 0 || (uint)index >= obj->getVarCount()) {
 		// This is same way sierra does it and there are some games, that contain such scripts like
 		//  iceman script 998 (fred::canBeHere, executed right at the start)
-		debugC(kDebugLevelVM, "[VM] Invalid property #%d (out of [0..%d]) requested!",
-			index, obj->getVarCount());
+		debugC(kDebugLevelVM, "[VM] Invalid property #%d (out of [0..%d]) requested from object %04x:%04x (%s)",
+			index, obj->getVarCount(), PRINT_REG(obj->getPos()), s->_segMan->getObjectName(obj->getPos()));
 		return dummyReg;
 	}
 


Commit: c8225c9c0e1dbdc3ff423c962cd473132829aefb
    https://github.com/scummvm/scummvm/commit/c8225c9c0e1dbdc3ff423c962cd473132829aefb
Author: md5 (md5 at scummvm.org)
Date: 2011-03-03T14:25:20-08:00

Commit Message:
SCI: Amiga SCI1 middle games use the new PC SCI1 late transition effects

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



diff --git a/engines/sci/graphics/transitions.cpp b/engines/sci/graphics/transitions.cpp
index e025a2f..7e7966b 100644
--- a/engines/sci/graphics/transitions.cpp
+++ b/engines/sci/graphics/transitions.cpp
@@ -108,6 +108,8 @@ void GfxTransitions::init() {
 
 	if (getSciVersion() >= SCI_VERSION_1_LATE)
 		_translationTable = NULL;
+	else if (g_sci->getResMan()->isAmiga32color())
+		_translationTable = NULL;
 	else
 		_translationTable = oldTransitionIDs;
 
@@ -124,6 +126,7 @@ void GfxTransitions::setup(int16 number, bool blackoutFlag) {
 		_number = SCI_TRANSITIONS_NONE;
 #endif
 		_blackoutFlag = blackoutFlag;
+		debugC(kDebugLevelGraphics, "Transition %d, blackout %d", number, blackoutFlag);
 	}
 }
 


Commit: e286b1b5f147a2494b6576febef37d246cdc687d
    https://github.com/scummvm/scummvm/commit/e286b1b5f147a2494b6576febef37d246cdc687d
Author: md5 (md5 at scummvm.org)
Date: 2011-03-03T14:25:21-08:00

Commit Message:
SCI: Removed a hack for SCI1 Amiga games in setOnScreen()

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



diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 0f95a3f..683f436 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -418,10 +418,6 @@ void GfxPalette::getSys(Palette *pal) {
 }
 
 void GfxPalette::setOnScreen() {
-	// We dont change palette at all times for amiga
-	if (_resMan->isAmiga32color())
-		return;
-
 	copySysPaletteToScreen();
 }
 


Commit: 9cc12cfc97028e71ebaede1db67a076e408edaeb
    https://github.com/scummvm/scummvm/commit/9cc12cfc97028e71ebaede1db67a076e408edaeb
Author: md5 (md5 at scummvm.org)
Date: 2011-03-03T14:25:22-08:00

Commit Message:
SCI21: kSave(1) is kRestoreGame

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



diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index f2c93fd..4518276 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -1156,10 +1156,11 @@ reg_t kCD(EngineState *s, int argc, reg_t *argv) {
 
 reg_t kSave(EngineState *s, int argc, reg_t *argv) {
 	switch (argv[0].toUint16()) {
-	case 0: // Called by kq7 when starting chapters
+	case 0:
 		return kSaveGame(s, argc - 1,argv + 1);
-	case 2: // GetSaveDir
-		// Yay! Reusing the old kernel function!
+	case 1:
+		return kRestoreGame(s, argc - 1,argv + 1);
+	case 2:
 		return kGetSaveDir(s, argc - 1, argv + 1);
 	case 5:
 		// TODO


Commit: 1bdc6db980ffb72c4466d3b1a37f631f78ef59b9
    https://github.com/scummvm/scummvm/commit/1bdc6db980ffb72c4466d3b1a37f631f78ef59b9
Author: md5 (md5 at scummvm.org)
Date: 2011-03-03T14:25:23-08:00

Commit Message:
SCI21: Now replacing save/restore dialogs in SCI2.1 and newer games

Changed paths:
    engines/sci/sci.cpp



diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 657a7b9..de33a59 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -265,8 +265,6 @@ Common::Error SciEngine::run() {
 	// Initialize all graphics related subsystems
 	initGraphics();
 
-	debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion()));
-
 	// Patch in our save/restore code, so that dialogs are replaced
 	patchGameSaveRestore();
 	setLauncherLanguage();
@@ -425,7 +423,7 @@ static byte patchGameRestoreSave[] = {
 	0x76,              // push0
 	0x38, 0xff, 0xff,  // pushi -1
 	0x76,              // push0
-	0x43, 0xff, 0x06,  // callk kRestoreGame/kSaveGame (will get fixed directly)
+	0x43, 0xff, 0x06,  // callk kRestoreGame/kSaveGame (will get changed afterwards)
 	0x48,              // ret
 };
 
@@ -435,7 +433,18 @@ static byte patchGameRestoreSaveSci2[] = {
 	0x76,              // push0
 	0x38, 0xff, 0xff,  // pushi -1
 	0x76,              // push0
-	0x43, 0xff, 0x06, 0x00, // callk kRestoreGame/kSaveGame (will get fixed directly)
+	0x43, 0xff, 0x06, 0x00, // callk kRestoreGame/kSaveGame (will get changed afterwards)
+	0x48,              // ret
+};
+
+// SCI21 version: Same as above, but the second parameter to callk is a word
+static byte patchGameRestoreSaveSci21[] = {
+	0x39, 0x04,        // pushi 04
+	0x76,              // push0	// 0: save, 1: restore (will get changed afterwards)
+	0x76,              // push0
+	0x38, 0xff, 0xff,  // pushi -1
+	0x76,              // push0
+	0x43, 0xff, 0x08, 0x00, // callk kSave (will get changed afterwards)
 	0x48,              // ret
 };
 
@@ -449,6 +458,15 @@ static void patchGameSaveRestoreCode(SegManager *segMan, reg_t methodAddress, by
 	patchPtr[8] = id;
 }
 
+static void patchGameSaveRestoreCodeSci21(SegManager *segMan, reg_t methodAddress, byte id, bool doRestore) {
+	Script *script = segMan->getScript(methodAddress.segment);
+	byte *patchPtr = const_cast<byte *>(script->getBuf(methodAddress.offset));
+	memcpy(patchPtr, patchGameRestoreSaveSci21, sizeof(patchGameRestoreSaveSci21));
+	if (doRestore)
+		patchPtr[2] = 0x78;	// push1
+	patchPtr[9] = id;
+}
+
 void SciEngine::patchGameSaveRestore() {
 	SegManager *segMan = _gamestate->_segMan;
 	const Object *gameObject = segMan->getObject(_gameObjectAddress);
@@ -478,23 +496,28 @@ void SciEngine::patchGameSaveRestore() {
 			kernelIdRestore = kernelNr;
 		if (kernelName == "SaveGame")
 			kernelIdSave = kernelNr;
+		if (kernelName == "Save")
+			kernelIdSave = kernelIdRestore = kernelNr;
 	}
 
-	// TODO: This feature does not yet work with the SCI2.1 middle and newer
-	// kernel functions (i.e. kSave)
-	if (!kernelIdRestore || !kernelIdSave)
-		return;
-
 	// Search for gameobject superclass ::restore
 	uint16 gameSuperObjectMethodCount = gameSuperObject->getMethodCount();
 	for (uint16 methodNr = 0; methodNr < gameSuperObjectMethodCount; methodNr++) {
 		uint16 selectorId = gameSuperObject->getFuncSelector(methodNr);
 		Common::String methodName = _kernel->getSelectorName(selectorId);
-		if (methodName == "restore")
-			patchGameSaveRestoreCode(segMan, gameSuperObject->getFunction(methodNr), kernelIdRestore);
+		if (methodName == "restore") {
+			if (kernelIdSave != kernelIdRestore)
+				patchGameSaveRestoreCode(segMan, gameSuperObject->getFunction(methodNr), kernelIdRestore);
+			else
+				patchGameSaveRestoreCodeSci21(segMan, gameSuperObject->getFunction(methodNr), kernelIdRestore, true);
+		}
 		else if (methodName == "save") {
-			if (_gameId != GID_FAIRYTALES)	// Fairy Tales saves automatically without a dialog
-				patchGameSaveRestoreCode(segMan, gameSuperObject->getFunction(methodNr), kernelIdSave);
+			if (_gameId != GID_FAIRYTALES) {	// Fairy Tales saves automatically without a dialog
+				if (kernelIdSave != kernelIdRestore)
+					patchGameSaveRestoreCode(segMan, gameSuperObject->getFunction(methodNr), kernelIdSave);
+				else
+					patchGameSaveRestoreCodeSci21(segMan, gameSuperObject->getFunction(methodNr), kernelIdSave, false);
+			}
 		}
 	}
 
@@ -504,8 +527,12 @@ void SciEngine::patchGameSaveRestore() {
 		uint16 selectorId = gameObject->getFuncSelector(methodNr);
 		Common::String methodName = _kernel->getSelectorName(selectorId);
 		if (methodName == "save") {
-			if (_gameId != GID_FAIRYTALES)	// Fairy Tales saves automatically without a dialog
-				patchGameSaveRestoreCode(segMan, gameObject->getFunction(methodNr), kernelIdSave);
+			if (_gameId != GID_FAIRYTALES) {	// Fairy Tales saves automatically without a dialog
+				if (kernelIdSave != kernelIdRestore)
+					patchGameSaveRestoreCode(segMan, gameObject->getFunction(methodNr), kernelIdSave);
+				else
+					patchGameSaveRestoreCodeSci21(segMan, gameObject->getFunction(methodNr), kernelIdSave, false);
+			}
 			break;
 		}
 	}






More information about the Scummvm-git-logs mailing list