blob: 6080b4750aaab1abbfe5203d6d165885b8c44a1c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
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();
}
}
}
|