diff options
author | Liam <byteslice@airmail.cc> | 2024-01-03 00:29:03 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-01-30 02:17:33 +0100 |
commit | 182137a9a4b09c8188d2cbffa312550c5dc83641 (patch) | |
tree | af62d2ecf774e7790c227cb0984e5392deca5afe /src/core/hle/service/am/applet_ae.cpp | |
parent | am: retrieve main applet creation info from frontend (diff) | |
download | yuzu-182137a9a4b09c8188d2cbffa312550c5dc83641.tar yuzu-182137a9a4b09c8188d2cbffa312550c5dc83641.tar.gz yuzu-182137a9a4b09c8188d2cbffa312550c5dc83641.tar.bz2 yuzu-182137a9a4b09c8188d2cbffa312550c5dc83641.tar.lz yuzu-182137a9a4b09c8188d2cbffa312550c5dc83641.tar.xz yuzu-182137a9a4b09c8188d2cbffa312550c5dc83641.tar.zst yuzu-182137a9a4b09c8188d2cbffa312550c5dc83641.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/am/applet_ae.cpp | 72 |
1 files changed, 42 insertions, 30 deletions
diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp index bd9e5f505..1b715dea6 100644 --- a/src/core/hle/service/am/applet_ae.cpp +++ b/src/core/hle/service/am/applet_ae.cpp @@ -2,40 +2,15 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/service/am/applet_ae.h" +#include "core/hle/service/am/applet_manager.h" #include "core/hle/service/am/library_applet_proxy.h" #include "core/hle/service/am/system_applet_proxy.h" #include "core/hle/service/ipc_helpers.h" namespace Service::AM { -void AppletAE::OpenSystemAppletProxy(HLERequestContext& ctx) { - LOG_DEBUG(Service_AM, "called"); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface<ISystemAppletProxy>(nvnflinger, msg_queue, system); -} - -void AppletAE::OpenLibraryAppletProxy(HLERequestContext& ctx) { - LOG_DEBUG(Service_AM, "called"); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface<ILibraryAppletProxy>(nvnflinger, msg_queue, system); -} - -void AppletAE::OpenLibraryAppletProxyOld(HLERequestContext& ctx) { - LOG_DEBUG(Service_AM, "called"); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface<ILibraryAppletProxy>(nvnflinger, msg_queue, system); -} - -AppletAE::AppletAE(Nvnflinger::Nvnflinger& nvnflinger_, - std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_) - : ServiceFramework{system_, "appletAE"}, nvnflinger{nvnflinger_}, - msg_queue{std::move(msg_queue_)} { +AppletAE::AppletAE(Nvnflinger::Nvnflinger& nvnflinger_, Core::System& system_) + : ServiceFramework{system_, "appletAE"}, nvnflinger{nvnflinger_} { // clang-format off static const FunctionInfo functions[] = { {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"}, @@ -54,8 +29,45 @@ AppletAE::AppletAE(Nvnflinger::Nvnflinger& nvnflinger_, AppletAE::~AppletAE() = default; -const std::shared_ptr<AppletMessageQueue>& AppletAE::GetMessageQueue() const { - return msg_queue; +void AppletAE::OpenSystemAppletProxy(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + if (const auto applet = GetAppletFromContext(ctx)) { + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface<ISystemAppletProxy>(nvnflinger, applet, system); + } else { + UNIMPLEMENTED(); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultUnknown); + } +} + +void AppletAE::OpenLibraryAppletProxy(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + if (const auto applet = GetAppletFromContext(ctx)) { + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface<ILibraryAppletProxy>(nvnflinger, applet, system); + } else { + UNIMPLEMENTED(); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultUnknown); + } +} + +void AppletAE::OpenLibraryAppletProxyOld(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + return OpenLibraryAppletProxy(ctx); +} + +std::shared_ptr<Applet> AppletAE::GetAppletFromContext(HLERequestContext& ctx) { + const auto aruid = ctx.GetPID(); + return system.GetAppletManager().GetByAppletResourceUserId(aruid); } } // namespace Service::AM |