[Scummvm-git-logs] scummvm master -> b4d40ed596760bee4ebeed194f4de971f9203085
sev-
sev at scummvm.org
Tue May 19 10:33:04 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a611975561 WIN32: Fix `convertEncoding` problem due to String deallcation
1f9d421558 COMMON: moved `convertBiDiString(..lang)` to unicode-bidi.h
b4d40ed596 SCI: add support for Hebrew translation of Torin
Commit: a611975561afdb7fd914c2bcc166d1c9ac12b27b
https://github.com/scummvm/scummvm/commit/a611975561afdb7fd914c2bcc166d1c9ac12b27b
Author: Zvika Haramaty (haramaty.zvika at gmail.com)
Date: 2020-05-19T12:32:58+02:00
Commit Message:
WIN32: Fix `convertEncoding` problem due to String deallcation
Changed paths:
backends/platform/sdl/win32/win32.cpp
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index e52525e1ae..58f6c67bc9 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -436,9 +436,11 @@ char *OSystem_Win32::convertEncoding(const char* to, const char *from, const cha
#endif
// UTF-32 is really important for us, because it is used for the
// transliteration in Common::Encoding and Win32 cannot convert it
+ Common::String tempString;
if (Common::String(from).hasPrefixIgnoreCase("utf-32")) {
Common::U32String UTF32Str((const uint32 *)string, length / 4);
- string = Common::convertUtf32ToUtf8(UTF32Str).c_str();
+ tempString = Common::convertUtf32ToUtf8(UTF32Str);
+ string = tempString.c_str();
from = "utf-8";
}
if (Common::String(to).hasPrefixIgnoreCase("utf-32")) {
Commit: 1f9d421558994f205c6859d2013a64a7b7240b02
https://github.com/scummvm/scummvm/commit/1f9d421558994f205c6859d2013a64a7b7240b02
Author: Zvika Haramaty (haramaty.zvika at gmail.com)
Date: 2020-05-19T12:32:58+02:00
Commit Message:
COMMON: moved `convertBiDiString(..lang)` to unicode-bidi.h
Continuing the work at https://github.com/scummvm/scummvm/pull/2236,
which moved `convertBiDiString(..page)` to unicode-bidi.h,
now moving to there also the `(..lang)` flavour.
Thus, translation.h has only the SVM-GUI related function, and the
two util functions page+code are in unicode-bidi.
Changed paths:
common/translation.cpp
common/translation.h
common/unicode-bidi.cpp
common/unicode-bidi.h
diff --git a/common/translation.cpp b/common/translation.cpp
index 8007041878..4290b163a1 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -460,15 +460,9 @@ String TranslationManager::convertBiDiString(const String &input) {
return input;
};
- return TranslationManager::convertBiDiString(input, HE_ISR);
+ return Common::convertBiDiString(input, HE_ISR);
}
-String TranslationManager::convertBiDiString(const String &input, const Common::Language lang) {
- if (lang != HE_ISR) //TODO: modify when we'll support other RTL languages, such as Arabic and Farsi
- return input;
-
- return Common::convertBiDiString(input, kWindows1255);
-}
} // End of namespace Common
diff --git a/common/translation.h b/common/translation.h
index 88cd86a65d..f711316d70 100644
--- a/common/translation.h
+++ b/common/translation.h
@@ -181,7 +181,6 @@ public:
* For RTL (Right To Left) languages, returns visual representation of a logical single-line input
*/
String convertBiDiString(const String &input);
- String convertBiDiString(const String &input, const Common::Language lang);
private:
/**
diff --git a/common/unicode-bidi.cpp b/common/unicode-bidi.cpp
index 1e5c9f9cd7..5921d2fda2 100644
--- a/common/unicode-bidi.cpp
+++ b/common/unicode-bidi.cpp
@@ -95,6 +95,13 @@ void UnicodeBiDiText::initWithU32String(const U32String &input) {
}
+String convertBiDiString(const String &input, const Common::Language lang) {
+ if (lang != Common::HE_ISR) //TODO: modify when we'll support other RTL languages, such as Arabic and Farsi
+ return input;
+
+ return Common::convertBiDiString(input, kWindows1255);
+}
+
String convertBiDiString(const String &input, const Common::CodePage page) {
return convertBiDiU32String(input.decode(page)).visual.encode(page);
}
diff --git a/common/unicode-bidi.h b/common/unicode-bidi.h
index 414f9a1e0d..995673802a 100644
--- a/common/unicode-bidi.h
+++ b/common/unicode-bidi.h
@@ -25,6 +25,7 @@
#include "common/str.h"
#include "common/ustr.h"
+#include "common/language.h"
namespace Common {
@@ -48,6 +49,7 @@ public:
/* just call the constructor for convenience */
UnicodeBiDiText convertBiDiU32String(const U32String &input);
+String convertBiDiString(const String &input, const Common::Language lang);
String convertBiDiString(const String &input, const Common::CodePage page);
} // End of namespace Common
Commit: b4d40ed596760bee4ebeed194f4de971f9203085
https://github.com/scummvm/scummvm/commit/b4d40ed596760bee4ebeed194f4de971f9203085
Author: Zvika Haramaty (haramaty.zvika at gmail.com)
Date: 2020-05-19T12:32:58+02:00
Commit Message:
SCI: add support for Hebrew translation of Torin
- Detect fan made Hebrew translation of Torin's Passage
- Use BiDi algorithm in SCI engine
Changed paths:
engines/sci/detection.cpp
engines/sci/detection_tables.h
engines/sci/graphics/text32.cpp
engines/sci/sci.cpp
engines/sci/sci.h
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 78d5af4cf5..4d32508f88 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -552,6 +552,7 @@ static const char *directoryGlobs[] = {
"italian",
"msg",
"spanish",
+ "patches",
0
};
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index f5c762a433..3388ecb970 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -5354,6 +5354,17 @@ static const struct ADGameDescription SciGameDescriptions[] = {
// AD_LISTEND},
// Common::IT_ITA, Common::kPlatformWindows, ADGF_DROPPLATFORM, GUIO_TORIN },
+ // fan made Hebrew translation, by "Hebrew Adventure" https://www.facebook.com/groups/200491360554968/
+ // distributed as zip package to be extracted over GOG.com version
+ // from ZvikaZ
+ { "torin", "", {
+ {"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799},
+ {"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887},
+ {"PATCHES/61101.p56", 0, "c179fa0c1f842c3076393939e1f29e48", 200121},
+ AD_LISTEND},
+ Common::HE_ISR, Common::kPlatformWindows, ADGF_DROPPLATFORM, GUIO_TORIN },
+
+
// ---
// Torin's Passage - Multilingual EN/FR/DE w/ German audio Windows CD (from m_kiewitz)
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 3a5ed42970..d63b799dcf 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -22,6 +22,7 @@
#include "common/util.h"
#include "common/stack.h"
+#include "common/unicode-bidi.h"
#include "graphics/primitives.h"
#include "sci/sci.h"
@@ -340,10 +341,18 @@ void GfxText32::drawTextBox() {
uint length = getLongest(&nextCharIndex, textRectWidth);
int16 textWidth = getTextWidth(charIndex, length);
- if (_alignment == kTextAlignCenter) {
- _drawPosition.x += (textRectWidth - textWidth) / 2;
- } else if (_alignment == kTextAlignRight) {
- _drawPosition.x += textRectWidth - textWidth;
+ if (!g_sci->isLanguageRTL()) {
+ if (_alignment == kTextAlignCenter) {
+ _drawPosition.x += (textRectWidth - textWidth) / 2;
+ } else if (_alignment == kTextAlignRight) {
+ _drawPosition.x += textRectWidth - textWidth;
+ }
+ } else {
+ if (_alignment == kTextAlignCenter) {
+ _drawPosition.x += (textRectWidth - textWidth) / 2;
+ } else if (_alignment == kTextAlignLeft) {
+ _drawPosition.x += textRectWidth - textWidth;
+ }
}
drawText(charIndex, length);
@@ -364,7 +373,18 @@ void GfxText32::drawText(const uint index, uint length) {
// This draw loop implementation is somewhat different than the
// implementation in SSCI, but is accurate. Primarily the changes revolve
// around eliminating some extra temporaries and fixing the logic to match.
- const char *text = _text.c_str() + index;
+
+ Common::String textString;
+ const char *text;
+ if (!g_sci->isLanguageRTL()) {
+ text = _text.c_str() + index;
+ } else {
+ const char *textOrig = _text.c_str() + index;
+ Common::String textLogical = Common::String(textOrig, (uint32)length);
+ textString = Common::convertBiDiString(textLogical, g_sci->getLanguage());
+ text = textString.c_str();
+ }
+
while (length-- > 0) {
char currentChar = *text++;
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 6b2c0af151..3bffefdfeb 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -784,6 +784,10 @@ Common::Language SciEngine::getLanguage() const {
return _gameDescription->language;
}
+bool SciEngine::isLanguageRTL() const {
+ return getLanguage() == Common::HE_ISR;
+}
+
Common::Platform SciEngine::getPlatform() const {
return _gameDescription->platform;
}
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 2a1d2ab71e..127dc32d8c 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -271,6 +271,7 @@ public:
const SciGameId &getGameId() const { return _gameId; }
const char *getGameIdStr() const;
Common::Language getLanguage() const;
+ bool isLanguageRTL() const; // true if language's direction is from Right To Left
Common::Platform getPlatform() const;
bool isDemo() const;
bool isCD() const;
More information about the Scummvm-git-logs
mailing list