mirror of
https://codeberg.org/yuzu-emu/yuzu.git
synced 2025-12-16 12:09:04 +00: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
884a47cab0
commit
49b17b42d0
@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/logging/log.h"
|
||||
@ -30,22 +31,23 @@ public:
|
||||
|
||||
private:
|
||||
void InitializeOld(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_MM, "(STUBBED) called.");
|
||||
|
||||
IPC::RequestParser rp{ctx};
|
||||
module = rp.PopEnum<Module>();
|
||||
priority = rp.Pop<Priority>();
|
||||
event_clear_mode = rp.Pop<u32>();
|
||||
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};
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void FinalizeOld(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_MM, "(STUBBED) called.");
|
||||
|
||||
IPC::RequestParser rp{ctx};
|
||||
module = rp.PopEnum<Module>();
|
||||
const auto module = rp.PopEnum<Module>();
|
||||
|
||||
LOG_WARNING(Service_MM, "(STUBBED) called, module={:d}", static_cast<u32>(module));
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultSuccess);
|
||||
@ -55,20 +57,23 @@ private:
|
||||
LOG_WARNING(Service_MM, "(STUBBED) called.");
|
||||
|
||||
IPC::RequestParser rp{ctx};
|
||||
module = rp.PopEnum<Module>();
|
||||
const auto module = rp.PopEnum<Module>();
|
||||
min = rp.Pop<Setting>();
|
||||
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;
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void GetOld(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_MM, "(STUBBED) called.");
|
||||
|
||||
IPC::RequestParser rp{ctx};
|
||||
module = rp.PopEnum<Module>();
|
||||
const auto module = rp.PopEnum<Module>();
|
||||
|
||||
LOG_DEBUG(Service_MM, "(STUBBED) called, module={:d}", static_cast<u32>(module));
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
@ -20,11 +21,23 @@ enum class Module : u32 {
|
||||
NVDEC = 5,
|
||||
NVENC = 6,
|
||||
NVJPG = 7,
|
||||
TEST = 8
|
||||
TEST = 8,
|
||||
};
|
||||
|
||||
typedef u32 Priority;
|
||||
typedef u32 Setting;
|
||||
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);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user