Rewrote mm:u to follow switchbrew.org documentation

This commit is contained in:
Jarrod Norwell 2024-04-13 20:53:26 +08:00
parent 169beb4766
commit 4ce69bc41f
3 changed files with 61 additions and 20 deletions

@ -1 +1 @@
Subproject commit 9c1294eaddb88cb0e044c675ccae059a85fc9c6c
Subproject commit 65c1c83ca42540415516c37e21c9aeb7dd2c96d1

View File

@ -30,24 +30,34 @@ public:
private:
void InitializeOld(HLERequestContext& ctx) {
LOG_WARNING(Service_MM, "(STUBBED) called");
LOG_WARNING(Service_MM, "(STUBBED) called.");
IPC::RequestParser rp{ctx};
module = rp.PopEnum<Module>();
priority = rp.Pop<Priority>();
event_clear_mode = rp.Pop<u32>();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void FinalizeOld(HLERequestContext& ctx) {
LOG_WARNING(Service_MM, "(STUBBED) called");
LOG_WARNING(Service_MM, "(STUBBED) called.");
IPC::RequestParser rp{ctx};
module = rp.PopEnum<Module>();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void SetAndWaitOld(HLERequestContext& ctx) {
LOG_WARNING(Service_MM, "(STUBBED) called.");
IPC::RequestParser rp{ctx};
min = rp.Pop<u32>();
max = rp.Pop<u32>();
LOG_DEBUG(Service_MM, "(STUBBED) called, min=0x{:X}, max=0x{:X}", min, max);
module = rp.PopEnum<Module>();
min = rp.Pop<Setting>();
max = rp.Pop<Setting>();
current = min;
IPC::ResponseBuilder rb{ctx, 2};
@ -55,7 +65,10 @@ private:
}
void GetOld(HLERequestContext& ctx) {
LOG_DEBUG(Service_MM, "(STUBBED) called");
LOG_WARNING(Service_MM, "(STUBBED) called.");
IPC::RequestParser rp{ctx};
module = rp.PopEnum<Module>();
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
@ -63,27 +76,35 @@ private:
}
void Initialize(HLERequestContext& ctx) {
LOG_WARNING(Service_MM, "(STUBBED) called");
LOG_WARNING(Service_MM, "(STUBBED) called.");
IPC::RequestParser rp{ctx};
module = rp.PopEnum<Module>();
priority = rp.Pop<Priority>();
event_clear_mode = rp.Pop<u32>();
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push<u32>(id); // Any non zero value
rb.Push(request_id);
}
void Finalize(HLERequestContext& ctx) {
LOG_WARNING(Service_MM, "(STUBBED) called");
LOG_WARNING(Service_MM, "(STUBBED) called.");
IPC::RequestParser rp{ctx};
request_id = rp.Pop<u32>();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void SetAndWait(HLERequestContext& ctx) {
LOG_WARNING(Service_MM, "(STUBBED) called.");
IPC::RequestParser rp{ctx};
u32 input_id = rp.Pop<u32>();
min = rp.Pop<u32>();
max = rp.Pop<u32>();
LOG_DEBUG(Service_MM, "(STUBBED) called, input_id=0x{:X}, min=0x{:X}, max=0x{:X}", input_id,
min, max);
request_id = rp.Pop<u32>();
min = rp.Pop<Setting>();
max = rp.Pop<Setting>();
current = min;
IPC::ResponseBuilder rb{ctx, 2};
@ -91,17 +112,20 @@ private:
}
void Get(HLERequestContext& ctx) {
LOG_DEBUG(Service_MM, "(STUBBED) called");
LOG_WARNING(Service_MM, "(STUBBED) called.");
IPC::RequestParser rp{ctx};
request_id = rp.Pop<u32>();
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(current);
}
u32 min{0};
u32 max{0};
u32 current{0};
u32 id{1};
Module module{Module::TEST};
Priority priority{0};
Setting min{0}, max{0}, current{0};
u32 request_id{0}, event_clear_mode{0};
};
void LoopProcess(Core::System& system) {

View File

@ -3,12 +3,29 @@
#pragma once
#include "common/common_types.h"
namespace Core {
class System;
}
namespace Service::MM {
enum class Module : u32 {
CPU = 0,
GPU = 1,
EMC = 2,
SYS_BUS = 3,
M_SELECT = 4,
NVDEC = 5,
NVENC = 6,
NVJPG = 7,
TEST = 8
};
typedef u32 Priority;
typedef u32 Setting;
void LoopProcess(Core::System& system);
} // namespace Service::MM