mirror of
https://git.citron-emu.org/Citron/Citron.git
synced 2025-01-31 21:26:57 +01:00
service: mm: Implement proper parameter handling for MM service
Add proper type definitions and parameter handling for the Memory Management (mm:u) service based on the Switch documentation: - Add Module enum for hardware components (CPU, GPU, EMC, etc) - Add Priority and Setting type definitions as u32 - Add EventClearMode enum for initialization - Implement proper parameter handling for all IPC calls - Add detailed logging with parameter values The Module enum now properly reflects the documented hardware components: CPU, GPU, EMC, System Bus, Memory Select, and NVIDIA modules (NVDEC, NVENC, NVJPG). This makes the implementation match the documented nn::mmnv::IRequest interface. Refs: switchbrew.org/wiki/Display_services#mm:u
This commit is contained in:
parent
37677052c1
commit
0adeac26af
2 changed files with 52 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
@ -30,14 +31,23 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitializeOld(HLERequestContext& ctx) {
|
void InitializeOld(HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_MM, "(STUBBED) called");
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto module = rp.PopEnum<Module>();
|
||||||
|
const auto priority = rp.Pop<Priority>();
|
||||||
|
const auto event_clear_mode = rp.PopEnum<EventClearMode>();
|
||||||
|
|
||||||
|
LOG_WARNING(Service_MM, "(STUBBED) called, module={:d}, priority={:d}, event_clear_mode={:d}",
|
||||||
|
static_cast<u32>(module), priority, static_cast<u32>(event_clear_mode));
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinalizeOld(HLERequestContext& ctx) {
|
void FinalizeOld(HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_MM, "(STUBBED) called");
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto module = rp.PopEnum<Module>();
|
||||||
|
|
||||||
|
LOG_WARNING(Service_MM, "(STUBBED) called, module={:d}", static_cast<u32>(module));
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
|
@ -45,9 +55,12 @@ private:
|
||||||
|
|
||||||
void SetAndWaitOld(HLERequestContext& ctx) {
|
void SetAndWaitOld(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
min = rp.Pop<u32>();
|
const auto module = rp.PopEnum<Module>();
|
||||||
max = rp.Pop<u32>();
|
min = rp.Pop<Setting>();
|
||||||
LOG_DEBUG(Service_MM, "(STUBBED) called, min=0x{:X}, max=0x{:X}", min, max);
|
max = rp.Pop<Setting>();
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_MM, "(STUBBED) called, module={:d}, min=0x{:X}, max=0x{:X}",
|
||||||
|
static_cast<u32>(module), min, max);
|
||||||
|
|
||||||
current = min;
|
current = min;
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
@ -55,7 +68,10 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetOld(HLERequestContext& ctx) {
|
void GetOld(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto module = rp.PopEnum<Module>();
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_MM, "(STUBBED) called, module={:d}", static_cast<u32>(module));
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
|
|
|
@ -1,14 +1,44 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/common_types.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::MM {
|
namespace Service::MM {
|
||||||
|
|
||||||
|
enum class Module : u32 {
|
||||||
|
Cpu = 0,
|
||||||
|
Gpu = 1,
|
||||||
|
Emc = 2,
|
||||||
|
SysBus = 3,
|
||||||
|
Mselect = 4,
|
||||||
|
Nvdec = 5,
|
||||||
|
Nvenc = 6,
|
||||||
|
Nvjpg = 7,
|
||||||
|
Test = 8,
|
||||||
|
};
|
||||||
|
|
||||||
|
using Priority = u32;
|
||||||
|
using Setting = u32;
|
||||||
|
|
||||||
|
enum class EventClearMode : u32 {
|
||||||
|
// TODO: Add specific clear mode values when documented
|
||||||
|
};
|
||||||
|
|
||||||
|
// Consolidate settings into a struct for better organization
|
||||||
|
struct Settings {
|
||||||
|
Setting min{0};
|
||||||
|
Setting max{0};
|
||||||
|
Setting current{0};
|
||||||
|
u32 id{1}; // Used by newer API versions
|
||||||
|
};
|
||||||
|
|
||||||
void LoopProcess(Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::MM
|
} // namespace Service::MM
|
||||||
|
|
Loading…
Reference in a new issue