fix: inconsistent focus mode

This commit is contained in:
Jacobwasbeast 2025-02-14 16:18:06 -06:00
parent 85f47f996c
commit f73a7dce4f
16 changed files with 181 additions and 131 deletions

View File

@ -19,8 +19,9 @@ namespace Ryujinx.HLE.HOS.Applets
private EventObserver _eventObserver = null;
// Foreground roots.
private RealApplet _homeMenu = null;
private RealApplet _overlayDisp = null;
RealApplet _homeMenu = null;
RealApplet _overlayDisp = null;
RealApplet _application = null;
// Removed single application field to allow multiple applications.
// Home menu state.
@ -130,23 +131,22 @@ namespace Ryujinx.HLE.HOS.Applets
{
_overlayDisp = applet;
}
// For application applets, we no longer assign a unique field.
// They are simply tracked as root applets (if callerPid == 0) and in the _applets dictionary.
else if (isApplication)
{
_application = applet;
}
_applets[applet.AppletResourceUserId] = applet;
_eventObserver.TrackAppletProcess(applet);
// If this is the first applet being tracked, or if it is one of the special system applets,
// perform initial setup.
if (_applets.Count == 1 ||
applet.AppletId == RealAppletId.SystemAppletMenu ||
applet.AppletId == RealAppletId.OverlayApplet)
if (_applets.Count == 1 || applet.AppletId == RealAppletId.SystemAppletMenu || applet.AppletId == RealAppletId.OverlayApplet)
{
SetupFirstApplet(applet);
_foregroundRequestedApplet = applet;
applet.AppletState.SetFocus(false);
}
// _foregroundRequestedApplet = applet;
// applet.AppletState.SetFocusState(FocusState.InFocus);
_eventObserver.RequestUpdate();
}
@ -169,7 +169,7 @@ namespace Ryujinx.HLE.HOS.Applets
{
applet.AppletState.SetFocusState(FocusState.InFocus);
_foregroundRequestedApplet = applet;
RequestApplicationToGetForeground(applet.ProcessHandle.Pid);
RequestApplicationToGetForeground();
}
applet.UpdateSuspensionStateLocked(true);
@ -208,63 +208,33 @@ namespace Ryujinx.HLE.HOS.Applets
_eventObserver.RequestUpdate();
}
/// <summary>
/// Requests that the home menu be focused.
/// The PID provided must match the home menus PID.
/// </summary>
internal void RequestHomeMenuToGetForeground(ulong pid)
internal void RequestApplicationToGetForeground()
{
lock (_lock)
// lock (_lock)
{
if (_homeMenu != null && _homeMenu.ProcessHandle.Pid == pid)
{
_foregroundRequestedApplet = _homeMenu;
}
else
{
Logger.Warning?.Print(LogClass.ServiceAm, $"RequestHomeMenuToGetForeground: Provided pid {pid} does not match the home menu.");
}
_foregroundRequestedApplet = _application;
}
_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();
}
internal void RequestLockHomeMenuIntoForeground()
{
_homeMenuForegroundLocked = true;
// lock (_lock)
{
_homeMenuForegroundLocked = true;
}
_eventObserver.RequestUpdate();
}
internal void RequestUnlockHomeMenuFromForeground()
{
_homeMenuForegroundLocked = false;
// lock (_lock)
{
_homeMenuForegroundLocked = false;
}
_eventObserver.RequestUpdate();
}
@ -627,6 +597,21 @@ namespace Ryujinx.HLE.HOS.Applets
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

View File

@ -59,7 +59,7 @@ namespace Ryujinx.HLE.HOS
public void Execute(IExecutionContext context, ulong codeAddress)
{
// We must wait until shader cache is loaded, among other things, before executing CPU code.
_gpuContext.WaitUntilGpuReady();
//_gpuContext.WaitUntilGpuReady();
_cpuContext.Execute(context, codeAddress);
}

View File

