[Scummvm-git-logs] scummvm master -> 920308f877b03194c6f9f9cd5de06c664b565fbe
elasota
noreply at scummvm.org
Tue May 30 17:22:47 UTC 2023
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:
389594e9ec VCRUISE: Add fallback for loading localization data if only Speech00.txt exists, and could be in any language
1eb6ea63ac VCRUISE: Use Japanese and Chinese versions of Noto Sans for those languages
920308f877 VCRUISE: Add Schizm English CD version detection
Commit: 389594e9ec140eddcfe9e79a49c0e5f6720a839e
https://github.com/scummvm/scummvm/commit/389594e9ec140eddcfe9e79a49c0e5f6720a839e
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-30T13:22:27-04:00
Commit Message:
VCRUISE: Add fallback for loading localization data if only Speech00.txt exists, and could be in any language
Changed paths:
engines/vcruise/runtime.cpp
engines/vcruise/runtime.h
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 2a26eba704d..088d97c0e5c 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -61,6 +61,12 @@
namespace VCruise {
+struct CodePageGuess {
+ Common::CodePage codePage;
+ const char *searchString;
+ const char *languageName;
+};
+
class RuntimeMenuInterface : public MenuInterface {
public:
explicit RuntimeMenuInterface(Runtime *runtime);
@@ -1371,23 +1377,34 @@ bool Runtime::bootGame(bool newGame) {
Common::CodePage codePage = resolveCodePageForLanguage(lang);
- bool subtitlesLoadedOK = loadSubtitles(codePage);
+ bool subtitlesLoadedOK = loadSubtitles(codePage, false);
- if (!loadSubtitles(codePage)) {
+ if (!subtitlesLoadedOK) {
lang = _defaultLanguage;
_languageIndex = _defaultLanguageIndex;
warning("Localization data failed to load, retrying with default language");
codePage = resolveCodePageForLanguage(lang);
- subtitlesLoadedOK = loadSubtitles(codePage);
+ subtitlesLoadedOK = loadSubtitles(codePage, false);
+
+ if (!subtitlesLoadedOK) {
+ if (_languageIndex != 0) {
+ codePage = Common::CodePage::kWindows1250;
+ _languageIndex = 0;
+ _defaultLanguageIndex = 0;
+
+ warning("Localization data failed to load again, trying one more time and guessing the encoding.");
- if (!subtitlesLoadedOK)
- warning("Localization data failed to load! Text and subtitles will be disabled.");
+ subtitlesLoadedOK = loadSubtitles(codePage, true);
+ }
+ }
}
if (subtitlesLoadedOK)
- debug(1, "Subtitles loaded OK");
+ debug(1, "Localization data loaded OK");
+ else
+ warning("Localization data failed to load! Text and subtitles will be disabled.");
_uiGraphics.resize(24);
for (uint i = 0; i < _uiGraphics.size(); i++) {
@@ -4689,7 +4706,7 @@ Common::SharedPtr<Graphics::Surface> Runtime::loadGraphic(const Common::String &
return surf;
}
-bool Runtime::loadSubtitles(Common::CodePage codePage) {
+bool Runtime::loadSubtitles(Common::CodePage codePage, bool guessCodePage) {
Common::String filePath = Common::String::format("Log/Speech%02u.txt", _languageIndex);
Common::INIFile ini;
@@ -4701,6 +4718,37 @@ bool Runtime::loadSubtitles(Common::CodePage codePage) {
return false;
}
+ if (guessCodePage) {
+ bool guessedCodePage = false;
+
+ Common::String checkString;
+ if (ini.getKey("szQuestion2", "szTextData", checkString)) {
+ const CodePageGuess guesses[] = {
+ {Common::CodePage::kWindows1252, "previously", "English"},
+ {Common::CodePage::kWindows1252, "\x7c" "berschrieben", "German"},
+ {Common::CodePage::kWindows1250, "poprzedni", "Polish"},
+ {Common::CodePage::kWindows1252, "pr\xe9" "c\xe9" "dement", "French"},
+ {Common::CodePage::kWindows1252, "opgeslagen", "Dutch"},
+ {Common::CodePage::kWindows1252, "partida", "Spanish"},
+ {Common::CodePage::kWindows1252, "precedentemente", "Italian"},
+ {Common::CodePage::kWindows1251, "\xf1\xee\xf5\xf0\xe0\xed\xe5\xed\xed\xf3\xfe", "Russian"},
+ {Common::CodePage::kWindows1253, "\xf0\xf1\xef\xe7\xe3\xef\xfd\xec\xe5\xed\xef", "Greek"},
+ };
+
+ for (const CodePageGuess &guess : guesses) {
+ if (checkString.contains(guess.searchString)) {
+ codePage = guess.codePage;
+ warning("Fallback language detection: Guessed language as %s", guess.languageName);
+ guessedCodePage = true;
+ break;
+ }
+ }
+ }
+
+ if (!guessedCodePage)
+ warning("Couldn't guess text encoding from localization content, please report this as a bug!");
+ }
+
for (const Common::INIFile::Section §ion : ini.getSections()) {
if (section.name == "Anims")
continue; // Ignore
@@ -4708,9 +4756,9 @@ bool Runtime::loadSubtitles(Common::CodePage codePage) {
FrameToSubtitleMap_t *frameMap = nullptr;
bool isWave = false;
- if (section.name.substr(0, 5) == "Disc-")
+ if (section.name.hasPrefix("Disc-"))
isWave = true;
- else if (section.name.size() == 8 && section.name.substr(0, 4) == "Anim") {
+ else if (section.name.size() == 8 && section.name.hasPrefix("Anim")) {
uint animID = 0;
if (sscanf(section.name.substr(4, 4).c_str(), "%u", &animID) == 1)
frameMap = &_animSubtitles[animID];
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index 3c6e390cf7d..7915fe3dee2 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -899,7 +899,7 @@ private:
Common::String getFileNameForItemGraphic(uint itemID) const;
Common::SharedPtr<Graphics::Surface> loadGraphic(const Common::String &graphicName, bool required);
- bool loadSubtitles(Common::CodePage codePage);
+ bool loadSubtitles(Common::CodePage codePage, bool guessCodePage);
void changeToMenuPage(MenuPage *menuPage);
Commit: 1eb6ea63ac1be41b577ee0fe2fdc82272b9a8e77
https://github.com/scummvm/scummvm/commit/1eb6ea63ac1be41b577ee0fe2fdc82272b9a8e77
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-30T13:22:27-04:00
Commit Message:
VCRUISE: Use Japanese and Chinese versions of Noto Sans for those languages
Changed paths:
engines/vcruise/runtime.cpp
engines/vcruise/runtime.h
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 088d97c0e5c..08f32cff6c4 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -63,6 +63,7 @@ namespace VCruise {
struct CodePageGuess {
Common::CodePage codePage;
+ Runtime::CharSet charSet;
const char *searchString;
const char *languageName;
};
@@ -1051,7 +1052,8 @@ Runtime::Runtime(OSystem *system, Audio::Mixer *mixer, const Common::FSNode &roo
_panoramaState(kPanoramaStateInactive),
_listenerX(0), _listenerY(0), _listenerAngle(0), _soundCacheIndex(0),
_isInGame(false),
- _subtitleFont(nullptr), _isDisplayingSubtitles(false), _isSubtitleSourceAnimation(false), _languageIndex(0), _defaultLanguageIndex(0), _defaultLanguage(defaultLanguage),
+ _subtitleFont(nullptr), _isDisplayingSubtitles(false), _isSubtitleSourceAnimation(false),
+ _languageIndex(0), _defaultLanguageIndex(0), _defaultLanguage(defaultLanguage), _charSet(kCharSetLatin),
_isCDVariant(false) {
for (uint i = 0; i < kNumDirections; i++) {
@@ -1375,7 +1377,8 @@ bool Runtime::bootGame(bool newGame) {
}
}
- Common::CodePage codePage = resolveCodePageForLanguage(lang);
+ Common::CodePage codePage = Common::CodePage::kASCII;
+ resolveCodePageForLanguage(lang, codePage, _charSet);
bool subtitlesLoadedOK = loadSubtitles(codePage, false);
@@ -1385,7 +1388,7 @@ bool Runtime::bootGame(bool newGame) {
warning("Localization data failed to load, retrying with default language");
- codePage = resolveCodePageForLanguage(lang);
+ resolveCodePageForLanguage(lang, codePage, _charSet);
subtitlesLoadedOK = loadSubtitles(codePage, false);
if (!subtitlesLoadedOK) {
@@ -1394,7 +1397,7 @@ bool Runtime::bootGame(bool newGame) {
_languageIndex = 0;
_defaultLanguageIndex = 0;
- warning("Localization data failed to load again, trying one more time and guessing the encoding.");
+ warning("Localization data failed to load again, trying one more time and guessing the encoding");
subtitlesLoadedOK = loadSubtitles(codePage, true);
}
@@ -1431,24 +1434,38 @@ bool Runtime::bootGame(bool newGame) {
return true;
}
-Common::CodePage Runtime::resolveCodePageForLanguage(Common::Language lang) {
+void Runtime::resolveCodePageForLanguage(Common::Language lang, Common::CodePage &outCodePage, CharSet &outCharSet) {
switch (lang) {
case Common::PL_POL:
case Common::CS_CZE:
- return Common::CodePage::kWindows1250;
+ outCodePage = Common::CodePage::kWindows1250;
+ outCharSet = kCharSetLatin;
+ return;
case Common::RU_RUS:
case Common::BG_BUL:
- return Common::CodePage::kWindows1251;
+ outCodePage = Common::CodePage::kWindows1251;
+ outCharSet = kCharSetCyrillic;
+ return;
case Common::EL_GRC:
- return Common::CodePage::kWindows1253;
+ outCodePage = Common::CodePage::kWindows1253;
+ outCharSet = kCharSetGreek;
+ return;
case Common::ZH_TWN:
- return Common::CodePage::kBig5;
+ outCodePage = Common::CodePage::kBig5;
+ outCharSet = kCharSetChineseTraditional;
+ return;
case Common::JA_JPN:
- return Common::CodePage::kWindows932; // Uses Shift-JIS, which Windows 932 is an extension of
+ outCodePage = Common::CodePage::kWindows932;
+ outCharSet = kCharSetJapanese;
+ return;
case Common::ZH_CHN:
- return Common::CodePage::kGBK;
+ outCodePage = Common::CodePage::kGBK;
+ outCharSet = kCharSetChineseSimplified;
+ return;
default:
- return Common::CodePage::kWindows1252;
+ outCodePage = Common::CodePage::kWindows1252;
+ outCharSet = kCharSetLatin;
+ return;
}
}
@@ -4724,15 +4741,15 @@ bool Runtime::loadSubtitles(Common::CodePage codePage, bool guessCodePage) {
Common::String checkString;
if (ini.getKey("szQuestion2", "szTextData", checkString)) {
const CodePageGuess guesses[] = {
- {Common::CodePage::kWindows1252, "previously", "English"},
- {Common::CodePage::kWindows1252, "\x7c" "berschrieben", "German"},
- {Common::CodePage::kWindows1250, "poprzedni", "Polish"},
- {Common::CodePage::kWindows1252, "pr\xe9" "c\xe9" "dement", "French"},
- {Common::CodePage::kWindows1252, "opgeslagen", "Dutch"},
- {Common::CodePage::kWindows1252, "partida", "Spanish"},
- {Common::CodePage::kWindows1252, "precedentemente", "Italian"},
- {Common::CodePage::kWindows1251, "\xf1\xee\xf5\xf0\xe0\xed\xe5\xed\xed\xf3\xfe", "Russian"},
- {Common::CodePage::kWindows1253, "\xf0\xf1\xef\xe7\xe3\xef\xfd\xec\xe5\xed\xef", "Greek"},
+ {Common::CodePage::kWindows1252, kCharSetLatin, "previously", "English"},
+ {Common::CodePage::kWindows1252, kCharSetLatin, "\x7c" "berschrieben", "German"},
+ {Common::CodePage::kWindows1250, kCharSetLatin, "poprzedni", "Polish"},
+ {Common::CodePage::kWindows1252, kCharSetLatin, "pr\xe9" "c\xe9" "dement", "French"},
+ {Common::CodePage::kWindows1252, kCharSetLatin, "opgeslagen", "Dutch"},
+ {Common::CodePage::kWindows1252, kCharSetLatin, "partida", "Spanish"},
+ {Common::CodePage::kWindows1252, kCharSetLatin, "precedentemente", "Italian"},
+ {Common::CodePage::kWindows1251, kCharSetCyrillic, "\xf1\xee\xf5\xf0\xe0\xed\xe5\xed\xed\xf3\xfe", "Russian"},
+ {Common::CodePage::kWindows1253, kCharSetGreek, "\xf0\xf1\xef\xe7\xe3\xef\xfd\xec\xe5\xed\xef", "Greek"},
};
for (const CodePageGuess &guess : guesses) {
@@ -5102,10 +5119,43 @@ const Graphics::Font *Runtime::resolveFont(const Common::String &textStyle, uint
#ifdef USE_FREETYPE2
const char *fontFile = nullptr;
- if (textStyle == "Verdana")
- fontFile = "NotoSans-Bold.ttf";
- else if (textStyle == "Arial")
- fontFile = "LiberationSans-Bold.ttf";
+ if (textStyle == "Verdana") {
+ switch (_charSet) {
+ case kCharSetGreek:
+ case kCharSetLatin:
+ case kCharSetCyrillic:
+ default:
+ fontFile = "NotoSans-Bold.ttf";
+ break;
+ case kCharSetChineseSimplified:
+ fontFile = "NotoSansSC-Bold.ttf";
+ break;
+ case kCharSetChineseTraditional:
+ fontFile = "NotoSansTC-Bold.ttf";
+ break;
+ case kCharSetJapanese:
+ fontFile = "NotoSansJP-Bold.ttf";
+ break;
+ }
+ } else if (textStyle == "Arial") {
+ switch (_charSet) {
+ case kCharSetGreek:
+ case kCharSetLatin:
+ case kCharSetCyrillic:
+ default:
+ fontFile = "LiberationSans-Bold.ttf";
+ break;
+ case kCharSetChineseSimplified:
+ fontFile = "NotoSansSC-Bold.ttf";
+ break;
+ case kCharSetChineseTraditional:
+ fontFile = "NotoSansTC-Bold.ttf";
+ break;
+ case kCharSetJapanese:
+ fontFile = "NotoSansJP-Bold.ttf";
+ break;
+ }
+ }
if (fontFile) {
// Pass as 61dpi to account for weird scaling
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index 7915fe3dee2..b94b4538fa0 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -564,6 +564,15 @@ class Runtime {
public:
friend class RuntimeMenuInterface;
+ enum CharSet {
+ kCharSetLatin,
+ kCharSetGreek,
+ kCharSetCyrillic,
+ kCharSetJapanese,
+ kCharSetChineseTraditional,
+ kCharSetChineseSimplified,
+ };
+
Runtime(OSystem *system, Audio::Mixer *mixer, const Common::FSNode &rootFSNode, VCruiseGameID gameID, Common::Language defaultLanguage);
virtual ~Runtime();
@@ -594,7 +603,7 @@ public:
LoadGameOutcome loadGame(Common::ReadStream *stream);
bool bootGame(bool newGame);
- static Common::CodePage resolveCodePageForLanguage(Common::Language lang);
+ static void resolveCodePageForLanguage(Common::Language lang, Common::CodePage &outCodePage, CharSet &outCharSet);
void drawLabel(Graphics::ManagedSurface *surface, const Common::String &labelID, const Common::Rect &contentRect);
void getLabelDef(const Common::String &labelID, const Graphics::Font *&outFont, const Common::String *&outTextUTF8, uint32 &outColor, uint32 &outShadowColor, uint32 &outShadowOffset);
@@ -1326,6 +1335,7 @@ private:
Common::SharedPtr<Graphics::Font> _subtitleFontKeepalive;
uint _defaultLanguageIndex;
uint _languageIndex;
+ CharSet _charSet;
bool _isCDVariant;
StartConfigDef _startConfigs[kNumStartConfigs];
Commit: 920308f877b03194c6f9f9cd5de06c664b565fbe
https://github.com/scummvm/scummvm/commit/920308f877b03194c6f9f9cd5de06c664b565fbe
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-30T13:22:27-04:00
Commit Message:
VCRUISE: Add Schizm English CD version detection
Changed paths:
engines/vcruise/detection_tables.h
diff --git a/engines/vcruise/detection_tables.h b/engines/vcruise/detection_tables.h
index dd165f0e8f4..f485d4981e6 100644
--- a/engines/vcruise/detection_tables.h
+++ b/engines/vcruise/detection_tables.h
@@ -113,6 +113,20 @@ static const VCruiseGameDescription gameDescriptions[] = {
GID_REAH,
Common::EN_ANY,
},
+ { // Schizm: Mysterious Journey, English CD Version
+ {
+ "schizm",
+ "English CD",
+ AD_ENTRY2s("Schizm.exe", "24bb1831a53b3969d9d1a9302740de4a", 368640,
+ "0001_a.wav", "374d93abc3422840623acc618ecb2b1e", 1553784),
+ Common::UNK_LANG,
+ Common::kPlatformWindows,
+ ADGF_TESTING | VCRUISE_GF_WANT_OGG_VORBIS | VCRUISE_GF_NEED_JPEG,
+ GUIO0()
+ },
+ GID_SCHIZM,
+ Common::EN_GRB,
+ },
{ // Schizm: Mysterious Journey, English DVD/digital Version
{
"schizm",
More information about the Scummvm-git-logs
mailing list