LmIpcServer.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Ryujinx.Horizon.Sdk.Sf.Hipc;
  2. using Ryujinx.Horizon.Sdk.Sm;
  3. using Ryujinx.Horizon.Sm;
  4. namespace Ryujinx.Horizon.LogManager
  5. {
  6. class LmIpcServer
  7. {
  8. private const int LogMaxSessionsCount = 42;
  9. private const int PointerBufferSize = 0x400;
  10. private const int MaxDomains = 31;
  11. private const int MaxDomainObjects = 61;
  12. private const int MaxPortsCount = 1;
  13. private static readonly ManagerOptions _logManagerOptions = new ManagerOptions(
  14. PointerBufferSize,
  15. MaxDomains,
  16. MaxDomainObjects,
  17. false);
  18. private static readonly ServiceName _logServiceName = ServiceName.Encode("lm");
  19. private SmApi _sm;
  20. private ServerManager _serverManager;
  21. private LmLog _logServiceObject;
  22. public void Initialize()
  23. {
  24. HeapAllocator allocator = new HeapAllocator();
  25. _sm = new SmApi();
  26. _sm.Initialize().AbortOnFailure();
  27. _serverManager = new ServerManager(allocator, _sm, MaxPortsCount, _logManagerOptions, LogMaxSessionsCount);
  28. _logServiceObject = new LmLog();
  29. _serverManager.RegisterObjectForServer(_logServiceObject, _logServiceName, LogMaxSessionsCount);
  30. }
  31. public void ServiceRequests()
  32. {
  33. _serverManager.ServiceRequests();
  34. }
  35. public void Shutdown()
  36. {
  37. _serverManager.Dispose();
  38. }
  39. }
  40. }