@ -75,7 +75,7 @@ namespace Ryujinx.HLE.HOS
return IntialAppletState;
}
internal WindowSystem WindowSystem { get; private set; }
public WindowSystem WindowSystem { get; private set; }
internal EventObserver EventObserver { get; private set; }
@ -346,7 +346,7 @@ namespace Ryujinx.HLE.HOS
public void ReturnFocus()
{
GetAppletState(WindowSystem.GetFocusedApp()).SetFocus(true);
GetAppletState(WindowSystem.GetFocusedApp()).SetFocusState(FocusState.InFocus);
}
public void SimulateWakeUpMessage()
@ -526,11 +526,20 @@ namespace Ryujinx.HLE.HOS
IsPaused = pause;
}
public void SetupFirst(ulong ProgramId)
public void SetupFirst(ulong ProgramId, ulong Pid)
{
bool isApp = ProgramId > 0x01000000000007FF;
RealApplet app = WindowSystem.TrackProcess(ProgramId, 0, isApp);
app.AppletState.SetFocusForce(true);
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);
}
}
}
}

View File

@ -113,7 +113,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService
// GetHomeMenuFunctions() -> object<nn::am::service::IHomeMenuFunctions>
public ResultCode GetHomeMenuFunctions(ServiceCtx context)
{
MakeObject(context, new IHomeMenuFunctions(context.Device.System, _pid));
MakeObject(context, new IHomeMenuFunctions(context.Device.System));
return ResultCode.Success;
}

View File

@ -69,7 +69,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService
// GetHomeMenuFunctions() -> object<nn::am::service::IHomeMenuFunctions>
public ResultCode GetHomeMenuFunctions(ServiceCtx context)
{
MakeObject(context, new IHomeMenuFunctions(context.Device.System, _pid));
MakeObject(context, new IHomeMenuFunctions(context.Device.System));
return ResultCode.Success;
}

View File

@ -110,7 +110,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
{
applet.ProcessHandle.SetActivity(false);
}
context.Device.System.WindowSystem.RequestApplicationToGetForeground(applet.ProcessHandle.Pid);
context.Device.System.WindowSystem.RequestApplicationToGetForeground();
return ResultCode.Success;
}

View File

@ -117,11 +117,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
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}");
context.ResponseData.Write((byte)focusState);
@ -136,9 +131,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
_acquiredSleepLockEvent.ReadableEvent.Signal();
_applet.AppletState.SetFocusForce(true);
context.Device.System.WindowSystem.RequestApplicationToGetForeground(_applet.ProcessHandle.Pid);
return ResultCode.Success;
}

View File

