From fb55f57da7cbeb39d12d39a13be16ff602a8fda3 Mon Sep 17 00:00:00 2001
From: Ac_K <Acoustik666@gmail.com>
Date: Wed, 20 Sep 2023 22:55:27 +0200
Subject: [PATCH] Horizon: Migrate wlan and stubs latest services (#5708)

* Horizon: Migrate wlan and stubs latest services

This PR migrate empty wlan services, values are found by RE.
Latest firmwares added some other services which are now stubbed and up-to-date.

* Fix imports ordering
---
 .../HOS/Services/Wlan/IInfraManager.cs        |  8 ---
 .../HOS/Services/Wlan/ILocalGetActionFrame.cs |  8 ---
 .../HOS/Services/Wlan/ILocalGetFrame.cs       |  8 ---
 .../HOS/Services/Wlan/ILocalManager.cs        |  8 ---
 .../HOS/Services/Wlan/ISocketGetFrame.cs      |  8 ---
 .../HOS/Services/Wlan/ISocketManager.cs       |  8 ---
 .../HOS/Services/Wlan/IUnknown1.cs            |  8 ---
 .../Sdk/Wlan/IDetectManager.cs                |  8 +++
 .../Sdk/Wlan/IGeneralServiceCreator.cs        |  8 +++
 src/Ryujinx.Horizon/Sdk/Wlan/IInfraManager.cs |  8 +++
 .../Sdk/Wlan/ILocalGetActionFrame.cs          |  8 +++
 .../Sdk/Wlan/ILocalGetFrame.cs                |  8 +++
 src/Ryujinx.Horizon/Sdk/Wlan/ILocalManager.cs |  8 +++
 .../Sdk/Wlan/IPrivateServiceCreator.cs        |  8 +++
 .../Sdk/Wlan/ISfDriverServiceCreator.cs       |  8 +++
 .../Sdk/Wlan/ISocketGetFrame.cs               |  8 +++
 .../Sdk/Wlan/ISocketManager.cs                |  8 +++
 src/Ryujinx.Horizon/ServiceTable.cs           |  2 +
 src/Ryujinx.Horizon/Wlan/Ipc/DetectManager.cs |  8 +++
 .../Wlan/Ipc/GeneralServiceCreator.cs         |  8 +++
 src/Ryujinx.Horizon/Wlan/Ipc/InfraManager.cs  |  8 +++
 .../Wlan/Ipc/LocalGetActionFrame.cs           |  8 +++
 src/Ryujinx.Horizon/Wlan/Ipc/LocalGetFrame.cs |  8 +++
 src/Ryujinx.Horizon/Wlan/Ipc/LocalManager.cs  |  8 +++
 .../Wlan/Ipc/PrivateServiceCreator.cs         |  8 +++
 .../Wlan/Ipc/SfDriverServiceCreator.cs        |  8 +++
 .../Wlan/Ipc/SocketGetFrame.cs                |  8 +++
 src/Ryujinx.Horizon/Wlan/Ipc/SocketManager.cs |  8 +++
 src/Ryujinx.Horizon/Wlan/WlanIpcServer.cs     | 59 +++++++++++++++++++
 src/Ryujinx.Horizon/Wlan/WlanMain.cs          | 17 ++++++
 30 files changed, 238 insertions(+), 56 deletions(-)
 delete mode 100644 src/Ryujinx.HLE/HOS/Services/Wlan/IInfraManager.cs
 delete mode 100644 src/Ryujinx.HLE/HOS/Services/Wlan/ILocalGetActionFrame.cs
 delete mode 100644 src/Ryujinx.HLE/HOS/Services/Wlan/ILocalGetFrame.cs
 delete mode 100644 src/Ryujinx.HLE/HOS/Services/Wlan/ILocalManager.cs
 delete mode 100644 src/Ryujinx.HLE/HOS/Services/Wlan/ISocketGetFrame.cs
 delete mode 100644 src/Ryujinx.HLE/HOS/Services/Wlan/ISocketManager.cs
 delete mode 100644 src/Ryujinx.HLE/HOS/Services/Wlan/IUnknown1.cs
 create mode 100644 src/Ryujinx.Horizon/Sdk/Wlan/IDetectManager.cs
 create mode 100644 src/Ryujinx.Horizon/Sdk/Wlan/IGeneralServiceCreator.cs
 create mode 100644 src/Ryujinx.Horizon/Sdk/Wlan/IInfraManager.cs
 create mode 100644 src/Ryujinx.Horizon/Sdk/Wlan/ILocalGetActionFrame.cs
 create mode 100644 src/Ryujinx.Horizon/Sdk/Wlan/ILocalGetFrame.cs
 create mode 100644 src/Ryujinx.Horizon/Sdk/Wlan/ILocalManager.cs
 create mode 100644 src/Ryujinx.Horizon/Sdk/Wlan/IPrivateServiceCreator.cs
 create mode 100644 src/Ryujinx.Horizon/Sdk/Wlan/ISfDriverServiceCreator.cs
 create mode 100644 src/Ryujinx.Horizon/Sdk/Wlan/ISocketGetFrame.cs
 create mode 100644 src/Ryujinx.Horizon/Sdk/Wlan/ISocketManager.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/Ipc/DetectManager.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/Ipc/GeneralServiceCreator.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/Ipc/InfraManager.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/Ipc/LocalGetActionFrame.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/Ipc/LocalGetFrame.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/Ipc/LocalManager.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/Ipc/PrivateServiceCreator.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/Ipc/SfDriverServiceCreator.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/Ipc/SocketGetFrame.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/Ipc/SocketManager.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/WlanIpcServer.cs
 create mode 100644 src/Ryujinx.Horizon/Wlan/WlanMain.cs

diff --git a/src/Ryujinx.HLE/HOS/Services/Wlan/IInfraManager.cs b/src/Ryujinx.HLE/HOS/Services/Wlan/IInfraManager.cs
deleted file mode 100644
index a8462578..00000000
--- a/src/Ryujinx.HLE/HOS/Services/Wlan/IInfraManager.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ryujinx.HLE.HOS.Services.Wlan
-{
-    [Service("wlan:inf")]
-    class IInfraManager : IpcService
-    {
-        public IInfraManager(ServiceCtx context) { }
-    }
-}
diff --git a/src/Ryujinx.HLE/HOS/Services/Wlan/ILocalGetActionFrame.cs b/src/Ryujinx.HLE/HOS/Services/Wlan/ILocalGetActionFrame.cs
deleted file mode 100644
index 060e5854..00000000
--- a/src/Ryujinx.HLE/HOS/Services/Wlan/ILocalGetActionFrame.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ryujinx.HLE.HOS.Services.Wlan
-{
-    [Service("wlan:lga")]
-    class ILocalGetActionFrame : IpcService
-    {
-        public ILocalGetActionFrame(ServiceCtx context) { }
-    }
-}
diff --git a/src/Ryujinx.HLE/HOS/Services/Wlan/ILocalGetFrame.cs b/src/Ryujinx.HLE/HOS/Services/Wlan/ILocalGetFrame.cs
deleted file mode 100644
index d726b7d4..00000000
--- a/src/Ryujinx.HLE/HOS/Services/Wlan/ILocalGetFrame.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ryujinx.HLE.HOS.Services.Wlan
-{
-    [Service("wlan:lg")]
-    class ILocalGetFrame : IpcService
-    {
-        public ILocalGetFrame(ServiceCtx context) { }
-    }
-}
diff --git a/src/Ryujinx.HLE/HOS/Services/Wlan/ILocalManager.cs b/src/Ryujinx.HLE/HOS/Services/Wlan/ILocalManager.cs
deleted file mode 100644
index 3db07ac7..00000000
--- a/src/Ryujinx.HLE/HOS/Services/Wlan/ILocalManager.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ryujinx.HLE.HOS.Services.Wlan
-{
-    [Service("wlan:lcl")]
-    class ILocalManager : IpcService
-    {
-        public ILocalManager(ServiceCtx context) { }
-    }
-}
diff --git a/src/Ryujinx.HLE/HOS/Services/Wlan/ISocketGetFrame.cs b/src/Ryujinx.HLE/HOS/Services/Wlan/ISocketGetFrame.cs
deleted file mode 100644
index 5c932923..00000000
--- a/src/Ryujinx.HLE/HOS/Services/Wlan/ISocketGetFrame.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ryujinx.HLE.HOS.Services.Wlan
-{
-    [Service("wlan:sg")]
-    class ISocketGetFrame : IpcService
-    {
-        public ISocketGetFrame(ServiceCtx context) { }
-    }
-}
diff --git a/src/Ryujinx.HLE/HOS/Services/Wlan/ISocketManager.cs b/src/Ryujinx.HLE/HOS/Services/Wlan/ISocketManager.cs
deleted file mode 100644
index 1b40b80e..00000000
--- a/src/Ryujinx.HLE/HOS/Services/Wlan/ISocketManager.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ryujinx.HLE.HOS.Services.Wlan
-{
-    [Service("wlan:soc")]
-    class ISocketManager : IpcService
-    {
-        public ISocketManager(ServiceCtx context) { }
-    }
-}
diff --git a/src/Ryujinx.HLE/HOS/Services/Wlan/IUnknown1.cs b/src/Ryujinx.HLE/HOS/Services/Wlan/IUnknown1.cs
deleted file mode 100644
index 731f8c0a..00000000
--- a/src/Ryujinx.HLE/HOS/Services/Wlan/IUnknown1.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ryujinx.HLE.HOS.Services.Wlan
-{
-    [Service("wlan:dtc")] // 6.0.0+
-    class IUnknown1 : IpcService
-    {
-        public IUnknown1(ServiceCtx context) { }
-    }
-}
diff --git a/src/Ryujinx.Horizon/Sdk/Wlan/IDetectManager.cs b/src/Ryujinx.Horizon/Sdk/Wlan/IDetectManager.cs
new file mode 100644
index 00000000..2629ed6e
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Wlan/IDetectManager.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Sf;
+
+namespace Ryujinx.Horizon.Sdk.Wlan
+{
+    interface IDetectManager : IServiceObject
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Wlan/IGeneralServiceCreator.cs b/src/Ryujinx.Horizon/Sdk/Wlan/IGeneralServiceCreator.cs
new file mode 100644
index 00000000..fa7704e7
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Wlan/IGeneralServiceCreator.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Sf;
+
+namespace Ryujinx.Horizon.Sdk.Wlan
+{
+    interface IGeneralServiceCreator : IServiceObject
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Wlan/IInfraManager.cs b/src/Ryujinx.Horizon/Sdk/Wlan/IInfraManager.cs
new file mode 100644
index 00000000..6739e168
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Wlan/IInfraManager.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Sf;
+
+namespace Ryujinx.Horizon.Sdk.Wlan
+{
+    interface IInfraManager : IServiceObject
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Wlan/ILocalGetActionFrame.cs b/src/Ryujinx.Horizon/Sdk/Wlan/ILocalGetActionFrame.cs
new file mode 100644
index 00000000..171ddba7
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Wlan/ILocalGetActionFrame.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Sf;
+
+namespace Ryujinx.Horizon.Sdk.Wlan
+{
+    interface ILocalGetActionFrame : IServiceObject
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Wlan/ILocalGetFrame.cs b/src/Ryujinx.Horizon/Sdk/Wlan/ILocalGetFrame.cs
new file mode 100644
index 00000000..0a8d587e
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Wlan/ILocalGetFrame.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Sf;
+
+namespace Ryujinx.Horizon.Sdk.Wlan
+{
+    interface ILocalGetFrame : IServiceObject
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Wlan/ILocalManager.cs b/src/Ryujinx.Horizon/Sdk/Wlan/ILocalManager.cs
new file mode 100644
index 00000000..cba9eb91
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Wlan/ILocalManager.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Sf;
+
+namespace Ryujinx.Horizon.Sdk.Wlan
+{
+    interface ILocalManager : IServiceObject
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Wlan/IPrivateServiceCreator.cs b/src/Ryujinx.Horizon/Sdk/Wlan/IPrivateServiceCreator.cs
new file mode 100644
index 00000000..5ab2e0ee
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Wlan/IPrivateServiceCreator.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Sf;
+
+namespace Ryujinx.Horizon.Sdk.Wlan
+{
+    interface IPrivateServiceCreator : IServiceObject
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Wlan/ISfDriverServiceCreator.cs b/src/Ryujinx.Horizon/Sdk/Wlan/ISfDriverServiceCreator.cs
new file mode 100644
index 00000000..78d32e6a
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Wlan/ISfDriverServiceCreator.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Sf;
+
+namespace Ryujinx.Horizon.Sdk.Wlan
+{
+    interface ISfDriverServiceCreator : IServiceObject
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Wlan/ISocketGetFrame.cs b/src/Ryujinx.Horizon/Sdk/Wlan/ISocketGetFrame.cs
new file mode 100644
index 00000000..c6d3e0b9
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Wlan/ISocketGetFrame.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Sf;
+
+namespace Ryujinx.Horizon.Sdk.Wlan
+{
+    interface ISocketGetFrame : IServiceObject
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Wlan/ISocketManager.cs b/src/Ryujinx.Horizon/Sdk/Wlan/ISocketManager.cs
new file mode 100644
index 00000000..dcdfef48
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Wlan/ISocketManager.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Sf;
+
+namespace Ryujinx.Horizon.Sdk.Wlan
+{
+    interface ISocketManager : IServiceObject
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/ServiceTable.cs b/src/Ryujinx.Horizon/ServiceTable.cs
index cd443329..fd423aa2 100644
--- a/src/Ryujinx.Horizon/ServiceTable.cs
+++ b/src/Ryujinx.Horizon/ServiceTable.cs
@@ -3,6 +3,7 @@ using Ryujinx.Horizon.Lbl;
 using Ryujinx.Horizon.LogManager;
 using Ryujinx.Horizon.MmNv;
 using Ryujinx.Horizon.Prepo;
+using Ryujinx.Horizon.Wlan;
 using System.Collections.Generic;
 using System.Threading;
 
@@ -29,6 +30,7 @@ namespace Ryujinx.Horizon
             RegisterService<LmMain>();
             RegisterService<MmNvMain>();
             RegisterService<PrepoMain>();
+            RegisterService<WlanMain>();
 
             _totalServices = entries.Count;
 
diff --git a/src/Ryujinx.Horizon/Wlan/Ipc/DetectManager.cs b/src/Ryujinx.Horizon/Wlan/Ipc/DetectManager.cs
new file mode 100644
index 00000000..595592f7
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/Ipc/DetectManager.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Wlan;
+
+namespace Ryujinx.Horizon.Wlan.Ipc
+{
+    partial class DetectManager : IDetectManager
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Wlan/Ipc/GeneralServiceCreator.cs b/src/Ryujinx.Horizon/Wlan/Ipc/GeneralServiceCreator.cs
new file mode 100644
index 00000000..7f651d22
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/Ipc/GeneralServiceCreator.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Wlan;
+
+namespace Ryujinx.Horizon.Wlan.Ipc
+{
+    partial class GeneralServiceCreator : IGeneralServiceCreator
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Wlan/Ipc/InfraManager.cs b/src/Ryujinx.Horizon/Wlan/Ipc/InfraManager.cs
new file mode 100644
index 00000000..d69c73b5
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/Ipc/InfraManager.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Wlan;
+
+namespace Ryujinx.Horizon.Wlan.Ipc
+{
+    partial class InfraManager : IInfraManager
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Wlan/Ipc/LocalGetActionFrame.cs b/src/Ryujinx.Horizon/Wlan/Ipc/LocalGetActionFrame.cs
new file mode 100644
index 00000000..8458655e
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/Ipc/LocalGetActionFrame.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Wlan;
+
+namespace Ryujinx.Horizon.Wlan.Ipc
+{
+    partial class LocalGetActionFrame : ILocalGetActionFrame
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Wlan/Ipc/LocalGetFrame.cs b/src/Ryujinx.Horizon/Wlan/Ipc/LocalGetFrame.cs
new file mode 100644
index 00000000..5ce8724d
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/Ipc/LocalGetFrame.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Wlan;
+
+namespace Ryujinx.Horizon.Wlan.Ipc
+{
+    partial class LocalGetFrame : ILocalGetFrame
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Wlan/Ipc/LocalManager.cs b/src/Ryujinx.Horizon/Wlan/Ipc/LocalManager.cs
new file mode 100644
index 00000000..789ac190
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/Ipc/LocalManager.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Wlan;
+
+namespace Ryujinx.Horizon.Wlan.Ipc
+{
+    partial class LocalManager : ILocalManager
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Wlan/Ipc/PrivateServiceCreator.cs b/src/Ryujinx.Horizon/Wlan/Ipc/PrivateServiceCreator.cs
new file mode 100644
index 00000000..c25723f9
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/Ipc/PrivateServiceCreator.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Wlan;
+
+namespace Ryujinx.Horizon.Wlan.Ipc
+{
+    partial class PrivateServiceCreator : IPrivateServiceCreator
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Wlan/Ipc/SfDriverServiceCreator.cs b/src/Ryujinx.Horizon/Wlan/Ipc/SfDriverServiceCreator.cs
new file mode 100644
index 00000000..fd74024b
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/Ipc/SfDriverServiceCreator.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Wlan;
+
+namespace Ryujinx.Horizon.Wlan.Ipc
+{
+    partial class SfDriverServiceCreator : ISfDriverServiceCreator
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Wlan/Ipc/SocketGetFrame.cs b/src/Ryujinx.Horizon/Wlan/Ipc/SocketGetFrame.cs
new file mode 100644
index 00000000..5c1663f6
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/Ipc/SocketGetFrame.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Wlan;
+
+namespace Ryujinx.Horizon.Wlan.Ipc
+{
+    partial class SocketGetFrame : ISocketGetFrame
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Wlan/Ipc/SocketManager.cs b/src/Ryujinx.Horizon/Wlan/Ipc/SocketManager.cs
new file mode 100644
index 00000000..a112e745
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/Ipc/SocketManager.cs
@@ -0,0 +1,8 @@
+using Ryujinx.Horizon.Sdk.Wlan;
+
+namespace Ryujinx.Horizon.Wlan.Ipc
+{
+    partial class SocketManager : ISocketManager
+    {
+    }
+}
diff --git a/src/Ryujinx.Horizon/Wlan/WlanIpcServer.cs b/src/Ryujinx.Horizon/Wlan/WlanIpcServer.cs
new file mode 100644
index 00000000..eb13f028
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/WlanIpcServer.cs
@@ -0,0 +1,59 @@
+using Ryujinx.Horizon.Sdk.Sf.Hipc;
+using Ryujinx.Horizon.Sdk.Sm;
+using Ryujinx.Horizon.Wlan.Ipc;
+
+namespace Ryujinx.Horizon.Wlan
+{
+    class WlanIpcServer
+    {
+        private const int WlanOtherMaxSessionsCount = 10;
+        private const int WlanDtcMaxSessionsCount = 4;
+        private const int WlanMaxSessionsCount = 30;
+        private const int WlanNdMaxSessionsCount = 5;
+        private const int WlanPMaxSessionsCount = 30;
+        private const int TotalMaxSessionsCount = WlanDtcMaxSessionsCount + WlanMaxSessionsCount + WlanNdMaxSessionsCount + WlanPMaxSessionsCount + WlanOtherMaxSessionsCount * 6;
+
+        private const int PointerBufferSize = 0x1000;
+        private const int MaxDomains = 16;
+        private const int MaxDomainObjects = 10;
+        private const int MaxPortsCount = 10;
+
+        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 GeneralServiceCreator(),  ServiceName.Encode("wlan"),     WlanMaxSessionsCount);      // 15.0.0+
+            _serverManager.RegisterObjectForServer(new DetectManager(),          ServiceName.Encode("wlan:dtc"), WlanDtcMaxSessionsCount);   // 6.0.0-14.1.2
+            _serverManager.RegisterObjectForServer(new InfraManager(),           ServiceName.Encode("wlan:inf"), WlanOtherMaxSessionsCount); // 1.0.0-14.1.2
+            _serverManager.RegisterObjectForServer(new LocalManager(),           ServiceName.Encode("wlan:lcl"), WlanOtherMaxSessionsCount); // 1.0.0-14.1.2
+            _serverManager.RegisterObjectForServer(new LocalGetFrame(),          ServiceName.Encode("wlan:lg"),  WlanOtherMaxSessionsCount); // 1.0.0-14.1.2
+            _serverManager.RegisterObjectForServer(new LocalGetActionFrame(),    ServiceName.Encode("wlan:lga"), WlanOtherMaxSessionsCount); // 1.0.0-14.1.2
+            _serverManager.RegisterObjectForServer(new SfDriverServiceCreator(), ServiceName.Encode("wlan:nd"),  WlanNdMaxSessionsCount);    // 15.0.0+
+            _serverManager.RegisterObjectForServer(new PrivateServiceCreator(),  ServiceName.Encode("wlan:p"),   WlanPMaxSessionsCount);     // 15.0.0+
+            _serverManager.RegisterObjectForServer(new SocketGetFrame(),         ServiceName.Encode("wlan:sg"),  WlanOtherMaxSessionsCount); // 1.0.0-14.1.2
+            _serverManager.RegisterObjectForServer(new SocketManager(),          ServiceName.Encode("wlan:soc"), WlanOtherMaxSessionsCount); // 1.0.0-14.1.2
+#pragma warning restore IDE0055
+        }
+
+        public void ServiceRequests()
+        {
+            _serverManager.ServiceRequests();
+        }
+
+        public void Shutdown()
+        {
+            _serverManager.Dispose();
+        }
+    }
+}
diff --git a/src/Ryujinx.Horizon/Wlan/WlanMain.cs b/src/Ryujinx.Horizon/Wlan/WlanMain.cs
new file mode 100644
index 00000000..1381a8cb
--- /dev/null
+++ b/src/Ryujinx.Horizon/Wlan/WlanMain.cs
@@ -0,0 +1,17 @@
+namespace Ryujinx.Horizon.Wlan
+{
+    class WlanMain : IService
+    {
+        public static void Main(ServiceTable serviceTable)
+        {
+            WlanIpcServer ipcServer = new();
+
+            ipcServer.Initialize();
+
+            serviceTable.SignalServiceReady();
+
+            ipcServer.ServiceRequests();
+            ipcServer.Shutdown();
+        }
+    }
+}