Use IPC:MakeHeader instead of hardcoded raw values for IPC command tables. (#6453)

* Use IPC:MakeHeader instead of hardcoded values for IPC command tables.

* Use u32 instead of unsigned int in MakeHeader function

Co-authored-by: SachinVin <26602104+SachinVin@users.noreply.github.com>

* Fix clang format

---------

Co-authored-by: SachinVin <26602104+SachinVin@users.noreply.github.com>
This commit is contained in:
PabloMK7 2023-04-28 07:31:03 +02:00 committed by GitHub
parent 9bd8c9290b
commit 63bc0b59bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 1983 additions and 1896 deletions

View file

@ -180,10 +180,12 @@ IR_RST::IR_RST(Core::System& system) : ServiceFramework("ir:rst", 1), system(sys
});
static const FunctionInfo functions[] = {
{0x00010000, &IR_RST::GetHandles, "GetHandles"},
{0x00020080, &IR_RST::Initialize, "Initialize"},
{0x00030000, &IR_RST::Shutdown, "Shutdown"},
{0x00090000, nullptr, "WriteToTwoFields"},
// clang-format off
{IPC::MakeHeader(0x0001, 0, 0), &IR_RST::GetHandles, "GetHandles"},
{IPC::MakeHeader(0x0002, 2, 0), &IR_RST::Initialize, "Initialize"},
{IPC::MakeHeader(0x0003, 0, 0), &IR_RST::Shutdown, "Shutdown"},
{IPC::MakeHeader(0x0009, 0, 0), nullptr, "WriteToTwoFields"},
// clang-format on
};
RegisterHandlers(functions);
}

View file

