[Scummvm-cvs-logs] scummvm master -> 4595b75d24aab8aab4e1d7e70849a8b149ff0c8e

clone2727 clone2727 at gmail.com
Sat Dec 3 22:01:26 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4595b75d24 SCUMM: Add support for the mustard mac map file


Commit: 4595b75d24aab8aab4e1d7e70849a8b149ff0c8e
    https://github.com/scummvm/scummvm/commit/4595b75d24aab8aab4e1d7e70849a8b149ff0c8e
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-12-03T12:54:30-08:00

Commit Message:
SCUMM: Add support for the mustard mac map file

Changed paths:
    engines/scumm/he/script_v80he.cpp



diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp
index 9711f64..eb62b65 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);






More information about the Scummvm-git-logs mailing list