From 4ce69bc41f33e3816b9a73ecc6268bd808e44367 Mon Sep 17 00:00:00 2001 From: Jarrod Norwell Date: Sat, 13 Apr 2024 20:53:26 +0800 Subject: [PATCH] Rewrote mm:u to follow switchbrew.org documentation --- externals/ffmpeg/ffmpeg | 2 +- src/core/hle/service/mm/mm_u.cpp | 62 ++++++++++++++++++++++---------- src/core/hle/service/mm/mm_u.h | 17 +++++++++ 3 files changed, 61 insertions(+), 20 deletions(-) diff --git a/externals/ffmpeg/ffmpeg b/externals/ffmpeg/ffmpeg index 9c1294e..65c1c83 160000 --- a/externals/ffmpeg/ffmpeg +++ b/externals/ffmpeg/ffmpeg @@ -1 +1 @@ -Subproject commit 9c1294eaddb88cb0e044c675ccae059a85fc9c6c +Subproject commit 65c1c83ca42540415516c37e21c9aeb7dd2c96d1 diff --git a/src/core/hle/service/mm/mm_u.cpp b/src/core/hle/service/mm/mm_u.cpp index 39e5dc7..e639bef 100644 --- a/src/core/hle/service/mm/mm_u.cpp +++ b/src/core/hle/service/mm/mm_u.cpp @@ -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(); + priority = rp.Pop(); + event_clear_mode = rp.Pop(); 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(); 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(); - max = rp.Pop(); - LOG_DEBUG(Service_MM, "(STUBBED) called, min=0x{:X}, max=0x{:X}", min, max); + module = rp.PopEnum(); + min = rp.Pop(); + max = rp.Pop(); 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(); 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(); + priority = rp.Pop(); + event_clear_mode = rp.Pop(); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - rb.Push(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(); 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(); - min = rp.Pop(); - max = rp.Pop(); - LOG_DEBUG(Service_MM, "(STUBBED) called, input_id=0x{:X}, min=0x{:X}, max=0x{:X}", input_id, - min, max); + request_id = rp.Pop(); + min = rp.Pop(); + max = rp.Pop(); 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(); 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) { diff --git a/src/core/hle/service/mm/mm_u.h b/src/core/hle/service/mm/mm_u.h index 7efaefc..8be8172 100644 --- a/src/core/hle/service/mm/mm_u.h +++ b/src/core/hle/service/mm/mm_u.h @@ -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