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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Tue Aug 24 15:50:56 CEST 2010


Revision: 52341
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52341&view=rev
Author:   m_kiewitz
Date:     2010-08-24 13:50:55 +0000 (Tue, 24 Aug 2010)

Log Message:
-----------
SCI: some work on replacing save dialog

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-08-24 13:41:24 UTC (rev 52340)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-08-24 13:50:55 UTC (rev 52341)
@@ -343,10 +343,11 @@
 	const Object *gameSuperObject = segMan->getObject(_gameSuperClassAddress);
 	const uint16 gameSuperMethodCount = gameSuperObject->getMethodCount();
 	reg_t methodAddress;
-	Script *script = NULL;
+	const uint16 kernelCount = _kernel->getKernelNamesSize();
 	const byte *scriptRestorePtr = NULL;
-	const uint16 kernelCount = _kernel->getKernelNamesSize();
 	byte kernelIdRestore = 0;
+	const byte *scriptSavePtr = NULL;
+	byte kernelIdSave = 0;
 
 	// this feature is currently not supported on SCI32
 	if (getSciVersion() >= SCI_VERSION_2)
@@ -367,6 +368,8 @@
 		Common::String kernelName = _kernel->getKernelName(kernelNr);
 		if (kernelName == "RestoreGame")
 			kernelIdRestore = kernelNr;
+		if (kernelName == "SaveGame")
+			kernelIdSave = kernelNr;
 	}
 
 	for (uint16 methodNr = 0; methodNr < gameSuperMethodCount; methodNr++) {
@@ -374,17 +377,32 @@
 		Common::String methodName = _kernel->getSelectorName(selectorId);
 		if (methodName == "restore") {
 			methodAddress = gameSuperObject->getFunction(methodNr);
-			script = segMan->getScript(methodAddress.segment);
+			Script *script = segMan->getScript(methodAddress.segment);
 			scriptRestorePtr = script->getBuf(methodAddress.offset);
 			break;
 		}
+		if (methodName == "save") {
+			methodAddress = gameSuperObject->getFunction(methodNr);
+			Script *script = segMan->getScript(methodAddress.segment);
+			scriptSavePtr = script->getBuf(methodAddress.offset);
+			break;
+		}
 	}
+
+	switch (_gameId) {
+	case GID_FAIRYTALES: // fairy tales automatically saves w/o dialog
+		scriptSavePtr = NULL;
+	default:
+		break;
+	}
+
 	if (scriptRestorePtr) {
 		// Now patch in our code
 		byte *patchPtr = const_cast<byte *>(scriptRestorePtr);
 		memcpy(patchPtr, patchGameRestore, sizeof(patchGameRestore));
 		patchPtr[8] = kernelIdRestore;
 	}
+	// Saving is not yet patched
 }
 
 bool SciEngine::initGame() {


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