summaryrefslogtreecommitdiffstats
path: root/src/core
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
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')
-rw-r--r--src/core/frontend/applets/software_keyboard.cpp5
-rw-r--r--src/core/frontend/applets/software_keyboard.h6
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard.cpp42
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard.h3
4 files changed, 36 insertions, 20 deletions
diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp
index 12c76c9ee..c4863ee73 100644
--- a/src/core/frontend/applets/software_keyboard.cpp
+++ b/src/core/frontend/applets/software_keyboard.cpp
@@ -16,7 +16,8 @@ DefaultSoftwareKeyboardApplet::~DefaultSoftwareKeyboardApplet() = default;
void DefaultSoftwareKeyboardApplet::InitializeKeyboard(
bool is_inline, KeyboardInitializeParameters initialize_parameters,
- std::function<void(Service::AM::Applets::SwkbdResult, std::u16string)> submit_normal_callback_,
+ std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
+ submit_normal_callback_,
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
submit_inline_callback_) {
if (is_inline) {
@@ -128,7 +129,7 @@ void DefaultSoftwareKeyboardApplet::ExitKeyboard() const {
}
void DefaultSoftwareKeyboardApplet::SubmitNormalText(std::u16string text) const {
- submit_normal_callback(Service::AM::Applets::SwkbdResult::Ok, text);
+ submit_normal_callback(Service::AM::Applets::SwkbdResult::Ok, text, true);
}
void DefaultSoftwareKeyboardApplet::SubmitInlineText(std::u16string_view text) const {
diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h
index 29109306b..490c55cc2 100644
--- a/src/core/frontend/applets/software_keyboard.h
+++ b/src/core/frontend/applets/software_keyboard.h
@@ -57,7 +57,7 @@ public:
virtual void InitializeKeyboard(
bool is_inline, KeyboardInitializeParameters initialize_parameters,
- std::function<void(Service::AM::Applets::SwkbdResult, std::u16string)>
+ std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
submit_normal_callback_,
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
submit_inline_callback_) = 0;
@@ -82,7 +82,7 @@ public:
void InitializeKeyboard(
bool is_inline, KeyboardInitializeParameters initialize_parameters,
- std::function<void(Service::AM::Applets::SwkbdResult, std::u16string)>
+ std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
submit_normal_callback_,
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
submit_inline_callback_) override;
@@ -106,7 +106,7 @@ private:
KeyboardInitializeParameters parameters;
- mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string)>
+ mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
submit_normal_callback;
mutable std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
submit_inline_callback;
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);
+ },
+ {});
}
}
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:
*
* @param result SwkbdResult enum
* @param submitted_text UTF-16 encoded string
+ * @param confirmed Whether the text has been confirmed after TextCheckResult::Confirm
*/
- void SubmitTextNormal(SwkbdResult result, std::u16string submitted_text);
+ void SubmitTextNormal(SwkbdResult result, std::u16string submitted_text, bool confirmed);
/**
* Submits the input text to the application.