summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/am/applets/applet_software_keyboard.cpp
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2021-11-10 13:42:11 +0100
committerGitHub <noreply@github.com>2021-11-10 13:42:11 +0100
commitbdabd17c765a9f8372e838368e2a7d6567bee052 (patch)
treefc34ff9929b59a913f2c555dcf8067fff5c9e5bf /src/core/hle/service/am/applets/applet_software_keyboard.cpp
parentservice/pctl: Stub EndFreeCommunication (diff)
parentapplets/swkbd: Fix text check message encoding (diff)
downloadyuzu-bdabd17c765a9f8372e838368e2a7d6567bee052.tar
yuzu-bdabd17c765a9f8372e838368e2a7d6567bee052.tar.gz
yuzu-bdabd17c765a9f8372e838368e2a7d6567bee052.tar.bz2
yuzu-bdabd17c765a9f8372e838368e2a7d6567bee052.tar.lz
yuzu-bdabd17c765a9f8372e838368e2a7d6567bee052.tar.xz
yuzu-bdabd17c765a9f8372e838368e2a7d6567bee052.tar.zst
yuzu-bdabd17c765a9f8372e838368e2a7d6567bee052.zip
Diffstat (limited to 'src/core/hle/service/am/applets/applet_software_keyboard.cpp')
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard.cpp42
1 files changed, 28 insertions, 14 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 c89aa1bbf..f38f53f69 100644
--- a/src/core/hle/service/am/applets/applet_software_keyboard.cpp
+++ b/src/core/hle/service/am/applets/applet_software_keyboard.cpp
@@ -109,13 +109,18 @@ void SoftwareKeyboard::Execute() {
ShowNormalKeyboard();
}
-void SoftwareKeyboard::SubmitTextNormal(SwkbdResult result, std::u16string submitted_text) {
+void SoftwareKeyboard::SubmitTextNormal(SwkbdResult result, std::u16string submitted_text,
+ bool confirmed) {
if (complete) {
return;
}
if (swkbd_config_common.use_text_check && result == SwkbdResult::Ok) {
- SubmitForTextCheck(submitted_text);
+ if (confirmed) {
+ SubmitNormalOutputAndExit(result, submitted_text);
+ } else {
+ SubmitForTextCheck(submitted_text);
+ }
} else {
SubmitNormalOutputAndExit(result, submitted_text);
}
@@ -273,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),
@@ -583,11 +596,12 @@ void SoftwareKeyboard::InitializeFrontendKeyboard() {
.disable_cancel_button{disable_cancel_button},
};
- frontend.InitializeKeyboard(false, std::move(initialize_parameters),
- [this](SwkbdResult result, std::u16string submitted_text) {
- SubmitTextNormal(result, submitted_text);
- },
- {});
+ frontend.InitializeKeyboard(
+ false, std::move(initialize_parameters),
+ [this](SwkbdResult result, std::u16string submitted_text, bool confirmed) {
+ SubmitTextNormal(result, submitted_text, confirmed);
+ },
+ {});
}
}