diff options
-rw-r--r-- | src/core/hle/service/am/applets/applet_software_keyboard.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.cpp b/src/core/hle/service/am/applets/applet_software_keyboard.cpp index 1f21cee91..f38f53f69 100644 --- a/src/core/hle/service/am/applets/applet_software_keyboard.cpp +++ b/src/core/hle/service/am/applets/applet_software_keyboard.cpp @@ -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), |