@ -1,3 +1,4 @@
using LibHac.Util;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Threading;
@ -8,21 +9,18 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
{
class IHomeMenuFunctions : IpcService
{
private ulong _pid;
private int _channelEventHandle;
public IHomeMenuFunctions(Horizon system, ulong pid)
public IHomeMenuFunctions(Horizon system)
{
_pid = pid;
}
[CommandCmif(10)]
// RequestToGetForeground()
public ResultCode RequestToGetForeground(ServiceCtx context)
{
Logger.Stub?.PrintStub(LogClass.ServiceAm);
context.Device.System.WindowSystem.RequestApplicationToGetForeground(_pid);
context.Device.System.GetAppletState(_pid).SetFocusForce(true);
// Logger.Stub?.PrintStub(LogClass.ServiceAm);
context.Device.System.WindowSystem.RequestHomeMenuToGetForeground();
return ResultCode.Success;
}
@ -31,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// LockForeground()
public ResultCode LockForeground(ServiceCtx context)
{
Logger.Stub?.PrintStub(LogClass.ServiceAm);
// Logger.Stub?.PrintStub(LogClass.ServiceAm);
context.Device.System.WindowSystem.RequestLockHomeMenuIntoForeground();
return ResultCode.Success;
@ -41,12 +39,30 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// UnlockForeground()
public ResultCode UnlockForeground(ServiceCtx context)
{
Logger.Stub?.PrintStub(LogClass.ServiceAm);
// Logger.Stub?.PrintStub(LogClass.ServiceAm);
context.Device.System.WindowSystem.RequestUnlockHomeMenuFromForeground();
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)]
// GetPopFromGeneralChannelEvent() -> handle<copy>
public ResultCode GetPopFromGeneralChannelEvent(ServiceCtx context)
@ -54,8 +70,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
if (_channelEventHandle == 0)
{
if (context.Process.HandleTable.GenerateHandle(
context.Device.System.GeneralChannelEvent.ReadableEvent,
out _channelEventHandle) != Result.Success)
context.Device.System.GeneralChannelEvent.ReadableEvent,
out _channelEventHandle) != Result.Success)
{
throw new InvalidOperationException("Out of handles!");
}
@ -69,6 +85,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
}
[CommandCmif(31)]
[CommandCmif(32)]
// GetWriterLockAccessorEx(i32) -> object<nn::am::service::ILockAccessor>
public ResultCode GetWriterLockAccessorEx(ServiceCtx context)
{

View File

@ -1,4 +1,5 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Applets;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Threading;
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
{
private readonly ulong _pid;
private readonly RealApplet _applet;
private readonly KEvent _libraryAppletLaunchableEvent;
private int _libraryAppletLaunchableEventHandle;
private KEvent _accumulatedSuspendedTickChangedEvent;
@ -29,8 +30,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
private bool _screenShotPermission = false;
private bool _operationModeChangedNotification = false;
private bool _performanceModeChangedNotification = false;
private bool _restartMessageEnabled = false;
private bool _outOfFocusSuspendingEnabled = false;
private bool _handlesRequestToDisplay = false;
#pragma warning restore IDE0052
private bool _autoSleepDisabled = false;
@ -44,8 +43,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
public ISelfController(ServiceCtx context, ulong pid)
{
_libraryAppletLaunchableEvent = new KEvent(context.Device.System.KernelContext);
_pid = pid;
_applet = context.Device.System.WindowSystem.GetByAruId(_pid);
}
[CommandCmif(0)]
@ -54,6 +53,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
{
Logger.Stub?.PrintStub(LogClass.ServiceAm);
_applet.ProcessHandle.Terminate();
return ResultCode.Success;
}
@ -61,7 +62,17 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// LockExit()
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;
}
@ -70,7 +81,15 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// UnlockExit()
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;
}
@ -112,11 +131,12 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// GetLibraryAppletLaunchableEvent() -> handle<copy>
public ResultCode GetLibraryAppletLaunchableEvent(ServiceCtx context)
{
_libraryAppletLaunchableEvent.ReadableEvent.Signal();
var evnt = _applet.AppletState.LaunchableEvent;
evnt.ReadableEvent.Signal();
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!");
}
@ -172,11 +192,18 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// SetFocusHandlingMode(b8, b8, b8)
public ResultCode SetFocusHandlingMode(ServiceCtx context)
{
bool unknownFlag1 = context.RequestData.ReadBoolean();
bool unknownFlag2 = context.RequestData.ReadBoolean();
bool unknownFlag3 = context.RequestData.ReadBoolean();
bool notify = context.RequestData.ReadBoolean();
bool background = 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;
}
@ -189,7 +216,10 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { restartMessageEnabled });
_restartMessageEnabled = restartMessageEnabled;
lock (_applet.Lock)
{
_applet.AppletState.ResumeNotificationEnabled = restartMessageEnabled;
}
return ResultCode.Success;
}
@ -210,7 +240,11 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { outOfFocusSuspendingEnabled });
_outOfFocusSuspendingEnabled = outOfFocusSuspendingEnabled;
lock (_applet.Lock)
{
_applet.AppletState.SetOutOfFocusSuspendingEnabled(outOfFocusSuspendingEnabled);
_applet.UpdateSuspensionStateLocked(false);
}
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 recordingLayerId, _pid);
//context.Device.System.SurfaceFlinger.SetRenderLayer(displayLayerId);
context.ResponseData.Write(displayLayerId);
context.ResponseData.Write(recordingLayerId);
@ -285,10 +318,16 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
}
[CommandCmif(60)]
// OverrideAutoSleepTimeAndDimmingTime()
// OverrideAutoSleepTimeAndDimmingTime(i32, i32, i32, i32)
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;
}
@ -316,6 +355,17 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
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)]
// ReportUserIsActive()
public ResultCode ReportUserIsActive(ServiceCtx context)

View File

