diff options
| author | 2018-11-17 12:20:16 -0500 | |
|---|---|---|
| committer | 2018-11-18 10:53:47 -0500 | |
| commit | 02e6602baaf36d7c148739eae922fa91ba4818fd (patch) | |
| tree | f7adcf1bc006c6c29c60fd646bebf2f822307a07 /src | |
| parent | applet: Use std::queue instead of std::vector for storage stack (diff) | |
| download | yuzu-02e6602baaf36d7c148739eae922fa91ba4818fd.tar.gz yuzu-02e6602baaf36d7c148739eae922fa91ba4818fd.tar.xz yuzu-02e6602baaf36d7c148739eae922fa91ba4818fd.zip | |
software_keyboard: Push all data over all channels on dialog completion
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/am/applets/software_keyboard.cpp | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp index a5ffa1f31..5661cc98d 100644 --- a/src/core/hle/service/am/applets/software_keyboard.cpp +++ b/src/core/hle/service/am/applets/software_keyboard.cpp | |||
| @@ -97,8 +97,10 @@ void SoftwareKeyboard::ReceiveInteractiveData(std::shared_ptr<IStorage> storage) | |||
| 97 | void SoftwareKeyboard::Execute(AppletStorageProxyFunction out_data, | 97 | void SoftwareKeyboard::Execute(AppletStorageProxyFunction out_data, |
| 98 | AppletStorageProxyFunction out_interactive_data, | 98 | AppletStorageProxyFunction out_interactive_data, |
| 99 | AppletStateProxyFunction state) { | 99 | AppletStateProxyFunction state) { |
| 100 | if (complete) | 100 | if (complete) { |
| 101 | out_data(IStorage{final_data}); | ||
| 101 | return; | 102 | return; |
| 103 | } | ||
| 102 | 104 | ||
| 103 | const auto& frontend{Core::System::GetInstance().GetSoftwareKeyboard()}; | 105 | const auto& frontend{Core::System::GetInstance().GetSoftwareKeyboard()}; |
| 104 | 106 | ||
| @@ -112,32 +114,38 @@ void SoftwareKeyboard::Execute(AppletStorageProxyFunction out_data, | |||
| 112 | } | 114 | } |
| 113 | 115 | ||
| 114 | void SoftwareKeyboard::WriteText(std::optional<std::u16string> text) { | 116 | void SoftwareKeyboard::WriteText(std::optional<std::u16string> text) { |
| 115 | std::vector<u8> output(SWKBD_OUTPUT_BUFFER_SIZE); | 117 | std::vector<u8> output_main(SWKBD_OUTPUT_BUFFER_SIZE); |
| 116 | 118 | ||
| 117 | if (text.has_value()) { | 119 | if (text.has_value()) { |
| 120 | std::vector<u8> output_sub(SWKBD_OUTPUT_BUFFER_SIZE); | ||
| 118 | status = RESULT_SUCCESS; | 121 | status = RESULT_SUCCESS; |
| 119 | if (config.text_check) { | 122 | |
| 120 | const auto size = static_cast<u32>(text->size() * 2 + 4); | 123 | const u64 size = text->size() * 2 + 8; |
| 121 | std::memcpy(output.data(), &size, sizeof(u32)); | 124 | std::memcpy(output_sub.data(), &size, sizeof(u64)); |
| 125 | std::memcpy(output_sub.data() + 8, text->data(), | ||
| 126 | std::min(text->size() * 2, SWKBD_OUTPUT_BUFFER_SIZE - 8)); | ||
| 127 | |||
| 128 | output_main[0] = config.text_check; | ||
| 129 | std::memcpy(output_main.data() + 4, text->data(), | ||
| 130 | std::min(text->size() * 2, SWKBD_OUTPUT_BUFFER_SIZE - 4)); | ||
| 131 | |||
| 132 | complete = !config.text_check; | ||
| 133 | final_data = output_main; | ||
| 134 | |||
| 135 | if (complete) { | ||
| 136 | out_data(IStorage{output_main}); | ||
| 122 | } else { | 137 | } else { |
| 123 | output[0] = 1; | 138 | out_data(IStorage{output_main}); |
| 139 | out_interactive_data(IStorage{output_sub}); | ||
| 124 | } | 140 | } |
| 125 | 141 | ||
| 126 | const auto size = static_cast<u32>(text->size()); | 142 | state(); |
| 127 | std::memcpy(output.data() + 4, &size, sizeof(u32)); | ||
| 128 | std::memcpy(output.data() + 8, text->data(), | ||
| 129 | std::min(text->size() * 2, SWKBD_OUTPUT_BUFFER_SIZE - 8)); | ||
| 130 | } else { | 143 | } else { |
| 131 | status = ResultCode(-1); | 144 | status = ResultCode(-1); |
| 145 | output_main[0] = 1; | ||
| 132 | complete = true; | 146 | complete = true; |
| 133 | out_data(IStorage{output}); | 147 | out_data(IStorage{output_main}); |
| 134 | return; | 148 | state(); |
| 135 | } | 149 | } |
| 136 | |||
| 137 | complete = !config.text_check; | ||
| 138 | |||
| 139 | out_data(IStorage{output}); | ||
| 140 | out_interactive_data(IStorage{output}); | ||
| 141 | state(); | ||
| 142 | } | 150 | } |
| 143 | } // namespace Service::AM::Applets | 151 | } // namespace Service::AM::Applets |