[Scummvm-git-logs] scummvm master -> e97c916b4bc89833e3262d56ec3da582acbcc2a9

sev- noreply at scummvm.org
Mon Mar 4 16:16:26 UTC 2024


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:
e97c916b4b MACVENTURE: Fix loading filenames with unicode characters


Commit: e97c916b4bc89833e3262d56ec3da582acbcc2a9
    https://github.com/scummvm/scummvm/commit/e97c916b4bc89833e3262d56ec3da582acbcc2a9
Author: polyesterswing (kurianjojo2004 at gmail.com)
Date: 2024-03-04T17:16:21+01:00

Commit Message:
MACVENTURE: Fix loading filenames with unicode characters

Changed paths:
    engines/macventure/macventure.cpp
    engines/macventure/stringtable.h


diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 131fba10598..d42164111ac 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -32,6 +32,7 @@
 #include "common/debug.h"
 #include "common/error.h"
 #include "common/config-manager.h"
+#include "common/str-enc.h"
 #include "engines/util.h"
 
 #include "macventure/macventure.h"
@@ -41,20 +42,6 @@
 
 namespace MacVenture {
 
-// HACK, see below
-void toASCII(Common::String &str) {
-	debugC(3, kMVDebugMain, "toASCII: %s", str.c_str());
-	Common::String::iterator it = str.begin();
-	for (; it != str.end(); it++) {
-		if (*it == '\216') {
-			str.replace(it, it + 1, "e");
-		}
-		if (*it == '\210') {
-			str.replace(it, it + 1, "a");
-		}
-	}
-}
-
 enum {
 	kMaxMenuTitleLength = 30
 };
@@ -467,9 +454,8 @@ Common::Path MacVentureEngine::getStartGameFileName() {
 	char *fileName = new char[length + 1];
 	res->read(fileName, length);
 	fileName[length] = '\0';
-	Common::String result = Common::String(fileName, length);
-	// HACK, see definition of toASCII
-	toASCII(result);
+
+	Common::U32String result(fileName, Common::kMacRoman);
 
 	delete[] fileName;
 	delete res;
diff --git a/engines/macventure/stringtable.h b/engines/macventure/stringtable.h
index 6a3b55ef86c..f2cb6ae4d1a 100644
--- a/engines/macventure/stringtable.h
+++ b/engines/macventure/stringtable.h
@@ -33,11 +33,10 @@
 #include "macventure/macventure.h"
 
 #include "common/file.h"
+#include "common/str-enc.h"
 
 namespace MacVenture {
 
-extern void toASCII(Common::String &str);
-
 enum StringTableID {
 	kErrorStringTableID = 0x80,
 	kFilenamesStringTableID = 0x81,
@@ -89,9 +88,9 @@ private:
 			char *str = new char[strLength + 1];
 			res->read(str, strLength);
 			str[strLength] = '\0';
-			// HACK until a proper special char implementation is found, this will have to do.
-			Common::String result = Common::String(str);
-			toASCII(result);
+
+			Common::U32String result(str, Common::kMacRoman);
+
 			debugC(4, kMVDebugText, "Loaded string %s", str);
 			_strings.push_back(Common::String(result));
 			delete[] str;




More information about the Scummvm-git-logs mailing list