| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- // Copyright 2018 yuzu emulator team
- // Licensed under GPLv2 or any later version
- // Refer to the license.txt file included.
- #include "common/logging/log.h"
- #include "core/hle/ipc_helpers.h"
- #include "core/hle/service/am/am.h"
- #include "core/hle/service/am/applet_ae.h"
- #include "core/hle/service/nvflinger/nvflinger.h"
- namespace Service::AM {
- class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
- public:
- explicit ILibraryAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,
- std::shared_ptr<AppletMessageQueue> msg_queue)
- : ServiceFramework("ILibraryAppletProxy"), nvflinger(std::move(nvflinger)),
- msg_queue(std::move(msg_queue)) {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
- {1, &ILibraryAppletProxy::GetSelfController, "GetSelfController"},
- {2, &ILibraryAppletProxy::GetWindowController, "GetWindowController"},
- {3, &ILibraryAppletProxy::GetAudioController, "GetAudioController"},
- {4, &ILibraryAppletProxy::GetDisplayController, "GetDisplayController"},
- {10, &ILibraryAppletProxy::GetProcessWindingController, "GetProcessWindingController"},
- {11, &ILibraryAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
- {20, &ILibraryAppletProxy::GetApplicationFunctions, "GetApplicationFunctions"},
- {21, nullptr, "GetAppletCommonFunctions"},
- {1000, &ILibraryAppletProxy::GetDebugFunctions, "GetDebugFunctions"},
- };
- // clang-format on
- RegisterHandlers(functions);
- }
- private:
- void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<ICommonStateGetter>(msg_queue);
- }
- void GetSelfController(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<ISelfController>(nvflinger);
- }
- void GetWindowController(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IWindowController>();
- }
- void GetAudioController(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IAudioController>();
- }
- void GetDisplayController(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IDisplayController>();
- }
- void GetProcessWindingController(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IProcessWindingController>();
- }
- void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IDebugFunctions>();
- }
- void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<ILibraryAppletCreator>();
- }
- void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IApplicationFunctions>();
- }
- std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
- std::shared_ptr<AppletMessageQueue> msg_queue;
- };
- class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
- public:
- explicit ISystemAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,
- std::shared_ptr<AppletMessageQueue> msg_queue)
- : ServiceFramework("ISystemAppletProxy"), nvflinger(std::move(nvflinger)),
- msg_queue(std::move(msg_queue)) {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
- {1, &ISystemAppletProxy::GetSelfController, "GetSelfController"},
- {2, &ISystemAppletProxy::GetWindowController, "GetWindowController"},
- {3, &ISystemAppletProxy::GetAudioController, "GetAudioController"},
- {4, &ISystemAppletProxy::GetDisplayController, "GetDisplayController"},
- {10, nullptr, "GetProcessWindingController"},
- {11, &ISystemAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
- {20, &ISystemAppletProxy::GetHomeMenuFunctions, "GetHomeMenuFunctions"},
- {21, &ISystemAppletProxy::GetGlobalStateController, "GetGlobalStateController"},
- {22, &ISystemAppletProxy::GetApplicationCreator, "GetApplicationCreator"},
- {23, nullptr, "GetAppletCommonFunctions"},
- {1000, &ISystemAppletProxy::GetDebugFunctions, "GetDebugFunctions"},
- };
- // clang-format on
- RegisterHandlers(functions);
- }
- private:
- void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<ICommonStateGetter>(msg_queue);
- }
- void GetSelfController(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<ISelfController>(nvflinger);
- }
- void GetWindowController(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IWindowController>();
- }
- void GetAudioController(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IAudioController>();
- }
- void GetDisplayController(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IDisplayController>();
- }
- void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IDebugFunctions>();
- }
- void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<ILibraryAppletCreator>();
- }
- void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IHomeMenuFunctions>();
- }
- void GetGlobalStateController(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IGlobalStateController>();
- }
- void GetApplicationCreator(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IApplicationCreator>();
- }
- std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
- std::shared_ptr<AppletMessageQueue> msg_queue;
- };
- void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<ISystemAppletProxy>(nvflinger, msg_queue);
- }
- void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue);
- }
- void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue);
- }
- AppletAE::AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,
- std::shared_ptr<AppletMessageQueue> msg_queue)
- : ServiceFramework("appletAE"), nvflinger(std::move(nvflinger)),
- msg_queue(std::move(msg_queue)) {
- // clang-format off
- static const FunctionInfo functions[] = {
- {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"},
- {200, &AppletAE::OpenLibraryAppletProxyOld, "OpenLibraryAppletProxyOld"},
- {201, &AppletAE::OpenLibraryAppletProxy, "OpenLibraryAppletProxy"},
- {300, nullptr, "OpenOverlayAppletProxy"},
- {350, nullptr, "OpenSystemApplicationProxy"},
- {400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"},
- {410, nullptr, "GetSystemAppletControllerForDebug"},
- {1000, nullptr, "GetDebugFunctions"},
- };
- // clang-format on
- RegisterHandlers(functions);
- }
- AppletAE::~AppletAE() = default;
- const std::shared_ptr<AppletMessageQueue>& AppletAE::GetMessageQueue() const {
- return msg_queue;
- }
- } // namespace Service::AM
|