cd37c75b82
* Horizon: Implement arp:r and arp:w services * Fix formatting * Remove HLE arp services * Revert "Remove HLE arp services" This reverts commit c576fcccadb963db56b96bacabd1c1ac7abfb1ab. * Keep LibHac impl since it's used in bcat * Addresses gdkchan's feedback * ArpApi in PrepoIpcServer and remove LmApi * Fix 2 * Fixes ArpApi init * Fix encoding * Update PrepoService.cs * Fix prepo
61 lines
2 KiB
C#
61 lines
2 KiB
C#
using Ryujinx.Horizon.Arp.Ipc;
|
|
using Ryujinx.Horizon.Sdk.Arp;
|
|
using Ryujinx.Horizon.Sdk.Arp.Detail;
|
|
using Ryujinx.Horizon.Sdk.Sf.Hipc;
|
|
using Ryujinx.Horizon.Sdk.Sm;
|
|
|
|
namespace Ryujinx.Horizon.Arp
|
|
{
|
|
class ArpIpcServer
|
|
{
|
|
private const int ArpRMaxSessionsCount = 16;
|
|
private const int ArpWMaxSessionsCount = 8;
|
|
private const int MaxSessionsCount = ArpRMaxSessionsCount + ArpWMaxSessionsCount;
|
|
|
|
private const int PointerBufferSize = 0x1000;
|
|
private const int MaxDomains = 24;
|
|
private const int MaxDomainObjects = 32;
|
|
private const int MaxPortsCount = 2;
|
|
|
|
private static readonly ManagerOptions _managerOptions = new(PointerBufferSize, MaxDomains, MaxDomainObjects, false);
|
|
|
|
private SmApi _sm;
|
|
private ServerManager _serverManager;
|
|
private ApplicationInstanceManager _applicationInstanceManager;
|
|
|
|
public IReader Reader { get; private set; }
|
|
public IWriter Writer { get; private set; }
|
|
|
|
public void Initialize()
|
|
{
|
|
HeapAllocator allocator = new();
|
|
|
|
_sm = new SmApi();
|
|
_sm.Initialize().AbortOnFailure();
|
|
|
|
_serverManager = new ServerManager(allocator, _sm, MaxPortsCount, _managerOptions, MaxSessionsCount);
|
|
|
|
_applicationInstanceManager = new ApplicationInstanceManager();
|
|
|
|
Reader reader = new(_applicationInstanceManager);
|
|
Reader = reader;
|
|
|
|
Writer writer = new(_applicationInstanceManager);
|
|
Writer = writer;
|
|
|
|
_serverManager.RegisterObjectForServer(reader, ServiceName.Encode("arp:r"), ArpRMaxSessionsCount);
|
|
_serverManager.RegisterObjectForServer(writer, ServiceName.Encode("arp:w"), ArpWMaxSessionsCount);
|
|
}
|
|
|
|
public void ServiceRequests()
|
|
{
|
|
_serverManager.ServiceRequests();
|
|
}
|
|
|
|
public void Shutdown()
|
|
{
|
|
_applicationInstanceManager.Dispose();
|
|
_serverManager.Dispose();
|
|
}
|
|
}
|
|
}
|