aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Horizon/MmNv/MmNvIpcServer.cs
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2023-08-17 14:59:05 +0200
committerGitHub <noreply@github.com>2023-08-17 09:59:05 -0300
commitb0b7843d5c7372db60211255be0edfcb97dcb56d (patch)
tree08ddc16f41e3455f66c47d86bba83d7295e1a83c /src/Ryujinx.Horizon/MmNv/MmNvIpcServer.cs
parent6ed613a6e6a66d57d2fdb045d926e42dfcdd3206 (diff)
mm: Migrate service in Horizon project (#5580)
* mm: Migrate service in Horizon project This PR migrate the `mm:u` service to the Horizon project, things were checked by some RE aswell, that's why some vars are renamed, the logic should be the same as before. Tests are welcome. * Lock _sessionList instead * Fix comment * Fix Session fields order
Diffstat (limited to 'src/Ryujinx.Horizon/MmNv/MmNvIpcServer.cs')
-rw-r--r--src/Ryujinx.Horizon/MmNv/MmNvIpcServer.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/Ryujinx.Horizon/MmNv/MmNvIpcServer.cs b/src/Ryujinx.Horizon/MmNv/MmNvIpcServer.cs
new file mode 100644
index 00000000..e60b2558
--- /dev/null
+++ b/src/Ryujinx.Horizon/MmNv/MmNvIpcServer.cs
@@ -0,0 +1,43 @@
+using Ryujinx.Horizon.MmNv.Ipc;
+using Ryujinx.Horizon.Sdk.Sf.Hipc;
+using Ryujinx.Horizon.Sdk.Sm;
+
+namespace Ryujinx.Horizon.MmNv
+{
+ class MmNvIpcServer
+ {
+ private const int MmNvMaxSessionsCount = 9;
+
+ private const int PointerBufferSize = 0;
+ private const int MaxDomains = 0;
+ private const int MaxDomainObjects = 0;
+ private const int MaxPortsCount = 1;
+
+ private static readonly ManagerOptions _mmNvOptions = 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, _mmNvOptions, MmNvMaxSessionsCount);
+
+ _serverManager.RegisterObjectForServer(new Request(), ServiceName.Encode("mm:u"), MmNvMaxSessionsCount);
+ }
+
+ public void ServiceRequests()
+ {
+ _serverManager.ServiceRequests();
+ }
+
+ public void Shutdown()
+ {
+ _serverManager.Dispose();
+ }
+ }
+}