Add the stub applet instead of not implemented exception.

This commit is contained in:
Chenj 2020-03-26 23:08:47 +09:00
parent 0dd38028cb
commit e589cc804c
2 changed files with 49 additions and 1 deletions

View file

@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Applets
return (IApplet)Activator.CreateInstance(appletClass, system);
}
throw new NotImplementedException($"{applet} applet is not implemented.");
return new StubApplet(applet);
}
}
}

View file

@ -0,0 +1,48 @@
using System;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
namespace Ryujinx.HLE.HOS.Applets
{
class StubApplet : IApplet
{
public AppletId AppletId { get; }
public event EventHandler AppletStateChanged;
public StubApplet(AppletId appletId)
{
AppletId = appletId;
}
public ResultCode GetResult()
{
Logger.PrintWarning(LogClass.ServiceAm, $"Stub {AppletId} applet called.");
return ResultCode.Success;
}
public ResultCode Start(AppletSession normalSession, AppletSession interactiveSession)
{
Logger.PrintWarning(LogClass.ServiceAm, $"Stub {AppletId} applet called.");
byte[] normalData;
byte[] interactiveData;
normalSession.TryPop(out normalData);
interactiveSession.TryPop(out interactiveData);
normalSession.Push(BuildResponse());
interactiveSession.Push(BuildResponse());
AppletStateChanged?.Invoke(this, null);
return ResultCode.Success;
}
private byte[] BuildResponse()
{
return new byte[0x1000];
}
}
}