VERY experimental Nintendo Switch 2 emulator
C++
applets: Correct usage of SignalStateChanged event This was causing some games (most notably Pokemon Quest) to softlock due to an event being fired when not supposed to. This also removes a hack wherein we were firing the state changed event when the game retrieves it, which is incorrect.
Zach Hilman7a809f935c39
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cppindex 3a7b6da846..f83730cd60 100644--- a/src/core/hle/service/am/am.cpp+++ b/src/core/hle/service/am/am.cpp@@ -565,7 +565,6 @@ private:void GetAppletStateChangedEvent(Kernel::HLERequestContext& ctx) {LOG_DEBUG(Service_AM, "called");- applet->GetBroker().SignalStateChanged();const auto event = applet->GetBroker().GetStateChangedEvent();IPC::ResponseBuilder rb{ctx, 2, 1};diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cppindex 47da355370..7698ca8195 100644--- a/src/core/hle/service/am/applets/applets.cpp+++ b/src/core/hle/service/am/applets/applets.cpp@@ -16,11 +16,11 @@ namespace Service::AM::Applets {AppletDataBroker::AppletDataBroker() {auto& kernel = Core::System::GetInstance().Kernel();state_changed_event = Kernel::WritableEvent::CreateEventPair(- kernel, Kernel::ResetType::OneShot, "ILibraryAppletAccessor:StateChangedEvent");+ kernel, Kernel::ResetType::Sticky, "ILibraryAppletAccessor:StateChangedEvent");pop_out_data_event = Kernel::WritableEvent::CreateEventPair(- kernel, Kernel::ResetType::OneShot, "ILibraryAppletAccessor:PopDataOutEvent");+ kernel, Kernel::ResetType::Sticky, "ILibraryAppletAccessor:PopDataOutEvent");pop_interactive_out_data_event = Kernel::WritableEvent::CreateEventPair(- kernel, Kernel::ResetType::OneShot, "ILibraryAppletAccessor:PopInteractiveDataOutEvent");+ kernel, Kernel::ResetType::Sticky, "ILibraryAppletAccessor:PopInteractiveDataOutEvent");}AppletDataBroker::~AppletDataBroker() = default;diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cppindex 981bdec51f..f255f74b53 100644--- a/src/core/hle/service/am/applets/software_keyboard.cpp+++ b/src/core/hle/service/am/applets/software_keyboard.cpp@@ -146,11 +146,10 @@ void SoftwareKeyboard::WriteText(std::optional<std::u16string> text) {if (complete) {broker.PushNormalDataFromApplet(IStorage{output_main});+ broker.SignalStateChanged();} else {broker.PushInteractiveDataFromApplet(IStorage{output_sub});}-- broker.SignalStateChanged();} else {output_main[0] = 1;complete = true;