SHARE
TWEET

Untitled

a guest Apr 24th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/base/plugins.cpp b/base/plugins.cpp
  2. index 18755003b4..571831a3c6 100644
  3. --- a/base/plugins.cpp
  4. +++ b/base/plugins.cpp
  5. @@ -514,7 +514,7 @@ GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &game
  6.     return result;
  7.  }
  8.  
  9. -GameList EngineManager::detectGames(const Common::FSList &fslist) const {
  10. +GameList EngineManager::detectGames(const Common::FSList &fslist, bool useUnknownGameDialog) const {
  11.     GameList candidates;
  12.     PluginList plugins;
  13.     PluginList::const_iterator iter;
  14. @@ -524,7 +524,7 @@ GameList EngineManager::detectGames(const Common::FSList &fslist) const {
  15.         // Iterate over all known games and for each check if it might be
  16.         // the game in the presented directory.
  17.         for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
  18. -           candidates.push_back((*iter)->get<MetaEngine>().detectGames(fslist));
  19. +           candidates.push_back((*iter)->get<MetaEngine>().detectGames(fslist, useUnknownGameDialog));
  20.         }
  21.     } while (PluginManager::instance().loadNextPlugin());
  22.     return candidates;
  23. diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
  24. index aadad74f6c..039f5826a7 100644
  25. --- a/engines/advancedDetector.cpp
  26. +++ b/engines/advancedDetector.cpp
  27. @@ -150,7 +150,7 @@ bool cleanupPirated(ADGameDescList &matched) {
  28.  }
  29.  
  30.  
  31. -GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const {
  32. +GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist, bool useUnknownGameDialog) const {
  33.     ADGameDescList matches;
  34.     GameList detectedGames;
  35.     FileMap allFiles;
  36. @@ -162,7 +162,7 @@ GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const {
  37.     composeFileHashMap(allFiles, fslist, (_maxScanDepth == 0 ? 1 : _maxScanDepth));
  38.  
  39.     // Run the detector on this
  40. -   matches = detectGame(fslist.begin()->getParent(), allFiles, Common::UNK_LANG, Common::kPlatformUnknown, "");
  41. +   matches = detectGame(fslist.begin()->getParent(), allFiles, Common::UNK_LANG, Common::kPlatformUnknown, "", useUnknownGameDialog);
  42.  
  43.     if (matches.empty()) {
  44.         // Use fallback detector if there were no matches by other means
  45. @@ -213,7 +213,7 @@ const ExtraGuiOptions AdvancedMetaEngine::getExtraGuiOptions(const Common::Strin
  46.     return options;
  47.  }
  48.  
  49. -Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
  50. +Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine, bool useUnknownGameDialog) const {
  51.     assert(engine);
  52.  
  53.     const ADGameDescription *agdDesc = 0;
  54. @@ -327,7 +327,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
  55.         return Common::kNoError;
  56.  }
  57.  
  58. -void AdvancedMetaEngine::reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps, const ADGameIdList &matchedGameIds) const {
  59. +void AdvancedMetaEngine::reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps, const ADGameIdList &matchedGameIds, bool useUnknownGameDialog) const {
  60.     const char *reportCommon = "The game in '%s' seems to be an unknown %s engine game "
  61.                                "variant.\n\nPlease report the following data to the ScummVM "
  62.                                "team at %s along with the name of the game you tried to add and "
  63. @@ -373,7 +373,7 @@ void AdvancedMetaEngine::reportUnknown(const Common::FSNode &path, const ADFileP
  64.     g_system->logMessage(LogMessageType::kInfo, reportLog.c_str());
  65.  
  66.     // Check if the GUI is running, show the UnknownGameDialog and print the translated unknown game information
  67. -   if (GUI::GuiManager::hasInstance() && g_gui.isActive()) {
  68. +   if (GUI::GuiManager::hasInstance() && g_gui.isActive() && useUnknownGameDialog == true) {
  69.         UnknownGameDialog dialog(report, reportTranslated, bugtrackerAffectedEngine);
  70.         dialog.runModal();
  71.     }
  72. @@ -449,7 +449,7 @@ bool AdvancedMetaEngine::getFileProperties(const Common::FSNode &parent, const F
  73.     return true;
  74.  }
  75.  
  76. -ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const {
  77. +ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra, bool useUnknownGameDialog) const {
  78.     ADFilePropertiesMap filesProps;
  79.  
  80.     const ADGameFileDescription *fileDesc;
  81. @@ -574,7 +574,7 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons
  82.     // We didn't find a match
  83.     if (matched.empty()) {
  84.         if (!filesProps.empty() && gotAnyMatchesWithAllFiles) {
  85. -           reportUnknown(parent, filesProps, matchedGameIds);
  86. +           reportUnknown(parent, filesProps, matchedGameIds, useUnknownGameDialog);
  87.         }
  88.  
  89.         // Filename based fallback
  90. diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
  91. index 5160a99679..99737e0c2c 100644
  92. --- a/engines/advancedDetector.h
  93. +++ b/engines/advancedDetector.h
  94. @@ -278,9 +278,9 @@ public:
  95.  
  96.     virtual GameDescriptor findGame(const char *gameId) const;
  97.  
  98. -   virtual GameList detectGames(const Common::FSList &fslist) const;
  99. +   virtual GameList detectGames(const Common::FSList &fslist, bool useUnknownGameDialog = false) const;
  100.  
  101. -   virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
  102. +   virtual Common::Error createInstance(OSystem *syst, Engine **engine, bool useUnknownGameDialog = false) const;
  103.  
  104.     virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
  105.  
  106. @@ -313,7 +313,7 @@ protected:
  107.      * @param extra     restrict results to specified extra string (only if kADFlagUseExtraAsHint is set)
  108.      * @return  list of ADGameDescription pointers corresponding to matched games
  109.      */
  110. -   virtual ADGameDescList detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const;
  111. +   virtual ADGameDescList detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra, bool useUnknownGameDialog = false) const;
  112.  
  113.     /**
  114.      * Iterates over all ADFileBasedFallback records inside fileBasedFallback.
  115. @@ -333,7 +333,7 @@ protected:
  116.      * Log and print a report that we found an unknown game variant, together with the file
  117.      * names, sizes and MD5 sums.
  118.      */
  119. -   void reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps, const ADGameIdList &matchedGameIds = ADGameIdList()) const;
  120. +   void reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps, const ADGameIdList &matchedGameIds = ADGameIdList(), bool useUnknownGameDialog = false) const;
  121.  
  122.     // TODO
  123.     void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const;
  124. diff --git a/engines/metaengine.h b/engines/metaengine.h
  125. index b3aaa96a8f..8b513db397 100644
  126. --- a/engines/metaengine.h
  127. +++ b/engines/metaengine.h
  128. @@ -79,7 +79,7 @@ public:
  129.      * (possibly empty) list of games supported by the engine which it was able
  130.      * to detect amongst the given files.
  131.      */
  132. -   virtual GameList detectGames(const Common::FSList &fslist) const = 0;
  133. +   virtual GameList detectGames(const Common::FSList &fslist, bool useUnknownGameDialog = false) const = 0;
  134.  
  135.     /**
  136.      * Tries to instantiate an engine instance based on the settings of
  137. @@ -91,7 +91,7 @@ public:
  138.      *                  the newly create Engine, or 0 in case of an error
  139.      * @return      a Common::Error describing the error which occurred, or kNoError
  140.      */
  141. -   virtual Common::Error createInstance(OSystem *syst, Engine **engine) const = 0;
  142. +   virtual Common::Error createInstance(OSystem *syst, Engine **engine, bool useUnknownGameDialog = false) const = 0;
  143.  
  144.     /**
  145.      * Return a list of all save states associated with the given target.
  146. @@ -269,7 +269,7 @@ class EngineManager : public Common::Singleton<EngineManager> {
  147.  public:
  148.     GameDescriptor findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin = NULL) const;
  149.     GameDescriptor findGame(const Common::String &gameName, const Plugin **plugin = NULL) const;
  150. -   GameList detectGames(const Common::FSList &fslist) const;
  151. +   GameList detectGames(const Common::FSList &fslist, bool useUnknownGameDialog = false) const;
  152.     const PluginList &getPlugins() const;
  153.  };
  154.  
  155. diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
  156. index 0aa993a53a..6b6ef5472a 100644
  157. --- a/engines/scumm/detection.cpp
  158. +++ b/engines/scumm/detection.cpp
  159. @@ -563,7 +563,7 @@ static void composeFileHashMap(DescMap &fileMD5Map, const Common::FSList &fslist
  160.     }
  161.  }
  162.  
  163. -static void detectGames(const Common::FSList &fslist, Common::List<DetectorResult> &results, const char *gameid) {
  164. +static void detectGames(const Common::FSList &fslist, Common::List<DetectorResult> &results, const char *gameid, bool useUnknownGameDialog) {
  165.     DescMap fileMD5Map;
  166.     DetectorResult dr;
  167.  
  168. @@ -961,9 +961,9 @@ public:
  169.     virtual bool hasFeature(MetaEngineFeature f) const;
  170.     virtual GameList getSupportedGames() const;
  171.     virtual GameDescriptor findGame(const char *gameid) const;
  172. -   virtual GameList detectGames(const Common::FSList &fslist) const;
  173. +   virtual GameList detectGames(const Common::FSList &fslist, bool useUnknownGameDialog) const;
  174.  
  175. -   virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
  176. +   virtual Common::Error createInstance(OSystem *syst, Engine **engine, bool useUnknownGameDialog) const;
  177.  
  178.     virtual SaveStateList listSaves(const char *target) const;
  179.     virtual int getMaximumSaveSlot() const;
  180. @@ -1026,11 +1026,11 @@ static Common::String generatePreferredTarget(const DetectorResult &x) {
  181.     return res;
  182.  }
  183.  
  184. -GameList ScummMetaEngine::detectGames(const Common::FSList &fslist) const {
  185. +GameList ScummMetaEngine::detectGames(const Common::FSList &fslist, bool useUnknownGameDialog) const {
  186.     GameList detectedGames;
  187.     Common::List<DetectorResult> results;
  188.  
  189. -   ::detectGames(fslist, results, 0);
  190. +   ::detectGames(fslist, results, 0, useUnknownGameDialog);
  191.  
  192.     for (Common::List<DetectorResult>::iterator
  193.               x = results.begin(); x != results.end(); ++x) {
  194. @@ -1059,7 +1059,7 @@ GameList ScummMetaEngine::detectGames(const Common::FSList &fslist) const {
  195.   *
  196.   * This is heavily based on our MD5 detection scheme.
  197.   */
  198. -Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
  199. +Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine, bool useUnknownGameDialog) const {
  200.     assert(syst);
  201.     assert(engine);
  202.     const char *gameid = ConfMan.get("gameid").c_str();
  203. @@ -1079,7 +1079,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co
  204.  
  205.     // Invoke the detector, but fixed to the specified gameid.
  206.     Common::List<DetectorResult> results;
  207. -   ::detectGames(fslist, results, gameid);
  208. +   ::detectGames(fslist, results, gameid, useUnknownGameDialog);
  209.  
  210.     // Unable to locate game data
  211.     if (results.empty())
  212. diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
  213. index b5425f9532..c2f263ca4e 100644
  214. --- a/engines/sky/detection.cpp
  215. +++ b/engines/sky/detection.cpp
  216. @@ -79,9 +79,9 @@ public:
  217.     virtual GameList getSupportedGames() const;
  218.     virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
  219.     virtual GameDescriptor findGame(const char *gameid) const;
  220. -   virtual GameList detectGames(const Common::FSList &fslist) const;
  221. +   virtual GameList detectGames(const Common::FSList &fslist, bool useUnknownGameDialog = false) const;
  222.  
  223. -   virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
  224. +   virtual Common::Error createInstance(OSystem *syst, Engine **engine, bool useUnknownGameDialog = false) const;
  225.  
  226.     virtual SaveStateList listSaves(const char *target) const;
  227.     virtual int getMaximumSaveSlot() const;
  228. @@ -141,7 +141,7 @@ GameDescriptor SkyMetaEngine::findGame(const char *gameid) const {
  229.     return GameDescriptor();
  230.  }
  231.  
  232. -GameList SkyMetaEngine::detectGames(const Common::FSList &fslist) const {
  233. +GameList SkyMetaEngine::detectGames(const Common::FSList &fslist, bool useUnknownGameDialog) const {
  234.     GameList detectedGames;
  235.     bool hasSkyDsk = false;
  236.     bool hasSkyDnr = false;
  237. @@ -190,7 +190,7 @@ GameList SkyMetaEngine::detectGames(const Common::FSList &fslist) const {
  238.     return detectedGames;
  239.  }
  240.  
  241. -Common::Error SkyMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
  242. +Common::Error SkyMetaEngine::createInstance(OSystem *syst, Engine **engine, bool useUnknownGameDialog) const {
  243.     assert(engine);
  244.     *engine = new Sky::SkyEngine(syst);
  245.     return Common::kNoError;
  246. diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
  247. index 0b81690bc5..58f4834db5 100644
  248. --- a/engines/sword1/detection.cpp
  249. +++ b/engines/sword1/detection.cpp
  250. @@ -89,13 +89,13 @@ public:
  251.     virtual bool hasFeature(MetaEngineFeature f) const;
  252.     virtual GameList getSupportedGames() const;
  253.     virtual GameDescriptor findGame(const char *gameid) const;
  254. -   virtual GameList detectGames(const Common::FSList &fslist) const;
  255. +   virtual GameList detectGames(const Common::FSList &fslist, bool useUnknownGameDialog = false) const;
  256.     virtual SaveStateList listSaves(const char *target) const;
  257.     virtual int getMaximumSaveSlot() const;
  258.     virtual void removeSaveState(const char *target, int slot) const;
  259.     SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
  260.  
  261. -   virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
  262. +   virtual Common::Error createInstance(OSystem *syst, Engine **engine, bool useUnknownGameDialog = false) const;
  263.  };
  264.  
  265.  bool SwordMetaEngine::hasFeature(MetaEngineFeature f) const {
  266. @@ -175,7 +175,7 @@ void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound, bool r
  267.     }
  268.  }
  269.  
  270. -GameList SwordMetaEngine::detectGames(const Common::FSList &fslist) const {
  271. +GameList SwordMetaEngine::detectGames(const Common::FSList &fslist, bool useUnknownGameDialog) const {
  272.     int i, j;
  273.     GameList detectedGames;
  274.     bool filesFound[NUM_FILES_TO_CHECK];
  275. @@ -241,7 +241,7 @@ GameList SwordMetaEngine::detectGames(const Common::FSList &fslist) const {
  276.     return detectedGames;
  277.  }
  278.  
  279. -Common::Error SwordMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
  280. +Common::Error SwordMetaEngine::createInstance(OSystem *syst, Engine **engine, bool useUnknownGameDialog) const {
  281.     assert(engine);
  282.     *engine = new Sword1::SwordEngine(syst);
  283.     return Common::kNoError;
  284. diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
  285. index a2761eb5ce..0abf461a96 100644
  286. --- a/engines/sword2/sword2.cpp
  287. +++ b/engines/sword2/sword2.cpp
  288. @@ -95,12 +95,12 @@ public:
  289.     virtual GameList getSupportedGames() const;
  290.     virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
  291.     virtual GameDescriptor findGame(const char *gameid) const;
  292. -   virtual GameList detectGames(const Common::FSList &fslist) const;
  293. +   virtual GameList detectGames(const Common::FSList &fslist, bool useUnknownGameDialog = false) const;
  294.     virtual SaveStateList listSaves(const char *target) const;
  295.     virtual int getMaximumSaveSlot() const;
  296.     virtual void removeSaveState(const char *target, int slot) const;
  297.  
  298. -   virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
  299. +   virtual Common::Error createInstance(OSystem *syst, Engine **engine, bool useUnknownGameDialog = false) const;
  300.  };
  301.  
  302.  bool Sword2MetaEngine::hasFeature(MetaEngineFeature f) const {
  303. @@ -223,7 +223,7 @@ GameList detectGamesImpl(const Common::FSList &fslist, bool recursion = false) {
  304.     return detectedGames;
  305.  }
  306.  
  307. -GameList Sword2MetaEngine::detectGames(const Common::FSList &fslist) const {
  308. +GameList Sword2MetaEngine::detectGames(const Common::FSList &fslist, bool useUnknownGameDialog) const {
  309.     return detectGamesImpl(fslist);
  310.  }
  311.  
  312. @@ -266,7 +266,7 @@ void Sword2MetaEngine::removeSaveState(const char *target, int slot) const {
  313.     g_system->getSavefileManager()->removeSavefile(filename);
  314.  }
  315.  
  316. -Common::Error Sword2MetaEngine::createInstance(OSystem *syst, Engine **engine) const {
  317. +Common::Error Sword2MetaEngine::createInstance(OSystem *syst, Engine **engine, bool useUnknownGameDialog) const {
  318.     assert(syst);
  319.     assert(engine);
  320.  
  321. @@ -278,7 +278,7 @@ Common::Error Sword2MetaEngine::createInstance(OSystem *syst, Engine **engine) c
  322.  
  323.     // Invoke the detector
  324.     Common::String gameid = ConfMan.get("gameid");
  325. -   GameList detectedGames = detectGames(fslist);
  326. +   GameList detectedGames = detectGames(fslist, useUnknownGameDialog);
  327.  
  328.     for (uint i = 0; i < detectedGames.size(); i++) {
  329.         if (detectedGames[i].gameid() == gameid) {
  330. diff --git a/gui/launcher.cpp b/gui/launcher.cpp
  331. index 4fe1ae79c8..857d7d001a 100644
  332. --- a/gui/launcher.cpp
  333. +++ b/gui/launcher.cpp
  334. @@ -573,7 +573,7 @@ bool LauncherDialog::doGameDetection(const Common::String &path) {
  335.  
  336.     // ...so let's determine a list of candidates, games that
  337.     // could be contained in the specified directory.
  338. -   GameList candidates(EngineMan.detectGames(files));
  339. +   GameList candidates(EngineMan.detectGames(files, true));
  340.  
  341.     int idx;
  342.     if (candidates.empty()) {
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top