From 5644780e6e103a8b1dd61098db3097d75eeb8069 Mon Sep 17 00:00:00 2001 From: mageven <62494521+mageven@users.noreply.github.com> Date: Sat, 4 Jul 2020 04:18:07 +0530 Subject: [PATCH] Stub nifm IRequest GetAppletInfo (#1326) * Stub GetAppletInfo to be consistent with GetResult * Fix formatting and enum * Update and use ResultCode --- Ryujinx.HLE/HOS/Services/Nifm/ResultCode.cs | 2 ++ .../Services/Nifm/StaticService/IRequest.cs | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/Ryujinx.HLE/HOS/Services/Nifm/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Nifm/ResultCode.cs index c661ee81f2..73cadb1141 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/ResultCode.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/ResultCode.cs @@ -7,6 +7,8 @@ namespace Ryujinx.HLE.HOS.Services.Nifm Success = 0, + Unknown112 = (112 << ErrorCodeShift) | ModuleId, // IRequest::GetResult + Unknown180 = (180 << ErrorCodeShift) | ModuleId, // IRequest::GetAppletInfo NoInternetConnection = (300 << ErrorCodeShift) | ModuleId, ObjectIsNull = (350 << ErrorCodeShift) | ModuleId } diff --git a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs index cfc6b51692..395e976aa0 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs @@ -38,6 +38,11 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService { Logger.PrintStub(LogClass.ServiceNifm); + return GetResultImpl(); + } + + private ResultCode GetResultImpl() + { return ResultCode.Success; } @@ -86,5 +91,32 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService return ResultCode.Success; } + + [Command(21)] + // GetAppletInfo(u32) -> (u32, u32, u32, buffer) + public ResultCode GetAppletInfo(ServiceCtx context) + { + uint themeColor = context.RequestData.ReadUInt32(); + + Logger.PrintStub(LogClass.ServiceNifm); + + ResultCode result = GetResultImpl(); + + if (result == ResultCode.Success || (ResultCode)((int)result & 0x3fffff) == ResultCode.Unknown112) + { + return ResultCode.Unknown180; + } + + // Returns appletId, libraryAppletMode, outSize and a buffer. + // Returned applet ids- (0x19, 0xf, 0xe) + // libraryAppletMode seems to be 0 for all applets supported. + + // TODO: check order + context.ResponseData.Write(0xe); // Use error applet as default for now + context.ResponseData.Write(0); // libraryAppletMode + context.ResponseData.Write(0); // outSize + + return ResultCode.Success; + } } } \ No newline at end of file