diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/am/am.cpp | 30 | ||||
-rw-r--r-- | src/core/hle/service/am/am.h | 12 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/applets.cpp | 24 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/applets.h | 6 |
4 files changed, 29 insertions, 43 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 43c91e521..a3e0df9bf 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -210,8 +210,8 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger RegisterHandlers(functions); auto& kernel = Core::System::GetInstance().Kernel(); - launchable_event = Kernel::WritableEvent::CreateRegisteredEventPair( - kernel, Kernel::ResetType::Sticky, "ISelfController:LaunchableEvent"); + launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Sticky, + "ISelfController:LaunchableEvent"); } ISelfController::~ISelfController() = default; @@ -297,11 +297,11 @@ void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); - launchable_event->Signal(); + launchable_event.writable->Signal(); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(event->second); + rb.PushCopyObjects(launchable_event.readable); void ISelfController::SetScreenShotImageOrientation(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); @@ -349,9 +349,9 @@ void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& c AppletMessageQueue::AppletMessageQueue() { auto& kernel = Core::System::GetInstance().Kernel(); - on_new_message = Kernel::WritableEvent::CreateRegisteredEventPair( - kernel, Kernel::ResetType::Sticky, "AMMessageQueue:OnMessageRecieved"); - on_operation_mode_changed = Kernel::WritableEvent::CreateRegisteredEventPair( + on_new_message = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Sticky, + "AMMessageQueue:OnMessageRecieved"); + on_operation_mode_changed = Kernel::WritableEvent::CreateEventPair( kernel, Kernel::ResetType::OneShot, "AMMessageQueue:OperationModeChanged"); } @@ -359,32 +359,28 @@ AppletMessageQueue::~AppletMessageQueue() = default; const Kernel::SharedPtr<Kernel::ReadableEvent>& AppletMessageQueue::GetMesssageRecieveEvent() const { - const auto& event{ - Core::System::GetInstance().Kernel().FindNamedEvent("AMMessageQueue:OnMessageRecieved")}; - return event->second; + return on_new_message.readable; } const Kernel::SharedPtr<Kernel::ReadableEvent>& AppletMessageQueue::GetOperationModeChangedEvent() const { - const auto& event{ - Core::System::GetInstance().Kernel().FindNamedEvent("AMMessageQueue:OperationModeChanged")}; - return event->second; + return on_operation_mode_changed.readable; } void AppletMessageQueue::PushMessage(AppletMessage msg) { messages.push(msg); - on_new_message->Signal(); + on_new_message.writable->Signal(); } AppletMessageQueue::AppletMessage AppletMessageQueue::PopMessage() { if (messages.empty()) { - on_new_message->Clear(); + on_new_message.writable->Clear(); return AppletMessage::NoMessage; } auto msg = messages.front(); messages.pop(); if (messages.empty()) { - on_new_message->Clear(); + on_new_message.writable->Clear(); } return msg; } @@ -396,7 +392,7 @@ std::size_t AppletMessageQueue::GetMessageCount() const { void AppletMessageQueue::OperationModeChanged() { PushMessage(AppletMessage::OperationModeChanged); PushMessage(AppletMessage::PerformanceModeChanged); - on_operation_mode_changed->Signal(); + on_operation_mode_changed.writable->Signal(); } ICommonStateGetter::ICommonStateGetter(std::shared_ptr<AppletMessageQueue> msg_queue) diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index ef90b0702..34c45fadf 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -6,13 +6,9 @@ #include <memory> #include <queue> +#include "core/hle/kernel/writable_event.h" #include "core/hle/service/service.h" -namespace Kernel { -class ReadableEvent; -class WritableEvent; -} // namespace Kernel - namespace Service { namespace NVFlinger { class NVFlinger; @@ -62,8 +58,8 @@ public: private: std::queue<AppletMessage> messages; - Kernel::SharedPtr<Kernel::WritableEvent> on_new_message; - Kernel::SharedPtr<Kernel::WritableEvent> on_operation_mode_changed; + Kernel::EventPair on_new_message; + Kernel::EventPair on_operation_mode_changed; }; class IWindowController final : public ServiceFramework<IWindowController> { @@ -123,7 +119,7 @@ private: void GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); std::shared_ptr<NVFlinger::NVFlinger> nvflinger; - Kernel::SharedPtr<Kernel::WritableEvent> launchable_event; + Kernel::EventPair launchable_event; u32 idle_time_detection_extension = 0; }; diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp index 494205322..47da35537 100644 --- a/src/core/hle/service/am/applets/applets.cpp +++ b/src/core/hle/service/am/applets/applets.cpp @@ -15,11 +15,11 @@ namespace Service::AM::Applets { AppletDataBroker::AppletDataBroker() { auto& kernel = Core::System::GetInstance().Kernel(); - state_changed_event = Kernel::WritableEvent::CreateRegisteredEventPair( + state_changed_event = Kernel::WritableEvent::CreateEventPair( kernel, Kernel::ResetType::OneShot, "ILibraryAppletAccessor:StateChangedEvent"); - pop_out_data_event = Kernel::WritableEvent::CreateRegisteredEventPair( + pop_out_data_event = Kernel::WritableEvent::CreateEventPair( kernel, Kernel::ResetType::OneShot, "ILibraryAppletAccessor:PopDataOutEvent"); - pop_interactive_out_data_event = Kernel::WritableEvent::CreateRegisteredEventPair( + pop_interactive_out_data_event = Kernel::WritableEvent::CreateEventPair( kernel, Kernel::ResetType::OneShot, "ILibraryAppletAccessor:PopInteractiveDataOutEvent"); } @@ -67,7 +67,7 @@ void AppletDataBroker::PushNormalDataFromGame(IStorage storage) { void AppletDataBroker::PushNormalDataFromApplet(IStorage storage) { out_channel.push(std::make_unique<IStorage>(storage)); - pop_out_data_event->Signal(); + pop_out_data_event.writable->Signal(); } void AppletDataBroker::PushInteractiveDataFromGame(IStorage storage) { @@ -76,29 +76,23 @@ void AppletDataBroker::PushInteractiveDataFromGame(IStorage storage) { void AppletDataBroker::PushInteractiveDataFromApplet(IStorage storage) { out_interactive_channel.push(std::make_unique<IStorage>(storage)); - pop_interactive_out_data_event->Signal(); + pop_interactive_out_data_event.writable->Signal(); } void AppletDataBroker::SignalStateChanged() const { - state_changed_event->Signal(); + state_changed_event.writable->Signal(); } Kernel::SharedPtr<Kernel::ReadableEvent> AppletDataBroker::GetNormalDataEvent() const { - const auto& event{Core::System::GetInstance().Kernel().FindNamedEvent( - "ILibraryAppletAccessor:PopDataOutEvent")}; - return event->second; + return pop_out_data_event.readable; } Kernel::SharedPtr<Kernel::ReadableEvent> AppletDataBroker::GetInteractiveDataEvent() const { - const auto& event{Core::System::GetInstance().Kernel().FindNamedEvent( - "ILibraryAppletAccessor:PopInteractiveDataOutEvent")}; - return event->second; + return pop_interactive_out_data_event.readable; } Kernel::SharedPtr<Kernel::ReadableEvent> AppletDataBroker::GetStateChangedEvent() const { - const auto& event{Core::System::GetInstance().Kernel().FindNamedEvent( - "ILibraryAppletAccessor:StateChangedEvent")}; - return event->second; + return state_changed_event.readable; } Applet::Applet() = default; diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h index 5cd6232cc..3eff471eb 100644 --- a/src/core/hle/service/am/applets/applets.h +++ b/src/core/hle/service/am/applets/applets.h @@ -60,13 +60,13 @@ private: // PopInteractiveDataToGame and PushInteractiveDataFromApplet std::queue<std::unique_ptr<IStorage>> out_interactive_channel; - Kernel::SharedPtr<Kernel::WritableEvent> state_changed_event; + Kernel::EventPair state_changed_event; // Signaled on PushNormalDataFromApplet - Kernel::SharedPtr<Kernel::WritableEvent> pop_out_data_event; + Kernel::EventPair pop_out_data_event; // Signaled on PushInteractiveDataFromApplet - Kernel::SharedPtr<Kernel::WritableEvent> pop_interactive_out_data_event; + Kernel::EventPair pop_interactive_out_data_event; }; class Applet { |