diff options
| author | 2021-11-10 13:42:11 +0100 | |
|---|---|---|
| committer | 2021-11-10 13:42:11 +0100 | |
| commit | bdabd17c765a9f8372e838368e2a7d6567bee052 (patch) | |
| tree | fc34ff9929b59a913f2c555dcf8067fff5c9e5bf /src/core/hle | |
| parent | service/pctl: Stub EndFreeCommunication (diff) | |
| parent | applets/swkbd: Fix text check message encoding (diff) | |
| download | yuzu-bdabd17c765a9f8372e838368e2a7d6567bee052.tar.gz yuzu-bdabd17c765a9f8372e838368e2a7d6567bee052.tar.xz yuzu-bdabd17c765a9f8372e838368e2a7d6567bee052.zip | |
Merge pull request #7303 from Morph1984/swkbd-confirm-skip-textcheck
applets/swkbd: Skip text checking if the text has been confirmed
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/am/applets/applet_software_keyboard.cpp | 42 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/applet_software_keyboard.h | 3 |
2 files changed, 30 insertions, 15 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() { | |||
| 109 | ShowNormalKeyboard(); | 109 | ShowNormalKeyboard(); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | void SoftwareKeyboard::SubmitTextNormal(SwkbdResult result, std::u16string submitted_text) { | 112 | void SoftwareKeyboard::SubmitTextNormal(SwkbdResult result, std::u16string submitted_text, |
| 113 | bool confirmed) { | ||
| 113 | if (complete) { | 114 | if (complete) { |
| 114 | return; | 115 | return; |
| 115 | } | 116 | } |
| 116 | 117 | ||
| 117 | if (swkbd_config_common.use_text_check && result == SwkbdResult::Ok) { | 118 | if (swkbd_config_common.use_text_check && result == SwkbdResult::Ok) { |
| 118 | SubmitForTextCheck(submitted_text); | 119 | if (confirmed) { |
| 120 | SubmitNormalOutputAndExit(result, submitted_text); | ||
| 121 | } else { | ||
| 122 | SubmitForTextCheck(submitted_text); | ||
| 123 | } | ||
| 119 | } else { | 124 | } else { |
| 120 | SubmitNormalOutputAndExit(result, submitted_text); | 125 | SubmitNormalOutputAndExit(result, submitted_text); |
| 121 | } | 126 | } |
| @@ -273,13 +278,21 @@ void SoftwareKeyboard::ProcessTextCheck() { | |||
| 273 | 278 | ||
| 274 | std::memcpy(&swkbd_text_check, text_check_data.data(), sizeof(SwkbdTextCheck)); | 279 | std::memcpy(&swkbd_text_check, text_check_data.data(), sizeof(SwkbdTextCheck)); |
| 275 | 280 | ||
| 276 | std::u16string text_check_message = | 281 | std::u16string text_check_message = [this, &swkbd_text_check]() -> std::u16string { |
| 277 | swkbd_text_check.text_check_result == SwkbdTextCheckResult::Failure || | 282 | if (swkbd_text_check.text_check_result == SwkbdTextCheckResult::Failure || |
| 278 | swkbd_text_check.text_check_result == SwkbdTextCheckResult::Confirm | 283 | swkbd_text_check.text_check_result == SwkbdTextCheckResult::Confirm) { |
| 279 | ? Common::UTF16StringFromFixedZeroTerminatedBuffer( | 284 | return swkbd_config_common.use_utf8 |
| 280 | swkbd_text_check.text_check_message.data(), | 285 | ? Common::UTF8ToUTF16(Common::StringFromFixedZeroTerminatedBuffer( |
| 281 | swkbd_text_check.text_check_message.size()) | 286 | reinterpret_cast<const char*>( |
| 282 | : u""; | 287 | swkbd_text_check.text_check_message.data()), |
| 288 | swkbd_text_check.text_check_message.size() * sizeof(char16_t))) | ||
| 289 | : Common::UTF16StringFromFixedZeroTerminatedBuffer( | ||
| 290 | swkbd_text_check.text_check_message.data(), | ||
| 291 | swkbd_text_check.text_check_message.size()); | ||
| 292 | } else { | ||
| 293 | return u""; | ||
| 294 | } | ||
| 295 | }(); | ||
| 283 | 296 | ||
| 284 | LOG_INFO(Service_AM, "\nTextCheckResult: {}\nTextCheckMessage: {}", | 297 | LOG_INFO(Service_AM, "\nTextCheckResult: {}\nTextCheckMessage: {}", |
| 285 | GetTextCheckResultName(swkbd_text_check.text_check_result), | 298 | GetTextCheckResultName(swkbd_text_check.text_check_result), |
| @@ -583,11 +596,12 @@ void SoftwareKeyboard::InitializeFrontendKeyboard() { | |||
| 583 | .disable_cancel_button{disable_cancel_button}, | 596 | .disable_cancel_button{disable_cancel_button}, |
| 584 | }; | 597 | }; |
| 585 | 598 | ||
| 586 | frontend.InitializeKeyboard(false, std::move(initialize_parameters), | 599 | frontend.InitializeKeyboard( |
| 587 | [this](SwkbdResult result, std::u16string submitted_text) { | 600 | false, std::move(initialize_parameters), |
| 588 | SubmitTextNormal(result, submitted_text); | 601 | [this](SwkbdResult result, std::u16string submitted_text, bool confirmed) { |
| 589 | }, | 602 | SubmitTextNormal(result, submitted_text, confirmed); |
| 590 | {}); | 603 | }, |
| 604 | {}); | ||
| 591 | } | 605 | } |
| 592 | } | 606 | } |
| 593 | 607 | ||
diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.h b/src/core/hle/service/am/applets/applet_software_keyboard.h index 6009c10c7..a0fddd965 100644 --- a/src/core/hle/service/am/applets/applet_software_keyboard.h +++ b/src/core/hle/service/am/applets/applet_software_keyboard.h | |||
| @@ -36,8 +36,9 @@ public: | |||
| 36 | * | 36 | * |
| 37 | * @param result SwkbdResult enum | 37 | * @param result SwkbdResult enum |
| 38 | * @param submitted_text UTF-16 encoded string | 38 | * @param submitted_text UTF-16 encoded string |
| 39 | * @param confirmed Whether the text has been confirmed after TextCheckResult::Confirm | ||
| 39 | */ | 40 | */ |
| 40 | void SubmitTextNormal(SwkbdResult result, std::u16string submitted_text); | 41 | void SubmitTextNormal(SwkbdResult result, std::u16string submitted_text, bool confirmed); |
| 41 | 42 | ||
| 42 | /** | 43 | /** |
| 43 | * Submits the input text to the application. | 44 | * Submits the input text to the application. |