summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/am/applets
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-04-04 09:56:09 +0200
committerbunnei <bunneidev@gmail.com>2021-05-06 01:40:50 +0200
commitaddc0bf0379e075786048921bede6e089552a6db (patch)
tree7fa8819b52db29e1b354410441dd8f2438e2ed4a /src/core/hle/service/am/applets
parenthle: kernel: Migrate KSharedMemory to KAutoObject. (diff)
downloadyuzu-addc0bf0379e075786048921bede6e089552a6db.tar
yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.gz
yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.bz2
yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.lz
yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.xz
yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.zst
yuzu-addc0bf0379e075786048921bede6e089552a6db.zip
Diffstat (limited to 'src/core/hle/service/am/applets')
-rw-r--r--src/core/hle/service/am/applets/applets.cpp34
-rw-r--r--src/core/hle/service/am/applets/applets.h7
2 files changed, 18 insertions, 23 deletions
diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp
index c093813fe..58bff810d 100644
--- a/src/core/hle/service/am/applets/applets.cpp
+++ b/src/core/hle/service/am/applets/applets.cpp
@@ -12,7 +12,6 @@
#include "core/frontend/applets/profile_select.h"
#include "core/frontend/applets/software_keyboard.h"
#include "core/frontend/applets/web_browser.h"
-#include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/k_readable_event.h"
#include "core/hle/kernel/k_writable_event.h"
#include "core/hle/kernel/server_session.h"
@@ -31,16 +30,11 @@
namespace Service::AM::Applets {
AppletDataBroker::AppletDataBroker(Core::System& system_, LibraryAppletMode applet_mode_)
- : system{system_}, applet_mode{applet_mode_} {
- state_changed_event =
- Kernel::KEvent::Create(system.Kernel(), "ILibraryAppletAccessor:StateChangedEvent");
- state_changed_event->Initialize();
- pop_out_data_event =
- Kernel::KEvent::Create(system.Kernel(), "ILibraryAppletAccessor:PopDataOutEvent");
- pop_out_data_event->Initialize();
- pop_interactive_out_data_event = Kernel::KEvent::Create(
- system.Kernel(), "ILibraryAppletAccessor:PopInteractiveDataOutEvent");
- pop_interactive_out_data_event->Initialize();
+ : system{system_}, applet_mode{applet_mode_}, state_changed_event{system.Kernel()},
+ pop_out_data_event{system.Kernel()}, pop_interactive_out_data_event{system.Kernel()} {
+ state_changed_event.Initialize("ILibraryAppletAccessor:StateChangedEvent");
+ pop_out_data_event.Initialize("ILibraryAppletAccessor:PopDataOutEvent");
+ pop_interactive_out_data_event.Initialize("ILibraryAppletAccessor:PopInteractiveDataOutEvent");
}
AppletDataBroker::~AppletDataBroker() = default;
@@ -67,7 +61,7 @@ std::shared_ptr<IStorage> AppletDataBroker::PopNormalDataToGame() {
auto out = std::move(out_channel.front());
out_channel.pop_front();
- pop_out_data_event->GetWritableEvent()->Clear();
+ pop_out_data_event.GetWritableEvent()->Clear();
return out;
}
@@ -86,7 +80,7 @@ std::shared_ptr<IStorage> AppletDataBroker::PopInteractiveDataToGame() {
auto out = std::move(out_interactive_channel.front());
out_interactive_channel.pop_front();
- pop_interactive_out_data_event->GetWritableEvent()->Clear();
+ pop_interactive_out_data_event.GetWritableEvent()->Clear();
return out;
}
@@ -105,7 +99,7 @@ void AppletDataBroker::PushNormalDataFromGame(std::shared_ptr<IStorage>&& storag
void AppletDataBroker::PushNormalDataFromApplet(std::shared_ptr<IStorage>&& storage) {
out_channel.emplace_back(std::move(storage));
- pop_out_data_event->GetWritableEvent()->Signal();
+ pop_out_data_event.GetWritableEvent()->Signal();
}
void AppletDataBroker::PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& storage) {
@@ -114,11 +108,11 @@ void AppletDataBroker::PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& s
void AppletDataBroker::PushInteractiveDataFromApplet(std::shared_ptr<IStorage>&& storage) {
out_interactive_channel.emplace_back(std::move(storage));
- pop_interactive_out_data_event->GetWritableEvent()->Signal();
+ pop_interactive_out_data_event.GetWritableEvent()->Signal();
}
-void AppletDataBroker::SignalStateChanged() const {
- state_changed_event->GetWritableEvent()->Signal();
+void AppletDataBroker::SignalStateChanged() {
+ state_changed_event.GetWritableEvent()->Signal();
switch (applet_mode) {
case LibraryAppletMode::AllForeground:
@@ -143,15 +137,15 @@ void AppletDataBroker::SignalStateChanged() const {
}
Kernel::KReadableEvent* AppletDataBroker::GetNormalDataEvent() const {
- return pop_out_data_event->GetReadableEvent();
+ return pop_out_data_event.GetReadableEvent().get();
}
Kernel::KReadableEvent* AppletDataBroker::GetInteractiveDataEvent() const {
- return pop_interactive_out_data_event->GetReadableEvent();
+ return pop_interactive_out_data_event.GetReadableEvent().get();
}
Kernel::KReadableEvent* AppletDataBroker::GetStateChangedEvent() const {
- return state_changed_event->GetReadableEvent();
+ return state_changed_event.GetReadableEvent().get();
}
Applet::Applet(Core::System& system_, LibraryAppletMode applet_mode_)
diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h
index ffde8ced0..327843a98 100644
--- a/src/core/hle/service/am/applets/applets.h
+++ b/src/core/hle/service/am/applets/applets.h
@@ -8,6 +8,7 @@
#include <queue>
#include "common/swap.h"
+#include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/object.h"
union ResultCode;
@@ -119,13 +120,13 @@ private:
// PopInteractiveDataToGame and PushInteractiveDataFromApplet
std::deque<std::shared_ptr<IStorage>> out_interactive_channel;
- std::shared_ptr<Kernel::KEvent> state_changed_event;
+ Kernel::KEvent state_changed_event;
// Signaled on PushNormalDataFromApplet
- std::shared_ptr<Kernel::KEvent> pop_out_data_event;
+ Kernel::KEvent pop_out_data_event;
// Signaled on PushInteractiveDataFromApplet
- std::shared_ptr<Kernel::KEvent> pop_interactive_out_data_event;
+ Kernel::KEvent pop_interactive_out_data_event;
};
class Applet {