diff options
| -rw-r--r-- | src/core/frontend/applets/software_keyboard.cpp | 4 | ||||
| -rw-r--r-- | src/core/frontend/applets/software_keyboard.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/software_keyboard.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/applets/software_keyboard.cpp | 14 | ||||
| -rw-r--r-- | src/yuzu/applets/software_keyboard.h | 5 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 5 | ||||
| -rw-r--r-- | src/yuzu/main.h | 1 |
8 files changed, 34 insertions, 9 deletions
diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp index 4105101b3..856ed33da 100644 --- a/src/core/frontend/applets/software_keyboard.cpp +++ b/src/core/frontend/applets/software_keyboard.cpp | |||
| @@ -18,10 +18,12 @@ void DefaultSoftwareKeyboardApplet::RequestText( | |||
| 18 | out(parameters.initial_text); | 18 | out(parameters.initial_text); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | void DefaultSoftwareKeyboardApplet::SendTextCheckDialog(std::u16string error_message) const { | 21 | void DefaultSoftwareKeyboardApplet::SendTextCheckDialog( |
| 22 | std::u16string error_message, std::function<void()> finished_check) const { | ||
| 22 | LOG_WARNING(Service_AM, | 23 | LOG_WARNING(Service_AM, |
| 23 | "(STUBBED) called - Default fallback software keyboard does not support text " | 24 | "(STUBBED) called - Default fallback software keyboard does not support text " |
| 24 | "check! (error_message={})", | 25 | "check! (error_message={})", |
| 25 | Common::UTF16ToUTF8(error_message)); | 26 | Common::UTF16ToUTF8(error_message)); |
| 27 | finished_check(); | ||
| 26 | } | 28 | } |
| 27 | } // namespace Core::Frontend | 29 | } // namespace Core::Frontend |
diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h index 5420ea883..f9b202664 100644 --- a/src/core/frontend/applets/software_keyboard.h +++ b/src/core/frontend/applets/software_keyboard.h | |||
| @@ -39,14 +39,16 @@ public: | |||
| 39 | 39 | ||
| 40 | virtual void RequestText(std::function<void(std::optional<std::u16string>)> out, | 40 | virtual void RequestText(std::function<void(std::optional<std::u16string>)> out, |
| 41 | SoftwareKeyboardParameters parameters) const = 0; | 41 | SoftwareKeyboardParameters parameters) const = 0; |
| 42 | virtual void SendTextCheckDialog(std::u16string error_message) const = 0; | 42 | virtual void SendTextCheckDialog(std::u16string error_message, |
| 43 | std::function<void()> finished_check) const = 0; | ||
| 43 | }; | 44 | }; |
| 44 | 45 | ||
| 45 | class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet { | 46 | class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet { |
| 46 | public: | 47 | public: |
| 47 | void RequestText(std::function<void(std::optional<std::u16string>)> out, | 48 | void RequestText(std::function<void(std::optional<std::u16string>)> out, |
| 48 | SoftwareKeyboardParameters parameters) const override; | 49 | SoftwareKeyboardParameters parameters) const override; |
| 49 | void SendTextCheckDialog(std::u16string error_message) const override; | 50 | void SendTextCheckDialog(std::u16string error_message, |
| 51 | std::function<void()> finished_check) const override; | ||
| 50 | }; | 52 | }; |
| 51 | 53 | ||
| 52 | } // namespace Core::Frontend | 54 | } // namespace Core::Frontend |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 470253ef1..5cbcb8d91 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -605,8 +605,10 @@ private: | |||
| 605 | ASSERT(applet != nullptr); | 605 | ASSERT(applet != nullptr); |
| 606 | 606 | ||
| 607 | applet->Initialize(storage_stack); | 607 | applet->Initialize(storage_stack); |
| 608 | storage_stack.clear(); | 608 | while (!storage_stack.empty()) |
| 609 | interactive_storage_stack.clear(); | 609 | storage_stack.pop(); |
| 610 | while (!interactive_storage_stack.empty()) | ||
| 611 | interactive_storage_stack.pop(); | ||
| 610 | applet->Execute([this](IStorage storage) { AppletStorageProxyOutData(storage); }, | 612 | applet->Execute([this](IStorage storage) { AppletStorageProxyOutData(storage); }, |
| 611 | [this](IStorage storage) { AppletStorageProxyOutInteractiveData(storage); }, | 613 | [this](IStorage storage) { AppletStorageProxyOutInteractiveData(storage); }, |
| 612 | [this] { state_changed_event->Signal(); }); | 614 | [this] { state_changed_event->Signal(); }); |
diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp index bb28a2e8d..039bfcc0f 100644 --- a/src/core/hle/service/am/applets/software_keyboard.cpp +++ b/src/core/hle/service/am/applets/software_keyboard.cpp | |||
| @@ -87,7 +87,7 @@ void SoftwareKeyboard::ReceiveInteractiveData(std::shared_ptr<IStorage> storage) | |||
| 87 | std::array<char16_t, SWKBD_OUTPUT_INTERACTIVE_BUFFER_SIZE / 2 - 2> string; | 87 | std::array<char16_t, SWKBD_OUTPUT_INTERACTIVE_BUFFER_SIZE / 2 - 2> string; |
| 88 | std::memcpy(string.data(), data.data() + 4, string.size() * 2); | 88 | std::memcpy(string.data(), data.data() + 4, string.size() * 2); |
| 89 | frontend.SendTextCheckDialog( | 89 | frontend.SendTextCheckDialog( |
| 90 | Common::UTF16StringFromFixedZeroTerminatedBuffer(string.data(), string.size())); | 90 | Common::UTF16StringFromFixedZeroTerminatedBuffer(string.data(), string.size()), state); |
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | 93 | ||
diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/software_keyboard.cpp index 9fb179f5c..83b9c320b 100644 --- a/src/yuzu/applets/software_keyboard.cpp +++ b/src/yuzu/applets/software_keyboard.cpp | |||
| @@ -3,11 +3,13 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <mutex> | ||
| 6 | #include <QDialogButtonBox> | 7 | #include <QDialogButtonBox> |
| 7 | #include <QFont> | 8 | #include <QFont> |
| 8 | #include <QLabel> | 9 | #include <QLabel> |
| 9 | #include <QLineEdit> | 10 | #include <QLineEdit> |
| 10 | #include <QVBoxLayout> | 11 | #include <QVBoxLayout> |
| 12 | #include "core/hle/lock.h" | ||
| 11 | #include "yuzu/applets/software_keyboard.h" | 13 | #include "yuzu/applets/software_keyboard.h" |
| 12 | #include "yuzu/main.h" | 14 | #include "yuzu/main.h" |
| 13 | 15 | ||
| @@ -122,10 +124,20 @@ void QtSoftwareKeyboard::RequestText(std::function<void(std::optional<std::u16st | |||
| 122 | emit MainWindowGetText(parameters); | 124 | emit MainWindowGetText(parameters); |
| 123 | } | 125 | } |
| 124 | 126 | ||
| 125 | void QtSoftwareKeyboard::SendTextCheckDialog(std::u16string error_message) const { | 127 | void QtSoftwareKeyboard::SendTextCheckDialog(std::u16string error_message, |
| 128 | std::function<void()> finished_check) const { | ||
| 129 | this->finished_check = finished_check; | ||
| 126 | emit MainWindowTextCheckDialog(error_message); | 130 | emit MainWindowTextCheckDialog(error_message); |
| 127 | } | 131 | } |
| 128 | 132 | ||
| 129 | void QtSoftwareKeyboard::MainWindowFinishedText(std::optional<std::u16string> text) { | 133 | void QtSoftwareKeyboard::MainWindowFinishedText(std::optional<std::u16string> text) { |
| 134 | // Acquire the HLE mutex | ||
| 135 | std::lock_guard<std::recursive_mutex> lock(HLE::g_hle_lock); | ||
| 130 | text_output(text); | 136 | text_output(text); |
| 131 | } | 137 | } |
| 138 | |||
| 139 | void QtSoftwareKeyboard::MainWindowFinishedCheckDialog() { | ||
| 140 | // Acquire the HLE mutex | ||
| 141 | std::lock_guard<std::recursive_mutex> lock(HLE::g_hle_lock); | ||
| 142 | finished_check(); | ||
| 143 | } | ||
diff --git a/src/yuzu/applets/software_keyboard.h b/src/yuzu/applets/software_keyboard.h index 670b05dc9..8d56f5db2 100644 --- a/src/yuzu/applets/software_keyboard.h +++ b/src/yuzu/applets/software_keyboard.h | |||
| @@ -62,7 +62,8 @@ public: | |||
| 62 | 62 | ||
| 63 | void RequestText(std::function<void(std::optional<std::u16string>)> out, | 63 | void RequestText(std::function<void(std::optional<std::u16string>)> out, |
| 64 | Core::Frontend::SoftwareKeyboardParameters parameters) const override; | 64 | Core::Frontend::SoftwareKeyboardParameters parameters) const override; |
| 65 | void SendTextCheckDialog(std::u16string error_message) const override; | 65 | void SendTextCheckDialog(std::u16string error_message, |
| 66 | std::function<void()> finished_check) const override; | ||
| 66 | 67 | ||
| 67 | signals: | 68 | signals: |
| 68 | void MainWindowGetText(Core::Frontend::SoftwareKeyboardParameters parameters) const; | 69 | void MainWindowGetText(Core::Frontend::SoftwareKeyboardParameters parameters) const; |
| @@ -70,7 +71,9 @@ signals: | |||
| 70 | 71 | ||
| 71 | public slots: | 72 | public slots: |
| 72 | void MainWindowFinishedText(std::optional<std::u16string> text); | 73 | void MainWindowFinishedText(std::optional<std::u16string> text); |
| 74 | void MainWindowFinishedCheckDialog(); | ||
| 73 | 75 | ||
| 74 | private: | 76 | private: |
| 75 | mutable std::function<void(std::optional<std::u16string>)> text_output; | 77 | mutable std::function<void(std::optional<std::u16string>)> text_output; |
| 78 | mutable std::function<void()> finished_check; | ||
| 76 | }; | 79 | }; |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 28c53cc87..4262bd0eb 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -215,14 +215,17 @@ void GMainWindow::SoftwareKeyboardGetText( | |||
| 215 | dialog.setWindowModality(Qt::WindowModal); | 215 | dialog.setWindowModality(Qt::WindowModal); |
| 216 | dialog.exec(); | 216 | dialog.exec(); |
| 217 | 217 | ||
| 218 | if (!dialog.GetStatus()) | 218 | if (!dialog.GetStatus()) { |
| 219 | emit SoftwareKeyboardFinishedText(std::nullopt); | 219 | emit SoftwareKeyboardFinishedText(std::nullopt); |
| 220 | return; | ||
| 221 | } | ||
| 220 | 222 | ||
| 221 | emit SoftwareKeyboardFinishedText(dialog.GetText()); | 223 | emit SoftwareKeyboardFinishedText(dialog.GetText()); |
| 222 | } | 224 | } |
| 223 | 225 | ||
| 224 | void GMainWindow::SoftwareKeyboardInvokeCheckDialog(std::u16string error_message) { | 226 | void GMainWindow::SoftwareKeyboardInvokeCheckDialog(std::u16string error_message) { |
| 225 | QMessageBox::warning(this, tr("Text Check Failed"), QString::fromStdU16String(error_message)); | 227 | QMessageBox::warning(this, tr("Text Check Failed"), QString::fromStdU16String(error_message)); |
| 228 | emit SoftwareKeyboardFinishedCheckDialog(); | ||
| 226 | } | 229 | } |
| 227 | 230 | ||
| 228 | void GMainWindow::InitializeWidgets() { | 231 | void GMainWindow::InitializeWidgets() { |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index d83169805..674e73412 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -100,6 +100,7 @@ signals: | |||
| 100 | void UpdateThemedIcons(); | 100 | void UpdateThemedIcons(); |
| 101 | 101 | ||
| 102 | void SoftwareKeyboardFinishedText(std::optional<std::u16string> text); | 102 | void SoftwareKeyboardFinishedText(std::optional<std::u16string> text); |
| 103 | void SoftwareKeyboardFinishedCheckDialog(); | ||
| 103 | 104 | ||
| 104 | public slots: | 105 | public slots: |
| 105 | void SoftwareKeyboardGetText(const Core::Frontend::SoftwareKeyboardParameters& parameters); | 106 | void SoftwareKeyboardGetText(const Core::Frontend::SoftwareKeyboardParameters& parameters); |