fix: implement real applets with stability improvements

This commit is contained in:
Jacobwasbeast 2025-02-11 20:24:54 -06:00
parent d7cdb5584c
commit da678d3438
5 changed files with 20 additions and 11 deletions

View File

@ -507,10 +507,12 @@ namespace Ryujinx.HLE.HOS.Applets
if (child == _foregroundRequestedApplet)
{
UpdateAppletStateLocked(child, true);
_foregroundRequestedApplet.SetInteractibleLocked(true);
}
else
{
UpdateAppletStateLocked(child, isForeground);
_foregroundRequestedApplet.SetInteractibleLocked(isForeground);
}
}
}

View File

@ -135,9 +135,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Lib
// RequestExit()
public ResultCode RequestExit(ServiceCtx context)
{
_applet.ProcessHandle.SetActivity(false);
_applet.AppletState.OnExitRequested();
_applet?.ProcessHandle.Terminate();
_applet?.ProcessHandle?.SetActivity(false);
_applet?.AppletState?.OnExitRequested();
_applet?.ProcessHandle?.Terminate();
Logger.Stub?.PrintStub(LogClass.ServiceAm);
return ResultCode.Success;
@ -147,9 +147,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Lib
// Terminate()
public ResultCode Terminate(ServiceCtx context)
{
_applet.ProcessHandle.SetActivity(false);
_applet.AppletState.OnExitRequested();
_applet?.ProcessHandle.Terminate();
_applet?.ProcessHandle?.SetActivity(false);
_applet?.AppletState?.OnExitRequested();
_applet?.ProcessHandle?.Terminate();
Logger.Stub?.PrintStub(LogClass.ServiceAm);
return ResultCode.Success;
}

View File

@ -91,9 +91,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// RequestExit()
public ResultCode RequestExit(ServiceCtx context)
{
applet.ProcessHandle.SetActivity(false);
applet.AppletState.OnExitRequested();
applet?.ProcessHandle.Terminate();
applet?.ProcessHandle?.SetActivity(false);
applet?.AppletState?.OnExitRequested();
applet?.ProcessHandle?.Terminate();
Logger.Stub?.PrintStub(LogClass.ServiceAm);
return ResultCode.Success;

View File

@ -81,6 +81,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
}
[CommandCmif(18)]
[CommandCmif(23)]
[CommandCmif(25)]
// AcquireCallerAppletCaptureBufferEx() -> (b8, handle<copy>)
public ResultCode AcquireCallerAppletCaptureBufferEx(ServiceCtx context)
{
@ -110,6 +112,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
byte unknown1 = context.RequestData.ReadByte();
int captureSharedBuffer = context.RequestData.ReadInt32();
uint color = context.RequestData.ReadUInt32();
context.Device.System.ViServerS.CancelFrameBuffer(context.Device.System.ViServerS.GetSharedLayerId(),captureSharedBuffer);
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { unknown1, captureSharedBuffer });
return ResultCode.Success;
}

View File

@ -199,7 +199,7 @@ namespace Ryujinx.HLE.HOS.Services
if (SmObjectFactory != null)
{
_context.Syscall.ManageNamedPort(out int serverPortHandle, "sm:", 50);
_context.Syscall.ManageNamedPort(out int serverPortHandle, "sm:", 50).AbortOnFailure();
AddPort(serverPortHandle, SmObjectFactory);
}
@ -304,10 +304,14 @@ namespace Ryujinx.HLE.HOS.Services
_wakeEvent.WritableEvent.Clear();
}
}
else if (rc == KernelResult.PortRemoteClosed && signaledIndex >= 0 && SmObjectFactory != null)
else if (rc == KernelResult.PortRemoteClosed && signaledIndex >= 0/* && SmObjectFactory != null*/)
{
DestroySession(handles[signaledIndex]);
}
else
{
Logger.Warning?.Print(LogClass.Service, $"ReplyAndReceive failed with unknown result: {rc}");
}
_selfProcess.CpuMemory.Write(messagePtr + 0x0, 0);
_selfProcess.CpuMemory.Write(messagePtr + 0x4, 2 << 10);