2018-02-02 22:03:40 +01:00
|
|
|
// 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"
|
|
|
|
|
2018-04-20 03:41:44 +02:00
|
|
|
namespace Service::AM {
|
2018-02-02 22:03:40 +01:00
|
|
|
|
|
|
|
class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
|
|
|
|
public:
|
2018-07-19 18:05:48 +02:00
|
|
|
explicit ILibraryAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
|
2018-02-02 22:03:40 +01:00
|
|
|
: ServiceFramework("ILibraryAppletProxy"), nvflinger(std::move(nvflinger)) {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
|
|
|
|
{1, &ILibraryAppletProxy::GetSelfController, "GetSelfController"},
|
|
|
|
{2, &ILibraryAppletProxy::GetWindowController, "GetWindowController"},
|
|
|
|
{3, &ILibraryAppletProxy::GetAudioController, "GetAudioController"},
|
|
|
|
{4, &ILibraryAppletProxy::GetDisplayController, "GetDisplayController"},
|
2018-05-07 17:27:30 +02:00
|
|
|
{10, &ILibraryAppletProxy::GetProcessWindingController, "GetProcessWindingController"},
|
2018-02-02 22:03:40 +01:00
|
|
|
{11, &ILibraryAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
|
|
|
|
{20, &ILibraryAppletProxy::GetApplicationFunctions, "GetApplicationFunctions"},
|
|
|
|
{1000, &ILibraryAppletProxy::GetDebugFunctions, "GetDebugFunctions"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<ICommonStateGetter>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-02-02 22:03:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetSelfController(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<ISelfController>(nvflinger);
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-02-02 22:03:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetWindowController(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IWindowController>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-02-02 22:03:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetAudioController(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IAudioController>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-02-02 22:03:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetDisplayController(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IDisplayController>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-02-02 22:03:40 +01:00
|
|
|
}
|
|
|
|
|
2018-05-07 17:27:30 +02:00
|
|
|
void GetProcessWindingController(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IProcessWindingController>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
2018-02-02 22:03:40 +01:00
|
|
|
void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IDebugFunctions>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-02-02 22:03:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<ILibraryAppletCreator>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-02-02 22:03:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IApplicationFunctions>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-02-02 22:03:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
|
|
|
|
};
|
|
|
|
|
2018-05-07 17:27:30 +02:00
|
|
|
class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
|
|
|
|
public:
|
|
|
|
explicit ISystemAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
|
|
|
|
: ServiceFramework("ISystemAppletProxy"), nvflinger(std::move(nvflinger)) {
|
|
|
|
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"},
|
|
|
|
{1000, &ISystemAppletProxy::GetDebugFunctions, "GetDebugFunctions"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<ICommonStateGetter>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetSelfController(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<ISelfController>(nvflinger);
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetWindowController(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IWindowController>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetAudioController(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IAudioController>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetDisplayController(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IDisplayController>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IDebugFunctions>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<ILibraryAppletCreator>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IHomeMenuFunctions>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetGlobalStateController(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IGlobalStateController>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetApplicationCreator(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IApplicationCreator>();
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
|
|
|
|
};
|
|
|
|
|
|
|
|
void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<ISystemAppletProxy>(nvflinger);
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger);
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-05-07 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
2018-02-02 22:03:40 +01:00
|
|
|
void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger);
|
2018-07-02 18:13:26 +02:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2018-02-02 22:03:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
AppletAE::AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
|
|
|
|
: ServiceFramework("appletAE"), nvflinger(std::move(nvflinger)) {
|
|
|
|
static const FunctionInfo functions[] = {
|
2018-05-07 17:27:30 +02:00
|
|
|
{100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"},
|
2018-02-02 22:03:40 +01:00
|
|
|
{200, &AppletAE::OpenLibraryAppletProxyOld, "OpenLibraryAppletProxyOld"},
|
2018-05-07 17:27:30 +02:00
|
|
|
{201, &AppletAE::OpenLibraryAppletProxy, "OpenLibraryAppletProxy"},
|
2018-02-02 22:03:40 +01:00
|
|
|
{300, nullptr, "OpenOverlayAppletProxy"},
|
|
|
|
{350, nullptr, "OpenSystemApplicationProxy"},
|
|
|
|
{400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
2018-04-20 03:41:44 +02:00
|
|
|
} // namespace Service::AM
|