diff options
author | Yotam Barnoy | 2010-10-31 11:08:43 +0000 |
---|---|---|
committer | Yotam Barnoy | 2010-10-31 11:08:43 +0000 |
commit | 94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1 (patch) | |
tree | 3df2a4ae7967c56d464729669fc06ce4e93dff36 /engines/sci/sci.cpp | |
parent | 8df4278ba8cfbf71228e1927f9db635a9a30a57f (diff) | |
parent | dca3c8d8bfc6c4db38cf8e8291818dd472041d4e (diff) | |
download | scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.gz scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.bz2 scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.zip |
Updated with latest from trunk
svn-id: r53976
Diffstat (limited to 'engines/sci/sci.cpp')
-rw-r--r-- | engines/sci/sci.cpp | 122 |
1 files changed, 102 insertions, 20 deletions
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 8fc0f667d3..f8d25efe73 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -303,17 +303,17 @@ Common::Error SciEngine::run() { if (buggyScript && (buggyScript->size == 12354 || buggyScript->size == 12362)) { showScummVMDialog("A known buggy game script has been detected, which could " - "prevent you from progressing later on in the game, during " - "the sequence with the Green Man's riddles. Please, apply " - "the latest patch for this game by Sierra to avoid possible " - "problems"); + "prevent you from progressing later on in the game, during " + "the sequence with the Green Man's riddles. Please, apply " + "the latest patch for this game by Sierra to avoid possible " + "problems"); } } // Show a warning if the user has selected a General MIDI device, no GM patch exists // (i.e. patch 4) and the game is one of the known 8 SCI1 games that Sierra has provided // after market patches for in their "General MIDI Utility". - if (_soundCmd->getMusicType() == MT_GM) { + if (_soundCmd->getMusicType() == MT_GM && !ConfMan.getBool("native_mt32")) { if (!_resMan->findResource(ResourceId(kResourceTypePatch, 4), 0)) { switch (getGameId()) { case GID_ECOQUEST: @@ -325,16 +325,16 @@ Common::Error SciEngine::run() { case GID_SQ4: case GID_FAIRYTALES: showScummVMDialog("You have selected General MIDI as a sound device. Sierra " - "has provided after-market support for General MIDI for this " - "game in their \"General MIDI Utility\". Please, apply this " - "patch in order to enjoy MIDI music with this game. Once you " - "have obtained it, you can unpack all of the included *.PAT " - "files in your ScummVM extras folder and ScummVM will add the " - "appropriate patch automatically. Alternatively, you can follow " - "the instructions in the READ.ME file included in the patch and " - "rename the associated *.PAT file to 4.PAT and place it in the " - "game folder. Without this patch, General MIDI music for this " - "game will sound badly distorted."); + "has provided after-market support for General MIDI for this " + "game in their \"General MIDI Utility\". Please, apply this " + "patch in order to enjoy MIDI music with this game. Once you " + "have obtained it, you can unpack all of the included *.PAT " + "files in your ScummVM extras folder and ScummVM will add the " + "appropriate patch automatically. Alternatively, you can follow " + "the instructions in the READ.ME file included in the patch and " + "rename the associated *.PAT file to 4.PAT and place it in the " + "game folder. Without this patch, General MIDI music for this " + "game will sound badly distorted."); break; default: break; @@ -342,6 +342,13 @@ Common::Error SciEngine::run() { } } + if (gameHasFanMadePatch()) { + showScummVMDialog("Your game is patched with a fan made script patch. Such patches have " + "been reported to cause issues, as they modify game scripts extensively. " + "The issues that these patches fix do not occur in ScummVM, so you are " + "advised to remove this patch from your game folder in order to avoid " + "having unexpected errors and/or issues later on."); + } runGame(); @@ -350,6 +357,69 @@ Common::Error SciEngine::run() { return Common::kNoError; } +bool SciEngine::gameHasFanMadePatch() { + struct FanMadePatchInfo { + SciGameId gameID; + uint16 targetScript; + uint16 targetSize; + uint16 patchedByteOffset; + byte patchedByte; + }; + + const FanMadePatchInfo patchInfo[] = { + // game script size offset byte + // ** NRS Patches ************************** + { GID_HOYLE3, 994, 2580, 656, 0x78 }, + { GID_KQ1, 85, 5156, 631, 0x02 }, + { GID_LAURABOW2, 994, 4382, 0, 0x00 }, + { GID_LONGBOW, 994, 4950, 1455, 0x78 }, // English + { GID_LONGBOW, 994, 5020, 1469, 0x78 }, // German + { GID_LSL1, 803, 592, 342, 0x01 }, + { GID_LSL3, 380, 6148, 195, 0x35 }, + { GID_LSL5, 994, 4810, 1342, 0x78 }, // English + { GID_LSL5, 994, 4942, 1392, 0x76 }, // German + { GID_PQ1, 994, 4332, 1473, 0x78 }, + { GID_PQ2, 200, 10614, 0, 0x00 }, + { GID_PQ3, 994, 4686, 1291, 0x78 }, // English + { GID_PQ3, 994, 4734, 1283, 0x78 }, // German + { GID_QFG1VGA, 994, 4388, 0, 0x00 }, + { GID_QFG3, 994, 4714, 0, 0x00 }, + // TODO: Disabled, as it fixes a whole lot of bugs which can't be tested till SCI2.1 support is finished + //{ GID_QFG4, 710, 11477, 0, 0x00 }, + { GID_SQ1, 994, 4740, 0, 0x00 }, + { GID_SQ5, 994, 4142, 1496, 0x78 }, // English/German/French + // TODO: Disabled, till we can test the Italian version + //{ GID_SQ5, 994, 4148, 0, 0x00 }, // Italian - patched file is the same size as the original + // TODO: The bugs in SQ6 can't be tested till SCI2.1 support is finished + //{ GID_SQ6, 380, 16308, 15042, 0x0C }, // English + //{ GID_SQ6, 380, 11652, 0, 0x00 }, // German - patched file is the same size as the original + // ** End marker *************************** + { GID_FANMADE, 0, 0, 0, 0x00 } + }; + + int curEntry = 0; + + while (true) { + if (patchInfo[curEntry].targetSize == 0) + break; + + if (patchInfo[curEntry].gameID == getGameId()) { + Resource *targetScript = _resMan->findResource(ResourceId(kResourceTypeScript, patchInfo[curEntry].targetScript), 0); + + if (targetScript && targetScript->size + 2 == patchInfo[curEntry].targetSize) { + if (patchInfo[curEntry].patchedByteOffset == 0) + return true; + else if (targetScript->data[patchInfo[curEntry].patchedByteOffset - 2] == patchInfo[curEntry].patchedByte) + return true; + } + } + + curEntry++; + } + + return false; +} + static byte patchGameRestoreSave[] = { 0x39, 0x03, // pushi 03 0x76, // push0 @@ -377,7 +447,9 @@ void SciEngine::patchGameSaveRestore(SegManager *segMan) { switch (_gameId) { case GID_MOTHERGOOSE256: // mother goose saves/restores directly and has no save/restore dialogs - case GID_JONES: // gets confused, when we patch us in, although the game isn't able to save/restore o_O + case GID_JONES: // gets confused, when we patch us in, the game is only able to save to 1 slot, so hooking is not required + case GID_HOYLE1: // gets confused, although the game doesnt support saving/restoring at all + case GID_HOYLE2: // gets confused, see hoyle1 return; default: break; @@ -482,7 +554,7 @@ bool SciEngine::initGame() { _vocabulary->reset(); } - _gamestate->gameStartTime = _gamestate->lastWaitTime = _gamestate->_screenUpdateTime = g_system->getMillis(); + _gamestate->lastWaitTime = _gamestate->_screenUpdateTime = g_system->getMillis(); // Load game language into printLang property of game object setSciLanguage(); @@ -512,7 +584,7 @@ void SciEngine::initGraphics() { _gfxPaint32 = 0; #endif - if (_resMan->isSci11Mac() && getSciVersion() == SCI_VERSION_1_1) + if (hasMacIconBar()) _gfxMacIconBar = new GfxMacIconBar(); bool paletteMerging = true; @@ -578,6 +650,8 @@ void SciEngine::initStackBaseWithSelector(Selector selector) { } void SciEngine::runGame() { + setTotalPlayTime(0); + initStackBaseWithSelector(SELECTOR(play)); // Call the play selector // Attach the debug console on game startup, if requested @@ -631,8 +705,10 @@ void SciEngine::exitGame() { GUI::Debugger *SciEngine::getDebugger() { if (_gamestate) { ExecStack *xs = &(_gamestate->_executionStack.back()); - xs->addr.pc.offset = _debugState.old_pc_offset; - xs->sp = _debugState.old_sp; + if (xs) { + xs->addr.pc.offset = _debugState.old_pc_offset; + xs->sp = _debugState.old_sp; + } } _debugState.runningStep = 0; // Stop multiple execution @@ -662,6 +738,10 @@ bool SciEngine::isDemo() const { return _gameDescription->flags & ADGF_DEMO; } +bool SciEngine::hasMacIconBar() const { + return _resMan->isSci11Mac() && getSciVersion() == SCI_VERSION_1_1 && getGameId() != GID_HOYLE4; +} + Common::String SciEngine::getSavegameName(int nr) const { return _targetName + Common::String::printf(".%03d", nr); } @@ -700,6 +780,8 @@ int SciEngine::inQfGImportRoom() const { void SciEngine::pauseEngineIntern(bool pause) { _mixer->pauseAll(pause); + if (_soundCmd) + _soundCmd->pauseAll(pause); } void SciEngine::syncSoundSettings() { |