From 7eea773fc73524cdfaf96a3760f4739c4f100398 Mon Sep 17 00:00:00 2001 From: BLooperZ Date: Wed, 27 Nov 2019 07:37:21 +0200 Subject: COMPOSER: fallback load default configs --- engines/composer/composer.cpp | 7 ++----- engines/composer/composer.h | 2 +- engines/composer/detection.cpp | 7 +++---- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'engines/composer') diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index 6e2df19adf..9931298bf6 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -85,11 +85,8 @@ Common::Error ComposerEngine::run() { _queuedScripts[i]._scriptId = 0; } - Common::String configFile; - getConfigFile(configFile); - - if (!(_bookIni.loadFromFile(configFile))) { - warning("Detected config file is not available - trying other options"); + if (!loadDetectedConfigFile(_bookIni)) { + // Config files for Darby the Dragon are located in subdirectory _directoriesToStrip = 0; if (!_bookIni.loadFromFile("programs/book.ini")) { error("failed to find book.ini"); diff --git a/engines/composer/composer.h b/engines/composer/composer.h index 8af620de70..64ec077676 100644 --- a/engines/composer/composer.h +++ b/engines/composer/composer.h @@ -182,7 +182,7 @@ public: uint32 getFeatures() const; Common::Language getLanguage() const; Common::Platform getPlatform() const; - void getConfigFile(Common::String &file) const; + bool loadDetectedConfigFile(Common::INIFile &configFile) const; const ComposerGameDescription *_gameDescription; diff --git a/engines/composer/detection.cpp b/engines/composer/detection.cpp index 3d09089149..69100d673e 100644 --- a/engines/composer/detection.cpp +++ b/engines/composer/detection.cpp @@ -56,17 +56,16 @@ Common::Platform ComposerEngine::getPlatform() const { return _gameDescription->desc.platform; } -void ComposerEngine::getConfigFile(Common::String &configFile) const { +bool ComposerEngine::loadDetectedConfigFile(Common::INIFile &configFile) const { const ADGameFileDescription *res = _gameDescription->desc.filesDescriptions; while (res->fileName != NULL) { if (res->fileType == GAME_CONFIGFILE) { - configFile = res->fileName; - return; + return configFile.loadFromFile(res->fileName); } res++; } // default config file name - configFile = "book.ini"; + return configFile.loadFromFile("book.ini") || configFile.loadFromFile("book.mac"); } } -- cgit v1.2.3