@ -19,8 +19,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
context.ResponseData.Write(appletResourceUserId);
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { appletResourceUserId });
return ResultCode.Success;
}
@ -35,7 +33,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
return ResultCode.Success;
}
[CommandCmif(10)]
// AcquireForegroundRights()
public ResultCode AcquireForegroundRights(ServiceCtx context)

View File

@ -12,7 +12,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
// OpenSystemAppletProxy(u64, pid, handle<copy>) -> object<nn::am::service::ISystemAppletProxy>
public ResultCode OpenSystemAppletProxy(ServiceCtx context)
{
context.Device.System.WindowSystem.TrackProcess(context.Request.HandleDesc.PId, 0, false);
MakeObject(context, new ISystemAppletProxy(context.Request.HandleDesc.PId));
return ResultCode.Success;
@ -23,7 +22,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
// OpenLibraryAppletProxy(u64, pid, handle<copy>) -> object<nn::am::service::ILibraryAppletProxy>
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));
return ResultCode.Success;
@ -33,7 +31,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
// OpenOverlayAppletProxy(pid, handle<copy>) -> object<nn::am::service::IOverlayAppletProxy>
public ResultCode OpenOverlayAppletProxy(ServiceCtx context)
{
context.Device.System.WindowSystem.TrackProcess(context.Request.HandleDesc.PId, 0, false);
MakeObject(context, new IOverlayAppletProxy(context.Request.HandleDesc.PId));
return ResultCode.Success;
@ -43,7 +40,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
// OpenSystemApplicationProxy(u64, pid, handle<copy>) -> object<nn::am::service::IApplicationProxy>
public ResultCode OpenSystemApplicationProxy(ServiceCtx context)
{
context.Device.System.WindowSystem.TrackProcess(context.Request.HandleDesc.PId, 0, false);
MakeObject(context, new IApplicationProxy(context.Request.HandleDesc.PId));
return ResultCode.Success;

View File

@ -1,3 +1,4 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.Horizon.Common;
@ -31,5 +32,13 @@ namespace Ryujinx.HLE.HOS.Services.Npns
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(receiveEventHandle);
return ResultCode.Success;
}
[CommandCmif(8)] // 18.0.0+
// ListenToByName()
public ResultCode ListenToByName(ServiceCtx context)
{
Logger.Stub?.PrintStub(LogClass.ServiceNpns);
return ResultCode.Success;
}
}
}

View File

@ -321,13 +321,6 @@ namespace Ryujinx.HLE.HOS.SystemState
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)
{
Messages.Clear();

View File

@ -168,7 +168,7 @@ namespace Ryujinx.HLE
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 filePath = VirtualFileSystem.SwitchPathToSystemPath(contentPath);
@ -178,7 +178,7 @@ namespace Ryujinx.HLE
throw new InvalidSystemResourceException("Specified title ID is not installed on the system.");
}
return Processes.LoadNca(filePath);
return Processes.LoadNca(filePath, out result);
}
}
}

View File

@ -42,6 +42,7 @@ using Ryujinx.HLE.HOS;
using Ryujinx.HLE.HOS.Services.Account.Acc;
using Ryujinx.HLE.HOS.Services.Ns.Types;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Loaders.Processes;
using Ryujinx.Input;
using Ryujinx.Input.HLE;
using SkiaSharp;
@ -679,6 +680,8 @@ namespace Ryujinx.Ava
InitEmulatedSwitch();
MainWindow.UpdateGraphicsConfig();
Device.LoadSystemProgramId(0x010000000000100C, out ProcessResult process);
Device.System.WindowSystem.TrackNewProcess(process.ProcessId,0,false);
SystemVersion firmwareVersion = ContentManager.GetCurrentFirmwareVersion();
@ -967,7 +970,6 @@ namespace Ryujinx.Ava
ConfigurationState.Instance.Multiplayer.LdnServer,
ConfigurationState.Instance.Graphics.CustomVSyncInterval.Value,
ConfigurationState.Instance.Hacks.ShowDirtyHacks ? ConfigurationState.Instance.Hacks.EnabledHacks : null));
Device.LoadSystemProgramId(0x010000000000100C);
}
private static IHardwareDeviceDriver InitializeAudio()

View File

@ -1569,7 +1569,7 @@ namespace Ryujinx.Ava.UI.ViewModels
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;