fix: inconsistent focus mode
This commit is contained in:
parent
85f47f996c
commit
f73a7dce4f
@ -19,8 +19,9 @@ namespace Ryujinx.HLE.HOS.Applets
|
|||||||
private EventObserver _eventObserver = null;
|
private EventObserver _eventObserver = null;
|
||||||
|
|
||||||
// Foreground roots.
|
// Foreground roots.
|
||||||
private RealApplet _homeMenu = null;
|
RealApplet _homeMenu = null;
|
||||||
private RealApplet _overlayDisp = null;
|
RealApplet _overlayDisp = null;
|
||||||
|
RealApplet _application = null;
|
||||||
// Removed single application field to allow multiple applications.
|
// Removed single application field to allow multiple applications.
|
||||||
|
|
||||||
// Home menu state.
|
// Home menu state.
|
||||||
@ -130,23 +131,22 @@ namespace Ryujinx.HLE.HOS.Applets
|
|||||||
{
|
{
|
||||||
_overlayDisp = applet;
|
_overlayDisp = applet;
|
||||||
}
|
}
|
||||||
// For application applets, we no longer assign a unique field.
|
else if (isApplication)
|
||||||
// They are simply tracked as root applets (if callerPid == 0) and in the _applets dictionary.
|
{
|
||||||
|
_application = applet;
|
||||||
|
}
|
||||||
|
|
||||||
_applets[applet.AppletResourceUserId] = applet;
|
_applets[applet.AppletResourceUserId] = applet;
|
||||||
_eventObserver.TrackAppletProcess(applet);
|
_eventObserver.TrackAppletProcess(applet);
|
||||||
|
|
||||||
// If this is the first applet being tracked, or if it is one of the special system applets,
|
if (_applets.Count == 1 || applet.AppletId == RealAppletId.SystemAppletMenu || applet.AppletId == RealAppletId.OverlayApplet)
|
||||||
// perform initial setup.
|
|
||||||
if (_applets.Count == 1 ||
|
|
||||||
applet.AppletId == RealAppletId.SystemAppletMenu ||
|
|
||||||
applet.AppletId == RealAppletId.OverlayApplet)
|
|
||||||
{
|
{
|
||||||
SetupFirstApplet(applet);
|
SetupFirstApplet(applet);
|
||||||
_foregroundRequestedApplet = applet;
|
|
||||||
applet.AppletState.SetFocus(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// _foregroundRequestedApplet = applet;
|
||||||
|
// applet.AppletState.SetFocusState(FocusState.InFocus);
|
||||||
|
|
||||||
_eventObserver.RequestUpdate();
|
_eventObserver.RequestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ namespace Ryujinx.HLE.HOS.Applets
|
|||||||
{
|
{
|
||||||
applet.AppletState.SetFocusState(FocusState.InFocus);
|
applet.AppletState.SetFocusState(FocusState.InFocus);
|
||||||
_foregroundRequestedApplet = applet;
|
_foregroundRequestedApplet = applet;
|
||||||
RequestApplicationToGetForeground(applet.ProcessHandle.Pid);
|
RequestApplicationToGetForeground();
|
||||||
}
|
}
|
||||||
|
|
||||||
applet.UpdateSuspensionStateLocked(true);
|
applet.UpdateSuspensionStateLocked(true);
|
||||||
@ -208,63 +208,33 @@ namespace Ryujinx.HLE.HOS.Applets
|
|||||||
_eventObserver.RequestUpdate();
|
_eventObserver.RequestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
internal void RequestApplicationToGetForeground()
|
||||||
/// Requests that the home menu be focused.
|
|
||||||
/// The PID provided must match the home menu’s PID.
|
|
||||||
/// </summary>
|
|
||||||
internal void RequestHomeMenuToGetForeground(ulong pid)
|
|
||||||
{
|
{
|
||||||
lock (_lock)
|
// lock (_lock)
|
||||||
{
|
{
|
||||||
if (_homeMenu != null && _homeMenu.ProcessHandle.Pid == pid)
|
_foregroundRequestedApplet = _application;
|
||||||
{
|
|
||||||
_foregroundRequestedApplet = _homeMenu;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Logger.Warning?.Print(LogClass.ServiceAm, $"RequestHomeMenuToGetForeground: Provided pid {pid} does not match the home menu.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_eventObserver.RequestUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Requests that an application be focused.
|
|
||||||
/// The PID provided must belong to an application applet.
|
|
||||||
/// </summary>
|
|
||||||
internal void RequestApplicationToGetForeground(ulong pid)
|
|
||||||
{
|
|
||||||
lock (_lock)
|
|
||||||
{
|
|
||||||
if (_applets.TryGetValue(pid, out var applet))
|
|
||||||
{
|
|
||||||
_foregroundRequestedApplet = applet;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (pid == _homeMenu?.ProcessHandle.Pid)
|
|
||||||
{
|
|
||||||
_foregroundRequestedApplet.AppletState.SetFocusForce(false,true);
|
|
||||||
_foregroundRequestedApplet = _homeMenu;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Logger.Warning?.Print(LogClass.ServiceAm, $"RequestApplicationToGetForeground: Provided pid {pid} is not an application applet.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_eventObserver.RequestUpdate();
|
_eventObserver.RequestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void RequestLockHomeMenuIntoForeground()
|
internal void RequestLockHomeMenuIntoForeground()
|
||||||
|
{
|
||||||
|
// lock (_lock)
|
||||||
{
|
{
|
||||||
_homeMenuForegroundLocked = true;
|
_homeMenuForegroundLocked = true;
|
||||||
|
}
|
||||||
|
|
||||||
_eventObserver.RequestUpdate();
|
_eventObserver.RequestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void RequestUnlockHomeMenuFromForeground()
|
internal void RequestUnlockHomeMenuFromForeground()
|
||||||
|
{
|
||||||
|
// lock (_lock)
|
||||||
{
|
{
|
||||||
_homeMenuForegroundLocked = false;
|
_homeMenuForegroundLocked = false;
|
||||||
|
}
|
||||||
|
|
||||||
_eventObserver.RequestUpdate();
|
_eventObserver.RequestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,6 +597,21 @@ namespace Ryujinx.HLE.HOS.Applets
|
|||||||
applet.CallerApplet.ProcessHandle.SetActivity(true);
|
applet.CallerApplet.ProcessHandle.SetActivity(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TrackNewProcess(ulong processProcessId, ulong i, bool b)
|
||||||
|
{
|
||||||
|
TrackProcess(processProcessId, i, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal RealApplet GetOverlayMenu()
|
||||||
|
{
|
||||||
|
return _overlayDisp;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal RealApplet GetHomeMenu()
|
||||||
|
{
|
||||||
|
return _homeMenu;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ButtonPressTracker
|
internal class ButtonPressTracker
|
||||||
|
@ -59,7 +59,7 @@ namespace Ryujinx.HLE.HOS
|
|||||||
public void Execute(IExecutionContext context, ulong codeAddress)
|
public void Execute(IExecutionContext context, ulong codeAddress)
|
||||||
{
|
{
|
||||||
// We must wait until shader cache is loaded, among other things, before executing CPU code.
|
// We must wait until shader cache is loaded, among other things, before executing CPU code.
|
||||||
_gpuContext.WaitUntilGpuReady();
|
//_gpuContext.WaitUntilGpuReady();
|
||||||
_cpuContext.Execute(context, codeAddress);
|
_cpuContext.Execute(context, codeAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ namespace Ryujinx.HLE.HOS
|
|||||||
return IntialAppletState;
|
return IntialAppletState;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal WindowSystem WindowSystem { get; private set; }
|
public WindowSystem WindowSystem { get; private set; }
|
||||||
|
|
||||||
internal EventObserver EventObserver { get; private set; }
|
internal EventObserver EventObserver { get; private set; }
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ namespace Ryujinx.HLE.HOS
|
|||||||
|
|
||||||
public void ReturnFocus()
|
public void ReturnFocus()
|
||||||
{
|
{
|
||||||
GetAppletState(WindowSystem.GetFocusedApp()).SetFocus(true);
|
GetAppletState(WindowSystem.GetFocusedApp()).SetFocusState(FocusState.InFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SimulateWakeUpMessage()
|
public void SimulateWakeUpMessage()
|
||||||
@ -526,11 +526,20 @@ namespace Ryujinx.HLE.HOS
|
|||||||
IsPaused = pause;
|
IsPaused = pause;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetupFirst(ulong ProgramId)
|
public void SetupFirst(ulong ProgramId, ulong Pid)
|
||||||
{
|
{
|
||||||
bool isApp = ProgramId > 0x01000000000007FF;
|
bool isApp = ProgramId > 0x01000000000007FF;
|
||||||
RealApplet app = WindowSystem.TrackProcess(ProgramId, 0, isApp);
|
ulong pid = 0;
|
||||||
|
|
||||||
|
if (WindowSystem.GetOverlayMenu() != null)
|
||||||
|
{
|
||||||
|
pid = WindowSystem.GetOverlayMenu().ProcessHandle.Pid;
|
||||||
|
}
|
||||||
|
RealApplet app = WindowSystem.TrackProcess(Pid, pid, isApp);
|
||||||
|
if (isApp)
|
||||||
|
{
|
||||||
app.AppletState.SetFocusForce(true);
|
app.AppletState.SetFocusForce(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService
|
|||||||
// GetHomeMenuFunctions() -> object<nn::am::service::IHomeMenuFunctions>
|
// GetHomeMenuFunctions() -> object<nn::am::service::IHomeMenuFunctions>
|
||||||
public ResultCode GetHomeMenuFunctions(ServiceCtx context)
|
public ResultCode GetHomeMenuFunctions(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new IHomeMenuFunctions(context.Device.System, _pid));
|
MakeObject(context, new IHomeMenuFunctions(context.Device.System));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService
|
|||||||
// GetHomeMenuFunctions() -> object<nn::am::service::IHomeMenuFunctions>
|
// GetHomeMenuFunctions() -> object<nn::am::service::IHomeMenuFunctions>
|
||||||
public ResultCode GetHomeMenuFunctions(ServiceCtx context)
|
public ResultCode GetHomeMenuFunctions(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new IHomeMenuFunctions(context.Device.System, _pid));
|
MakeObject(context, new IHomeMenuFunctions(context.Device.System));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
{
|
{
|
||||||
applet.ProcessHandle.SetActivity(false);
|
applet.ProcessHandle.SetActivity(false);
|
||||||
}
|
}
|
||||||
context.Device.System.WindowSystem.RequestApplicationToGetForeground(applet.ProcessHandle.Pid);
|
context.Device.System.WindowSystem.RequestApplicationToGetForeground();
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -117,11 +117,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
focusState = _applet.AppletState.GetAndClearFocusState();
|
focusState = _applet.AppletState.GetAndClearFocusState();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.Device.System.WindowSystem.IsFocusedApplet(_applet))
|
|
||||||
{
|
|
||||||
focusState = FocusState.InFocus;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.ServiceAm, $"pid: {_applet.ProcessHandle.Pid}, GetCurrentFocusState():{focusState}");
|
Logger.Info?.Print(LogClass.ServiceAm, $"pid: {_applet.ProcessHandle.Pid}, GetCurrentFocusState():{focusState}");
|
||||||
context.ResponseData.Write((byte)focusState);
|
context.ResponseData.Write((byte)focusState);
|
||||||
|
|
||||||
@ -136,9 +131,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
|
|
||||||
_acquiredSleepLockEvent.ReadableEvent.Signal();
|
_acquiredSleepLockEvent.ReadableEvent.Signal();
|
||||||
|
|
||||||
_applet.AppletState.SetFocusForce(true);
|
|
||||||
context.Device.System.WindowSystem.RequestApplicationToGetForeground(_applet.ProcessHandle.Pid);
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using LibHac.Util;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Ipc;
|
using Ryujinx.HLE.HOS.Ipc;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
@ -8,21 +9,18 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
{
|
{
|
||||||
class IHomeMenuFunctions : IpcService
|
class IHomeMenuFunctions : IpcService
|
||||||
{
|
{
|
||||||
private ulong _pid;
|
|
||||||
private int _channelEventHandle;
|
private int _channelEventHandle;
|
||||||
|
|
||||||
public IHomeMenuFunctions(Horizon system, ulong pid)
|
public IHomeMenuFunctions(Horizon system)
|
||||||
{
|
{
|
||||||
_pid = pid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandCmif(10)]
|
[CommandCmif(10)]
|
||||||
// RequestToGetForeground()
|
// RequestToGetForeground()
|
||||||
public ResultCode RequestToGetForeground(ServiceCtx context)
|
public ResultCode RequestToGetForeground(ServiceCtx context)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
// Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
||||||
context.Device.System.WindowSystem.RequestApplicationToGetForeground(_pid);
|
context.Device.System.WindowSystem.RequestHomeMenuToGetForeground();
|
||||||
context.Device.System.GetAppletState(_pid).SetFocusForce(true);
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
@ -31,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
// LockForeground()
|
// LockForeground()
|
||||||
public ResultCode LockForeground(ServiceCtx context)
|
public ResultCode LockForeground(ServiceCtx context)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
// Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
||||||
context.Device.System.WindowSystem.RequestLockHomeMenuIntoForeground();
|
context.Device.System.WindowSystem.RequestLockHomeMenuIntoForeground();
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
@ -41,12 +39,30 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
// UnlockForeground()
|
// UnlockForeground()
|
||||||
public ResultCode UnlockForeground(ServiceCtx context)
|
public ResultCode UnlockForeground(ServiceCtx context)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
// Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
||||||
context.Device.System.WindowSystem.RequestUnlockHomeMenuFromForeground();
|
context.Device.System.WindowSystem.RequestUnlockHomeMenuFromForeground();
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandCmif(20)]
|
||||||
|
// PopFromGeneralChannel() -> object<nn::am::service::IStorage>
|
||||||
|
public ResultCode PopFromGeneralChannel(ServiceCtx context)
|
||||||
|
{
|
||||||
|
bool pop = context.Device.System.GeneralChannelData.TryDequeue(out byte[] data);
|
||||||
|
if (!pop)
|
||||||
|
{
|
||||||
|
return ResultCode.NotAvailable;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logger.Debug?.Print(LogClass.ServiceAm, $"Data size: {data.Length}");
|
||||||
|
Logger.Info?.Print(LogClass.ServiceAm, $"GeneralChannel data: {data.ToHexString()}");
|
||||||
|
|
||||||
|
MakeObject(context, new IStorage(data));
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
[CommandCmif(21)]
|
[CommandCmif(21)]
|
||||||
// GetPopFromGeneralChannelEvent() -> handle<copy>
|
// GetPopFromGeneralChannelEvent() -> handle<copy>
|
||||||
public ResultCode GetPopFromGeneralChannelEvent(ServiceCtx context)
|
public ResultCode GetPopFromGeneralChannelEvent(ServiceCtx context)
|
||||||
@ -69,6 +85,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CommandCmif(31)]
|
[CommandCmif(31)]
|
||||||
|
[CommandCmif(32)]
|
||||||
// GetWriterLockAccessorEx(i32) -> object<nn::am::service::ILockAccessor>
|
// GetWriterLockAccessorEx(i32) -> object<nn::am::service::ILockAccessor>
|
||||||
public ResultCode GetWriterLockAccessorEx(ServiceCtx context)
|
public ResultCode GetWriterLockAccessorEx(ServiceCtx context)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.HLE.HOS.Applets;
|
||||||
using Ryujinx.HLE.HOS.Ipc;
|
using Ryujinx.HLE.HOS.Ipc;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy.Types;
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy.Types;
|
||||||
@ -11,8 +12,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
class ISelfController : IpcService
|
class ISelfController : IpcService
|
||||||
{
|
{
|
||||||
private readonly ulong _pid;
|
private readonly ulong _pid;
|
||||||
|
private readonly RealApplet _applet;
|
||||||
|
|
||||||
private readonly KEvent _libraryAppletLaunchableEvent;
|
|
||||||
private int _libraryAppletLaunchableEventHandle;
|
private int _libraryAppletLaunchableEventHandle;
|
||||||
|
|
||||||
private KEvent _accumulatedSuspendedTickChangedEvent;
|
private KEvent _accumulatedSuspendedTickChangedEvent;
|
||||||
@ -29,8 +30,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
private bool _screenShotPermission = false;
|
private bool _screenShotPermission = false;
|
||||||
private bool _operationModeChangedNotification = false;
|
private bool _operationModeChangedNotification = false;
|
||||||
private bool _performanceModeChangedNotification = false;
|
private bool _performanceModeChangedNotification = false;
|
||||||
private bool _restartMessageEnabled = false;
|
|
||||||
private bool _outOfFocusSuspendingEnabled = false;
|
|
||||||
private bool _handlesRequestToDisplay = false;
|
private bool _handlesRequestToDisplay = false;
|
||||||
#pragma warning restore IDE0052
|
#pragma warning restore IDE0052
|
||||||
private bool _autoSleepDisabled = false;
|
private bool _autoSleepDisabled = false;
|
||||||
@ -44,8 +43,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
|
|
||||||
public ISelfController(ServiceCtx context, ulong pid)
|
public ISelfController(ServiceCtx context, ulong pid)
|
||||||
{
|
{
|
||||||
_libraryAppletLaunchableEvent = new KEvent(context.Device.System.KernelContext);
|
|
||||||
_pid = pid;
|
_pid = pid;
|
||||||
|
_applet = context.Device.System.WindowSystem.GetByAruId(_pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandCmif(0)]
|
[CommandCmif(0)]
|
||||||
@ -54,6 +53,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
||||||
|
|
||||||
|
_applet.ProcessHandle.Terminate();
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +62,17 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
// LockExit()
|
// LockExit()
|
||||||
public ResultCode LockExit(ServiceCtx context)
|
public ResultCode LockExit(ServiceCtx context)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
lock (_applet.Lock)
|
||||||
|
{
|
||||||
|
if (_applet.AppletState.HasRequestedExit)
|
||||||
|
{
|
||||||
|
_applet.ProcessHandle.Terminate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_applet.ExitLocked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
@ -70,7 +81,15 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
// UnlockExit()
|
// UnlockExit()
|
||||||
public ResultCode UnlockExit(ServiceCtx context)
|
public ResultCode UnlockExit(ServiceCtx context)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
lock (_applet.Lock)
|
||||||
|
{
|
||||||
|
_applet.ExitLocked = false;
|
||||||
|
|
||||||
|
if (_applet.AppletState.HasRequestedExit)
|
||||||
|
{
|
||||||
|
_applet.ProcessHandle.Terminate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
@ -112,11 +131,12 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
// GetLibraryAppletLaunchableEvent() -> handle<copy>
|
// GetLibraryAppletLaunchableEvent() -> handle<copy>
|
||||||
public ResultCode GetLibraryAppletLaunchableEvent(ServiceCtx context)
|
public ResultCode GetLibraryAppletLaunchableEvent(ServiceCtx context)
|
||||||
{
|
{
|
||||||
_libraryAppletLaunchableEvent.ReadableEvent.Signal();
|
var evnt = _applet.AppletState.LaunchableEvent;
|
||||||
|
evnt.ReadableEvent.Signal();
|
||||||
|
|
||||||
if (_libraryAppletLaunchableEventHandle == 0)
|
if (_libraryAppletLaunchableEventHandle == 0)
|
||||||
{
|
{
|
||||||
if (context.Process.HandleTable.GenerateHandle(_libraryAppletLaunchableEvent.ReadableEvent, out _libraryAppletLaunchableEventHandle) != Result.Success)
|
if (context.Process.HandleTable.GenerateHandle(evnt.ReadableEvent, out _libraryAppletLaunchableEventHandle) != Result.Success)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Out of handles!");
|
throw new InvalidOperationException("Out of handles!");
|
||||||
}
|
}
|
||||||
@ -172,11 +192,18 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
// SetFocusHandlingMode(b8, b8, b8)
|
// SetFocusHandlingMode(b8, b8, b8)
|
||||||
public ResultCode SetFocusHandlingMode(ServiceCtx context)
|
public ResultCode SetFocusHandlingMode(ServiceCtx context)
|
||||||
{
|
{
|
||||||
bool unknownFlag1 = context.RequestData.ReadBoolean();
|
bool notify = context.RequestData.ReadBoolean();
|
||||||
bool unknownFlag2 = context.RequestData.ReadBoolean();
|
bool background = context.RequestData.ReadBoolean();
|
||||||
bool unknownFlag3 = context.RequestData.ReadBoolean();
|
bool suspend = context.RequestData.ReadBoolean();
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { unknownFlag1, unknownFlag2, unknownFlag3 });
|
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { notify, background, suspend });
|
||||||
|
|
||||||
|
lock (_applet.Lock)
|
||||||
|
{
|
||||||
|
_applet.AppletState.SetFocusHandlingMode(suspend);
|
||||||
|
_applet.AppletState.FocusStateChangedNotificationEnabled = notify;
|
||||||
|
_applet.UpdateSuspensionStateLocked(true);
|
||||||
|
}
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
@ -189,7 +216,10 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { restartMessageEnabled });
|
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { restartMessageEnabled });
|
||||||
|
|
||||||
_restartMessageEnabled = restartMessageEnabled;
|
lock (_applet.Lock)
|
||||||
|
{
|
||||||
|
_applet.AppletState.ResumeNotificationEnabled = restartMessageEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
@ -210,7 +240,11 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { outOfFocusSuspendingEnabled });
|
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { outOfFocusSuspendingEnabled });
|
||||||
|
|
||||||
_outOfFocusSuspendingEnabled = outOfFocusSuspendingEnabled;
|
lock (_applet.Lock)
|
||||||
|
{
|
||||||
|
_applet.AppletState.SetOutOfFocusSuspendingEnabled(outOfFocusSuspendingEnabled);
|
||||||
|
_applet.UpdateSuspensionStateLocked(false);
|
||||||
|
}
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
@ -263,7 +297,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
{
|
{
|
||||||
context.Device.System.SurfaceFlinger.CreateLayer(out long displayLayerId, _pid);
|
context.Device.System.SurfaceFlinger.CreateLayer(out long displayLayerId, _pid);
|
||||||
context.Device.System.SurfaceFlinger.CreateLayer(out long recordingLayerId, _pid);
|
context.Device.System.SurfaceFlinger.CreateLayer(out long recordingLayerId, _pid);
|
||||||
//context.Device.System.SurfaceFlinger.SetRenderLayer(displayLayerId);
|
|
||||||
|
|
||||||
context.ResponseData.Write(displayLayerId);
|
context.ResponseData.Write(displayLayerId);
|
||||||
context.ResponseData.Write(recordingLayerId);
|
context.ResponseData.Write(recordingLayerId);
|
||||||
@ -285,10 +318,16 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CommandCmif(60)]
|
[CommandCmif(60)]
|
||||||
// OverrideAutoSleepTimeAndDimmingTime()
|
// OverrideAutoSleepTimeAndDimmingTime(i32, i32, i32, i32)
|
||||||
public ResultCode OverrideAutoSleepTimeAndDimmingTime(ServiceCtx context)
|
public ResultCode OverrideAutoSleepTimeAndDimmingTime(ServiceCtx context)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
int unk1 = context.RequestData.ReadInt32();
|
||||||
|
int unk2 = context.RequestData.ReadInt32();
|
||||||
|
int unk3 = context.RequestData.ReadInt32();
|
||||||
|
int unk4 = context.RequestData.ReadInt32();
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { unk1, unk2, unk3, unk4 });
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,6 +355,17 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandCmif(64)]
|
||||||
|
// SetInputDetectionSourceSet(u32)
|
||||||
|
public ResultCode SetInputDetectionSourceSet(ServiceCtx context)
|
||||||
|
{
|
||||||
|
uint inputDetectionSourceSet = context.RequestData.ReadUInt32();
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { inputDetectionSourceSet });
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
[CommandCmif(65)]
|
[CommandCmif(65)]
|
||||||
// ReportUserIsActive()
|
// ReportUserIsActive()
|
||||||
public ResultCode ReportUserIsActive(ServiceCtx context)
|
public ResultCode ReportUserIsActive(ServiceCtx context)
|
||||||
|
@ -19,8 +19,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
|
|
||||||
context.ResponseData.Write(appletResourceUserId);
|
context.ResponseData.Write(appletResourceUserId);
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { appletResourceUserId });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +33,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[CommandCmif(10)]
|
[CommandCmif(10)]
|
||||||
// AcquireForegroundRights()
|
// AcquireForegroundRights()
|
||||||
public ResultCode AcquireForegroundRights(ServiceCtx context)
|
public ResultCode AcquireForegroundRights(ServiceCtx context)
|
||||||
|
@ -12,7 +12,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
|
|||||||
// OpenSystemAppletProxy(u64, pid, handle<copy>) -> object<nn::am::service::ISystemAppletProxy>
|
// OpenSystemAppletProxy(u64, pid, handle<copy>) -> object<nn::am::service::ISystemAppletProxy>
|
||||||
public ResultCode OpenSystemAppletProxy(ServiceCtx context)
|
public ResultCode OpenSystemAppletProxy(ServiceCtx context)
|
||||||
{
|
{
|
||||||
context.Device.System.WindowSystem.TrackProcess(context.Request.HandleDesc.PId, 0, false);
|
|
||||||
MakeObject(context, new ISystemAppletProxy(context.Request.HandleDesc.PId));
|
MakeObject(context, new ISystemAppletProxy(context.Request.HandleDesc.PId));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
@ -23,7 +22,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
|
|||||||
// OpenLibraryAppletProxy(u64, pid, handle<copy>) -> object<nn::am::service::ILibraryAppletProxy>
|
// OpenLibraryAppletProxy(u64, pid, handle<copy>) -> object<nn::am::service::ILibraryAppletProxy>
|
||||||
public ResultCode OpenLibraryAppletProxy(ServiceCtx context)
|
public ResultCode OpenLibraryAppletProxy(ServiceCtx context)
|
||||||
{
|
{
|
||||||
context.Device.System.WindowSystem.TrackProcess(context.Request.HandleDesc.PId, 0, false);
|
|
||||||
MakeObject(context, new ILibraryAppletProxy(context,context.Request.HandleDesc.PId));
|
MakeObject(context, new ILibraryAppletProxy(context,context.Request.HandleDesc.PId));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
@ -33,7 +31,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
|
|||||||
// OpenOverlayAppletProxy(pid, handle<copy>) -> object<nn::am::service::IOverlayAppletProxy>
|
// OpenOverlayAppletProxy(pid, handle<copy>) -> object<nn::am::service::IOverlayAppletProxy>
|
||||||
public ResultCode OpenOverlayAppletProxy(ServiceCtx context)
|
public ResultCode OpenOverlayAppletProxy(ServiceCtx context)
|
||||||
{
|
{
|
||||||
context.Device.System.WindowSystem.TrackProcess(context.Request.HandleDesc.PId, 0, false);
|
|
||||||
MakeObject(context, new IOverlayAppletProxy(context.Request.HandleDesc.PId));
|
MakeObject(context, new IOverlayAppletProxy(context.Request.HandleDesc.PId));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
@ -43,7 +40,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
|
|||||||
// OpenSystemApplicationProxy(u64, pid, handle<copy>) -> object<nn::am::service::IApplicationProxy>
|
// OpenSystemApplicationProxy(u64, pid, handle<copy>) -> object<nn::am::service::IApplicationProxy>
|
||||||
public ResultCode OpenSystemApplicationProxy(ServiceCtx context)
|
public ResultCode OpenSystemApplicationProxy(ServiceCtx context)
|
||||||
{
|
{
|
||||||
context.Device.System.WindowSystem.TrackProcess(context.Request.HandleDesc.PId, 0, false);
|
|
||||||
MakeObject(context, new IApplicationProxy(context.Request.HandleDesc.PId));
|
MakeObject(context, new IApplicationProxy(context.Request.HandleDesc.PId));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Ipc;
|
using Ryujinx.HLE.HOS.Ipc;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
using Ryujinx.Horizon.Common;
|
using Ryujinx.Horizon.Common;
|
||||||
@ -31,5 +32,13 @@ namespace Ryujinx.HLE.HOS.Services.Npns
|
|||||||
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(receiveEventHandle);
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(receiveEventHandle);
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandCmif(8)] // 18.0.0+
|
||||||
|
// ListenToByName()
|
||||||
|
public ResultCode ListenToByName(ServiceCtx context)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceNpns);
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -321,13 +321,6 @@ namespace Ryujinx.HLE.HOS.SystemState
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFocus(bool isFocused)
|
|
||||||
{
|
|
||||||
SetFocusHandlingMode(false);
|
|
||||||
FocusState focusState = isFocused ? FocusState.InFocus : FocusState.OutOfFocus;
|
|
||||||
SetFocusState(focusState);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetFocusForce(bool isFocused, bool shouldSuspend = false)
|
public void SetFocusForce(bool isFocused, bool shouldSuspend = false)
|
||||||
{
|
{
|
||||||
Messages.Clear();
|
Messages.Clear();
|
||||||
|
@ -168,7 +168,7 @@ namespace Ryujinx.HLE
|
|||||||
System.WindowSystem.ButtonPressTracker.Update();
|
System.WindowSystem.ButtonPressTracker.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadSystemProgramId(ulong programId)
|
public bool LoadSystemProgramId(ulong programId, out ProcessResult result)
|
||||||
{
|
{
|
||||||
string contentPath = System.ContentManager.GetInstalledContentPath(programId, StorageId.BuiltInSystem, NcaContentType.Program);
|
string contentPath = System.ContentManager.GetInstalledContentPath(programId, StorageId.BuiltInSystem, NcaContentType.Program);
|
||||||
string filePath = VirtualFileSystem.SwitchPathToSystemPath(contentPath);
|
string filePath = VirtualFileSystem.SwitchPathToSystemPath(contentPath);
|
||||||
@ -178,7 +178,7 @@ namespace Ryujinx.HLE
|
|||||||
throw new InvalidSystemResourceException("Specified title ID is not installed on the system.");
|
throw new InvalidSystemResourceException("Specified title ID is not installed on the system.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Processes.LoadNca(filePath);
|
return Processes.LoadNca(filePath, out result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ using Ryujinx.HLE.HOS;
|
|||||||
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||||
using Ryujinx.HLE.HOS.Services.Ns.Types;
|
using Ryujinx.HLE.HOS.Services.Ns.Types;
|
||||||
using Ryujinx.HLE.HOS.SystemState;
|
using Ryujinx.HLE.HOS.SystemState;
|
||||||
|
using Ryujinx.HLE.Loaders.Processes;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using Ryujinx.Input.HLE;
|
using Ryujinx.Input.HLE;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
@ -679,6 +680,8 @@ namespace Ryujinx.Ava
|
|||||||
|
|
||||||
InitEmulatedSwitch();
|
InitEmulatedSwitch();
|
||||||
MainWindow.UpdateGraphicsConfig();
|
MainWindow.UpdateGraphicsConfig();
|
||||||
|
Device.LoadSystemProgramId(0x010000000000100C, out ProcessResult process);
|
||||||
|
Device.System.WindowSystem.TrackNewProcess(process.ProcessId,0,false);
|
||||||
|
|
||||||
SystemVersion firmwareVersion = ContentManager.GetCurrentFirmwareVersion();
|
SystemVersion firmwareVersion = ContentManager.GetCurrentFirmwareVersion();
|
||||||
|
|
||||||
@ -967,7 +970,6 @@ namespace Ryujinx.Ava
|
|||||||
ConfigurationState.Instance.Multiplayer.LdnServer,
|
ConfigurationState.Instance.Multiplayer.LdnServer,
|
||||||
ConfigurationState.Instance.Graphics.CustomVSyncInterval.Value,
|
ConfigurationState.Instance.Graphics.CustomVSyncInterval.Value,
|
||||||
ConfigurationState.Instance.Hacks.ShowDirtyHacks ? ConfigurationState.Instance.Hacks.EnabledHacks : null));
|
ConfigurationState.Instance.Hacks.ShowDirtyHacks ? ConfigurationState.Instance.Hacks.EnabledHacks : null));
|
||||||
Device.LoadSystemProgramId(0x010000000000100C);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IHardwareDeviceDriver InitializeAudio()
|
private static IHardwareDeviceDriver InitializeAudio()
|
||||||
|
@ -1569,7 +1569,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppHost.Device.System.SetupFirst(AppHost.Device.Processes.ActiveApplication.ProcessId);
|
AppHost.Device.System.SetupFirst(AppHost.Device.Processes.ActiveApplication.ProgramId,AppHost.Device.Processes.ActiveApplication.ProcessId);
|
||||||
|
|
||||||
CanUpdate = false;
|
CanUpdate = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user