/ src / Ryujinx.Horizon / Ptm / TsIpcServer.cs
TsIpcServer.cs
 1  using Ryujinx.Horizon.Ptm.Ipc;
 2  using Ryujinx.Horizon.Sdk.Sf.Hipc;
 3  using Ryujinx.Horizon.Sdk.Sm;
 4  
 5  namespace Ryujinx.Horizon.Ptm
 6  {
 7      class TsIpcServer
 8      {
 9          private const int MaxSessionsCount = 4;
10  
11          private const int PointerBufferSize = 0;
12          private const int MaxDomains = 0;
13          private const int MaxDomainObjects = 0;
14          private const int MaxPortsCount = 1;
15  
16          private static readonly ManagerOptions _managerOptions = new(PointerBufferSize, MaxDomains, MaxDomainObjects, false);
17  
18          private SmApi _sm;
19          private ServerManager _serverManager;
20  
21          public void Initialize()
22          {
23              HeapAllocator allocator = new();
24  
25              _sm = new SmApi();
26              _sm.Initialize().AbortOnFailure();
27  
28              _serverManager = new ServerManager(allocator, _sm, MaxPortsCount, _managerOptions, MaxSessionsCount);
29  
30              _serverManager.RegisterObjectForServer(new MeasurementServer(), ServiceName.Encode("ts"), MaxSessionsCount);
31          }
32  
33          public void ServiceRequests()
34          {
35              _serverManager.ServiceRequests();
36          }
37  
38          public void Shutdown()
39          {
40              _serverManager.Dispose();
41              _sm.Dispose();
42          }
43      }
44  }