diff options
author | Matthew Hoops | 2011-12-03 15:54:00 -0500 |
---|---|---|
committer | Matthew Hoops | 2011-12-03 15:54:30 -0500 |
commit | 4595b75d24aab8aab4e1d7e70849a8b149ff0c8e (patch) | |
tree | a641bb5f66939617a791d4e1666718750f9ec091 /engines/scumm | |
parent | 4aca1957125fafd8726ee0a6c19abbc23b7abc5d (diff) | |
download | scummvm-rg350-4595b75d24aab8aab4e1d7e70849a8b149ff0c8e.tar.gz scummvm-rg350-4595b75d24aab8aab4e1d7e70849a8b149ff0c8e.tar.bz2 scummvm-rg350-4595b75d24aab8aab4e1d7e70849a8b149ff0c8e.zip |
SCUMM: Add support for the mustard mac map file
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/he/script_v80he.cpp | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index 9711f6415b..eb62b650a4 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -25,6 +25,7 @@ #include "common/archive.h" #include "common/config-file.h" #include "common/config-manager.h" +#include "common/macresman.h" #include "common/savefile.h" #include "common/str.h" @@ -158,19 +159,41 @@ void ScummEngine_v80he::o80_readConfigFile() { memcpy(section, "BluesTreasureHunt-Disc2\0", 24); } - Common::ConfigFile ConfFile; - if (!strcmp((char *)filename + r, "map.ini")) - ConfFile.loadFromFile((const char *)filename + r); - else - ConfFile.loadFromSaveFile((const char *)filename + r); + if (!strcmp((const char *)filename, "map (i)")) { + // Mac resource fork config file + // (as used by only mustard mac for map data?) + Common::MacResManager resFork; + + if (!resFork.open((const char *)filename) || !resFork.hasResFork()) + error("Could not open '%s'", filename); + + Common::String prefResName = Common::String::format("Pref:%s.%s", (const char *)section, (const char *)option); + Common::SeekableReadStream *res = resFork.getResource(prefResName); + + if (res) { + // The string is inside the resource as a pascal string + byte length = res->readByte(); + for (byte i = 0; i < length; i++) + entry += (char)res->readByte(); + + delete res; + } + } else { + // Normal Windows INI files + Common::ConfigFile confFile; + if (!strcmp((char *)filename + r, "map.ini")) + confFile.loadFromFile((const char *)filename + r); + else + confFile.loadFromSaveFile((const char *)filename + r); + + confFile.getKey((const char *)option, (const char *)section, entry); + } byte subOp = fetchScriptByte(); switch (subOp) { case 43: // HE 100 case 6: // number - ConfFile.getKey((const char *)option, (const char *)section, entry); - if (!strcmp((char *)option, "Benchmark")) push(2); else @@ -178,8 +201,6 @@ void ScummEngine_v80he::o80_readConfigFile() { break; case 77: // HE 100 case 7: // string - ConfFile.getKey((const char *)option, (const char *)section, entry); - writeVar(0, 0); len = resStrLen((const byte *)entry.c_str()); data = defineArray(0, kStringArray, 0, 0, 0, len); |