@ -11,24 +11,26 @@ namespace Service::IR {
IR_U::IR_U() : ServiceFramework("ir:u", 1) {
static const FunctionInfo functions[] = {
{0x00010000, nullptr, "Initialize"},
{0x00020000, nullptr, "Shutdown"},
{0x00030042, nullptr, "StartSendTransfer"},
{0x00040000, nullptr, "WaitSendTransfer"},
{0x000500C2, nullptr, "StartRecvTransfer"},
{0x00060000, nullptr, "WaitRecvTransfer"},
{0x00070080, nullptr, "GetRecvTransferCount"},
{0x00080000, nullptr, "GetSendState"},
{0x00090040, nullptr, "SetBitRate"},
{0x000A0000, nullptr, "GetBitRate"},
{0x000B0040, nullptr, "SetIRLEDState"},
{0x000C0000, nullptr, "GetIRLEDRecvState"},
{0x000D0000, nullptr, "GetSendFinishedEvent"},
{0x000E0000, nullptr, "GetRecvFinishedEvent"},
{0x000F0000, nullptr, "GetTransferState"},
{0x00100000, nullptr, "GetErrorStatus"},
{0x00110040, nullptr, "SetSleepModeActive"},
{0x00120040, nullptr, "SetSleepModeState"},
// clang-format off
{IPC::MakeHeader(0x0001, 0, 0), nullptr, "Initialize"},
{IPC::MakeHeader(0x0002, 0, 0), nullptr, "Shutdown"},
{IPC::MakeHeader(0x0003, 1, 2), nullptr, "StartSendTransfer"},
{IPC::MakeHeader(0x0004, 0, 0), nullptr, "WaitSendTransfer"},
{IPC::MakeHeader(0x0005, 3, 2), nullptr, "StartRecvTransfer"},
{IPC::MakeHeader(0x0006, 0, 0), nullptr, "WaitRecvTransfer"},
{IPC::MakeHeader(0x0007, 2, 0), nullptr, "GetRecvTransferCount"},
{IPC::MakeHeader(0x0008, 0, 0), nullptr, "GetSendState"},
{IPC::MakeHeader(0x0009, 1, 0), nullptr, "SetBitRate"},
{IPC::MakeHeader(0x000A, 0, 0), nullptr, "GetBitRate"},
{IPC::MakeHeader(0x000B, 1, 0), nullptr, "SetIRLEDState"},
{IPC::MakeHeader(0x000C, 0, 0), nullptr, "GetIRLEDRecvState"},
{IPC::MakeHeader(0x000D, 0, 0), nullptr, "GetSendFinishedEvent"},
{IPC::MakeHeader(0x000E, 0, 0), nullptr, "GetRecvFinishedEvent"},
{IPC::MakeHeader(0x000F, 0, 0), nullptr, "GetTransferState"},
{IPC::MakeHeader(0x0010, 0, 0), nullptr, "GetErrorStatus"},
{IPC::MakeHeader(0x0011, 1, 0), nullptr, "SetSleepModeActive"},
{IPC::MakeHeader(0x0012, 1, 0), nullptr, "SetSleepModeState"},
// clang-format on
};
RegisterHandlers(functions);
}

View file

@ -425,32 +425,34 @@ void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
IR_USER::IR_USER(Core::System& system) : ServiceFramework("ir:USER", 1) {
const FunctionInfo functions[] = {
{0x00010182, nullptr, "InitializeIrNop"},
{0x00020000, &IR_USER::FinalizeIrNop, "FinalizeIrNop"},
{0x00030000, nullptr, "ClearReceiveBuffer"},
{0x00040000, nullptr, "ClearSendBuffer"},
{0x000500C0, nullptr, "WaitConnection"},
{0x00060040, &IR_USER::RequireConnection, "RequireConnection"},
{0x000702C0, nullptr, "AutoConnection"},
{0x00080000, nullptr, "AnyConnection"},
{0x00090000, &IR_USER::Disconnect, "Disconnect"},
{0x000A0000, &IR_USER::GetReceiveEvent, "GetReceiveEvent"},
{0x000B0000, &IR_USER::GetSendEvent, "GetSendEvent"},
{0x000C0000, &IR_USER::GetConnectionStatusEvent, "GetConnectionStatusEvent"},
{0x000D0042, &IR_USER::SendIrNop, "SendIrNop"},
{0x000E0042, nullptr, "SendIrNopLarge"},
{0x000F0040, nullptr, "ReceiveIrnop"},
{0x00100042, nullptr, "ReceiveIrnopLarge"},
{0x00110040, nullptr, "GetLatestReceiveErrorResult"},
{0x00120040, nullptr, "GetLatestSendErrorResult"},
{0x00130000, nullptr, "GetConnectionStatus"},
{0x00140000, nullptr, "GetTryingToConnectStatus"},
{0x00150000, nullptr, "GetReceiveSizeFreeAndUsed"},
{0x00160000, nullptr, "GetSendSizeFreeAndUsed"},
{0x00170000, nullptr, "GetConnectionRole"},
{0x00180182, &IR_USER::InitializeIrNopShared, "InitializeIrNopShared"},
{0x00190040, &IR_USER::ReleaseReceivedData, "ReleaseReceivedData"},
{0x001A0040, nullptr, "SetOwnMachineId"},
// clang-format off
{IPC::MakeHeader(0x0001, 6, 2), nullptr, "InitializeIrNop"},
{IPC::MakeHeader(0x0002, 0, 0), &IR_USER::FinalizeIrNop, "FinalizeIrNop"},
{IPC::MakeHeader(0x0003, 0, 0), nullptr, "ClearReceiveBuffer"},
{IPC::MakeHeader(0x0004, 0, 0), nullptr, "ClearSendBuffer"},
{IPC::MakeHeader(0x0005, 3, 0), nullptr, "WaitConnection"},
{IPC::MakeHeader(0x0006, 1, 0), &IR_USER::RequireConnection, "RequireConnection"},
{IPC::MakeHeader(0x0007, 11, 0), nullptr, "AutoConnection"},
{IPC::MakeHeader(0x0008, 0, 0), nullptr, "AnyConnection"},
{IPC::MakeHeader(0x0009, 0, 0), &IR_USER::Disconnect, "Disconnect"},
{IPC::MakeHeader(0x000A, 0, 0), &IR_USER::GetReceiveEvent, "GetReceiveEvent"},
{IPC::MakeHeader(0x000B, 0, 0), &IR_USER::GetSendEvent, "GetSendEvent"},
{IPC::MakeHeader(0x000C, 0, 0), &IR_USER::GetConnectionStatusEvent, "GetConnectionStatusEvent"},
{IPC::MakeHeader(0x000D, 1, 2), &IR_USER::SendIrNop, "SendIrNop"},
{IPC::MakeHeader(0x000E, 1, 2), nullptr, "SendIrNopLarge"},
{IPC::MakeHeader(0x000F, 1, 0), nullptr, "ReceiveIrnop"},
{IPC::MakeHeader(0x0010, 1, 2), nullptr, "ReceiveIrnopLarge"},
{IPC::MakeHeader(0x0011, 1, 0), nullptr, "GetLatestReceiveErrorResult"},
{IPC::MakeHeader(0x0012, 1, 0), nullptr, "GetLatestSendErrorResult"},
{IPC::MakeHeader(0x0013, 0, 0), nullptr, "GetConnectionStatus"},
{IPC::MakeHeader(0x0014, 0, 0), nullptr, "GetTryingToConnectStatus"},
{IPC::MakeHeader(0x0015, 0, 0), nullptr, "GetReceiveSizeFreeAndUsed"},
{IPC::MakeHeader(0x0016, 0, 0), nullptr, "GetSendSizeFreeAndUsed"},
{IPC::MakeHeader(0x0017, 0, 0), nullptr, "GetConnectionRole"},
{IPC::MakeHeader(0x0018, 6, 2), &IR_USER::InitializeIrNopShared, "InitializeIrNopShared"},
{IPC::MakeHeader(0x0019, 1, 0), &IR_USER::ReleaseReceivedData, "ReleaseReceivedData"},
{IPC::MakeHeader(0x001A, 1, 0), nullptr, "SetOwnMachineId"},
// clang-format on
};
RegisterHandlers(functions);