mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-10-01 12:30:00 +02:00
Add support for dynamic docking/undocking (#1147)
* Add support for dynamic docking/undocking As SurfaceFlinger is now working more accurately, we can now support dynamic configuration of docking mode :) * Simplify a bt the code * Fix import ordering * Remove unused argument
This commit is contained in:
parent
21a0b0ebeb
commit
cdbb689b80
5 changed files with 32 additions and 11 deletions
|
@ -7,6 +7,7 @@ using LibHac.FsSystem.NcaUtils;
|
|||
using LibHac.Ncm;
|
||||
using LibHac.Ns;
|
||||
using LibHac.Spl;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Configuration;
|
||||
|
@ -16,7 +17,9 @@ using Ryujinx.HLE.HOS.Kernel.Common;
|
|||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy;
|
||||
using Ryujinx.HLE.HOS.Services.Mii;
|
||||
using Ryujinx.HLE.HOS.Services.Nv;
|
||||
using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl;
|
||||
using Ryujinx.HLE.HOS.Services.Pcv.Bpc;
|
||||
using Ryujinx.HLE.HOS.Services.Settings;
|
||||
|
@ -41,7 +44,6 @@ using TimeServiceManager = Ryujinx.HLE.HOS.Services.Time.TimeManager;
|
|||
using NsoExecutable = Ryujinx.HLE.Loaders.Executables.NsoExecutable;
|
||||
|
||||
using static LibHac.Fs.ApplicationSaveDataManagement;
|
||||
using Ryujinx.HLE.HOS.Services.Nv;
|
||||
|
||||
namespace Ryujinx.HLE.HOS
|
||||
{
|
||||
|
@ -114,6 +116,8 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
internal KEvent VsyncEvent { get; private set; }
|
||||
|
||||
internal KEvent DisplayResolutionChangeEvent { get; private set; }
|
||||
|
||||
public Keyset KeySet => Device.FileSystem.KeySet;
|
||||
|
||||
#pragma warning disable CS0649
|
||||
|
@ -224,6 +228,8 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
VsyncEvent = new KEvent(this);
|
||||
|
||||
DisplayResolutionChangeEvent = new KEvent(this);
|
||||
|
||||
ContentManager = contentManager;
|
||||
|
||||
// TODO: use set:sys (and get external clock source id from settings)
|
||||
|
@ -272,6 +278,20 @@ namespace Ryujinx.HLE.HOS
|
|||
HostSyncpoint = new NvHostSyncpt(device);
|
||||
|
||||
SurfaceFlinger = new SurfaceFlinger(device);
|
||||
|
||||
ConfigurationState.Instance.System.EnableDockedMode.Event += OnDockedModeChange;
|
||||
}
|
||||
|
||||
private void OnDockedModeChange(object sender, ReactiveEventArgs<bool> e)
|
||||
{
|
||||
if (e.NewValue != State.DockedMode)
|
||||
{
|
||||
State.DockedMode = e.NewValue;
|
||||
|
||||
AppletState.EnqueueMessage(MessageInfo.OperationModeChanged);
|
||||
AppletState.EnqueueMessage(MessageInfo.PerformanceModeChanged);
|
||||
SignalDisplayResolutionChange();
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadCart(string exeFsDir, string romFsFile = null)
|
||||
|
@ -807,6 +827,11 @@ namespace Ryujinx.HLE.HOS
|
|||
return rc;
|
||||
}
|
||||
|
||||
public void SignalDisplayResolutionChange()
|
||||
{
|
||||
DisplayResolutionChangeEvent.ReadableEvent.Signal();
|
||||
}
|
||||
|
||||
public void SignalVsync()
|
||||
{
|
||||
VsyncEvent.ReadableEvent.Signal();
|
||||
|
@ -852,6 +877,8 @@ namespace Ryujinx.HLE.HOS
|
|||
{
|
||||
if (!_isDisposed && disposing)
|
||||
{
|
||||
ConfigurationState.Instance.System.EnableDockedMode.Event -= OnDockedModeChange;
|
||||
|
||||
_isDisposed = true;
|
||||
|
||||
SurfaceFlinger.Dispose();
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService
|
|||
// GetCommonStateGetter() -> object<nn::am::service::ICommonStateGetter>
|
||||
public ResultCode GetCommonStateGetter(ServiceCtx context)
|
||||
{
|
||||
MakeObject(context, new ICommonStateGetter(context.Device.System));
|
||||
MakeObject(context, new ICommonStateGetter());
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
|
|
@ -9,14 +9,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||
{
|
||||
class ICommonStateGetter : IpcService
|
||||
{
|
||||
private KEvent _displayResolutionChangeEvent;
|
||||
|
||||
private CpuBoostMode _cpuBoostMode = CpuBoostMode.Disabled;
|
||||
|
||||
public ICommonStateGetter(Horizon system)
|
||||
{
|
||||
_displayResolutionChangeEvent = new KEvent(system);
|
||||
}
|
||||
public ICommonStateGetter() { }
|
||||
|
||||
[Command(0)]
|
||||
// GetEventHandle() -> handle<copy>
|
||||
|
@ -108,7 +103,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||
// GetDefaultDisplayResolutionChangeEvent() -> handle<copy>
|
||||
public ResultCode GetDefaultDisplayResolutionChangeEvent(ServiceCtx context)
|
||||
{
|
||||
if (context.Process.HandleTable.GenerateHandle(_displayResolutionChangeEvent.ReadableEvent, out int handle) != KernelResult.Success)
|
||||
if (context.Process.HandleTable.GenerateHandle(context.Device.System.DisplayResolutionChangeEvent.ReadableEvent, out int handle) != KernelResult.Success)
|
||||
{
|
||||
throw new InvalidOperationException("Out of handles!");
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService
|
|||
// GetCommonStateGetter() -> object<nn::am::service::ICommonStateGetter>
|
||||
public ResultCode GetCommonStateGetter(ServiceCtx context)
|
||||
{
|
||||
MakeObject(context, new ICommonStateGetter(context.Device.System));
|
||||
MakeObject(context, new ICommonStateGetter());
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,6 @@ namespace Ryujinx.HLE
|
|||
|
||||
EnableDeviceVsync = ConfigurationState.Instance.Graphics.EnableVsync;
|
||||
|
||||
// TODO: Make this reloadable and implement Docking/Undocking logic.
|
||||
System.State.DockedMode = ConfigurationState.Instance.System.EnableDockedMode;
|
||||
|
||||
if (ConfigurationState.Instance.System.EnableMulticoreScheduling)
|
||||
|
|
Loading…
Reference in a new issue