SCI: Fix Phantasmagoria Mac's kDoSound

This commit is contained in:
Matthew Hoops 2013-04-28 13:42:50 -04:00
parent 2c5a0008ba
commit ee86e671f1
4 changed files with 44 additions and 1 deletions

View file

@ -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) {

View file

@ -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;

View file

@ -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

View file

@ -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