AppletOE: Stub a bunch of functions required by libnx homebrew.

This commit is contained in:
Subv 2018-01-15 15:43:46 -05:00 committed by bunnei
parent bf0e20c571
commit f7dc637a61

View File

@ -71,6 +71,15 @@ private:
// Takes 3 input u8s with each field located immediately after the previous u8, these are // Takes 3 input u8s with each field located immediately after the previous u8, these are
// bool flags. No output. // bool flags. No output.
IPC::RequestParser rp{ctx};
struct FocusHandlingModeParams {
u8 unknown0;
u8 unknown1;
u8 unknown2;
};
auto flags = rp.PopRaw<FocusHandlingModeParams>();
IPC::RequestBuilder rb{ctx, 2}; IPC::RequestBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -85,27 +94,38 @@ private:
} }
void SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) { void SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
bool flag = rp.Pop<bool>();
IPC::RequestBuilder rb{ctx, 2}; IPC::RequestBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called flag=%u", static_cast<u32>(flag));
} }
void SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) { void SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
bool flag = rp.Pop<bool>();
IPC::RequestBuilder rb{ctx, 2}; IPC::RequestBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called flag=%u", static_cast<u32>(flag));
} }
void SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) { void SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) {
// Takes 3 input u8s with each field located immediately after the previous u8, these are // Takes 3 input u8s with each field located immediately after the previous u8, these are
// bool flags. No output. // bool flags. No output.
IPC::RequestParser rp{ctx};
bool enabled = rp.Pop<bool>();
IPC::RequestBuilder rb{ctx, 2}; IPC::RequestBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called enabled=%u", static_cast<u32>(enabled));
} }
}; };
@ -115,6 +135,8 @@ public:
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ICommonStateGetter::GetEventHandle, "GetEventHandle"}, {0, &ICommonStateGetter::GetEventHandle, "GetEventHandle"},
{1, &ICommonStateGetter::ReceiveMessage, "ReceiveMessage"}, {1, &ICommonStateGetter::ReceiveMessage, "ReceiveMessage"},
{5, &ICommonStateGetter::GetOperationMode, "GetOperationMode"},
{6, &ICommonStateGetter::GetPerformanceMode, "GetPerformanceMode"},
{9, &ICommonStateGetter::GetCurrentFocusState, "GetCurrentFocusState"}, {9, &ICommonStateGetter::GetCurrentFocusState, "GetCurrentFocusState"},
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
@ -123,6 +145,16 @@ public:
} }
private: private:
enum class FocusState : u8 {
InFocus = 1,
NotInFocus = 2,
};
enum class OperationMode : u8 {
Handheld = 0,
Docked = 1,
};
void GetEventHandle(Kernel::HLERequestContext& ctx) { void GetEventHandle(Kernel::HLERequestContext& ctx) {
event->Signal(); event->Signal();
@ -144,7 +176,23 @@ private:
void GetCurrentFocusState(Kernel::HLERequestContext& ctx) { void GetCurrentFocusState(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb{ctx, 3}; IPC::RequestBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(1); // 1: In focus, 2/3: Out of focus(running in "background") 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);
rb.Push(static_cast<u8>(OperationMode::Handheld));
LOG_WARNING(Service, "(STUBBED) called");
}
void GetPerformanceMode(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0);
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
} }
@ -160,6 +208,7 @@ public:
{66, &IApplicationFunctions::InitializeGamePlayRecording, {66, &IApplicationFunctions::InitializeGamePlayRecording,
"InitializeGamePlayRecording"}, "InitializeGamePlayRecording"},
{67, &IApplicationFunctions::SetGamePlayRecordingState, "SetGamePlayRecordingState"}, {67, &IApplicationFunctions::SetGamePlayRecordingState, "SetGamePlayRecordingState"},
{40, &IApplicationFunctions::NotifyRunning, "NotifyRunning"},
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -187,6 +236,15 @@ private:
void SetGamePlayRecordingState(Kernel::HLERequestContext& ctx) { void SetGamePlayRecordingState(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb{ctx, 2}; IPC::RequestBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
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
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
} }
}; };