SmServerManager.cs 1.0 KB

123456789101112131415161718192021222324252627282930
  1. using Ryujinx.Horizon.Common;
  2. using Ryujinx.Horizon.Sdk.Sf.Hipc;
  3. using Ryujinx.Horizon.Sdk.Sm;
  4. using Ryujinx.Horizon.Sm.Impl;
  5. using Ryujinx.Horizon.Sm.Ipc;
  6. using Ryujinx.Horizon.Sm.Types;
  7. using System;
  8. namespace Ryujinx.Horizon.Sm
  9. {
  10. class SmServerManager : ServerManager
  11. {
  12. private readonly ServiceManager _serviceManager;
  13. public SmServerManager(ServiceManager serviceManager, HeapAllocator allocator, SmApi sm, int maxPorts, ManagerOptions options, int maxSessions) : base(allocator, sm, maxPorts, options, maxSessions)
  14. {
  15. _serviceManager = serviceManager;
  16. }
  17. protected override Result OnNeedsToAccept(int portIndex, Server server)
  18. {
  19. return (SmPortIndex)portIndex switch
  20. {
  21. SmPortIndex.User => AcceptImpl(server, new UserService(_serviceManager)),
  22. SmPortIndex.Manager => AcceptImpl(server, new ManagerService()),
  23. _ => throw new ArgumentOutOfRangeException(nameof(portIndex)),
  24. };
  25. }
  26. }
  27. }