[Scummvm-git-logs] scummvm master -> 1345295bd5b2aae28955341ee00d85aa658f3e07

bluegr bluegr at gmail.com
Wed Oct 28 20:17:12 UTC 2020


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:
1345295bd5 SCI: Hebrew - fix save games encoding


Commit: 1345295bd5b2aae28955341ee00d85aa658f3e07
    https://github.com/scummvm/scummvm/commit/1345295bd5b2aae28955341ee00d85aa658f3e07
Author: Zvika Haramaty (haramaty.zvika at gmail.com)
Date: 2020-10-28T22:17:05+02:00

Commit Message:
SCI: Hebrew - fix save games encoding

Make sure that Hebrew save games are using UTF8 (otherwise, when saving
in Hebrew it works well from original Sierra save/restore dialogs, but
when loading from ScummVM's dialog, it looks garbled)

Changed paths:
    engines/sci/engine/file.cpp
    engines/sci/engine/kfile.cpp


diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp
index 96aa46b877..62bcac58f1 100644
--- a/engines/sci/engine/file.cpp
+++ b/engines/sci/engine/file.cpp
@@ -23,6 +23,7 @@
 #include "common/savefile.h"
 #include "common/stream.h"
 #include "common/memstream.h"
+#include "common/unicode-bidi.h"
 
 #include "sci/sci.h"
 #include "sci/engine/file.h"
@@ -333,9 +334,15 @@ bool fillSavegameDesc(const Common::String &filename, SavegameDesc &desc) {
 	if (meta.name.lastChar() == '\n')
 		meta.name.deleteLastChar();
 
+	Common::String nameString = meta.name;
+	if (g_sci->getLanguage() == Common::HE_ISR) {
+		Common::U32String nameU32String = meta.name.decode(Common::kUtf8);
+		nameString = nameU32String.encode(Common::kWindows1255);
+	}
+	
 	// At least Phant2 requires use of strncpy, since it creates save game
 	// names of exactly kMaxSaveNameLength
-	strncpy(desc.name, meta.name.c_str(), kMaxSaveNameLength);
+	strncpy(desc.name, nameString.c_str(), kMaxSaveNameLength);
 
 	return true;
 }
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 1dffb6336c..7d3c2a9883 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -30,6 +30,7 @@
 #include "common/system.h"
 #include "common/translation.h"
 #include "common/memstream.h"
+#include "common/str-enc.h"
 
 #include "gui/saveload.h"
 
@@ -1087,6 +1088,11 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
 		if (argv[2].isNull())
 			error("kSaveGame: called with description being NULL");
 		game_description = s->_segMan->getString(argv[2]);
+		if (g_sci->getLanguage() == Common::HE_ISR) {
+			Common::U32String u32string = game_description.decode(Common::kWindows1255);
+			game_description = u32string.encode(Common::kUtf8);
+		};
+
 
 		debug(3, "kSaveGame(%s,%d,%s,%s)", game_id.c_str(), virtualId, game_description.c_str(), version.c_str());
 




More information about the Scummvm-git-logs mailing list