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
This commit is contained in:
Ac_K 2021-06-28 20:54:45 +02:00 committed by GitHub
parent fefd4619a5
commit a79b39b913
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 591 additions and 33 deletions

View file

@ -0,0 +1,7 @@
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
{
class IAppletCommonFunctions : IpcService
{
public IAppletCommonFunctions() { }
}
}

View file

@ -2,6 +2,8 @@ using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.HOS.Services.Settings.Types;
using Ryujinx.HLE.HOS.SystemState;
using System;
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
@ -241,6 +243,18 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
return (ResultCode)_apmSystemManagerServer.GetCurrentPerformanceConfiguration(context);
}
[CommandHipc(300)] // 9.0.0+
// GetSettingsPlatformRegion() -> u8
public ResultCode GetSettingsPlatformRegion(ServiceCtx context)
{
PlatformRegion platformRegion = context.Device.System.State.DesiredRegionCode == (uint)RegionCode.China ? PlatformRegion.China : PlatformRegion.Global;
// FIXME: Call set:sys GetPlatformRegion
context.ResponseData.Write((byte)platformRegion);
return ResultCode.Success;
}
[CommandHipc(900)] // 11.0.0+
// SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled()
public ResultCode SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(ServiceCtx context)

View file

@ -1,7 +1,106 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Memory;
using System;
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
{
class IDisplayController : IpcService
{
public IDisplayController() { }
private KTransferMemory _transferMem;
private bool _lastApplicationCaptureBufferAcquired;
private bool _callerAppletCaptureBufferAcquired;
public IDisplayController(ServiceCtx context)
{
_transferMem = context.Device.System.AppletCaptureBufferTransfer;
}
[CommandHipc(8)] // 2.0.0+
// TakeScreenShotOfOwnLayer(b8, s32)
public ResultCode TakeScreenShotOfOwnLayer(ServiceCtx context)
{
bool unknown1 = context.RequestData.ReadBoolean();
int unknown2 = context.RequestData.ReadInt32();
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { unknown1, unknown2 });
return ResultCode.Success;
}
[CommandHipc(11)]
// ReleaseLastApplicationCaptureBuffer()
public ResultCode ReleaseLastApplicationCaptureBuffer(ServiceCtx context)
{
if (!_lastApplicationCaptureBufferAcquired)
{
return ResultCode.BufferNotAcquired;
}
_lastApplicationCaptureBufferAcquired = false;
return ResultCode.Success;
}
[CommandHipc(15)]
// ReleaseCallerAppletCaptureBuffer()
public ResultCode ReleaseCallerAppletCaptureBuffer(ServiceCtx context)
{
if (!_callerAppletCaptureBufferAcquired)
{
return ResultCode.BufferNotAcquired;
}
_callerAppletCaptureBufferAcquired = false;
return ResultCode.Success;
}
[CommandHipc(16)]
// AcquireLastApplicationCaptureBufferEx() -> (b8, handle<copy>)
public ResultCode AcquireLastApplicationCaptureBufferEx(ServiceCtx context)
{
if (_lastApplicationCaptureBufferAcquired)
{
return ResultCode.BufferAlreadyAcquired;
}
if (context.Process.HandleTable.GenerateHandle(_transferMem, out int handle) != KernelResult.Success)
{
throw new InvalidOperationException("Out of handles!");
}
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
_lastApplicationCaptureBufferAcquired = true;
context.ResponseData.Write(_lastApplicationCaptureBufferAcquired);
return ResultCode.Success;
}
[CommandHipc(18)]
// AcquireCallerAppletCaptureBufferEx() -> (b8, handle<copy>)
public ResultCode AcquireCallerAppletCaptureBufferEx(ServiceCtx context)
{
if (_callerAppletCaptureBufferAcquired)
{
return ResultCode.BufferAlreadyAcquired;
}
if (context.Process.HandleTable.GenerateHandle(_transferMem, out int handle) != KernelResult.Success)
{
throw new InvalidOperationException("Out of handles!");
}
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
_callerAppletCaptureBufferAcquired = true;
context.ResponseData.Write(_callerAppletCaptureBufferAcquired);
return ResultCode.Success;
}
}
}

View file

@ -35,9 +35,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
private uint _screenShotImageOrientation = 0;
private uint _idleTimeDetectionExtension = 0;
public ISelfController(Horizon system, long pid)
public ISelfController(ServiceCtx context, long pid)
{
_libraryAppletLaunchableEvent = new KEvent(system.KernelContext);
_libraryAppletLaunchableEvent = new KEvent(context.Device.System.KernelContext);
_pid = pid;
}
@ -225,6 +225,15 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
return ResultCode.Success;
}
[CommandHipc(41)] // 4.0.0+
// IsSystemBufferSharingEnabled()
public ResultCode IsSystemBufferSharingEnabled(ServiceCtx context)
{
// NOTE: Service checks a private field and return an error if the SystemBufferSharing is disabled.
return ResultCode.NotImplemented;
}
[CommandHipc(44)] // 10.0.0+
// CreateManagedDisplaySeparableLayer() -> (u64, u64)
public ResultCode CreateManagedDisplaySeparableLayer(ServiceCtx context)