mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2025-09-14 01:17:54 -05:00
Horizon: Migrate usb and psc services (#5800)
* Horizon: Migrate Usb and Psc services * Fix formatting * Adresses feedback
This commit is contained in:
47
src/Ryujinx.Horizon/Hshl/HshlIpcServer.cs
Normal file
47
src/Ryujinx.Horizon/Hshl/HshlIpcServer.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Ryujinx.Horizon.Hshl.Ipc;
|
||||
using Ryujinx.Horizon.Sdk.Sf.Hipc;
|
||||
using Ryujinx.Horizon.Sdk.Sm;
|
||||
|
||||
namespace Ryujinx.Horizon.Hshl
|
||||
{
|
||||
class HshlIpcServer
|
||||
{
|
||||
private const int HshlMaxSessionsCount = 10;
|
||||
private const int TotalMaxSessionsCount = HshlMaxSessionsCount * 2;
|
||||
|
||||
private const int PointerBufferSize = 0;
|
||||
private const int MaxDomains = 0;
|
||||
private const int MaxDomainObjects = 0;
|
||||
private const int MaxPortsCount = 2;
|
||||
|
||||
private static readonly ManagerOptions _options = new(PointerBufferSize, MaxDomains, MaxDomainObjects, false);
|
||||
|
||||
private SmApi _sm;
|
||||
private ServerManager _serverManager;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
HeapAllocator allocator = new();
|
||||
|
||||
_sm = new SmApi();
|
||||
_sm.Initialize().AbortOnFailure();
|
||||
|
||||
_serverManager = new ServerManager(allocator, _sm, MaxPortsCount, _options, TotalMaxSessionsCount);
|
||||
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
_serverManager.RegisterObjectForServer(new SetterManager(), ServiceName.Encode("hshl:set"), HshlMaxSessionsCount); // 11.0.0+
|
||||
_serverManager.RegisterObjectForServer(new Manager(), ServiceName.Encode("hshl:sys"), HshlMaxSessionsCount); // 11.0.0+
|
||||
#pragma warning restore IDE0055
|
||||
}
|
||||
|
||||
public void ServiceRequests()
|
||||
{
|
||||
_serverManager.ServiceRequests();
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
_serverManager.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
17
src/Ryujinx.Horizon/Hshl/HshlMain.cs
Normal file
17
src/Ryujinx.Horizon/Hshl/HshlMain.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Ryujinx.Horizon.Hshl
|
||||
{
|
||||
class HshlMain : IService
|
||||
{
|
||||
public static void Main(ServiceTable serviceTable)
|
||||
{
|
||||
HshlIpcServer ipcServer = new();
|
||||
|
||||
ipcServer.Initialize();
|
||||
|
||||
serviceTable.SignalServiceReady();
|
||||
|
||||
ipcServer.ServiceRequests();
|
||||
ipcServer.Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
8
src/Ryujinx.Horizon/Hshl/Ipc/Manager.cs
Normal file
8
src/Ryujinx.Horizon/Hshl/Ipc/Manager.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Ryujinx.Horizon.Sdk.Hshl;
|
||||
|
||||
namespace Ryujinx.Horizon.Hshl.Ipc
|
||||
{
|
||||
partial class Manager : IManager
|
||||
{
|
||||
}
|
||||
}
|
8
src/Ryujinx.Horizon/Hshl/Ipc/SetterManager.cs
Normal file
8
src/Ryujinx.Horizon/Hshl/Ipc/SetterManager.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Ryujinx.Horizon.Sdk.Hshl;
|
||||
|
||||
namespace Ryujinx.Horizon.Hshl.Ipc
|
||||
{
|
||||
partial class SetterManager : ISetterManager
|
||||
{
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user