COMPOSER: Load book config from MacBinary

This commit is contained in:
BLooperZ 2022-12-07 20:06:29 +02:00 committed by Eugene Sandulenko
parent 2bd777c926
commit 3e12c9ddc2
3 changed files with 12 additions and 2 deletions

View File

@ -24,6 +24,7 @@
#include "common/savefile.h"
#include "common/system.h"
#include "common/textconsole.h"
#include "common/macresman.h"
namespace Common {
@ -65,6 +66,14 @@ bool INIFile::loadFromFile(const String &filename) {
return false;
}
bool INIFile::loadFromFileOrDataFork(const String &filename) {
SeekableReadStream *file = Common::MacResManager::openFileOrDataFork(filename);
if (file)
return loadFromStream(*file);
else
return false;
}
bool INIFile::loadFromSaveFile(const String &filename) {
assert(g_system);
SaveFileManager *saveFileMan = g_system->getSavefileManager();

View File

@ -106,6 +106,7 @@ public:
void clear();
bool loadFromFile(const String &filename); /*!< Load configuration from a file. */
bool loadFromFileOrDataFork(const String &filename); /*!< Load configuration from a file in MacBinary format. */
bool loadFromSaveFile(const String &filename); /*!< Load configuration from a save file. */
bool loadFromStream(SeekableReadStream &stream); /*!< Load configuration from a @ref SeekableReadStream. */
bool saveToFile(const String &filename); /*!< Save the current configuration to a file. */

View File

@ -54,12 +54,12 @@ bool ComposerEngine::loadDetectedConfigFile(Common::INIFile &configFile) const {
const ADGameFileDescription *res = _gameDescription->desc.filesDescriptions;
while (res->fileName != nullptr) {
if (res->fileType == GAME_CONFIGFILE) {
return configFile.loadFromFile(res->fileName);
return configFile.loadFromFileOrDataFork(res->fileName);
}
res++;
}
// default config file name
return configFile.loadFromFile("book.ini") || configFile.loadFromFile("book.mac");
return configFile.loadFromFileOrDataFork("book.ini") || configFile.loadFromFileOrDataFork("book.mac");
}
} // End of namespace Composer