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

clone2727 clone2727 at gmail.com
Sun Apr 28 19:51:21 CEST 2013


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

Summary:
ee86e671f1 SCI: Fix Phantasmagoria Mac's kDoSound


Commit: ee86e671f1c29232d7d1d02841851e43b825d6ac
    https://github.com/scummvm/scummvm/commit/ee86e671f1c29232d7d1d02841851e43b825d6ac
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2013-04-28T10:43:17-07:00

Commit Message:
SCI: Fix Phantasmagoria Mac's kDoSound

Changed paths:
    engines/sci/engine/features.cpp
    engines/sci/engine/kernel.cpp
    engines/sci/engine/kernel.h
    engines/sci/engine/ksound.cpp



diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index 49e2bfc..6005ac5 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -496,7 +496,9 @@ bool GameFeatures::autoDetectSci21KernelType() {
 		opcode = extOpcode >> 1;
 
 		// Check for end of script
-		if (opcode == op_ret || offset >= script->getBufSize())
+		// We don't check for op_ret here because the Phantasmagoria Mac script
+		// has an op_ret early on in its script (controlled by a branch).
+		if (offset >= script->getBufSize())
 			break;
 
 		if (opcode == op_callk) {
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 0d0bbe8..b5ca65f 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -585,6 +585,17 @@ void Kernel::mapFunctions() {
 			continue;
 		}
 
+#ifdef ENABLE_SCI32
+		// HACK: Phantasmagoria Mac uses a modified kDoSound (which *nothing*
+		// else seems to use)!
+		if (g_sci->getPlatform() == Common::kPlatformMacintosh && g_sci->getGameId() == GID_PHANTASMAGORIA && kernelName == "DoSound") {
+			_kernelFuncs[id].function = kDoSoundPhantasmagoriaMac;
+			_kernelFuncs[id].signature = parseKernelSignature("DoSoundPhantasmagoriaMac", "i.*");
+			_kernelFuncs[id].name = "DoSoundPhantasmagoriaMac";
+			continue;
+		}
+#endif
+
 		// If the name is known, look it up in s_kernelMap. This table
 		// maps kernel func names to actual function (pointers).
 		SciKernelMapEntry *kernelMap = s_kernelMap;
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index e3ebce8..8a02107 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -471,6 +471,9 @@ reg_t kAddLine(EngineState *s, int argc, reg_t *argv);
 reg_t kUpdateLine(EngineState *s, int argc, reg_t *argv);
 reg_t kDeleteLine(EngineState *s, int argc, reg_t *argv);
 
+// Phantasmagoria Mac Special Kernel Function
+reg_t kDoSoundPhantasmagoriaMac(EngineState *s, int argc, reg_t *argv);
+
 // SCI3 Kernel functions
 reg_t kPlayDuck(EngineState *s, int argc, reg_t *argv);
 #endif
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index b803e12..2879b7f 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -309,6 +309,33 @@ reg_t kSetLanguage(EngineState *s, int argc, reg_t *argv) {
 	return s->r_acc;
 }
 
+reg_t kDoSoundPhantasmagoriaMac(EngineState *s, int argc, reg_t *argv) {
+	// Phantasmagoria Mac (and seemingly no other game (!)) uses this
+	// cutdown version of kDoSound.
+
+	switch (argv[0].toUint16()) {
+	case 0:
+		return g_sci->_soundCmd->kDoSoundMasterVolume(argc - 1, argv + 1, s->r_acc);
+	case 2:
+		return g_sci->_soundCmd->kDoSoundInit(argc - 1, argv + 1, s->r_acc);
+	case 3:
+		return g_sci->_soundCmd->kDoSoundDispose(argc - 1, argv + 1, s->r_acc);
+	case 4:
+		return g_sci->_soundCmd->kDoSoundPlay(argc - 1, argv + 1, s->r_acc);
+	case 5:
+		return g_sci->_soundCmd->kDoSoundStop(argc - 1, argv + 1, s->r_acc);
+	case 8:
+		return g_sci->_soundCmd->kDoSoundSetVolume(argc - 1, argv + 1, s->r_acc);
+	case 9:
+		return g_sci->_soundCmd->kDoSoundSetLoop(argc - 1, argv + 1, s->r_acc);
+	case 10:
+		return g_sci->_soundCmd->kDoSoundUpdateCues(argc - 1, argv + 1, s->r_acc);
+	}
+
+	error("Unknown kDoSound Phantasmagoria Mac subop %d", argv[0].toUint16());
+	return s->r_acc;
+}
+
 #endif
 
 } // End of namespace Sci






More information about the Scummvm-git-logs mailing list