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

@ -11,7 +11,9 @@ namespace Service::NWM {
NWM_CEC::NWM_CEC() : ServiceFramework("nwm::CEC") {
static const FunctionInfo functions[] = {
{0x000D0082, nullptr, "SendProbeRequest"},
// clang-format off
{IPC::MakeHeader(0x000D, 2, 2), nullptr, "SendProbeRequest"},
// clang-format on
};
RegisterHandlers(functions);
}

View file

@ -11,7 +11,9 @@ namespace Service::NWM {
NWM_EXT::NWM_EXT() : ServiceFramework("nwm::EXT") {
static const FunctionInfo functions[] = {
{0x00080040, nullptr, "ControlWirelessEnabled"},
// clang-format off
{IPC::MakeHeader(0x0008, 1, 0), nullptr, "ControlWirelessEnabled"},
// clang-format on
};
RegisterHandlers(functions);
}

View file

@ -11,9 +11,11 @@ namespace Service::NWM {
NWM_INF::NWM_INF() : ServiceFramework("nwm::INF") {
static const FunctionInfo functions[] = {
{0x000603C4, nullptr, "RecvBeaconBroadcastData"},
{0x00070742, nullptr, "ConnectToEncryptedAP"},
{0x00080302, nullptr, "ConnectToAP"},
// clang-format off
{IPC::MakeHeader(0x0006, 15, 4), nullptr, "RecvBeaconBroadcastData"},
{IPC::MakeHeader(0x0007, 29, 2), nullptr, "ConnectToEncryptedAP"},
{IPC::MakeHeader(0x0008, 12, 2), nullptr, "ConnectToAP"},
// clang-format on
};
RegisterHandlers(functions);
}

View file

@ -1467,35 +1467,37 @@ void NWM_UDS::BeaconBroadcastCallback(std::uintptr_t user_data, s64 cycles_late)
NWM_UDS::NWM_UDS(Core::System& system) : ServiceFramework("nwm::UDS"), system(system) {
static const FunctionInfo functions[] = {
{0x000102C2, &NWM_UDS::InitializeDeprecated, "Initialize (deprecated)"},
{0x00020000, nullptr, "Scrap"},
{0x00030000, &NWM_UDS::Shutdown, "Shutdown"},
{0x00040402, &NWM_UDS::BeginHostingNetworkDeprecated, "BeginHostingNetwork (deprecated)"},
{0x00050040, &NWM_UDS::EjectClient, "EjectClient"},
{0x00060000, nullptr, "EjectSpectator"},
{0x00070080, &NWM_UDS::UpdateNetworkAttribute, "UpdateNetworkAttribute"},
{0x00080000, &NWM_UDS::DestroyNetwork, "DestroyNetwork"},
{0x00090442, &NWM_UDS::ConnectToNetworkDeprecated, "ConnectToNetwork (deprecated)"},
{0x000A0000, &NWM_UDS::DisconnectNetwork, "DisconnectNetwork"},
{0x000B0000, &NWM_UDS::GetConnectionStatus, "GetConnectionStatus"},
{0x000D0040, &NWM_UDS::GetNodeInformation, "GetNodeInformation"},
{0x000E0006, &NWM_UDS::DecryptBeaconData<0x0E>, "DecryptBeaconData (deprecated)"},
{0x000F0404, &NWM_UDS::RecvBeaconBroadcastData, "RecvBeaconBroadcastData"},
{0x00100042, &NWM_UDS::SetApplicationData, "SetApplicationData"},
{0x00110040, &NWM_UDS::GetApplicationData, "GetApplicationData"},
{0x00120100, &NWM_UDS::Bind, "Bind"},
{0x00130040, &NWM_UDS::Unbind, "Unbind"},
{0x001400C0, &NWM_UDS::PullPacket, "PullPacket"},
{0x00150080, nullptr, "SetMaxSendDelay"},
{0x00170182, &NWM_UDS::SendTo, "SendTo"},
{0x001A0000, &NWM_UDS::GetChannel, "GetChannel"},
{0x001B0302, &NWM_UDS::InitializeWithVersion, "InitializeWithVersion"},
{0x001D0044, &NWM_UDS::BeginHostingNetwork, "BeginHostingNetwork"},
{0x001E0084, &NWM_UDS::ConnectToNetwork, "ConnectToNetwork"},
{0x001F0006, &NWM_UDS::DecryptBeaconData<0x1F>, "DecryptBeaconData"},
{0x00200040, nullptr, "Flush"},
{0x00210080, nullptr, "SetProbeResponseParam"},
{0x00220402, nullptr, "ScanOnConnection"},
// clang-format off
{IPC::MakeHeader(0x0001, 11, 2), &NWM_UDS::InitializeDeprecated, "Initialize (deprecated)"},
{IPC::MakeHeader(0x0002, 0, 0), nullptr, "Scrap"},
{IPC::MakeHeader(0x0003, 0, 0), &NWM_UDS::Shutdown, "Shutdown"},
{IPC::MakeHeader(0x0004, 16, 2), &NWM_UDS::BeginHostingNetworkDeprecated, "BeginHostingNetwork (deprecated)"},
{IPC::MakeHeader(0x0005, 1, 0), &NWM_UDS::EjectClient, "EjectClient"},
{IPC::MakeHeader(0x0006, 0, 0), nullptr, "EjectSpectator"},
{IPC::MakeHeader(0x0007, 2, 0), &NWM_UDS::UpdateNetworkAttribute, "UpdateNetworkAttribute"},
{IPC::MakeHeader(0x0008, 0, 0), &NWM_UDS::DestroyNetwork, "DestroyNetwork"},
{IPC::MakeHeader(0x0009, 17, 2), &NWM_UDS::ConnectToNetworkDeprecated, "ConnectToNetwork (deprecated)"},
{IPC::MakeHeader(0x000A, 0, 0), &NWM_UDS::DisconnectNetwork, "DisconnectNetwork"},
{IPC::MakeHeader(0x000B, 0, 0), &NWM_UDS::GetConnectionStatus, "GetConnectionStatus"},
{IPC::MakeHeader(0x000D, 1, 0), &NWM_UDS::GetNodeInformation, "GetNodeInformation"},
{IPC::MakeHeader(0x000E, 0, 6), &NWM_UDS::DecryptBeaconData<0x0E>, "DecryptBeaconData (deprecated)"},
{IPC::MakeHeader(0x000F, 16, 4), &NWM_UDS::RecvBeaconBroadcastData, "RecvBeaconBroadcastData"},
{IPC::MakeHeader(0x0010, 1, 2), &NWM_UDS::SetApplicationData, "SetApplicationData"},
{IPC::MakeHeader(0x0011, 1, 0), &NWM_UDS::GetApplicationData, "GetApplicationData"},
{IPC::MakeHeader(0x0012, 4, 0), &NWM_UDS::Bind, "Bind"},
{IPC::MakeHeader(0x0013, 1, 0), &NWM_UDS::Unbind, "Unbind"},
{IPC::MakeHeader(0x0014, 3, 0), &NWM_UDS::PullPacket, "PullPacket"},
{IPC::MakeHeader(0x0015, 2, 0), nullptr, "SetMaxSendDelay"},
{IPC::MakeHeader(0x0017, 6, 2), &NWM_UDS::SendTo, "SendTo"},
{IPC::MakeHeader(0x001A, 0, 0), &NWM_UDS::GetChannel, "GetChannel"},
{IPC::MakeHeader(0x001B, 12, 2), &NWM_UDS::InitializeWithVersion, "InitializeWithVersion"},
{IPC::MakeHeader(0x001D, 1, 4), &NWM_UDS::BeginHostingNetwork, "BeginHostingNetwork"},
{IPC::MakeHeader(0x001E, 2, 4), &NWM_UDS::ConnectToNetwork, "ConnectToNetwork"},
{IPC::MakeHeader(0x001F, 0, 6), &NWM_UDS::DecryptBeaconData<0x1F>, "DecryptBeaconData"},
{IPC::MakeHeader(0x0020, 1, 0), nullptr, "Flush"},
{IPC::MakeHeader(0x0021, 2, 0), nullptr, "SetProbeResponseParam"},
{IPC::MakeHeader(0x0022, 16, 2), nullptr, "ScanOnConnection"},
// clang-format on
};
connection_status_event =
system.Kernel().CreateEvent(Kernel::ResetType::OneShot, "NWM::connection_status_event");