MmNvIpcServer.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Ryujinx.Horizon.MmNv.Ipc;
  2. using Ryujinx.Horizon.Sdk.Sf.Hipc;
  3. using Ryujinx.Horizon.Sdk.Sm;
  4. namespace Ryujinx.Horizon.MmNv
  5. {
  6. class MmNvIpcServer
  7. {
  8. private const int MaxSessionsCount = 40;
  9. private const int PointerBufferSize = 0;
  10. private const int MaxDomains = 0;
  11. private const int MaxDomainObjects = 0;
  12. private const int MaxPortsCount = 1;
  13. private static readonly ManagerOptions _managerOptions = new(PointerBufferSize, MaxDomains, MaxDomainObjects, false);
  14. private SmApi _sm;
  15. private ServerManager _serverManager;
  16. public void Initialize()
  17. {
  18. HeapAllocator allocator = new();
  19. _sm = new SmApi();
  20. _sm.Initialize().AbortOnFailure();
  21. _serverManager = new ServerManager(allocator, _sm, MaxPortsCount, _managerOptions, MaxSessionsCount);
  22. _serverManager.RegisterObjectForServer(new Request(), ServiceName.Encode("mm:u"), MaxSessionsCount);
  23. }
  24. public void ServiceRequests()
  25. {
  26. _serverManager.ServiceRequests();
  27. }
  28. public void Shutdown()
  29. {
  30. _serverManager.Dispose();
  31. _sm.Dispose();
  32. }
  33. }
  34. }