From a79b39b91347816ea14677b58af738b70df03e9c Mon Sep 17 00:00:00 2001 From: Ac_K Date: Mon, 28 Jun 2021 20:54:45 +0200 Subject: no name: Mii Editor applet support (#2419) * no name: Mii Editor applet support * addresses gdkchan feedback * Fix comment * Bypass MountCounter of MiiDatabaseManager * Fix GetSettingsPlatformRegion * Disable Applet Menu for unsupported firmwares --- .../LibraryAppletProxy/AppletStandalone.cs | 16 +++++ .../ILibraryAppletSelfAccessor.cs | 78 ++++++++++++++++++++++ .../IProcessWindingController.cs | 24 +++++++ 3 files changed, 118 insertions(+) create mode 100644 Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/AppletStandalone.cs create mode 100644 Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/ILibraryAppletSelfAccessor.cs create mode 100644 Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/IProcessWindingController.cs (limited to 'Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy') diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/AppletStandalone.cs b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/AppletStandalone.cs new file mode 100644 index 00000000..69967c56 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/AppletStandalone.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.LibraryAppletProxy +{ + class AppletStandalone + { + public AppletId AppletId; + public LibraryAppletMode LibraryAppletMode; + public Queue InputData; + + public AppletStandalone() + { + InputData = new Queue(); + } + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/ILibraryAppletSelfAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/ILibraryAppletSelfAccessor.cs new file mode 100644 index 00000000..00081e1b --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/ILibraryAppletSelfAccessor.cs @@ -0,0 +1,78 @@ +using Ryujinx.Common; +using System; + +namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.LibraryAppletProxy +{ + class ILibraryAppletSelfAccessor : IpcService + { + private AppletStandalone _appletStandalone = new AppletStandalone(); + + public ILibraryAppletSelfAccessor(ServiceCtx context) + { + if (context.Device.Application.TitleId == 0x0100000000001009) + { + // Create MiiEdit data. + _appletStandalone = new AppletStandalone() + { + AppletId = AppletId.MiiEdit, + LibraryAppletMode = LibraryAppletMode.AllForeground + }; + + byte[] miiEditInputData = new byte[0x100]; + miiEditInputData[0] = 0x03; // Hardcoded unknown value. + + _appletStandalone.InputData.Enqueue(miiEditInputData); + } + else + { + throw new NotImplementedException($"{context.Device.Application.TitleId} applet is not implemented."); + } + } + + [CommandHipc(0)] + // PopInData() -> object + public ResultCode PopInData(ServiceCtx context) + { + byte[] appletData = _appletStandalone.InputData.Dequeue(); + + if (appletData.Length == 0) + { + return ResultCode.NotAvailable; + } + + MakeObject(context, new IStorage(appletData)); + + return ResultCode.Success; + } + + [CommandHipc(11)] + // GetLibraryAppletInfo() -> nn::am::service::LibraryAppletInfo + public ResultCode GetLibraryAppletInfo(ServiceCtx context) + { + LibraryAppletInfo libraryAppletInfo = new LibraryAppletInfo() + { + AppletId = _appletStandalone.AppletId, + LibraryAppletMode = _appletStandalone.LibraryAppletMode + }; + + context.ResponseData.WriteStruct(libraryAppletInfo); + + return ResultCode.Success; + } + + [CommandHipc(14)] + // GetCallerAppletIdentityInfo() -> nn::am::service::AppletIdentityInfo + public ResultCode GetCallerAppletIdentityInfo(ServiceCtx context) + { + AppletIdentifyInfo appletIdentifyInfo = new AppletIdentifyInfo() + { + AppletId = AppletId.QLaunch, + TitleId = 0x0100000000001000 + }; + + context.ResponseData.WriteStruct(appletIdentifyInfo); + + return ResultCode.Success; + } + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/IProcessWindingController.cs b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/IProcessWindingController.cs new file mode 100644 index 00000000..e6c16734 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletProxy/IProcessWindingController.cs @@ -0,0 +1,24 @@ +using Ryujinx.Common; + +namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.LibraryAppletProxy +{ + class IProcessWindingController : IpcService + { + public IProcessWindingController() { } + + [CommandHipc(0)] + // GetLaunchReason() -> nn::am::service::AppletProcessLaunchReason + public ResultCode GetLaunchReason(ServiceCtx context) + { + // NOTE: Flag is set by using an internal field. + AppletProcessLaunchReason appletProcessLaunchReason = new AppletProcessLaunchReason() + { + Flag = 0 + }; + + context.ResponseData.WriteStruct(appletProcessLaunchReason); + + return ResultCode.Success; + } + } +} \ No newline at end of file -- cgit v1.2.3