BcatServerManager.cs 1.2 KB

12345678910111213141516171819202122232425262728
  1. using Ryujinx.Horizon.Bcat.Ipc;
  2. using Ryujinx.Horizon.Bcat.Types;
  3. using Ryujinx.Horizon.Common;
  4. using Ryujinx.Horizon.Sdk.Sf.Hipc;
  5. using Ryujinx.Horizon.Sdk.Sm;
  6. using System;
  7. namespace Ryujinx.Horizon.Bcat
  8. {
  9. class BcatServerManager : ServerManager
  10. {
  11. public BcatServerManager(HeapAllocator allocator, SmApi sm, int maxPorts, ManagerOptions options, int maxSessions) : base(allocator, sm, maxPorts, options, maxSessions)
  12. {
  13. }
  14. protected override Result OnNeedsToAccept(int portIndex, Server server)
  15. {
  16. return (BcatPortIndex)portIndex switch
  17. {
  18. BcatPortIndex.Admin => AcceptImpl(server, new ServiceCreator("bcat:a", BcatServicePermissionLevel.Admin)),
  19. BcatPortIndex.Manager => AcceptImpl(server, new ServiceCreator("bcat:m", BcatServicePermissionLevel.Manager)),
  20. BcatPortIndex.User => AcceptImpl(server, new ServiceCreator("bcat:u", BcatServicePermissionLevel.User)),
  21. BcatPortIndex.System => AcceptImpl(server, new ServiceCreator("bcat:s", BcatServicePermissionLevel.System)),
  22. _ => throw new ArgumentOutOfRangeException(nameof(portIndex)),
  23. };
  24. }
  25. }
  26. }