summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-17 18:18:03 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-18 16:53:47 +0100
commit19b2571aecfff680c7a414c505eafc26264b6f2f (patch)
tree1f9725a2acbf98647f981496aaf758de1a5008ca
parentsoftware_keyboard: Push buffer size to offset 0x4 in output data (diff)
downloadyuzu-19b2571aecfff680c7a414c505eafc26264b6f2f.tar
yuzu-19b2571aecfff680c7a414c505eafc26264b6f2f.tar.gz
yuzu-19b2571aecfff680c7a414c505eafc26264b6f2f.tar.bz2
yuzu-19b2571aecfff680c7a414c505eafc26264b6f2f.tar.lz
yuzu-19b2571aecfff680c7a414c505eafc26264b6f2f.tar.xz
yuzu-19b2571aecfff680c7a414c505eafc26264b6f2f.tar.zst
yuzu-19b2571aecfff680c7a414c505eafc26264b6f2f.zip
-rw-r--r--src/core/frontend/applets/software_keyboard.cpp4
-rw-r--r--src/core/frontend/applets/software_keyboard.h6
-rw-r--r--src/core/hle/service/am/am.cpp6
-rw-r--r--src/core/hle/service/am/applets/software_keyboard.cpp2
-rw-r--r--src/yuzu/applets/software_keyboard.cpp14
-rw-r--r--src/yuzu/applets/software_keyboard.h5
-rw-r--r--src/yuzu/main.cpp5
-rw-r--r--src/yuzu/main.h1
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(
out(parameters.initial_text);
}
-void DefaultSoftwareKeyboardApplet::SendTextCheckDialog(std::u16string error_message) const {
+void DefaultSoftwareKeyboardApplet::SendTextCheckDialog(
+ std::u16string error_message, std::function<void()> finished_check) const {
LOG_WARNING(Service_AM,
"(STUBBED) called - Default fallback software keyboard does not support text "
"check! (error_message={})",
Common::UTF16ToUTF8(error_message));
+ finished_check();
}
} // 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:
virtual void RequestText(std::function<void(std::optional<std::u16string>)> out,
SoftwareKeyboardParameters parameters) const = 0;
- virtual void SendTextCheckDialog(std::u16string error_message) const = 0;
+ virtual void SendTextCheckDialog(std::u16string error_message,
+ std::function<void()> finished_check) const = 0;
};
class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet {
public:
void RequestText(std::function<void(std::optional<std::u16string>)> out,
SoftwareKeyboardParameters parameters) const override;
- void SendTextCheckDialog(std::u16string error_message) const override;
+ void SendTextCheckDialog(std::u16string error_message,
+ std::function<void()> finished_check) const override;
};
} // 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:
ASSERT(applet != nullptr);
applet->Initialize(storage_stack);
- storage_stack.clear();
- interactive_storage_stack.clear();
+ while (!storage_stack.empty())
+ storage_stack.pop();
+ while (!interactive_storage_stack.empty())
+ interactive_storage_stack.pop();
applet->Execute([this](IStorage storage) { AppletStorageProxyOutData(storage); },
[this](IStorage storage) { AppletStorageProxyOutInteractiveData(storage); },
[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)
std::array<char16_t, SWKBD_OUTPUT_INTERACTIVE_BUFFER_SIZE / 2 - 2> string;
std::memcpy(string.data(), data.data() + 4, string.size() * 2);
frontend.SendTextCheckDialog(
- Common::UTF16StringFromFixedZeroTerminatedBuffer(string.data(), string.size()));
+ Common::UTF16StringFromFixedZeroTerminatedBuffer(string.data(), string.size()), state);
}
}
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 @@
// Refer to the license.txt file included.
#include <algorithm>
+#include <mutex>
#include <QDialogButtonBox>
#include <QFont>
#include <QLabel>
#include <QLineEdit>
#include <QVBoxLayout>
+#include "core/hle/lock.h"
#include "yuzu/applets/software_keyboard.h"
#include "yuzu/main.h"
@@ -122,10 +124,20 @@ void QtSoftwareKeyboard::RequestText(std::function<void(std::optional<std::u16st
emit MainWindowGetText(parameters);
}
-void QtSoftwareKeyboard::SendTextCheckDialog(std::u16string error_message) const {
+void QtSoftwareKeyboard::SendTextCheckDialog(std::u16string error_message,
+ std::function<void()> finished_check) const {
+ this->finished_check = finished_check;
emit MainWindowTextCheckDialog(error_message);
}
void QtSoftwareKeyboard::MainWindowFinishedText(std::optional<std::u16string> text) {
+ // Acquire the HLE mutex
+ std::lock_guard<std::recursive_mutex> lock(HLE::g_hle_lock);
text_output(text);
}
+
+void QtSoftwareKeyboard::MainWindowFinishedCheckDialog() {
+ // Acquire the HLE mutex
+ std::lock_guard<std::recursive_mutex> lock(HLE::g_hle_lock);
+ finished_check();
+}
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:
void RequestText(std::function<void(std::optional<std::u16string>)> out,
Core::Frontend::SoftwareKeyboardParameters parameters) const override;
- void SendTextCheckDialog(std::u16string error_message) const override;
+ void SendTextCheckDialog(std::u16string error_message,
+ std::function<void()> finished_check) const override;
signals:
void MainWindowGetText(Core::Frontend::SoftwareKeyboardParameters parameters) const;
@@ -70,7 +71,9 @@ signals:
public slots:
void MainWindowFinishedText(std::optional<std::u16string> text);
+ void MainWindowFinishedCheckDialog();
private:
mutable std::function<void(std::optional<std::u16string>)> text_output;
+ mutable std::function<void()> finished_check;
};
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(
dialog.setWindowModality(Qt::WindowModal);
dialog.exec();
- if (!dialog.GetStatus())
+ if (!dialog.GetStatus()) {
emit SoftwareKeyboardFinishedText(std::nullopt);
+ return;
+ }
emit SoftwareKeyboardFinishedText(dialog.GetText());
}
void GMainWindow::SoftwareKeyboardInvokeCheckDialog(std::u16string error_message) {
QMessageBox::warning(this, tr("Text Check Failed"), QString::fromStdU16String(error_message));
+ emit SoftwareKeyboardFinishedCheckDialog();
}
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:
void UpdateThemedIcons();
void SoftwareKeyboardFinishedText(std::optional<std::u16string> text);
+ void SoftwareKeyboardFinishedCheckDialog();
public slots:
void SoftwareKeyboardGetText(const Core::Frontend::SoftwareKeyboardParameters& parameters);