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"
|
2017-12-29 06:44:46 +01:00
|
|
|
#include "core/hle/kernel/event.h"
|
2017-10-15 04:50:04 +02:00
|
|
|
#include "core/hle/service/am/applet_oe.h"
|
2018-01-15 23:19:32 +01:00
|
|
|
#include "core/hle/service/apm/apm.h"
|
2018-01-22 19:46:36 +01:00
|
|
|
#include "core/hle/service/nvflinger/nvflinger.h"
|
2017-10-15 04:50:04 +02:00
|
|
|
|
|
|
|
namespace Service {
|
|
|
|
namespace AM {
|
|
|
|
|
2017-12-29 06:44:46 +01:00
|
|
|
class IWindowController final : public ServiceFramework<IWindowController> {
|
|
|
|
public:
|
|
|
|
IWindowController() : ServiceFramework("IWindowController") {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{1, &IWindowController::GetAppletResourceUserId, "GetAppletResourceUserId"},
|
|
|
|
{10, &IWindowController::AcquireForegroundRights, "AcquireForegroundRights"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void GetAppletResourceUserId(Kernel::HLERequestContext& ctx) {
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
2018-01-07 16:02:48 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 4};
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u64>(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AcquireForegroundRights(Kernel::HLERequestContext& ctx) {
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
2018-01-07 16:02:48 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class IAudioController final : public ServiceFramework<IAudioController> {
|
|
|
|
public:
|
|
|
|
IAudioController() : ServiceFramework("IAudioController") {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class IDisplayController final : public ServiceFramework<IDisplayController> {
|
|
|
|
public:
|
|
|
|
IDisplayController() : ServiceFramework("IDisplayController") {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class IDebugFunctions final : public ServiceFramework<IDebugFunctions> {
|
|
|
|
public:
|
|
|
|
IDebugFunctions() : ServiceFramework("IDebugFunctions") {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class ISelfController final : public ServiceFramework<ISelfController> {
|
|
|
|
public:
|
2018-01-22 19:46:36 +01:00
|
|
|
ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
|
|
|
|
: ServiceFramework("ISelfController"), nvflinger(std::move(nvflinger)) {
|
2018-01-15 20:41:06 +01:00
|
|
|
static const FunctionInfo functions[] = {
|
2018-01-19 21:09:50 +01:00
|
|
|
{1, &ISelfController::LockExit, "LockExit"},
|
|
|
|
{2, &ISelfController::UnlockExit, "UnlockExit"},
|
2018-01-16 23:18:18 +01:00
|
|
|
{11, &ISelfController::SetOperationModeChangedNotification,
|
|
|
|
"SetOperationModeChangedNotification"},
|
|
|
|
{12, &ISelfController::SetPerformanceModeChangedNotification,
|
|
|
|
"SetPerformanceModeChangedNotification"},
|
2018-01-15 20:41:06 +01:00
|
|
|
{13, &ISelfController::SetFocusHandlingMode, "SetFocusHandlingMode"},
|
2018-01-16 23:18:18 +01:00
|
|
|
{14, &ISelfController::SetRestartMessageEnabled, "SetRestartMessageEnabled"},
|
|
|
|
{16, &ISelfController::SetOutOfFocusSuspendingEnabled,
|
|
|
|
"SetOutOfFocusSuspendingEnabled"},
|
2018-01-22 19:50:22 +01:00
|
|
|
{40, &ISelfController::CreateManagedDisplayLayer, "CreateManagedDisplayLayer"},
|
2018-01-15 20:41:06 +01:00
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void SetFocusHandlingMode(Kernel::HLERequestContext& ctx) {
|
|
|
|
// Takes 3 input u8s with each field located immediately after the previous u8, these are
|
|
|
|
// bool flags. No output.
|
|
|
|
|
2018-01-15 21:43:46 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
|
|
|
|
struct FocusHandlingModeParams {
|
|
|
|
u8 unknown0;
|
|
|
|
u8 unknown1;
|
|
|
|
u8 unknown2;
|
|
|
|
};
|
|
|
|
auto flags = rp.PopRaw<FocusHandlingModeParams>();
|
|
|
|
|
2018-01-15 20:41:06 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
2018-01-16 23:18:18 +01:00
|
|
|
|
|
|
|
void SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) {
|
2018-01-15 21:43:46 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
|
|
|
|
bool flag = rp.Pop<bool>();
|
|
|
|
|
2018-01-16 23:18:18 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
2018-01-15 21:43:46 +01:00
|
|
|
LOG_WARNING(Service, "(STUBBED) called flag=%u", static_cast<u32>(flag));
|
2018-01-16 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) {
|
2018-01-15 21:43:46 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
|
|
|
|
bool flag = rp.Pop<bool>();
|
|
|
|
|
2018-01-16 23:18:18 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
2018-01-15 21:43:46 +01:00
|
|
|
LOG_WARNING(Service, "(STUBBED) called flag=%u", static_cast<u32>(flag));
|
2018-01-16 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) {
|
|
|
|
// Takes 3 input u8s with each field located immediately after the previous u8, these are
|
|
|
|
// bool flags. No output.
|
2018-01-15 21:43:46 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
|
|
|
|
bool enabled = rp.Pop<bool>();
|
2018-01-16 23:18:18 +01:00
|
|
|
|
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
2018-01-15 21:43:46 +01:00
|
|
|
LOG_WARNING(Service, "(STUBBED) called enabled=%u", static_cast<u32>(enabled));
|
2018-01-16 23:18:18 +01:00
|
|
|
}
|
2018-01-19 21:09:50 +01:00
|
|
|
|
|
|
|
void LockExit(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
|
|
|
void UnlockExit(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
2018-01-22 19:46:36 +01:00
|
|
|
|
2018-01-22 19:50:22 +01:00
|
|
|
void CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) {
|
|
|
|
// TODO(Subv): Find out how AM determines the display to use, for now just create the layer
|
|
|
|
// in the Default display.
|
|
|
|
u64 display_id = nvflinger->OpenDisplay("Default");
|
|
|
|
u64 layer_id = nvflinger->CreateLayer(display_id);
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb{ctx, 4};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(layer_id);
|
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
2018-01-22 19:46:36 +01:00
|
|
|
std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
|
2017-12-29 06:44:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> {
|
|
|
|
public:
|
|
|
|
ICommonStateGetter() : ServiceFramework("ICommonStateGetter") {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &ICommonStateGetter::GetEventHandle, "GetEventHandle"},
|
|
|
|
{1, &ICommonStateGetter::ReceiveMessage, "ReceiveMessage"},
|
2018-01-15 21:43:46 +01:00
|
|
|
{5, &ICommonStateGetter::GetOperationMode, "GetOperationMode"},
|
|
|
|
{6, &ICommonStateGetter::GetPerformanceMode, "GetPerformanceMode"},
|
2018-01-15 20:41:06 +01:00
|
|
|
{9, &ICommonStateGetter::GetCurrentFocusState, "GetCurrentFocusState"},
|
2017-12-29 06:44:46 +01:00
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
|
|
|
|
event = Kernel::Event::Create(Kernel::ResetType::OneShot, "ICommonStateGetter:Event");
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2018-01-15 21:43:46 +01:00
|
|
|
enum class FocusState : u8 {
|
|
|
|
InFocus = 1,
|
|
|
|
NotInFocus = 2,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class OperationMode : u8 {
|
|
|
|
Handheld = 0,
|
|
|
|
Docked = 1,
|
|
|
|
};
|
|
|
|
|
2017-12-29 06:44:46 +01:00
|
|
|
void GetEventHandle(Kernel::HLERequestContext& ctx) {
|
|
|
|
event->Signal();
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb{ctx, 2, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-07 07:50:55 +01:00
|
|
|
rb.PushCopyObjects(event);
|
2017-12-29 06:44:46 +01:00
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReceiveMessage(Kernel::HLERequestContext& ctx) {
|
2018-01-07 16:29:16 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 3};
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-15 06:06:34 +01:00
|
|
|
rb.Push<u32>(15);
|
2017-12-29 06:44:46 +01:00
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
2018-01-15 20:41:06 +01:00
|
|
|
void GetCurrentFocusState(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 3};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-15 21:43:46 +01:00
|
|
|
rb.Push(static_cast<u8>(FocusState::InFocus));
|
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetOperationMode(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 3};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-17 02:32:08 +01:00
|
|
|
rb.Push(static_cast<u8>(OperationMode::Handheld));
|
2018-01-15 21:43:46 +01:00
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetPerformanceMode(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 3};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-17 02:32:08 +01:00
|
|
|
rb.Push(static_cast<u32>(APM::PerformanceMode::Handheld));
|
2018-01-15 20:41:06 +01:00
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
2017-12-29 06:44:46 +01:00
|
|
|
Kernel::SharedPtr<Kernel::Event> event;
|
|
|
|
};
|
|
|
|
|
2018-01-18 20:54:34 +01:00
|
|
|
class IStorageAccessor final : public ServiceFramework<IStorageAccessor> {
|
|
|
|
public:
|
|
|
|
explicit IStorageAccessor(std::vector<u8> buffer)
|
|
|
|
: ServiceFramework("IStorageAccessor"), buffer(std::move(buffer)) {
|
|
|
|
static const FunctionInfo functions[] = {
|
2018-01-20 08:48:02 +01:00
|
|
|
{0, &IStorageAccessor::GetSize, "GetSize"},
|
|
|
|
{11, &IStorageAccessor::Read, "Read"},
|
2018-01-18 20:54:34 +01:00
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<u8> buffer;
|
|
|
|
|
|
|
|
void GetSize(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 4};
|
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(static_cast<u64>(buffer.size()));
|
|
|
|
|
|
|
|
LOG_DEBUG(Service, "called");
|
|
|
|
}
|
|
|
|
|
|
|
|
void Read(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
|
|
|
|
u64 offset = rp.Pop<u64>();
|
|
|
|
|
|
|
|
const auto& output_buffer = ctx.BufferDescriptorC()[0];
|
|
|
|
|
|
|
|
ASSERT(offset + output_buffer.Size() <= buffer.size());
|
|
|
|
|
|
|
|
Memory::WriteBlock(output_buffer.Address(), buffer.data() + offset, output_buffer.Size());
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
LOG_DEBUG(Service, "called");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class IStorage final : public ServiceFramework<IStorage> {
|
|
|
|
public:
|
|
|
|
explicit IStorage(std::vector<u8> buffer)
|
|
|
|
: ServiceFramework("IStorage"), buffer(std::move(buffer)) {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &IStorage::Open, "Open"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<u8> buffer;
|
|
|
|
|
|
|
|
void Open(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
|
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<AM::IStorageAccessor>(buffer);
|
|
|
|
|
|
|
|
LOG_DEBUG(Service, "called");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-12-29 06:44:46 +01:00
|
|
|
class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> {
|
|
|
|
public:
|
2018-01-15 20:41:06 +01:00
|
|
|
IApplicationFunctions() : ServiceFramework("IApplicationFunctions") {
|
|
|
|
static const FunctionInfo functions[] = {
|
2018-01-18 20:54:34 +01:00
|
|
|
{1, &IApplicationFunctions::PopLaunchParameter, "PopLaunchParameter"},
|
2018-01-19 21:44:58 +01:00
|
|
|
{21, &IApplicationFunctions::GetDesiredLanguage, "GetDesiredLanguage"},
|
2018-01-15 20:41:06 +01:00
|
|
|
{22, &IApplicationFunctions::SetTerminateResult, "SetTerminateResult"},
|
2018-01-16 23:18:18 +01:00
|
|
|
{66, &IApplicationFunctions::InitializeGamePlayRecording,
|
|
|
|
"InitializeGamePlayRecording"},
|
|
|
|
{67, &IApplicationFunctions::SetGamePlayRecordingState, "SetGamePlayRecordingState"},
|
2018-01-15 21:43:46 +01:00
|
|
|
{40, &IApplicationFunctions::NotifyRunning, "NotifyRunning"},
|
2018-01-15 20:41:06 +01:00
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2018-01-18 20:54:34 +01:00
|
|
|
void PopLaunchParameter(Kernel::HLERequestContext& ctx) {
|
|
|
|
constexpr u8 data[0x88] = {
|
|
|
|
0xca, 0x97, 0x94, 0xc7, // Magic
|
|
|
|
1, 0, 0, 0, // IsAccountSelected (bool)
|
|
|
|
1, 0, 0, 0, // User Id (word 0)
|
|
|
|
0, 0, 0, 0, // User Id (word 1)
|
|
|
|
0, 0, 0, 0, // User Id (word 2)
|
|
|
|
0, 0, 0, 0 // User Id (word 3)
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<u8> buffer(data, data + sizeof(data));
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
|
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<AM::IStorage>(buffer);
|
|
|
|
|
|
|
|
LOG_DEBUG(Service, "called");
|
|
|
|
}
|
|
|
|
|
2018-01-15 20:41:06 +01:00
|
|
|
void SetTerminateResult(Kernel::HLERequestContext& ctx) {
|
|
|
|
// Takes an input u32 Result, no output.
|
|
|
|
// For example, in some cases official apps use this with error 0x2A2 then uses svcBreak.
|
|
|
|
|
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
u32 result = rp.Pop<u32>();
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called, result=0x%08X", result);
|
|
|
|
}
|
2018-01-16 23:18:18 +01:00
|
|
|
|
2018-01-19 21:44:58 +01:00
|
|
|
void GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 4};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u64>(SystemLanguage::English);
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
2018-01-16 23:18:18 +01:00
|
|
|
void InitializeGamePlayRecording(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetGamePlayRecordingState(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-15 21:43:46 +01:00
|
|
|
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyRunning(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb{ctx, 3};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u8>(0); // Unknown, seems to be ignored by official processes
|
|
|
|
|
2018-01-16 23:18:18 +01:00
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
}
|
2017-12-29 06:44:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class ILibraryAppletCreator final : public ServiceFramework<ILibraryAppletCreator> {
|
|
|
|
public:
|
|
|
|
ILibraryAppletCreator() : ServiceFramework("ILibraryAppletCreator") {}
|
|
|
|
};
|
|
|
|
|
|
|
|
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"},
|
|
|
|
{11, &IApplicationProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
|
|
|
|
{20, &IApplicationProxy::GetApplicationFunctions, "GetApplicationFunctions"},
|
|
|
|
{1000, &IApplicationProxy::GetDebugFunctions, "GetDebugFunctions"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void GetAudioController(Kernel::HLERequestContext& ctx) {
|
2018-01-07 16:02:48 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<IAudioController>();
|
2018-01-15 20:41:06 +01:00
|
|
|
LOG_DEBUG(Service, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetDisplayController(Kernel::HLERequestContext& ctx) {
|
2018-01-07 16:02:48 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<IDisplayController>();
|
2018-01-15 20:41:06 +01:00
|
|
|
LOG_DEBUG(Service, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
|
2018-01-07 16:02:48 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<IDebugFunctions>();
|
2018-01-15 20:41:06 +01:00
|
|
|
LOG_DEBUG(Service, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetWindowController(Kernel::HLERequestContext& ctx) {
|
2018-01-07 16:02:48 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<IWindowController>();
|
2018-01-15 20:41:06 +01:00
|
|
|
LOG_DEBUG(Service, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetSelfController(Kernel::HLERequestContext& ctx) {
|
2018-01-07 16:02:48 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-22 19:46:36 +01:00
|
|
|
rb.PushIpcInterface<ISelfController>(nvflinger);
|
2018-01-15 20:41:06 +01:00
|
|
|
LOG_DEBUG(Service, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
|
2018-01-07 16:02:48 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<ICommonStateGetter>();
|
2018-01-15 20:41:06 +01:00
|
|
|
LOG_DEBUG(Service, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
|
2018-01-07 16:02:48 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<ILibraryAppletCreator>();
|
2018-01-15 20:41:06 +01:00
|
|
|
LOG_DEBUG(Service, "called");
|
2017-12-29 06:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
|
2018-01-07 16:02:48 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2017-12-29 06:44:46 +01:00
|
|
|
rb.PushIpcInterface<IApplicationFunctions>();
|
2018-01-15 20:41:06 +01:00
|
|
|
LOG_DEBUG(Service, "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-07 16:02:48 +01:00
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-22 19:46:36 +01:00
|
|
|
rb.PushIpcInterface<IApplicationProxy>(nvflinger);
|
2018-01-15 20:41:06 +01:00
|
|
|
LOG_DEBUG(Service, "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);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace AM
|
|
|
|
} // namespace Service
|