diff options
author | Matthew Hoops | 2013-04-28 13:42:50 -0400 |
---|---|---|
committer | Matthew Hoops | 2013-04-28 13:43:17 -0400 |
commit | ee86e671f1c29232d7d1d02841851e43b825d6ac (patch) | |
tree | 5c5faefa02c2017f5bc6dde9a2973b4a1333aec4 /engines/sci/engine | |
parent | 2c5a0008badb2c89d1c3f62f7c8b105b22ed8a19 (diff) | |
download | scummvm-rg350-ee86e671f1c29232d7d1d02841851e43b825d6ac.tar.gz scummvm-rg350-ee86e671f1c29232d7d1d02841851e43b825d6ac.tar.bz2 scummvm-rg350-ee86e671f1c29232d7d1d02841851e43b825d6ac.zip |
SCI: Fix Phantasmagoria Mac's kDoSound
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/features.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/kernel.cpp | 11 | ||||
-rw-r--r-- | engines/sci/engine/kernel.h | 3 | ||||
-rw-r--r-- | engines/sci/engine/ksound.cpp | 27 |
4 files changed, 44 insertions, 1 deletions
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp index 49e2bfc79f..6005ac50be 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 0d0bbe8882..b5ca65fc1b 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 e3ebce80fb..8a021073fc 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 b803e123f1..2879b7f45d 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 |