From 73b77489846989c8bccf9615ae75658d1ebc6f1d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 20 Nov 2018 12:02:16 -0500 Subject: am/applets: Make the applet data broker part of the applet itself. The accessor should be doing just that, accessing, rather than retaining the lifetime of the data broker as well. --- src/core/hle/service/am/am.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/core/hle/service/am/am.cpp') diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index fd14af1e7..9696db42b 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -532,8 +532,7 @@ void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) { class ILibraryAppletAccessor final : public ServiceFramework { public: explicit ILibraryAppletAccessor(std::shared_ptr applet) - : ServiceFramework("ILibraryAppletAccessor"), applet(std::move(applet)), - broker(std::make_shared()) { + : ServiceFramework("ILibraryAppletAccessor"), applet(std::move(applet)) { // clang-format off static const FunctionInfo functions[] = { {0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"}, @@ -562,7 +561,7 @@ public: private: void GetAppletStateChangedEvent(Kernel::HLERequestContext& ctx) { - const auto event = broker->GetStateChangedEvent(); + const auto event = applet->GetBroker().GetStateChangedEvent(); event->Signal(); IPC::ResponseBuilder rb{ctx, 2, 1}; @@ -590,7 +589,7 @@ private: void Start(Kernel::HLERequestContext& ctx) { ASSERT(applet != nullptr); - applet->Initialize(broker); + applet->Initialize(); applet->Execute(); IPC::ResponseBuilder rb{ctx, 2}; @@ -601,7 +600,7 @@ private: void PushInData(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - broker->PushNormalDataFromGame(*rp.PopIpcInterface()); + applet->GetBroker().PushNormalDataFromGame(*rp.PopIpcInterface()); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); @@ -612,7 +611,7 @@ private: void PopOutData(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - const auto storage = broker->PopNormalDataToGame(); + const auto storage = applet->GetBroker().PopNormalDataToGame(); if (storage == nullptr) { rb.Push(ERR_NO_DATA_IN_CHANNEL); return; @@ -626,7 +625,7 @@ private: void PushInteractiveInData(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - broker->PushInteractiveDataFromGame(*rp.PopIpcInterface()); + applet->GetBroker().PushInteractiveDataFromGame(*rp.PopIpcInterface()); ASSERT(applet->IsInitialized()); applet->ExecuteInteractive(); @@ -641,7 +640,7 @@ private: void PopInteractiveOutData(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - const auto storage = broker->PopInteractiveDataToGame(); + const auto storage = applet->GetBroker().PopInteractiveDataToGame(); if (storage == nullptr) { rb.Push(ERR_NO_DATA_IN_CHANNEL); return; @@ -656,7 +655,7 @@ private: void GetPopOutDataEvent(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(broker->GetNormalDataEvent()); + rb.PushCopyObjects(applet->GetBroker().GetNormalDataEvent()); LOG_DEBUG(Service_AM, "called"); } @@ -664,13 +663,12 @@ private: void GetPopInteractiveOutDataEvent(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(broker->GetInteractiveDataEvent()); + rb.PushCopyObjects(applet->GetBroker().GetInteractiveDataEvent()); LOG_DEBUG(Service_AM, "called"); } std::shared_ptr applet; - std::shared_ptr broker; }; void IStorage::Open(Kernel::HLERequestContext& ctx) { -- cgit v1.2.3