diff options
author | Filippos Karapetis | 2009-08-25 08:38:14 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-08-25 08:38:14 +0000 |
commit | ed66cad6777a779f5cabeec037a24613da0134bf (patch) | |
tree | a63032758b32e3ada2ec0287033edfc5a17ee1c3 /engines/sci/detection.cpp | |
parent | bc20237ae37cf042a0f7c2c49cd0ca68ef76379b (diff) | |
download | scummvm-rg350-ed66cad6777a779f5cabeec037a24613da0134bf.tar.gz scummvm-rg350-ed66cad6777a779f5cabeec037a24613da0134bf.tar.bz2 scummvm-rg350-ed66cad6777a779f5cabeec037a24613da0134bf.zip |
- Simplified the parameters of some functions
- Replaced some EngineState parameters
- The SCI version is now obtained from the resource manager or the segment manager, thereby simplifying several functions
- Plugged 2 leaks in the fallback detector
- Renamed the segment manager and resource manager to "segmentManager" and "resourceManager" in all places, for consistency
svn-id: r43722
Diffstat (limited to 'engines/sci/detection.cpp')
-rw-r--r-- | engines/sci/detection.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index ef229c8a19..5971d1d384 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -340,21 +340,23 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl return 0; } - ResourceManager *resMgr = new ResourceManager(fslist); - SciVersion version = resMgr->sciVersion(); - ViewType gameViews = resMgr->getViewType(); + ResourceManager *resourceManager = new ResourceManager(fslist); + SciVersion version = resourceManager->sciVersion(); + ViewType gameViews = resourceManager->getViewType(); // Have we identified the game views? If not, stop here if (gameViews == kViewUnknown) { SearchMan.remove("SCI_detection"); + delete resourceManager; return (const ADGameDescription *)&s_fallbackDesc; } #ifndef ENABLE_SCI32 // Is SCI32 compiled in? If not, and this is a SCI32 game, // stop here - if (resMgr->sciVersion() == SCI_VERSION_32) { + if (resourceManager->sciVersion() == SCI_VERSION_32) { SearchMan.remove("SCI_detection"); + delete resourceManager; return (const ADGameDescription *)&s_fallbackDesc; } #endif @@ -363,7 +365,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl if (gameViews == kViewEga) s_fallbackDesc.desc.extra = "EGA"; - SegManager *segManager = new SegManager(resMgr, version); + SegManager *segManager = new SegManager(resourceManager); if (exePlatform == Common::kPlatformUnknown) { // Try to determine the platform from game resources @@ -385,20 +387,20 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl s_fallbackDesc.desc.platform = exePlatform; // Determine the game id - if (!script_instantiate(resMgr, segManager, version, 0)) { + if (!script_instantiate(resourceManager, segManager, 0)) { warning("fallbackDetect(): Could not instantiate script 0"); SearchMan.remove("SCI_detection"); delete segManager; - delete resMgr; + delete resourceManager; return 0; } reg_t game_obj = script_lookup_export(segManager, 0, 0); - Common::String gameName = obj_get_name(segManager, version, game_obj); + Common::String gameName = obj_get_name(segManager, game_obj); debug(2, "Detected ID: \"%s\" at %04x:%04x", gameName.c_str(), PRINT_REG(game_obj)); gameName.toLowercase(); s_fallbackDesc.desc.gameid = strdup(convertSierraGameId(gameName).c_str()); delete segManager; - delete resMgr; + delete resourceManager; SearchMan.remove("SCI_detection"); |