aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletCreator
diff options
context:
space:
mode:
authorjduncanator <1518948+jduncanator@users.noreply.github.com>2019-11-14 16:18:44 +1100
committerAc_K <Acoustik666@gmail.com>2019-11-14 06:18:44 +0100
commit35e561276648ecfd828cfa4883d95f26959100c6 (patch)
treeec31e8287bf87d2811e7801627bd51e78a105d87 /Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletCreator
parent7c111a356704bc86038d2001f9bbe56d27152590 (diff)
Implement a rudimentary applets system (#804)
* Implement Player Select applet * Initialize the Horizon system reference * Tidy up namespaces * Resolve nits * Resolve nits * Rename stack to queue * Implement an applet FIFO * Remove debugging log * Log applet creation events * Reorganise AppletFifo * More reorganisation * Final changes
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletCreator')
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletCreator/ILibraryAppletAccessor.cs42
1 files changed, 29 insertions, 13 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletCreator/ILibraryAppletAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletCreator/ILibraryAppletAccessor.cs
index 9d8e2a96..8c4d1008 100644
--- a/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletCreator/ILibraryAppletAccessor.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/LibraryAppletCreator/ILibraryAppletAccessor.cs
@@ -1,19 +1,37 @@
using Ryujinx.Common.Logging;
+using Ryujinx.HLE.HOS.Applets;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
-using Ryujinx.HLE.HOS.Services.Am.AppletAE.Storage;
using System;
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.LibraryAppletCreator
{
class ILibraryAppletAccessor : IpcService
{
+ private IApplet _applet;
+
+ private AppletFifo<byte[]> _inData;
+ private AppletFifo<byte[]> _outData;
+
private KEvent _stateChangedEvent;
- public ILibraryAppletAccessor(Horizon system)
+ public ILibraryAppletAccessor(AppletId appletId, Horizon system)
{
_stateChangedEvent = new KEvent(system);
+
+ _applet = AppletManager.Create(appletId, system);
+ _inData = new AppletFifo<byte[]>();
+ _outData = new AppletFifo<byte[]>();
+
+ _applet.AppletStateChanged += OnAppletStateChanged;
+
+ Logger.PrintInfo(LogClass.ServiceAm, $"Applet '{appletId}' created.");
+ }
+
+ private void OnAppletStateChanged(object sender, EventArgs e)
+ {
+ _stateChangedEvent.ReadableEvent.Signal();
}
[Command(0)]
@@ -29,8 +47,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Lib
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
- Logger.PrintStub(LogClass.ServiceAm);
-
return ResultCode.Success;
}
@@ -38,25 +54,23 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Lib
// Start()
public ResultCode Start(ServiceCtx context)
{
- Logger.PrintStub(LogClass.ServiceAm);
-
- return ResultCode.Success;
+ return (ResultCode)_applet.Start(_inData, _outData);
}
[Command(30)]
// GetResult()
public ResultCode GetResult(ServiceCtx context)
{
- Logger.PrintStub(LogClass.ServiceAm);
-
- return ResultCode.Success;
+ return (ResultCode)_applet.GetResult();
}
[Command(100)]
// PushInData(object<nn::am::service::IStorage>)
public ResultCode PushInData(ServiceCtx context)
{
- Logger.PrintStub(LogClass.ServiceAm);
+ IStorage data = GetObject<IStorage>(context, 0);
+
+ _inData.Push(data.Data);
return ResultCode.Success;
}
@@ -65,9 +79,11 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Lib
// PopOutData() -> object<nn::am::service::IStorage>
public ResultCode PopOutData(ServiceCtx context)
{
- MakeObject(context, new IStorage(StorageHelper.MakeLaunchParams()));
+ byte[] data = _outData.Pop();
+ MakeObject(context, new IStorage(data));
+
return ResultCode.Success;
}
}
-} \ No newline at end of file
+}