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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
96 changed files with 2691 additions and 2707 deletions

View file

@ -191,7 +191,7 @@ struct CaptureState {
static_assert(sizeof(CaptureState) == 0x8, "CaptureState structure size is wrong");
void CSND_SND::Initialize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x01, 5, 0);
IPC::RequestParser rp(ctx);
const u32 size = Common::AlignUp(rp.Pop<u32>(), Memory::CITRA_PAGE_SIZE);
master_state_offset = rp.Pop<u32>();
channel_state_offset = rp.Pop<u32>();
@ -219,7 +219,7 @@ void CSND_SND::Initialize(Kernel::HLERequestContext& ctx) {
}
void CSND_SND::Shutdown(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x02, 0, 0);
IPC::RequestParser rp(ctx);
if (mutex)
mutex = nullptr;
@ -233,7 +233,7 @@ void CSND_SND::Shutdown(Kernel::HLERequestContext& ctx) {
}
void CSND_SND::ExecuteCommands(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x03, 1, 0);
IPC::RequestParser rp(ctx);
const u32 addr = rp.Pop<u32>();
LOG_WARNING(Service_CSND, "(STUBBED) called, addr=0x{:08X}", addr);
@ -397,7 +397,7 @@ void CSND_SND::ExecuteCommands(Kernel::HLERequestContext& ctx) {
}
void CSND_SND::AcquireSoundChannels(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x05, 0, 0);
IPC::RequestParser rp(ctx);
// This is "almost" hardcoded, as in CSND initializes this with some code during sysmodule
// startup, but it always compute to the same value.
@ -411,7 +411,7 @@ void CSND_SND::AcquireSoundChannels(Kernel::HLERequestContext& ctx) {
}
void CSND_SND::ReleaseSoundChannels(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x06, 0, 0);
IPC::RequestParser rp(ctx);
acquired_channel_mask = 0;
@ -422,7 +422,7 @@ void CSND_SND::ReleaseSoundChannels(Kernel::HLERequestContext& ctx) {
}
void CSND_SND::AcquireCapUnit(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x7, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
if (capture_units[0] && capture_units[1]) {
@ -446,7 +446,7 @@ void CSND_SND::AcquireCapUnit(Kernel::HLERequestContext& ctx) {
}
void CSND_SND::ReleaseCapUnit(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x8, 1, 0);
IPC::RequestParser rp(ctx);
const u32 index = rp.Pop<u32>();
capture_units[index] = false;
@ -458,7 +458,7 @@ void CSND_SND::ReleaseCapUnit(Kernel::HLERequestContext& ctx) {
}
void CSND_SND::FlushDataCache(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x9, 2, 2);
IPC::RequestParser rp(ctx);
[[maybe_unused]] const VAddr address = rp.Pop<u32>();
[[maybe_unused]] const u32 size = rp.Pop<u32>();
const auto process = rp.PopObject<Kernel::Process>();
@ -471,7 +471,7 @@ void CSND_SND::FlushDataCache(Kernel::HLERequestContext& ctx) {
}
void CSND_SND::StoreDataCache(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xA, 2, 2);
IPC::RequestParser rp(ctx);
[[maybe_unused]] const VAddr address = rp.Pop<u32>();
[[maybe_unused]] const u32 size = rp.Pop<u32>();
const auto process = rp.PopObject<Kernel::Process>();
@ -484,7 +484,7 @@ void CSND_SND::StoreDataCache(Kernel::HLERequestContext& ctx) {
}
void CSND_SND::InvalidateDataCache(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xB, 2, 2);
IPC::RequestParser rp(ctx);
[[maybe_unused]] const VAddr address = rp.Pop<u32>();
[[maybe_unused]] const u32 size = rp.Pop<u32>();
const auto process = rp.PopObject<Kernel::Process>();
@ -497,7 +497,7 @@ void CSND_SND::InvalidateDataCache(Kernel::HLERequestContext& ctx) {
}
void CSND_SND::Reset(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xC, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS);
@ -508,18 +508,18 @@ void CSND_SND::Reset(Kernel::HLERequestContext& ctx) {
CSND_SND::CSND_SND(Core::System& system) : ServiceFramework("csnd:SND", 4), system(system) {
static const FunctionInfo functions[] = {
// clang-format off
{IPC::MakeHeader(0x0001, 5, 0), &CSND_SND::Initialize, "Initialize"},
{IPC::MakeHeader(0x0002, 0, 0), &CSND_SND::Shutdown, "Shutdown"},
{IPC::MakeHeader(0x0003, 1, 0), &CSND_SND::ExecuteCommands, "ExecuteCommands"},
{IPC::MakeHeader(0x0004, 2, 0), nullptr, "ExecuteType1Commands"},
{IPC::MakeHeader(0x0005, 0, 0), &CSND_SND::AcquireSoundChannels, "AcquireSoundChannels"},
{IPC::MakeHeader(0x0006, 0, 0), &CSND_SND::ReleaseSoundChannels, "ReleaseSoundChannels"},
{IPC::MakeHeader(0x0007, 0, 0), &CSND_SND::AcquireCapUnit, "AcquireCapUnit"},
{IPC::MakeHeader(0x0008, 1, 0), &CSND_SND::ReleaseCapUnit, "ReleaseCapUnit"},
{IPC::MakeHeader(0x0009, 2, 2), &CSND_SND::FlushDataCache, "FlushDataCache"},
{IPC::MakeHeader(0x000A, 2, 2), &CSND_SND::StoreDataCache, "StoreDataCache"},
{IPC::MakeHeader(0x000B, 2, 2), &CSND_SND::InvalidateDataCache, "InvalidateDataCache"},
{IPC::MakeHeader(0x000C, 0, 0), &CSND_SND::Reset, "Reset"},
{0x0001, &CSND_SND::Initialize, "Initialize"},
{0x0002, &CSND_SND::Shutdown, "Shutdown"},
{0x0003, &CSND_SND::ExecuteCommands, "ExecuteCommands"},
{0x0004, nullptr, "ExecuteType1Commands"},
{0x0005, &CSND_SND::AcquireSoundChannels, "AcquireSoundChannels"},
{0x0006, &CSND_SND::ReleaseSoundChannels, "ReleaseSoundChannels"},
{0x0007, &CSND_SND::AcquireCapUnit, "AcquireCapUnit"},
{0x0008, &CSND_SND::ReleaseCapUnit, "ReleaseCapUnit"},
{0x0009, &CSND_SND::FlushDataCache, "FlushDataCache"},
{0x000A, &CSND_SND::StoreDataCache, "StoreDataCache"},
{0x000B, &CSND_SND::InvalidateDataCache, "InvalidateDataCache"},
{0x000C, &CSND_SND::Reset, "Reset"},
// clang-format on
};