diff options
author | Filippos Karapetis | 2009-08-23 21:57:30 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-08-23 21:57:30 +0000 |
commit | 60af2db2fdd8c0ca0d597033798bdf4b4efa4938 (patch) | |
tree | e427d0f6d3701a50d7288f8d20dce4eea0d22eeb /engines/sci | |
parent | e858994060118b0d21bbb18d3cfe59fb10f4399d (diff) | |
download | scummvm-rg350-60af2db2fdd8c0ca0d597033798bdf4b4efa4938.tar.gz scummvm-rg350-60af2db2fdd8c0ca0d597033798bdf4b4efa4938.tar.bz2 scummvm-rg350-60af2db2fdd8c0ca0d597033798bdf4b4efa4938.zip |
- Added more mappings from Sierra's internal IDs to our own ones. Hopefully, all SCI0-SCI11 games can now be detected correctly from the fallback detector
- Simplified some checks for old script types
svn-id: r43678
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/detection.cpp | 69 | ||||
-rw-r--r-- | engines/sci/engine/game.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/kernel.cpp | 5 | ||||
-rw-r--r-- | engines/sci/engine/kernel.h | 4 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.cpp | 9 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.h | 3 | ||||
-rw-r--r-- | engines/sci/engine/static_selectors.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/vm.h | 2 |
10 files changed, 67 insertions, 45 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index d41e1fa0b3..f60e42ddde 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -2412,7 +2412,18 @@ static const struct SciGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0 }, +#endif + + // Slater & Charlie go camping + {{"slater", "", { + {"resource.000", 0, "1846b57fe84774be72f7c50ab3c90df0", 2256126}, + {"resource.map", 0, "21f85414124dc23e54544a5536dc35cd", 4044}, + {"resource.msg", 0, "c44f51fb955eae266fecf360ebcd5ad2", 1132}, + {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO, GUIO_NOSPEECH}, + 0 + }, +#ifdef ENABLE_SCI32 // RAMA - English DOS/Windows Demo // Executable scanning reports "2.100.002", VERSION file reports "000.000.008" {{"rama", "Demo", { @@ -3045,15 +3056,20 @@ public: Common::String convertSierraGameId(Common::String sierraId) { // TODO: SCI32 IDs - // TODO: astrochicken - // TODO: The internal id of christmas1998 is "demo" - if (sierraId == "card") - return "christmas1990"; - // TODO: christmas1992 + // TODO: The internal id of christmas1988 is "demo" + if (sierraId == "card") { + // This could either be christmas1990 or christmas1992 + // christmas1990 has a "resource.001" file, whereas + // christmas1992 has a "resource.000" file + return (Common::File::exists("resource.001")) ? "christmas1990" : "christmas1992"; + } if (sierraId == "arthur") return "camelot"; - if (sierraId == "brain") - return "castlebrain"; + if (sierraId == "brain") { + // This could either be The Castle of Dr. Brain, or The Island of Dr. Brain + // castlebrain has resource.001, whereas islandbrain doesn't + return (Common::File::exists("resource.001")) ? "castlebrain" : "islandbrain"; + } // iceman is the same // longbow is the same if (sierraId == "eco") @@ -3068,8 +3084,8 @@ Common::String convertSierraGameId(Common::String sierraId) { return "hoyle1"; if (sierraId == "solitare") return "hoyle2"; - // TODO: hoyle3 - // TODO: hoyle4 + // hoyle3 is the same + // hoyle4 is the same if (sierraId == "kq1") return "kq1sci"; if (sierraId == "kq4") @@ -3081,9 +3097,10 @@ Common::String convertSierraGameId(Common::String sierraId) { // lsl5 is the same // lsl6 is the same // TODO: lslcasino - // TODO: fairytales - // TODO: mothergoose - // TODO: msastrochicken + if (sierraId == "tales") + return "fairytales"; + if (sierraId == "mg") + return "mothergoose"; if (sierraId == "cb1") return "laurabow"; if (sierraId == "lb2") @@ -3102,13 +3119,27 @@ Common::String convertSierraGameId(Common::String sierraId) { return "qfg2"; if (sierraId == "qfg1") return "qfg3"; - // TODO: slater + if (sierraId == "thegame") + return "slater"; if (sierraId == "sq1") return "sq1sci"; - // sq3 is the same + if (sierraId == "sq3") { + // Both SQ3 and the separately released subgame, Astro Chicken, + // have internal ID "sq3", but Astro Chicken only has "resource.map" + // and "resource.001". Detect if it's SQ3 by the existence of + // "resource.002" + return (Common::File::exists("resource.002")) ? "sq3" : "astrochicken"; + } + if (sierraId == "sq4") { + // Both SQ4 and the separately released subgame, Ms. Astro Chicken, + // have internal ID "sq4", but Astro Chicken only has "resource.map" + // and "resource.001". Detect if it's SQ4 by the existence of + // "resource.000" (which exists in both SQ4 floppy and CD, but not in + // the subgame) + return (Common::File::exists("resource.000")) ? "sq4" : "msastrochicken"; + } // sq4 is the same // sq5 is the same - // TODO: islandbrain return sierraId; } @@ -3185,12 +3216,8 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl // Determine the game id ResourceManager *resMgr = new ResourceManager(fslist); SciVersion version = resMgr->sciVersion(); - Kernel *kernel = new Kernel(resMgr, true); - bool hasOldScriptHeader = kernel->hasOldScriptHeader(); - delete kernel; - - SegManager *segManager = new SegManager(resMgr, version, hasOldScriptHeader); - if (!script_instantiate(resMgr, segManager, version, hasOldScriptHeader, 0)) { + SegManager *segManager = new SegManager(resMgr, version); + if (!script_instantiate(resMgr, segManager, version, 0)) { warning("fallbackDetect(): Could not instantiate script 0"); SearchMan.remove("SCI_detection"); return 0; diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index f649d97412..994054f6a7 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -191,7 +191,7 @@ int game_init_sound(EngineState *s, int sound_flags) { // Architectural stuff: Init/Unintialize engine int script_init_engine(EngineState *s) { s->kernel_opt_flags = 0; - s->seg_manager = new SegManager(s->resmgr, s->_version, ((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()); + s->seg_manager = new SegManager(s->resmgr, s->_version); s->gc_countdown = GC_INTERVAL - 1; SegmentId script_000_segment = s->seg_manager->getSegment(0, SCRIPT_GET_LOCK); @@ -294,7 +294,7 @@ int game_init(EngineState *s) { s->stack_base = stack->entries; s->stack_top = s->stack_base + VM_STACK_SIZE; - if (!script_instantiate(s->resmgr, s->seg_manager, s->_version, ((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader(), 0)) { + if (!script_instantiate(s->resmgr, s->seg_manager, s->_version, 0)) { warning("game_init(): Could not instantiate script 0"); return 1; } diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index a871df936f..687e621405 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -363,15 +363,12 @@ static const char *argtype_description[] = { "Arithmetic" }; -Kernel::Kernel(ResourceManager *resmgr, bool minimalLoad) : _resmgr(resmgr) { +Kernel::Kernel(ResourceManager *resmgr) : _resmgr(resmgr) { memset(&_selectorMap, 0, sizeof(_selectorMap)); // FIXME: Remove this once/if we C++ify selector_map_t loadSelectorNames(); detectSciFeatures(); - if (minimalLoad) // If we're only asked to detect game features, stop here - return; - mapSelectors(); // Map a few special selectors for later use loadOpcodes(); loadKernelNames(); diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 997cdaea77..a85025f514 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -67,10 +67,8 @@ class Kernel { public: /** * Initializes the SCI kernel - * @param minimalLoad If true, only the selector names are loaded, to detect game features. - * It's set to true by the advanced game detector to speed it up */ - Kernel(ResourceManager *resmgr, bool minimalLoad = false); + Kernel(ResourceManager *resmgr); ~Kernel(); uint getOpcodesSize() const { return _opcodes.size(); } diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 0ddb5187ac..b53e9d522c 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -219,7 +219,7 @@ static void sync_SegManagerPtr(Common::Serializer &s, SegManager *&obj) { if (s.isLoading()) { // FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch. delete obj; - obj = new SegManager(resMgr, version, ((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()); + obj = new SegManager(resMgr, version); } obj->saveLoadWithSerializer(s); diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index ddcd639f3c..0c731d449c 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -52,7 +52,7 @@ namespace Sci { #define INVALID_SCRIPT_ID -1 -SegManager::SegManager(ResourceManager *resMgr, SciVersion version, bool oldScriptHeader) { +SegManager::SegManager(ResourceManager *resMgr, SciVersion version) { id_seg_map = new IntMapper(); reserved_id = INVALID_SCRIPT_ID; id_seg_map->checkKey(reserved_id, true); // reserve entry 0 for INVALID_SCRIPT_ID @@ -68,7 +68,6 @@ SegManager::SegManager(ResourceManager *resMgr, SciVersion version, bool oldScri exports_wide = 0; _version = version; _resMgr = resMgr; - _oldScriptHeader = oldScriptHeader; int result = 0; @@ -150,7 +149,7 @@ void SegManager::setScriptSize(Script &scr, int script_nr) { if (!script || (_version >= SCI_VERSION_1_1 && !heap)) { error("SegManager::setScriptSize: failed to load %s", !script ? "script" : "heap"); } - if (_oldScriptHeader) { + if (_version == SCI_VERSION_0_EARLY) { // check if we got an old script header scr.buf_size = script->size + READ_LE_UINT16(script->data) * 2; //locals_size = READ_LE_UINT16(script->data) * 2; } else if (_version < SCI_VERSION_1_1) { @@ -445,7 +444,7 @@ SegmentId SegManager::getSegment(int script_nr, SCRIPT_GET load) { SegmentId segment; if ((load & SCRIPT_GET_LOAD) == SCRIPT_GET_LOAD) - script_instantiate(_resMgr, this, _version, _oldScriptHeader, script_nr); + script_instantiate(_resMgr, this, _version, script_nr); segment = segGet(script_nr); @@ -987,7 +986,7 @@ int SegManager::createSci0ClassTable() { Resource *script = _resMgr->findResource(ResourceId(kResourceTypeScript, scriptnr), 0); if (script) { - if (_oldScriptHeader) + if (version == SCI_VERSION_0_EARLY) // check if we got an old script header magic_offset = seeker = 2; else magic_offset = seeker = 0; diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h index fcf2659df3..5676990343 100644 --- a/engines/sci/engine/seg_manager.h +++ b/engines/sci/engine/seg_manager.h @@ -58,7 +58,7 @@ public: /** * Initialize the segment manager */ - SegManager(ResourceManager *resMgr, SciVersion version, bool oldScriptHeader); + SegManager(ResourceManager *resMgr, SciVersion version); /** * Deallocate all memory associated with the segment manager @@ -342,7 +342,6 @@ public: private: IntMapper *id_seg_map; ///< id - script id; seg - index of heap - bool _oldScriptHeader; public: // TODO: make private Common::Array<MemObject *> _heap; int reserved_id; diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp index 9c2abbfbc9..1897748c6d 100644 --- a/engines/sci/engine/static_selectors.cpp +++ b/engines/sci/engine/static_selectors.cpp @@ -499,10 +499,12 @@ static const SelectorRemap lsl5_demo_selectors[] = { } while (0) Common::StringList Kernel::checkStaticSelectorNames() { - Common::String gameID = ((SciEngine*)g_engine)->getGameID(); - Common::StringList names; - + if (!g_engine) + return names; + + Common::String gameID = ((SciEngine*)g_engine)->getGameID(); + if (gameID == "kq4sci") USE_SELECTOR_TABLE(kq4_demo_selectors); else if (gameID == "lsl3" || gameID == "iceman") // identical, except iceman has "flags" diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 943a8e0354..613de69f05 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -208,7 +208,7 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackP Script *scr = s->seg_manager->getScriptIfLoaded(seg); if (!scr) // Script not present yet? - seg = script_instantiate(s->resmgr, s->seg_manager, s->_version, ((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader(), script); + seg = script_instantiate(s->resmgr, s->seg_manager, s->_version, script); else scr->unmarkDeleted(); @@ -1761,11 +1761,11 @@ int script_instantiate_sci11(ResourceManager *resMgr, SegManager *segManager, Sc return seg_id; } -int script_instantiate(ResourceManager *resMgr, SegManager *segManager, SciVersion version, bool oldScriptHeader, int script_nr) { +int script_instantiate(ResourceManager *resMgr, SegManager *segManager, SciVersion version, int script_nr) { if (version >= SCI_VERSION_1_1) return script_instantiate_sci11(resMgr, segManager, version, script_nr); else - return script_instantiate_sci0(resMgr, segManager, version, oldScriptHeader, script_nr); + return script_instantiate_sci0(resMgr, segManager, version, (version == SCI_VERSION_0_EARLY), script_nr); } void script_uninstantiate_sci0(SegManager *segManager, SciVersion version, int script_nr, SegmentId seg) { diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index 867f732e2a..c8f94d5446 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -489,7 +489,7 @@ reg_t script_lookup_export(SegManager *segManager, int script_nr, int export_ind * @param[in] script_nr The script number to load * @return The script's segment ID or 0 if out of heap */ -int script_instantiate(ResourceManager *resMgr, SegManager *segManager, SciVersion version, bool oldScriptHeader, int script_nr); +int script_instantiate(ResourceManager *resMgr, SegManager *segManager, SciVersion version, int script_nr); /** * Decreases the numer of lockers of a script and unloads it if that number |