2018-01-13 22:22:39 +01:00
|
|
|
// Copyright 2018 yuzu emulator team
|
2017-10-15 04:50:04 +02:00
|
|
|
// 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"
|
2018-02-02 22:03:40 +01:00
|
|
|
#include "core/hle/service/am/am.h"
|
2017-10-15 04:50:04 +02:00
|
|
|
#include "core/hle/service/am/applet_oe.h"
|
2018-01-22 19:46:36 +01:00
|
|
|
#include "core/hle/service/nvflinger/nvflinger.h"
|
2017-10-15 04:50:04 +02:00
|
|
|
|
2018-04-20 03:41:44 +02:00
|
|
|
namespace Service::AM {
|
2017-10-15 04:50:04 +02:00
|
|
|
|
2017-12-29 06:44:46 +01:00
|
|
|
class IApplicationProxy final : public ServiceFramework<IApplicationProxy> {
|
|
|
|
public:
|
2018-01-22 19:46:36 +01:00
|
|
|
IApplicationProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
|
|
|
|
: ServiceFramework("IApplicationProxy"), nvflinger(std::move(nvflinger)) {
|
2017-12-29 06:44:46 +01:00
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"},
|
|
|
|
{1, &IApplicationProxy::GetSelfController, "GetSelfController"},
|
|
|
|
{2, &IApplicationProxy::GetWindowController, "GetWindowController"},
|
|
|
|
{3, &IApplicationProxy::GetAudioController, "GetAudioController"},
|
|
|
|
{4, &IApplicationProxy::GetDisplayController, "GetDisplayController"},
|
2018-04-10 17:41:17 +02:00
|
|
|
{10, nullptr, "GetProcessWindingController"},
|
2017-12-29 06:44:46 +01:00
|
|
|
{11, &IApplicationProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
|
|
|
|
{20, &IApplicationProxy::GetApplicationFunctions, "GetApplicationFunctions"},
|
|
|
|
{1000, &IApplicationProxy::GetDebugFunctions, "GetDebugFunctions"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void GetAudioController(Kernel::HLERequestContext& ctx) {
|
2018-01-24 01:52:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2018-01-07 16:02:48 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<IAudioController>();
|
2018-02-04 22:58:12 +01:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetDisplayController(Kernel::HLERequestContext& ctx) {
|
2018-01-24 01:52:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2018-01-07 16:02:48 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<IDisplayController>();
|
2018-02-04 22:58:12 +01:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
|
2018-01-24 01:52:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2018-01-07 16:02:48 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<IDebugFunctions>();
|
2018-02-04 22:58:12 +01:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetWindowController(Kernel::HLERequestContext& ctx) {
|
2018-01-24 01:52:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2018-01-07 16:02:48 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<IWindowController>();
|
2018-02-04 22:58:12 +01:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetSelfController(Kernel::HLERequestContext& ctx) {
|
2018-01-24 01:52:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2018-01-07 16:02:48 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-22 19:46:36 +01:00
|
|
|
rb.PushIpcInterface<ISelfController>(nvflinger);
|
2018-02-04 22:58:12 +01:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
|
2018-01-24 01:52:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2018-01-07 16:02:48 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<ICommonStateGetter>();
|
2018-02-04 22:58:12 +01:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
|
2018-01-24 01:52:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2018-01-07 16:02:48 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<ILibraryAppletCreator>();
|
2018-02-04 22:58:12 +01:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
|
2018-01-24 01:52:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2018-01-07 16:02:48 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<IApplicationFunctions>();
|
2018-02-04 22:58:12 +01:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
2018-01-22 19:46:36 +01:00
|
|
|
|
|
|
|
std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
|
2017-12-29 06:44:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) {
|
2018-01-24 01:52:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2018-01-07 16:02:48 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-22 19:46:36 +01:00
|
|
|
rb.PushIpcInterface<IApplicationProxy>(nvflinger);
|
2018-02-04 22:58:12 +01:00
|
|
|
LOG_DEBUG(Service_AM, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
2018-01-22 19:46:36 +01:00
|
|
|
AppletOE::AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
|
|
|
|
: ServiceFramework("appletOE"), nvflinger(std::move(nvflinger)) {
|
2017-10-15 04:50:04 +02:00
|
|
|
static const FunctionInfo functions[] = {
|
2017-12-29 06:44:46 +01:00
|
|
|
{0x00000000, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"},
|
2017-10-15 04:50:04 +02:00
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
2018-04-20 03:41:44 +02:00
|
|
|
} // namespace Service::AM
|