[Scummvm-git-logs] scummvm master -> 633f33d056ec887a65bbd30b9fe567b12b81347f
sev-
sev at scummvm.org
Mon Nov 1 15:20:51 UTC 2021
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:
1f10ab5bd5 BLADERUNNER: fix encodings for save descriptions
df94220554 BLADERUNNER: encode ingame save description to UTF-8
633f33d056 BLADERUNNER: add comment
Commit: 1f10ab5bd55fa304a2888390d5b49e4259192bce
https://github.com/scummvm/scummvm/commit/1f10ab5bd55fa304a2888390d5b49e4259192bce
Author: athrxx (athrxx at scummvm.org)
Date: 2021-11-01T16:20:47+01:00
Commit Message:
BLADERUNNER: fix encodings for save descriptions
If you type save names like e. g. "äöüÃ" in the GMM this will now show up correctly in the ingame save/load dialogs.
You still cannot type these characters ingame due to the current implementation of UIInputBox::charIsValid(char kc). I don't know why. If I comment out this function and simply return true it works just fine for me. So it is not a limitation of the font (although I am playing the English version).
Still, I haven't changed that behavior, since I am not familiar with the engine...If the only reason for charIsValid() was the wrong encoding it might make sense to limit or even remove it.
Changed paths:
engines/bladerunner/ui/kia_section_load.cpp
engines/bladerunner/ui/kia_section_save.cpp
engines/bladerunner/ui/ui_input_box.cpp
engines/bladerunner/ui/ui_input_box.h
diff --git a/engines/bladerunner/ui/kia_section_load.cpp b/engines/bladerunner/ui/kia_section_load.cpp
index 3e17089555..5899fc1fcf 100644
--- a/engines/bladerunner/ui/kia_section_load.cpp
+++ b/engines/bladerunner/ui/kia_section_load.cpp
@@ -70,7 +70,7 @@ void KIASectionLoad::open() {
if (!_saveList.empty()) {
_scrollBox->addLine(_vm->_textOptions->getText(36), -1, 4); // Load game:
for (uint i = 0; i < _saveList.size(); ++i) {
- _scrollBox->addLine(_saveList[i].getDescription(), i, 0);
+ _scrollBox->addLine(_saveList[i].getDescription().encode(Common::kDos850), i, 0);
}
_scrollBox->addLine("", -1, 4);
}
diff --git a/engines/bladerunner/ui/kia_section_save.cpp b/engines/bladerunner/ui/kia_section_save.cpp
index c454581dc1..f6bcaabcbd 100644
--- a/engines/bladerunner/ui/kia_section_save.cpp
+++ b/engines/bladerunner/ui/kia_section_save.cpp
@@ -112,7 +112,7 @@ void KIASectionSave::open() {
}
for (uint i = 0; i < _saveList.size(); ++i) {
- _scrollBox->addLine(_saveList[i].getDescription(), i, 0);
+ _scrollBox->addLine(_saveList[i].getDescription().encode(Common::kDos850), i, 0);
}
if (ableToSaveGame) {
@@ -296,7 +296,7 @@ void KIASectionSave::scrollBoxCallback(void *callbackData, void *source, int lin
if (self->_selectedLineId == self->_newSaveLineId) {
self->_inputBox->setText("");
} else {
- self->_inputBox->setText(self->_saveList[self->_selectedLineId].getDescription());
+ self->_inputBox->setText(self->_saveList[self->_selectedLineId].getDescription().encode(Common::kDos850));
}
self->_vm->_audioPlayer->playAud(self->_vm->_gameInfo->getSfxTrack(kSfxSPNBEEP3), 40, 0, 0, 50, 0);
diff --git a/engines/bladerunner/ui/ui_input_box.cpp b/engines/bladerunner/ui/ui_input_box.cpp
index 6c60f7e140..8b06ffbb25 100644
--- a/engines/bladerunner/ui/ui_input_box.cpp
+++ b/engines/bladerunner/ui/ui_input_box.cpp
@@ -88,9 +88,10 @@ void UIInputBox::hide() {
}
void UIInputBox::handleKeyDown(const Common::KeyState &kbd) {
+ char kc = Common::U32String(Common::String::format("%c", kbd.ascii), Common::kISO8859_1).encode(Common::kDos850).firstChar();
if (_isVisible) {
- if (charIsValid(kbd) && _text.size() < _maxLength) {
- _text += kbd.ascii;
+ if (charIsValid(kc) && _text.size() < _maxLength) {
+ _text += kc;
} else if (kbd.keycode == Common::KEYCODE_BACKSPACE) {
_text.deleteLastChar();
} else if (kbd.keycode == Common::KEYCODE_RETURN && !_text.empty()) {
@@ -101,18 +102,18 @@ void UIInputBox::handleKeyDown(const Common::KeyState &kbd) {
}
}
-bool UIInputBox::charIsValid(const Common::KeyState &kbd) {
- return kbd.ascii >= ' '
- && kbd.ascii != '<'
- && kbd.ascii != '>'
- && kbd.ascii != ':'
- && kbd.ascii != '"'
- && kbd.ascii != '/'
- && kbd.ascii != '\\'
- && kbd.ascii != '|'
- && kbd.ascii != '?'
- && kbd.ascii != '*'
- && kbd.ascii <= '~';// || kbd.ascii == '¡' || kbd.ascii == 'Ã');
+bool UIInputBox::charIsValid(char kc) {
+ return kc >= ' '
+ && kc != '<'
+ && kc != '>'
+ && kc != ':'
+ && kc != '"'
+ && kc != '/'
+ && kc != '\\'
+ && kc != '|'
+ && kc != '?'
+ && kc != '*'
+ && kc <= '~';// || kc == '¡' || kc == 'Ã');
}
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/ui/ui_input_box.h b/engines/bladerunner/ui/ui_input_box.h
index 3aa21f2e2f..87a83723ba 100644
--- a/engines/bladerunner/ui/ui_input_box.h
+++ b/engines/bladerunner/ui/ui_input_box.h
@@ -58,7 +58,7 @@ public:
void handleKeyDown(const Common::KeyState &kbd) override;
private:
- bool charIsValid(const Common::KeyState &kbd);
+ bool charIsValid(char kc);
};
} // End of namespace BladeRunner
Commit: df942205541354e8684898792a6dd19f713770a6
https://github.com/scummvm/scummvm/commit/df942205541354e8684898792a6dd19f713770a6
Author: athrxx (athrxx at scummvm.org)
Date: 2021-11-01T16:20:47+01:00
Commit Message:
BLADERUNNER: encode ingame save description to UTF-8
Changed paths:
engines/bladerunner/ui/kia_section_save.cpp
diff --git a/engines/bladerunner/ui/kia_section_save.cpp b/engines/bladerunner/ui/kia_section_save.cpp
index f6bcaabcbd..3a0ee50198 100644
--- a/engines/bladerunner/ui/kia_section_save.cpp
+++ b/engines/bladerunner/ui/kia_section_save.cpp
@@ -405,7 +405,7 @@ void KIASectionSave::save() {
}
BladeRunner::SaveFileHeader header;
- header._name = _inputBox->getText();
+ header._name = Common::U32String(_inputBox->getText()).encode(Common::kUtf8);
header._playTime = _vm->getTotalPlayTime();
BladeRunner::SaveFileManager::writeHeader(*saveFile, header);
Commit: 633f33d056ec887a65bbd30b9fe567b12b81347f
https://github.com/scummvm/scummvm/commit/633f33d056ec887a65bbd30b9fe567b12b81347f
Author: athrxx (athrxx at scummvm.org)
Date: 2021-11-01T16:20:47+01:00
Commit Message:
BLADERUNNER: add comment
Changed paths:
engines/bladerunner/ui/ui_input_box.cpp
diff --git a/engines/bladerunner/ui/ui_input_box.cpp b/engines/bladerunner/ui/ui_input_box.cpp
index 8b06ffbb25..5ef7a3af61 100644
--- a/engines/bladerunner/ui/ui_input_box.cpp
+++ b/engines/bladerunner/ui/ui_input_box.cpp
@@ -88,6 +88,9 @@ void UIInputBox::hide() {
}
void UIInputBox::handleKeyDown(const Common::KeyState &kbd) {
+ // The values that the KeyState::ascii field receives from the SDL backend are actually ISO 8859-1 encoded. They need to be
+ // reencoded to DOS so as to match the game font encoding (although we currently use UIInputBox::charIsValid() to block most
+ // extra characters, so it might not make much of a difference).
char kc = Common::U32String(Common::String::format("%c", kbd.ascii), Common::kISO8859_1).encode(Common::kDos850).firstChar();
if (_isVisible) {
if (charIsValid(kc) && _text.size() < _maxLength) {
More information about the Scummvm-git-logs
mailing list