1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-25 22:26:00 +00:00
Ryujinx/Ryujinx.Horizon/Sm/SmServerManager.cs

30 lines
1 KiB
C#
Raw Normal View History

using Ryujinx.Horizon.Common;
using Ryujinx.Horizon.Sdk.Sf.Hipc;
using Ryujinx.Horizon.Sdk.Sm;
using Ryujinx.Horizon.Sm.Impl;
using Ryujinx.Horizon.Sm.Ipc;
using Ryujinx.Horizon.Sm.Types;
using System;
namespace Ryujinx.Horizon.Sm
{
class SmServerManager : ServerManager
{
private readonly ServiceManager _serviceManager;
public SmServerManager(ServiceManager serviceManager, HeapAllocator allocator, SmApi sm, int maxPorts, ManagerOptions options, int maxSessions) : base(allocator, sm, maxPorts, options, maxSessions)
{
_serviceManager = serviceManager;
}
protected override Result OnNeedsToAccept(int portIndex, Server server)
{
return (SmPortIndex)portIndex switch
{
SmPortIndex.User => AcceptImpl(server, new UserService(_serviceManager)),
SmPortIndex.Manager => AcceptImpl(server, new ManagerService()),
_ => throw new ArgumentOutOfRangeException(nameof(portIndex)),
};
}
}
}