summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/am/applets/software_keyboard.cpp
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-17 04:20:09 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-18 16:53:47 +0100
commit6209fe0c27a5557c20ff6350a94f6e074e0285dc (patch)
tree31157e18ae9d17cac100aac80b371aae6cc84faf /src/core/hle/service/am/applets/software_keyboard.cpp
parentsoftware_keyboard: Make GetText asynchronous (diff)
downloadyuzu-6209fe0c27a5557c20ff6350a94f6e074e0285dc.tar
yuzu-6209fe0c27a5557c20ff6350a94f6e074e0285dc.tar.gz
yuzu-6209fe0c27a5557c20ff6350a94f6e074e0285dc.tar.bz2
yuzu-6209fe0c27a5557c20ff6350a94f6e074e0285dc.tar.lz
yuzu-6209fe0c27a5557c20ff6350a94f6e074e0285dc.tar.xz
yuzu-6209fe0c27a5557c20ff6350a94f6e074e0285dc.tar.zst
yuzu-6209fe0c27a5557c20ff6350a94f6e074e0285dc.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/am/applets/software_keyboard.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp
index 66b34d5ac..bb28a2e8d 100644
--- a/src/core/hle/service/am/applets/software_keyboard.cpp
+++ b/src/core/hle/service/am/applets/software_keyboard.cpp
@@ -69,7 +69,7 @@ bool SoftwareKeyboard::TransactionComplete() const {
}
ResultCode SoftwareKeyboard::GetStatus() const {
- return RESULT_SUCCESS;
+ return status;
}
void SoftwareKeyboard::ReceiveInteractiveData(std::shared_ptr<IStorage> storage) {
@@ -92,7 +92,8 @@ void SoftwareKeyboard::ReceiveInteractiveData(std::shared_ptr<IStorage> storage)
}
void SoftwareKeyboard::Execute(AppletStorageProxyFunction out_data,
- AppletStorageProxyFunction out_interactive_data) {
+ AppletStorageProxyFunction out_interactive_data,
+ AppletStateProxyFunction state) {
if (complete)
return;
@@ -102,6 +103,7 @@ void SoftwareKeyboard::Execute(AppletStorageProxyFunction out_data,
this->out_data = out_data;
this->out_interactive_data = out_interactive_data;
+ this->state = state;
frontend.RequestText([this](std::optional<std::u16string> text) { WriteText(text); },
parameters);
}
@@ -110,6 +112,7 @@ void SoftwareKeyboard::WriteText(std::optional<std::u16string> text) {
std::vector<u8> output(SWKBD_OUTPUT_BUFFER_SIZE);
if (text.has_value()) {
+ status = RESULT_SUCCESS;
if (config.text_check) {
const auto size = static_cast<u32>(text->size() * 2 + 4);
std::memcpy(output.data(), &size, sizeof(u32));
@@ -117,9 +120,12 @@ void SoftwareKeyboard::WriteText(std::optional<std::u16string> text) {
output[0] = 1;
}
- std::memcpy(output.data() + 4, text->data(),
- std::min(text->size() * 2, SWKBD_OUTPUT_BUFFER_SIZE - 4));
+ const auto size = static_cast<u32>(text->size());
+ std::memcpy(output.data() + 4, &size, sizeof(u32));
+ std::memcpy(output.data() + 8, text->data(),
+ std::min(text->size() * 2, SWKBD_OUTPUT_BUFFER_SIZE - 8));
} else {
+ status = ResultCode(-1);
complete = true;
out_data(IStorage{output});
return;
@@ -127,6 +133,8 @@ void SoftwareKeyboard::WriteText(std::optional<std::u16string> text) {
complete = !config.text_check;
- (complete ? out_data : out_interactive_data)(IStorage{output});
+ out_data(IStorage{output});
+ out_interactive_data(IStorage{output});
+ state();
}
} // namespace Service::AM::Applets