yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

applets/swkbd: Fix text check message encoding

The text check message can be encoded in UTF-8.
This commit is contained in:
Morph 2021-11-08 14:57:53 -05:00
parent 1af499c15b
commit 3af2117c88
1 changed files with 15 additions and 7 deletions

View File

@ -278,13 +278,21 @@ void SoftwareKeyboard::ProcessTextCheck() {
std::memcpy(&swkbd_text_check, text_check_data.data(), sizeof(SwkbdTextCheck));
std::u16string text_check_message =
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Failure ||
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Confirm
? Common::UTF16StringFromFixedZeroTerminatedBuffer(
swkbd_text_check.text_check_message.data(),
swkbd_text_check.text_check_message.size())
: u"";
std::u16string text_check_message = [this, &swkbd_text_check]() -> std::u16string {
if (swkbd_text_check.text_check_result == SwkbdTextCheckResult::Failure ||
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Confirm) {
return swkbd_config_common.use_utf8
? Common::UTF8ToUTF16(Common::StringFromFixedZeroTerminatedBuffer(
reinterpret_cast<const char*>(
swkbd_text_check.text_check_message.data()),
swkbd_text_check.text_check_message.size() * sizeof(char16_t)))
: Common::UTF16StringFromFixedZeroTerminatedBuffer(
swkbd_text_check.text_check_message.data(),
swkbd_text_check.text_check_message.size());
} else {
return u"";
}
}();
LOG_INFO(Service_AM, "\nTextCheckResult: {}\nTextCheckMessage: {}",
GetTextCheckResultName(swkbd_text_check.text_check_result),