[Scummvm-git-logs] scummvm master -> 2602d0fe8e0b981fffcc87ae8d941eec758c2774

bluegr bluegr at gmail.com
Wed Jul 21 21:06:29 UTC 2021


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

Summary:
b983c1f29f COMMON: Add conversion table for DOS862 encoding
2602d0fe8e SCUMM: Fix encoding for Hebrew dialogs


Commit: b983c1f29fd3c8d67cd83b84b943684a419fc6b4
    https://github.com/scummvm/scummvm/commit/b983c1f29fd3c8d67cd83b84b943684a419fc6b4
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2021-07-22T00:06:25+03:00

Commit Message:
COMMON: Add conversion table for DOS862 encoding

Changed paths:
    common/enc-internal.h
    common/encodings/singlebyte.cpp
    common/str-enc.cpp
    common/str-enc.h


diff --git a/common/enc-internal.h b/common/enc-internal.h
index 4a9d52deb0..c81045b1fe 100644
--- a/common/enc-internal.h
+++ b/common/enc-internal.h
@@ -41,6 +41,7 @@ extern const uint16 kLatin2ConversionTable[128];
 extern const uint16 kISO5ConversionTable[128];
 extern const uint16 kASCIIConversionTable[128];
 extern const uint16 kDos850ConversionTable[128];
+extern const uint16 kDos862ConversionTable[128];
 extern const uint16 kDos866ConversionTable[128];
 
 }
diff --git a/common/encodings/singlebyte.cpp b/common/encodings/singlebyte.cpp
index e9fdaff549..7ce699b563 100644
--- a/common/encodings/singlebyte.cpp
+++ b/common/encodings/singlebyte.cpp
@@ -264,6 +264,24 @@ const uint16 kDos850ConversionTable[128] = {
 	0x00b0, 0x00a8, 0x00b7, 0x00b9, 0x00b3, 0x00b2, 0x25a0, 0x00a0,
 };
 
