2023-01-08 12:13:39 +00:00
|
|
|
|
using Ryujinx.Horizon.LogManager.Ipc;
|
|
|
|
|
using Ryujinx.Horizon.Sdk.Sf.Hipc;
|
2023-01-04 22:15:45 +00:00
|
|
|
|
using Ryujinx.Horizon.Sdk.Sm;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.Horizon.LogManager
|
|
|
|
|
{
|
|
|
|
|
class LmIpcServer
|
|
|
|
|
{
|
|
|
|
|
private const int LogMaxSessionsCount = 42;
|
|
|
|
|
|
|
|
|
|
private const int PointerBufferSize = 0x400;
|
2023-01-08 12:13:39 +00:00
|
|
|
|
private const int MaxDomains = 31;
|
|
|
|
|
private const int MaxDomainObjects = 61;
|
|
|
|
|
private const int MaxPortsCount = 1;
|
2023-01-04 22:15:45 +00:00
|
|
|
|
|
2023-01-08 12:13:39 +00:00
|
|
|
|
private static readonly ManagerOptions _logManagerOptions = new(PointerBufferSize, MaxDomains, MaxDomainObjects, false);
|
2023-01-04 22:15:45 +00:00
|
|
|
|
|
2023-01-08 12:13:39 +00:00
|
|
|
|
private SmApi _sm;
|
2023-01-04 22:15:45 +00:00
|
|
|
|
private ServerManager _serverManager;
|
|
|
|
|
|
|
|
|
|
public void Initialize()
|
|
|
|
|
{
|
2023-01-08 12:13:39 +00:00
|
|
|
|
HeapAllocator allocator = new();
|
2023-01-04 22:15:45 +00:00
|
|
|
|
|
|
|
|
|
_sm = new SmApi();
|
|
|
|
|
_sm.Initialize().AbortOnFailure();
|
|
|
|
|
|
|
|
|
|
_serverManager = new ServerManager(allocator, _sm, MaxPortsCount, _logManagerOptions, LogMaxSessionsCount);
|
|
|
|
|
|
2023-01-08 12:13:39 +00:00
|
|
|
|
_serverManager.RegisterObjectForServer(new LogService(), ServiceName.Encode("lm"), LogMaxSessionsCount);
|
2023-01-04 22:15:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ServiceRequests()
|
|
|
|
|
{
|
|
|
|
|
_serverManager.ServiceRequests();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Shutdown()
|
|
|
|
|
{
|
|
|
|
|
_serverManager.Dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-01-08 12:13:39 +00:00
|
|
|
|
}
|