hle: Eliminate need to specify command headers for IPC. (#6678)

This commit is contained in:
Steveice10
2023-07-14 17:32:59 -07:00
committed by GitHub
parent 0bedb28bdc
commit e043caac27
96 changed files with 2691 additions and 2707 deletions

View File

@@ -27,7 +27,7 @@ namespace Service::PTM {
static const GameCoin default_game_coin = {0x4F00, 42, 0, 0, 0, 2014, 12, 29};
void Module::Interface::GetAdapterState(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x5, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
@@ -37,7 +37,7 @@ void Module::Interface::GetAdapterState(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetShellState(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x6, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
@@ -45,7 +45,7 @@ void Module::Interface::GetShellState(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetBatteryLevel(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x7, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
@@ -55,7 +55,7 @@ void Module::Interface::GetBatteryLevel(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetBatteryChargeState(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x8, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
@@ -65,7 +65,7 @@ void Module::Interface::GetBatteryChargeState(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetPedometerState(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x9, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
@@ -75,7 +75,7 @@ void Module::Interface::GetPedometerState(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetStepHistory(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xB, 3, 2);
IPC::RequestParser rp(ctx);
u32 hours = rp.Pop<u32>();
u64 start_time = rp.Pop<u64>();
@@ -98,7 +98,7 @@ void Module::Interface::GetStepHistory(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetTotalStepCount(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xC, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
@@ -108,7 +108,7 @@ void Module::Interface::GetTotalStepCount(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetSoftwareClosedFlag(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x80F, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
@@ -127,14 +127,14 @@ void CheckNew3DS(IPC::RequestBuilder& rb) {
}
void Module::Interface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x40A, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
Service::PTM::CheckNew3DS(rb);
}
void Module::Interface::GetSystemTime(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x401, 0, 0);
IPC::RequestParser rp(ctx);
auto& share_page = Core::System::GetInstance().Kernel().GetSharedPageHandler();
const u64 console_time = share_page.GetSystemTimeSince2000();

View File

@@ -14,23 +14,23 @@ PTM_Gets::PTM_Gets(std::shared_ptr<Module> ptm)
static const FunctionInfo functions[] = {
// ptm:u common commands
// clang-format off
{IPC::MakeHeader(0x0001, 0, 2), nullptr, "RegisterAlarmClient"},
{IPC::MakeHeader(0x0002, 2, 0), nullptr, "SetRtcAlarm"},
{IPC::MakeHeader(0x0003, 0, 0), nullptr, "GetRtcAlarm"},
{IPC::MakeHeader(0x0004, 0, 0), nullptr, "CancelRtcAlarm"},
{IPC::MakeHeader(0x0005, 0, 0), &PTM_Gets::GetAdapterState, "GetAdapterState"},
{IPC::MakeHeader(0x0006, 0, 0), &PTM_Gets::GetShellState, "GetShellState"},
{IPC::MakeHeader(0x0007, 0, 0), &PTM_Gets::GetBatteryLevel, "GetBatteryLevel"},
{IPC::MakeHeader(0x0008, 0, 0), &PTM_Gets::GetBatteryChargeState, "GetBatteryChargeState"},
{IPC::MakeHeader(0x0009, 0, 0), nullptr, "GetPedometerState"},
{IPC::MakeHeader(0x000A, 1, 2), nullptr, "GetStepHistoryEntry"},
{IPC::MakeHeader(0x000B, 3, 2), &PTM_Gets::GetStepHistory, "GetStepHistory"},
{IPC::MakeHeader(0x000C, 0, 0), &PTM_Gets::GetTotalStepCount, "GetTotalStepCount"},
{IPC::MakeHeader(0x000D, 1, 0), nullptr, "SetPedometerRecordingMode"},
{IPC::MakeHeader(0x000E, 0, 0), nullptr, "GetPedometerRecordingMode"},
{IPC::MakeHeader(0x000F, 2, 4), nullptr, "GetStepHistoryAll"},
{0x0001, nullptr, "RegisterAlarmClient"},
{0x0002, nullptr, "SetRtcAlarm"},
{0x0003, nullptr, "GetRtcAlarm"},
{0x0004, nullptr, "CancelRtcAlarm"},
{0x0005, &PTM_Gets::GetAdapterState, "GetAdapterState"},
{0x0006, &PTM_Gets::GetShellState, "GetShellState"},
{0x0007, &PTM_Gets::GetBatteryLevel, "GetBatteryLevel"},
{0x0008, &PTM_Gets::GetBatteryChargeState, "GetBatteryChargeState"},
{0x0009, nullptr, "GetPedometerState"},
{0x000A, nullptr, "GetStepHistoryEntry"},
{0x000B, &PTM_Gets::GetStepHistory, "GetStepHistory"},
{0x000C, &PTM_Gets::GetTotalStepCount, "GetTotalStepCount"},
{0x000D, nullptr, "SetPedometerRecordingMode"},
{0x000E, nullptr, "GetPedometerRecordingMode"},
{0x000F, nullptr, "GetStepHistoryAll"},
// ptm:gets
{IPC::MakeHeader(0x0401, 0, 0), &PTM_Gets::GetSystemTime, "GetSystemTime"},
{0x0401, &PTM_Gets::GetSystemTime, "GetSystemTime"},
// clang-format on
};
RegisterHandlers(functions);

View File

@@ -14,26 +14,26 @@ PTM_Play::PTM_Play(std::shared_ptr<Module> ptm)
static const FunctionInfo functions[] = {
// ptm:u common commands
// clang-format off
{IPC::MakeHeader(0x0001, 0, 2), nullptr, "RegisterAlarmClient"},
{IPC::MakeHeader(0x0002, 2, 0), nullptr, "SetRtcAlarm"},
{IPC::MakeHeader(0x0003, 0, 0), nullptr, "GetRtcAlarm"},
{IPC::MakeHeader(0x0004, 0, 0), nullptr, "CancelRtcAlarm"},
{IPC::MakeHeader(0x0005, 0, 0), &PTM_Play::GetAdapterState, "GetAdapterState"},
{IPC::MakeHeader(0x0006, 0, 0), &PTM_Play::GetShellState, "GetShellState"},
{IPC::MakeHeader(0x0007, 0, 0), &PTM_Play::GetBatteryLevel, "GetBatteryLevel"},
{IPC::MakeHeader(0x0008, 0, 0), &PTM_Play::GetBatteryChargeState, "GetBatteryChargeState"},
{IPC::MakeHeader(0x0009, 0, 0), nullptr, "GetPedometerState"},
{IPC::MakeHeader(0x000A, 1, 2), nullptr, "GetStepHistoryEntry"},
{IPC::MakeHeader(0x000B, 3, 2), &PTM_Play::GetStepHistory, "GetStepHistory"},
{IPC::MakeHeader(0x000C, 0, 0), &PTM_Play::GetTotalStepCount, "GetTotalStepCount"},
{IPC::MakeHeader(0x000D, 1, 0), nullptr, "SetPedometerRecordingMode"},
{IPC::MakeHeader(0x000E, 0, 0), nullptr, "GetPedometerRecordingMode"},
{IPC::MakeHeader(0x000F, 2, 4), nullptr, "GetStepHistoryAll"},
{0x0001, nullptr, "RegisterAlarmClient"},
{0x0002, nullptr, "SetRtcAlarm"},
{0x0003, nullptr, "GetRtcAlarm"},
{0x0004, nullptr, "CancelRtcAlarm"},
{0x0005, &PTM_Play::GetAdapterState, "GetAdapterState"},
{0x0006, &PTM_Play::GetShellState, "GetShellState"},
{0x0007, &PTM_Play::GetBatteryLevel, "GetBatteryLevel"},
{0x0008, &PTM_Play::GetBatteryChargeState, "GetBatteryChargeState"},
{0x0009, nullptr, "GetPedometerState"},
{0x000A, nullptr, "GetStepHistoryEntry"},
{0x000B, &PTM_Play::GetStepHistory, "GetStepHistory"},
{0x000C, &PTM_Play::GetTotalStepCount, "GetTotalStepCount"},
{0x000D, nullptr, "SetPedometerRecordingMode"},
{0x000E, nullptr, "GetPedometerRecordingMode"},
{0x000F, nullptr, "GetStepHistoryAll"},
// ptm:play
{IPC::MakeHeader(0x0807, 2, 2), nullptr, "GetPlayHistory"},
{IPC::MakeHeader(0x0808, 0, 0), nullptr, "GetPlayHistoryStart"},
{IPC::MakeHeader(0x0809, 0, 0), nullptr, "GetPlayHistoryLength"},
{IPC::MakeHeader(0x080B, 2, 0), nullptr, "CalcPlayHistoryStart"},
{0x0807, nullptr, "GetPlayHistory"},
{0x0808, nullptr, "GetPlayHistoryStart"},
{0x0809, nullptr, "GetPlayHistoryLength"},
{0x080B, nullptr, "CalcPlayHistoryStart"},
// clang-format on
};
RegisterHandlers(functions);

View File

@@ -13,7 +13,7 @@ PTM_Sets::PTM_Sets(std::shared_ptr<Module> ptm) : Module::Interface(std::move(pt
static const FunctionInfo functions[] = {
// Note that this service does not have access to ptm:u's common commands
// clang-format off
{IPC::MakeHeader(0x0001, 2, 0), nullptr, "SetSystemTime"},
{0x0001, nullptr, "SetSystemTime"},
// clang-format on
};
RegisterHandlers(functions);

View File

@@ -15,53 +15,53 @@ PTM_S_Common::PTM_S_Common(std::shared_ptr<Module> ptm, const char* name)
static const FunctionInfo functions[] = {
// ptm:u common commands
// clang-format off
{IPC::MakeHeader(0x0001, 0, 2), nullptr, "RegisterAlarmClient"},
{IPC::MakeHeader(0x0002, 2, 0), nullptr, "SetRtcAlarm"},
{IPC::MakeHeader(0x0003, 0, 0), nullptr, "GetRtcAlarm"},
{IPC::MakeHeader(0x0004, 0, 0), nullptr, "CancelRtcAlarm"},
{IPC::MakeHeader(0x0005, 0, 0), &PTM_S_Common::GetAdapterState, "GetAdapterState"},
{IPC::MakeHeader(0x0006, 0, 0), &PTM_S_Common::GetShellState, "GetShellState"},
{IPC::MakeHeader(0x0007, 0, 0), &PTM_S_Common::GetBatteryLevel, "GetBatteryLevel"},
{IPC::MakeHeader(0x0008, 0, 0), &PTM_S_Common::GetBatteryChargeState, "GetBatteryChargeState"},
{IPC::MakeHeader(0x0009, 0, 0), nullptr, "GetPedometerState"},
{IPC::MakeHeader(0x000A, 1, 2), nullptr, "GetStepHistoryEntry"},
{IPC::MakeHeader(0x000B, 3, 2), &PTM_S_Common::GetStepHistory, "GetStepHistory"},
{IPC::MakeHeader(0x000C, 0, 0), &PTM_S_Common::GetTotalStepCount, "GetTotalStepCount"},
{IPC::MakeHeader(0x000D, 1, 0), nullptr, "SetPedometerRecordingMode"},
{IPC::MakeHeader(0x000E, 0, 0), nullptr, "GetPedometerRecordingMode"},
{IPC::MakeHeader(0x000F, 2, 4), nullptr, "GetStepHistoryAll"},
{0x0001, nullptr, "RegisterAlarmClient"},
{0x0002, nullptr, "SetRtcAlarm"},
{0x0003, nullptr, "GetRtcAlarm"},
{0x0004, nullptr, "CancelRtcAlarm"},
{0x0005, &PTM_S_Common::GetAdapterState, "GetAdapterState"},
{0x0006, &PTM_S_Common::GetShellState, "GetShellState"},
{0x0007, &PTM_S_Common::GetBatteryLevel, "GetBatteryLevel"},
{0x0008, &PTM_S_Common::GetBatteryChargeState, "GetBatteryChargeState"},
{0x0009, nullptr, "GetPedometerState"},
{0x000A, nullptr, "GetStepHistoryEntry"},
{0x000B, &PTM_S_Common::GetStepHistory, "GetStepHistory"},
{0x000C, &PTM_S_Common::GetTotalStepCount, "GetTotalStepCount"},
{0x000D, nullptr, "SetPedometerRecordingMode"},
{0x000E, nullptr, "GetPedometerRecordingMode"},
{0x000F, nullptr, "GetStepHistoryAll"},
// ptm:sysm & ptm:s
{IPC::MakeHeader(0x0401, 3, 0), nullptr, "SetRtcAlarmEx"},
{IPC::MakeHeader(0x0402, 1, 2), nullptr, "ReplySleepQuery"},
{IPC::MakeHeader(0x0403, 1, 2), nullptr, "NotifySleepPreparationComplete"},
{IPC::MakeHeader(0x0404, 4, 2), nullptr, "SetWakeupTrigger"},
{IPC::MakeHeader(0x0405, 0, 0), nullptr, "GetAwakeReason"},
{IPC::MakeHeader(0x0406, 0, 0), nullptr, "RequestSleep"},
{IPC::MakeHeader(0x0407, 3, 0), nullptr, "ShutdownAsync"},
{IPC::MakeHeader(0x0408, 0, 0), nullptr, "Awake"},
{IPC::MakeHeader(0x0409, 2, 0), nullptr, "RebootAsync"},
{IPC::MakeHeader(0x040A, 0, 0), &PTM_S_Common::CheckNew3DS, "CheckNew3DS"},
{IPC::MakeHeader(0x0801, 25, 0), nullptr, "SetInfoLEDPattern"},
{IPC::MakeHeader(0x0802, 1, 0), nullptr, "SetInfoLEDPatternHeader"},
{IPC::MakeHeader(0x0803, 0, 0), nullptr, "GetInfoLEDStatus"},
{IPC::MakeHeader(0x0804, 1, 0), nullptr, "SetBatteryEmptyLEDPattern"},
{IPC::MakeHeader(0x0805, 0, 0), nullptr, "ClearStepHistory"},
{IPC::MakeHeader(0x0806, 3, 2), nullptr, "SetStepHistory"},
{IPC::MakeHeader(0x0807, 2, 2), nullptr, "GetPlayHistory"},
{IPC::MakeHeader(0x0808, 0, 0), nullptr, "GetPlayHistoryStart"},
{IPC::MakeHeader(0x0809, 0, 0), nullptr, "GetPlayHistoryLength"},
{IPC::MakeHeader(0x080A, 0, 0), nullptr, "ClearPlayHistory"},
{IPC::MakeHeader(0x080B, 2, 0), nullptr, "CalcPlayHistoryStart"},
{IPC::MakeHeader(0x080C, 2, 0), nullptr, "SetUserTime"},
{IPC::MakeHeader(0x080D, 0, 0), nullptr, "InvalidateSystemTime"},
{IPC::MakeHeader(0x080E, 5, 0), nullptr, "NotifyPlayEvent"},
{IPC::MakeHeader(0x080F, 0, 0), &PTM_S_Common::GetSoftwareClosedFlag, "GetSoftwareClosedFlag"},
{IPC::MakeHeader(0x0810, 0, 0), nullptr, "ClearSoftwareClosedFlag"},
{IPC::MakeHeader(0x0811, 0, 0), &PTM_S_Common::GetShellState, "GetShellState"},
{IPC::MakeHeader(0x0812, 0, 0), nullptr, "IsShutdownByBatteryEmpty"},
{IPC::MakeHeader(0x0813, 0, 0), nullptr, "FormatSavedata"},
{IPC::MakeHeader(0x0814, 0, 0), nullptr, "GetLegacyJumpProhibitedFlag"},
{IPC::MakeHeader(0x0818, 1, 0), nullptr, "ConfigureNew3DSCPU"},
{0x0401, nullptr, "SetRtcAlarmEx"},
{0x0402, nullptr, "ReplySleepQuery"},
{0x0403, nullptr, "NotifySleepPreparationComplete"},
{0x0404, nullptr, "SetWakeupTrigger"},
{0x0405, nullptr, "GetAwakeReason"},
{0x0406, nullptr, "RequestSleep"},
{0x0407, nullptr, "ShutdownAsync"},
{0x0408, nullptr, "Awake"},
{0x0409, nullptr, "RebootAsync"},
{0x040A, &PTM_S_Common::CheckNew3DS, "CheckNew3DS"},
{0x0801, nullptr, "SetInfoLEDPattern"},
{0x0802, nullptr, "SetInfoLEDPatternHeader"},
{0x0803, nullptr, "GetInfoLEDStatus"},
{0x0804, nullptr, "SetBatteryEmptyLEDPattern"},
{0x0805, nullptr, "ClearStepHistory"},
{0x0806, nullptr, "SetStepHistory"},
{0x0807, nullptr, "GetPlayHistory"},
{0x0808, nullptr, "GetPlayHistoryStart"},
{0x0809, nullptr, "GetPlayHistoryLength"},
{0x080A, nullptr, "ClearPlayHistory"},
{0x080B, nullptr, "CalcPlayHistoryStart"},
{0x080C, nullptr, "SetUserTime"},
{0x080D, nullptr, "InvalidateSystemTime"},
{0x080E, nullptr, "NotifyPlayEvent"},
{0x080F, &PTM_S_Common::GetSoftwareClosedFlag, "GetSoftwareClosedFlag"},
{0x0810, nullptr, "ClearSoftwareClosedFlag"},
{0x0811, &PTM_S_Common::GetShellState, "GetShellState"},
{0x0812, nullptr, "IsShutdownByBatteryEmpty"},
{0x0813, nullptr, "FormatSavedata"},
{0x0814, nullptr, "GetLegacyJumpProhibitedFlag"},
{0x0818, nullptr, "ConfigureNew3DSCPU"},
// clang-format on
};
RegisterHandlers(functions);

View File

@@ -12,21 +12,21 @@ namespace Service::PTM {
PTM_U::PTM_U(std::shared_ptr<Module> ptm) : Module::Interface(std::move(ptm), "ptm:u", 26) {
static const FunctionInfo functions[] = {
// clang-format off
{IPC::MakeHeader(0x0001, 0, 2), nullptr, "RegisterAlarmClient"},
{IPC::MakeHeader(0x0002, 2, 0), nullptr, "SetRtcAlarm"},
{IPC::MakeHeader(0x0003, 0, 0), nullptr, "GetRtcAlarm"},
{IPC::MakeHeader(0x0004, 0, 0), nullptr, "CancelRtcAlarm"},
{IPC::MakeHeader(0x0005, 0, 0), &PTM_U::GetAdapterState, "GetAdapterState"},
{IPC::MakeHeader(0x0006, 0, 0), &PTM_U::GetShellState, "GetShellState"},
{IPC::MakeHeader(0x0007, 0, 0), &PTM_U::GetBatteryLevel, "GetBatteryLevel"},
{IPC::MakeHeader(0x0008, 0, 0), &PTM_U::GetBatteryChargeState, "GetBatteryChargeState"},
{IPC::MakeHeader(0x0009, 0, 0), &PTM_U::GetPedometerState, "GetPedometerState"},
{IPC::MakeHeader(0x000A, 1, 2), nullptr, "GetStepHistoryEntry"},
{IPC::MakeHeader(0x000B, 3, 2), &PTM_U::GetStepHistory, "GetStepHistory"},
{IPC::MakeHeader(0x000C, 0, 0), &PTM_U::GetTotalStepCount, "GetTotalStepCount"},
{IPC::MakeHeader(0x000D, 1, 0), nullptr, "SetPedometerRecordingMode"},
{IPC::MakeHeader(0x000E, 0, 0), nullptr, "GetPedometerRecordingMode"},
{IPC::MakeHeader(0x000F, 2, 4), nullptr, "GetStepHistoryAll"},
{0x0001, nullptr, "RegisterAlarmClient"},
{0x0002, nullptr, "SetRtcAlarm"},
{0x0003, nullptr, "GetRtcAlarm"},
{0x0004, nullptr, "CancelRtcAlarm"},
{0x0005, &PTM_U::GetAdapterState, "GetAdapterState"},
{0x0006, &PTM_U::GetShellState, "GetShellState"},
{0x0007, &PTM_U::GetBatteryLevel, "GetBatteryLevel"},
{0x0008, &PTM_U::GetBatteryChargeState, "GetBatteryChargeState"},
{0x0009, &PTM_U::GetPedometerState, "GetPedometerState"},
{0x000A, nullptr, "GetStepHistoryEntry"},
{0x000B, &PTM_U::GetStepHistory, "GetStepHistory"},
{0x000C, &PTM_U::GetTotalStepCount, "GetTotalStepCount"},
{0x000D, nullptr, "SetPedometerRecordingMode"},
{0x000E, nullptr, "GetPedometerRecordingMode"},
{0x000F, nullptr, "GetStepHistoryAll"},
// clang-format on
};
RegisterHandlers(functions);