+const uint16 kDos862ConversionTable[128] = {
+	0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7,
+	0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
+	0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
+	0x05E8, 0x05E9, 0x05EA, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
+	0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
+	0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
+	0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
+	0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
+	0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
+	0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
+	0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
+	0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
+	0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4,
+	0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
+	0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248,
+	0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0};
+
 const uint16 kDos866ConversionTable[128] = {
 	0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
 	0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f,
diff --git a/common/str-enc.cpp b/common/str-enc.cpp
index 748d8f0ade..f1edf1aeac 100644
--- a/common/str-enc.cpp
+++ b/common/str-enc.cpp
@@ -725,6 +725,8 @@ getConversionTable(CodePage page) {
 		return kISO5ConversionTable;
 	case kDos850:
 		return kDos850ConversionTable;
+	case kDos862:
+		return kDos862ConversionTable;
 	case kDos866:
 		return kDos866ConversionTable;
 	case kASCII:
diff --git a/common/str-enc.h b/common/str-enc.h
index 5d35d1a8b6..be276d49e3 100644
--- a/common/str-enc.h
+++ b/common/str-enc.h
@@ -48,6 +48,7 @@ enum CodePage {
 	kMacCentralEurope,
 	kMacRoman,
 	kDos850,
+	kDos862,
 	kDos866,
 	kASCII,
 


Commit: 2602d0fe8e0b981fffcc87ae8d941eec758c2774
    https://github.com/scummvm/scummvm/commit/2602d0fe8e0b981fffcc87ae8d941eec758c2774
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2021-07-22T00:06:25+03:00

Commit Message:
SCUMM: Fix encoding for Hebrew dialogs

Like Pause dialog.

Changed paths:
    engines/scumm/dialogs.cpp
    engines/scumm/scumm.h
    engines/scumm/string.cpp


diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 0f7a57ac45..1f3076f053 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -430,6 +430,7 @@ void InfoDialog::reflowLayout() {
 
 const Common::U32String InfoDialog::queryResString(int stringno) {
 	byte buf[256];
+	byte reverseBuf[256];
 	const byte *result;
 
 	if (stringno == 0)
@@ -457,6 +458,8 @@ const Common::U32String InfoDialog::queryResString(int stringno) {
 		return _(string_map_table_v345[stringno - 1].string);
 	}
 
+	if (_vm->reverseIfNeeded(result, reverseBuf))
+		result = reverseBuf;
 	// Convert to a proper string (take care of FF codes)
 	byte chr;
 	String tmp;
@@ -468,16 +471,7 @@ const Common::U32String InfoDialog::queryResString(int stringno) {
 		}
 	}
 
-	Common::CodePage convertFromCodePage = Common::kCodePageInvalid;
-	if (_vm->_language == Common::KO_KOR)
-		convertFromCodePage = Common::kWindows949;
-	else if (_vm->_language == Common::JA_JPN)
-		convertFromCodePage = Common::kWindows932;
-	else if (_vm->_language == Common::ZH_TWN || _vm->_language == Common::ZH_CNA)
-		convertFromCodePage = Common::kWindows950;
-	else if (_vm->_language == Common::RU_RUS)
-		convertFromCodePage = Common::kDos866;
-
+	const Common::CodePage convertFromCodePage = _vm->getDialogCodePage();
 	return convertFromCodePage == Common::kCodePageInvalid ? _(tmp) : U32String(tmp, convertFromCodePage);
 }
 
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 8db9b371a4..07e6ee5ee6 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1135,7 +1135,7 @@ protected:
 	virtual void CHARSET_1();
 	bool newLine();
 	void drawString(int a, const byte *msg);
-	void fakeBidiString(byte *ltext, bool ignoreVerb);
+	void fakeBidiString(byte *ltext, bool ignoreVerb) const;
 	void debugMessage(const byte *msg);
 	void showMessageDialog(const byte *msg);
 
@@ -1150,6 +1150,10 @@ public:
 
 	// Used by class ScummDialog:
 	virtual void translateText(const byte *text, byte *trans_buff);
+	// Old Hebrew games require reversing the dialog text.
+	bool reverseIfNeeded(const byte *text, byte *reverseBuf) const;
+	// Returns codepage that matches the game for languages that require it.
+	Common::CodePage getDialogCodePage() const;
 
 	// Somewhat hackish stuff for 2 byte support (Chinese/Japanese/Korean)
 	bool _useCJKMode;
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index d409eda9c5..d3a53dfc42 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -486,7 +486,7 @@ bool ScummEngine::newLine() {
 	return true;
 }
 
-void ScummEngine::fakeBidiString(byte *ltext, bool ignoreVerb) {
+void ScummEngine::fakeBidiString(byte *ltext, bool ignoreVerb) const {
 	// Provides custom made BiDi mechanism.
 	// Reverses texts on each line marked by control characters (considering different control characters used in verbs panel)
 	// While preserving original order of numbers (also negative numbers and comma separated)
@@ -2075,4 +2075,38 @@ void ScummEngine::translateText(const byte *text, byte *trans_buff) {
 	memcpy(trans_buff, text, resStrLen(text) + 1);
 }
 
+bool ScummEngine::reverseIfNeeded(const byte *text, byte *reverseBuf) const {
+	if (_language != Common::HE_ISR)
+		return false;
+	if (_game.id != GID_LOOM && _game.id != GID_ZAK)
+		return false;
+	strcpy(reinterpret_cast<char *>(reverseBuf), reinterpret_cast<const char *>(text));
+	fakeBidiString(reverseBuf, true);
+	return true;
+}
+
+Common::CodePage ScummEngine::getDialogCodePage() const {
+	switch (_language) {
+	case Common::KO_KOR:
+		return Common::kWindows949;
+	case Common::JA_JPN:
+		return Common::kWindows932;
+	case Common::ZH_TWN:
+	case Common::ZH_CNA:
+		return Common::kWindows950;
+	case Common::RU_RUS:
+		return Common::kDos866;
+	case Common::HE_ISR:
+		switch (_game.id) {
+		case GID_LOOM:
+		case GID_ZAK:
+			return Common::kDos862;
+		default:
+			return Common::kWindows1255;
+		}
+	default:
+		return Common::kCodePageInvalid;
+	}
+}
+
 } // End of namespace Scumm




More information about the Scummvm-git-logs mailing list