summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/am/applets
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-12 17:08:09 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-18 16:53:47 +0100
commit8b433beff34c382e50334bb59c4f71394845558c (patch)
treef52f432b2ee5f4ef3917c1c0e2fa052930d68f3a /src/core/hle/service/am/applets
parentam: Allow applets to push multiple and different channels of data (diff)
downloadyuzu-8b433beff34c382e50334bb59c4f71394845558c.tar
yuzu-8b433beff34c382e50334bb59c4f71394845558c.tar.gz
yuzu-8b433beff34c382e50334bb59c4f71394845558c.tar.bz2
yuzu-8b433beff34c382e50334bb59c4f71394845558c.tar.lz
yuzu-8b433beff34c382e50334bb59c4f71394845558c.tar.xz
yuzu-8b433beff34c382e50334bb59c4f71394845558c.tar.zst
yuzu-8b433beff34c382e50334bb59c4f71394845558c.zip
Diffstat (limited to 'src/core/hle/service/am/applets')
-rw-r--r--src/core/hle/service/am/applets/software_keyboard.cpp19
-rw-r--r--src/core/hle/service/am/applets/software_keyboard.h5
2 files changed, 19 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 7352f3bdf..66b34d5ac 100644
--- a/src/core/hle/service/am/applets/software_keyboard.cpp
+++ b/src/core/hle/service/am/applets/software_keyboard.cpp
@@ -43,6 +43,10 @@ SoftwareKeyboard::SoftwareKeyboard() = default;
SoftwareKeyboard::~SoftwareKeyboard() = default;
void SoftwareKeyboard::Initialize(std::vector<std::shared_ptr<IStorage>> storage_) {
+ complete = false;
+ initial_text.clear();
+ final_data.clear();
+
Applet::Initialize(std::move(storage_));
ASSERT(storage_stack.size() >= 2);
@@ -96,20 +100,25 @@ void SoftwareKeyboard::Execute(AppletStorageProxyFunction out_data,
const auto parameters = ConvertToFrontendParameters(config, initial_text);
- const auto res = frontend.GetText(parameters);
+ this->out_data = out_data;
+ this->out_interactive_data = out_interactive_data;
+ frontend.RequestText([this](std::optional<std::u16string> text) { WriteText(text); },
+ parameters);
+}
+void SoftwareKeyboard::WriteText(std::optional<std::u16string> text) {
std::vector<u8> output(SWKBD_OUTPUT_BUFFER_SIZE);
- if (res.has_value()) {
+ if (text.has_value()) {
if (config.text_check) {
- const auto size = static_cast<u32>(res->size() * 2 + 4);
+ const auto size = static_cast<u32>(text->size() * 2 + 4);
std::memcpy(output.data(), &size, sizeof(u32));
} else {
output[0] = 1;
}
- std::memcpy(output.data() + 4, res->data(),
- std::min(res->size() * 2, SWKBD_OUTPUT_BUFFER_SIZE - 4));
+ std::memcpy(output.data() + 4, text->data(),
+ std::min(text->size() * 2, SWKBD_OUTPUT_BUFFER_SIZE - 4));
} else {
complete = true;
out_data(IStorage{output});
diff --git a/src/core/hle/service/am/applets/software_keyboard.h b/src/core/hle/service/am/applets/software_keyboard.h
index 66de4bc59..b08bff3d7 100644
--- a/src/core/hle/service/am/applets/software_keyboard.h
+++ b/src/core/hle/service/am/applets/software_keyboard.h
@@ -57,11 +57,16 @@ public:
void Execute(AppletStorageProxyFunction out_data,
AppletStorageProxyFunction out_interactive_data) override;
+ void WriteText(std::optional<std::u16string> text);
+
private:
KeyboardConfig config;
std::u16string initial_text;
bool complete = false;
std::vector<u8> final_data;
+
+ AppletStorageProxyFunction out_data;
+ AppletStorageProxyFunction out_interactive_data;
};
} // namespace Service::AM::Applets