Kaynağa Gözat

Refactor IPC services to have commands into separate classes, fix readme url

gdkchan 8 yıl önce
ebeveyn
işleme
fba0bf8732
73 değiştirilmiş dosya ile 825 ekleme ve 583 silme
  1. 1 1
      README.md
  2. 6 4
      Ryujinx.Core/OsHle/Handles/HSession.cs
  3. 6 72
      Ryujinx.Core/OsHle/Ipc/IpcHandler.cs
  4. 2 2
      Ryujinx.Core/OsHle/IpcServices/Acc/IManagerForApplication.cs
  5. 2 2
      Ryujinx.Core/OsHle/IpcServices/Acc/IProfile.cs
  6. 49 0
      Ryujinx.Core/OsHle/IpcServices/Acc/ServiceAcc.cs
  7. 3 3
      Ryujinx.Core/OsHle/IpcServices/Am/IApplicationFunctions.cs
  8. 3 3
      Ryujinx.Core/OsHle/IpcServices/Am/IApplicationProxy.cs
  9. 2 2
      Ryujinx.Core/OsHle/IpcServices/Am/IAudioController.cs
  10. 2 2
      Ryujinx.Core/OsHle/IpcServices/Am/ICommonStateGetter.cs
  11. 2 2
      Ryujinx.Core/OsHle/IpcServices/Am/IDebugFunctions.cs
  12. 2 2
      Ryujinx.Core/OsHle/IpcServices/Am/IDisplayController.cs
  13. 2 2
      Ryujinx.Core/OsHle/IpcServices/Am/ILibraryAppletCreator.cs
  14. 2 2
      Ryujinx.Core/OsHle/IpcServices/Am/ISelfController.cs
  15. 3 3
      Ryujinx.Core/OsHle/IpcServices/Am/IStorage.cs
  16. 2 2
      Ryujinx.Core/OsHle/IpcServices/Am/IStorageAccessor.cs
  17. 2 2
      Ryujinx.Core/OsHle/IpcServices/Am/IWindowController.cs
  18. 29 0
      Ryujinx.Core/OsHle/IpcServices/Am/ServiceAppletOE.cs
  19. 1 1
      Ryujinx.Core/OsHle/IpcServices/Android/GbpBuffer.cs
  20. 2 2
      Ryujinx.Core/OsHle/IpcServices/Android/NvFlinger.cs
  21. 1 1
      Ryujinx.Core/OsHle/IpcServices/Android/Parcel.cs
  22. 2 2
      Ryujinx.Core/OsHle/IpcServices/Apm/ISession.cs
  23. 29 0
      Ryujinx.Core/OsHle/IpcServices/Apm/ServiceApm.cs
  24. 2 2
      Ryujinx.Core/OsHle/IpcServices/Aud/IAudioOut.cs
  25. 2 2
      Ryujinx.Core/OsHle/IpcServices/Aud/IAudioRenderer.cs
  26. 57 0
      Ryujinx.Core/OsHle/IpcServices/Aud/ServiceAudOut.cs
  27. 51 0
      Ryujinx.Core/OsHle/IpcServices/Aud/ServiceAudRen.cs
  28. 1 1
      Ryujinx.Core/OsHle/IpcServices/ErrorCode.cs
  29. 1 1
      Ryujinx.Core/OsHle/IpcServices/ErrorModule.cs
  30. 2 2
      Ryujinx.Core/OsHle/IpcServices/Friend/IFriendService.cs
  31. 29 0
      Ryujinx.Core/OsHle/IpcServices/Friend/ServiceFriend.cs
  32. 1 1
      Ryujinx.Core/OsHle/IpcServices/FspSrv/FsErr.cs
  33. 2 2
      Ryujinx.Core/OsHle/IpcServices/FspSrv/IDirectory.cs
  34. 2 2
      Ryujinx.Core/OsHle/IpcServices/FspSrv/IFile.cs
  35. 4 4
      Ryujinx.Core/OsHle/IpcServices/FspSrv/IFileSystem.cs
  36. 2 2
      Ryujinx.Core/OsHle/IpcServices/FspSrv/IStorage.cs
  37. 67 0
      Ryujinx.Core/OsHle/IpcServices/FspSrv/ServiceFspSrv.cs
  38. 2 2
      Ryujinx.Core/OsHle/IpcServices/Hid/IActiveVibrationDeviceList.cs
  39. 2 2
      Ryujinx.Core/OsHle/IpcServices/Hid/IAppletResource.cs
  40. 98 0
      Ryujinx.Core/OsHle/IpcServices/Hid/ServiceHid.cs
  41. 2 2
      Ryujinx.Core/OsHle/IpcServices/IIpcService.cs
  42. 27 0
      Ryujinx.Core/OsHle/IpcServices/Lm/ServiceLm.cs
  43. 29 12
      Ryujinx.Core/OsHle/IpcServices/NvServices/ServiceNvDrv.cs
  44. 1 1
      Ryujinx.Core/OsHle/IpcServices/ObjHelper.cs
  45. 2 2
      Ryujinx.Core/OsHle/IpcServices/Pctl/IParentalControlService.cs
  46. 29 0
      Ryujinx.Core/OsHle/IpcServices/Pctl/ServicePctl.cs
  47. 51 0
      Ryujinx.Core/OsHle/IpcServices/Pl/ServicePl.cs
  48. 50 0
      Ryujinx.Core/OsHle/IpcServices/ServiceFactory.cs
  49. 17 3
      Ryujinx.Core/OsHle/IpcServices/Set/ServiceSet.cs
  50. 24 5
      Ryujinx.Core/OsHle/IpcServices/Sm/ServiceSm.cs
  51. 2 2
      Ryujinx.Core/OsHle/IpcServices/Time/ISteadyClock.cs
  52. 2 2
      Ryujinx.Core/OsHle/IpcServices/Time/ISystemClock.cs
  53. 2 2
      Ryujinx.Core/OsHle/IpcServices/Time/ITimeZoneService.cs
  54. 62 0
      Ryujinx.Core/OsHle/IpcServices/Time/ServiceTime.cs
  55. 1 1
      Ryujinx.Core/OsHle/IpcServices/Time/SystemClockType.cs
  56. 4 4
      Ryujinx.Core/OsHle/IpcServices/Vi/IApplicationDisplayService.cs
  57. 3 3
      Ryujinx.Core/OsHle/IpcServices/Vi/IHOSBinderDriver.cs
  58. 2 2
      Ryujinx.Core/OsHle/IpcServices/Vi/IManagerDisplayService.cs
  59. 2 2
      Ryujinx.Core/OsHle/IpcServices/Vi/ISystemDisplayService.cs
  60. 31 0
      Ryujinx.Core/OsHle/IpcServices/Vi/ServiceVi.cs
  61. 0 33
      Ryujinx.Core/OsHle/Services/ServiceAcc.cs
  62. 0 16
      Ryujinx.Core/OsHle/Services/ServiceApm.cs
  63. 0 16
      Ryujinx.Core/OsHle/Services/ServiceAppletOE.cs
  64. 0 71
      Ryujinx.Core/OsHle/Services/ServiceAud.cs
  65. 0 16
      Ryujinx.Core/OsHle/Services/ServiceFriend.cs
  66. 0 49
      Ryujinx.Core/OsHle/Services/ServiceFspSrv.cs
  67. 0 77
      Ryujinx.Core/OsHle/Services/ServiceHid.cs
  68. 0 12
      Ryujinx.Core/OsHle/Services/ServiceLm.cs
  69. 0 16
      Ryujinx.Core/OsHle/Services/ServicePctl.cs
  70. 0 35
      Ryujinx.Core/OsHle/Services/ServicePl.cs
  71. 0 45
      Ryujinx.Core/OsHle/Services/ServiceTime.cs
  72. 0 18
      Ryujinx.Core/OsHle/Services/ServiceVi.cs
  73. 2 1
      Ryujinx.Core/OsHle/Svc/SvcSystem.cs

+ 1 - 1
README.md

@@ -67,4 +67,4 @@ Run `dotnet run -c Release -- path\to\game_exefs_and_romfs_folder` to run offici
 **Latest build**
 
 These builds are compiled automatically for each commit on the master branch. They may be unstable or not work at all.
-To download the latest automatic build for Windows (64-bits), [Click Here](https://ci.appveyor.com/api/projects/gdkchan/ryujinx/artifacts/ryujinx_latest_unstable.zip).
+To download the latest automatic build for Windows (64-bits), [Click Here](https://ci.appveyor.com/api/projects/gdkchan/ryujinx/artifacts/ryujinx_latest_unstable.zip?pr=false).

+ 6 - 4
Ryujinx.Core/OsHle/Handles/HSession.cs

@@ -1,21 +1,23 @@
+using Ryujinx.Core.OsHle.IpcServices;
+
 namespace Ryujinx.Core.OsHle.Handles
 {
     class HSession
     {
-        public string ServiceName { get; private set; }
+        public IIpcService Service { get; private set; }
 
         public bool IsInitialized { get; private set; }
 
         public int State { get; set; }
 
-        public HSession(string ServiceName)
+        public HSession(IIpcService Service)
         {
-            this.ServiceName = ServiceName;
+            this.Service = Service;
         }
 
         public HSession(HSession Session)
         {
-            ServiceName   = Session.ServiceName;
+            Service       = Session.Service;
             IsInitialized = Session.IsInitialized;
         }
 

+ 6 - 72
Ryujinx.Core/OsHle/Ipc/IpcHandler.cs

@@ -1,79 +1,13 @@
 using ChocolArm64.Memory;
 using Ryujinx.Core.OsHle.Handles;
-using Ryujinx.Core.OsHle.Objects;
-using Ryujinx.Core.OsHle.Services;
+using Ryujinx.Core.OsHle.IpcServices;
 using System;
-using System.Collections.Generic;
 using System.IO;
 
 namespace Ryujinx.Core.OsHle.Ipc
 {
     static class IpcHandler
     {
-        private static Dictionary<(string, int), ServiceProcessRequest> ServiceCmds =
-                   new Dictionary<(string, int), ServiceProcessRequest>()
-        {
-            { ( "acc:u0",      3), Service.AccU0ListOpenUsers                       },
-            { ( "acc:u0",      5), Service.AccU0GetProfile                          },
-            { ( "acc:u0",    100), Service.AccU0InitializeApplicationInfo           },
-            { ( "acc:u0",    101), Service.AccU0GetBaasAccountManagerForApplication },
-            { ( "apm",         0), Service.ApmOpenSession                           },
-            { ( "apm:p",       0), Service.ApmOpenSession                           },
-            { ( "appletOE",    0), Service.AppletOpenApplicationProxy               },
-            { ( "audout:u",    0), Service.AudOutListAudioOuts                      },
-            { ( "audout:u",    1), Service.AudOutOpenAudioOut                       },
-            { ( "audren:u",    0), Service.AudRenOpenAudioRenderer                  },
-            { ( "audren:u",    1), Service.AudRenGetAudioRendererWorkBufferSize     },
-            { ( "friend:a",    0), Service.FriendCreateFriendService                },
-            { ( "fsp-srv",     1), Service.FspSrvInitialize                         },
-            { ( "fsp-srv",    18), Service.FspSrvMountSdCard                        },
-            { ( "fsp-srv",    51), Service.FspSrvMountSaveData                      },
-            { ( "fsp-srv",   200), Service.FspSrvOpenDataStorageByCurrentProcess    },
-            { ( "fsp-srv",   203), Service.FspSrvOpenRomStorage                     },
-            { ( "fsp-srv",  1005), Service.FspSrvGetGlobalAccessLogMode             },
-            { ( "hid",         0), Service.HidCreateAppletResource                  },
-            { ( "hid",        11), Service.HidActivateTouchScreen                   },
-            { ( "hid",       100), Service.HidSetSupportedNpadStyleSet              },
-            { ( "hid",       101), Service.HidGetSupportedNpadStyleSet              },
-            { ( "hid",       102), Service.HidSetSupportedNpadIdType                },
-            { ( "hid",       103), Service.HidActivateNpad                          },
-            { ( "hid",       120), Service.HidSetNpadJoyHoldType                    },
-            { ( "hid",       121), Service.HidGetNpadJoyHoldType                    },
-            { ( "hid",       203), Service.HidCreateActiveVibrationDeviceList       },
-            { ( "lm",          0), Service.LmInitialize                             },
-            { ( "nvdrv",       0), Service.NvDrvOpen                                },
-            { ( "nvdrv",       1), Service.NvDrvIoctl                               },
-            { ( "nvdrv",       2), Service.NvDrvClose                               },
-            { ( "nvdrv",       3), Service.NvDrvInitialize                          },
-            { ( "nvdrv",       4), Service.NvDrvQueryEvent                          },
-            { ( "nvdrv",       8), Service.NvDrvSetClientPid                        },
-            { ( "nvdrv:a",     0), Service.NvDrvOpen                                },
-            { ( "nvdrv:a",     1), Service.NvDrvIoctl                               },
-            { ( "nvdrv:a",     2), Service.NvDrvClose                               },
-            { ( "nvdrv:a",     3), Service.NvDrvInitialize                          },
-            { ( "nvdrv:a",     4), Service.NvDrvQueryEvent                          },
-            { ( "nvdrv:a",     8), Service.NvDrvSetClientPid                        },
-            { ( "pctl:a",      0), Service.PctlCreateService                        },
-            { ( "pl:u",        1), Service.PlGetLoadState                           },
-            { ( "pl:u",        2), Service.PlGetFontSize                            },
-            { ( "pl:u",        3), Service.PlGetSharedMemoryAddressOffset           },
-            { ( "pl:u",        4), Service.PlGetSharedMemoryNativeHandle            },
-            { ( "set",         1), Service.SetGetAvailableLanguageCodes             },
-            { ( "sm:",         0), Service.SmInitialize                             },
-            { ( "sm:",         1), Service.SmGetService                             },
-            { ( "time:u",      0), Service.TimeGetStandardUserSystemClock           },
-            { ( "time:u",      1), Service.TimeGetStandardNetworkSystemClock        },
-            { ( "time:u",      2), Service.TimeGetStandardSteadyClock               },
-            { ( "time:u",      3), Service.TimeGetTimeZoneService                   },
-            { ( "time:u",      4), Service.TimeGetStandardLocalSystemClock          },
-            { ( "time:s",      0), Service.TimeGetStandardUserSystemClock           },
-            { ( "time:s",      1), Service.TimeGetStandardNetworkSystemClock        },
-            { ( "time:s",      2), Service.TimeGetStandardSteadyClock               },
-            { ( "time:s",      3), Service.TimeGetTimeZoneService                   },
-            { ( "time:s",      4), Service.TimeGetStandardLocalSystemClock          },
-            { ( "vi:m",        2), Service.ViGetDisplayService                      },
-        };
-
         private const long SfciMagic = 'S' << 0 | 'F' << 8 | 'C' << 16 | 'I' << 24;
         private const long SfcoMagic = 'S' << 0 | 'F' << 8 | 'C' << 16 | 'O' << 24;
 
@@ -94,7 +28,7 @@ namespace Ryujinx.Core.OsHle.Ipc
 
                 if (Request.Type == IpcMessageType.Request)
                 {
-                    string ServiceName = Session.ServiceName;
+                    string ServiceName = Session.Service.GetType().Name;
 
                     ServiceProcessRequest ProcReq = null;
 
@@ -113,13 +47,13 @@ namespace Ryujinx.Core.OsHle.Ipc
 
                             if (Obj is HDomain)
                             {
-                                ServiceCmds.TryGetValue((ServiceName, CmdId), out ProcReq);
+                                Session.Service.Commands.TryGetValue(CmdId, out ProcReq);
 
                                 DbgServiceName = $"{ProcReq?.Method.Name ?? CmdId.ToString()}";
                             }
                             else if (Obj != null)
                             {
-                                ((IIpcInterface)Obj).Commands.TryGetValue(CmdId, out ProcReq);
+                                ((IIpcService)Obj).Commands.TryGetValue(CmdId, out ProcReq);
 
                                 DbgServiceName = $"{Obj.GetType().Name} {ProcReq?.Method.Name ?? CmdId.ToString()}";
                             }
@@ -142,13 +76,13 @@ namespace Ryujinx.Core.OsHle.Ipc
                         {
                             object Obj = ((HSessionObj)Session).Obj;
 
-                            ((IIpcInterface)Obj).Commands.TryGetValue(CmdId, out ProcReq);
+                            ((IIpcService)Obj).Commands.TryGetValue(CmdId, out ProcReq);
 
                             DbgServiceName = $"{Obj.GetType().Name} {ProcReq?.Method.Name ?? CmdId.ToString()}";
                         }
                         else
                         {
-                            ServiceCmds.TryGetValue((ServiceName, CmdId), out ProcReq);
+                            Session.Service.Commands.TryGetValue(CmdId, out ProcReq);
 
                             DbgServiceName = $"{ProcReq?.Method.Name ?? CmdId.ToString()}";
                         }

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Acc/IManagerForApplication.cs → Ryujinx.Core/OsHle/IpcServices/Acc/IManagerForApplication.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Acc
+namespace Ryujinx.Core.OsHle.IpcServices.Acc
 {
-    class IManagerForApplication : IIpcInterface
+    class IManagerForApplication : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Acc/IProfile.cs → Ryujinx.Core/OsHle/IpcServices/Acc/IProfile.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Acc
+namespace Ryujinx.Core.OsHle.IpcServices.Acc
 {
-    class IProfile : IIpcInterface
+    class IProfile : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 49 - 0
Ryujinx.Core/OsHle/IpcServices/Acc/ServiceAcc.cs

@@ -0,0 +1,49 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Acc
+{
+    class ServiceAcc : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceAcc()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                {   3, ListOpenUsers                       },
+                {   5, GetProfile                          },
+                { 100, InitializeApplicationInfo           },
+                { 101, GetBaasAccountManagerForApplication }
+            };
+        }
+
+        public long ListOpenUsers(ServiceCtx Context)
+        {
+            return 0;
+        }
+
+        public long GetProfile(ServiceCtx Context)
+        {
+            MakeObject(Context, new IProfile());
+
+            return 0;
+        }
+
+        public long InitializeApplicationInfo(ServiceCtx Context)
+        {
+            return 0;
+        }
+
+        public long GetBaasAccountManagerForApplication(ServiceCtx Context)
+        {
+            MakeObject(Context, new IManagerForApplication());
+
+            return 0;
+        }
+    }
+}

+ 3 - 3
Ryujinx.Core/OsHle/Objects/Am/IApplicationFunctions.cs → Ryujinx.Core/OsHle/IpcServices/Am/IApplicationFunctions.cs

@@ -2,11 +2,11 @@ using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 using System.IO;
 
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Am
 {
-    class IApplicationFunctions : IIpcInterface
+    class IApplicationFunctions : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 3 - 3
Ryujinx.Core/OsHle/Objects/Am/IApplicationProxy.cs → Ryujinx.Core/OsHle/IpcServices/Am/IApplicationProxy.cs

@@ -1,11 +1,11 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Am
 {
-    class IApplicationProxy : IIpcInterface
+    class IApplicationProxy : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Am/IAudioController.cs → Ryujinx.Core/OsHle/IpcServices/Am/IAudioController.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Am
 {
-    class IAudioController : IIpcInterface
+    class IAudioController : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Am/ICommonStateGetter.cs → Ryujinx.Core/OsHle/IpcServices/Am/ICommonStateGetter.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Am
 {
-    class ICommonStateGetter : IIpcInterface
+    class ICommonStateGetter : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Am/IDebugFunctions.cs → Ryujinx.Core/OsHle/IpcServices/Am/IDebugFunctions.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Am
 {
-    class IDebugFunctions : IIpcInterface
+    class IDebugFunctions : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Am/IDisplayController.cs → Ryujinx.Core/OsHle/IpcServices/Am/IDisplayController.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Am
 {
-    class IDisplayController : IIpcInterface
+    class IDisplayController : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Am/ILibraryAppletCreator.cs → Ryujinx.Core/OsHle/IpcServices/Am/ILibraryAppletCreator.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Am
 {
-    class ILibraryAppletCreator : IIpcInterface
+    class ILibraryAppletCreator : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Am/ISelfController.cs → Ryujinx.Core/OsHle/IpcServices/Am/ISelfController.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Am
 {
-    class ISelfController : IIpcInterface
+    class ISelfController : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 3 - 3
Ryujinx.Core/OsHle/Objects/Am/IStorage.cs → Ryujinx.Core/OsHle/IpcServices/Am/IStorage.cs

@@ -1,11 +1,11 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Am
 {
-    class IStorage : IIpcInterface
+    class IStorage : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Am/IStorageAccessor.cs → Ryujinx.Core/OsHle/IpcServices/Am/IStorageAccessor.cs

@@ -3,9 +3,9 @@ using Ryujinx.Core.OsHle.Ipc;
 using System;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Am
 {
-    class IStorageAccessor : IIpcInterface
+    class IStorageAccessor : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Am/IWindowController.cs → Ryujinx.Core/OsHle/IpcServices/Am/IWindowController.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Am
 {
-    class IWindowController : IIpcInterface
+    class IWindowController : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 29 - 0
Ryujinx.Core/OsHle/IpcServices/Am/ServiceAppletOE.cs

@@ -0,0 +1,29 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Am
+{
+    class ServiceAppletOE : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceAppletOE()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 0, OpenApplicationProxy }
+            };
+        }
+
+        public long OpenApplicationProxy(ServiceCtx Context)
+        {
+            MakeObject(Context, new IApplicationProxy());
+
+            return 0;
+        }
+    }
+}

+ 1 - 1
Ryujinx.Core/OsHle/Objects/Android/GbpBuffer.cs → Ryujinx.Core/OsHle/IpcServices/Android/GbpBuffer.cs

@@ -1,6 +1,6 @@
 using System.IO;
 
-namespace Ryujinx.Core.OsHle.Objects.Android
+namespace Ryujinx.Core.OsHle.IpcServices.Android
 {
     struct GbpBuffer
     {

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Android/NvFlinger.cs → Ryujinx.Core/OsHle/IpcServices/Android/NvFlinger.cs

@@ -6,9 +6,9 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading;
 
-using static Ryujinx.Core.OsHle.Objects.Android.Parcel;
+using static Ryujinx.Core.OsHle.IpcServices.Android.Parcel;
 
-namespace Ryujinx.Core.OsHle.Objects.Android
+namespace Ryujinx.Core.OsHle.IpcServices.Android
 {
     class NvFlinger : IDisposable
     {

+ 1 - 1
Ryujinx.Core/OsHle/Objects/Android/Parcel.cs → Ryujinx.Core/OsHle/IpcServices/Android/Parcel.cs

@@ -1,7 +1,7 @@
 using System;
 using System.IO;
 
-namespace Ryujinx.Core.OsHle.Objects.Android
+namespace Ryujinx.Core.OsHle.IpcServices.Android
 {
     static class Parcel
     {

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Apm/ISession.cs → Ryujinx.Core/OsHle/IpcServices/Apm/ISession.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Apm
+namespace Ryujinx.Core.OsHle.IpcServices.Apm
 {
-    class ISession : IIpcInterface
+    class ISession : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 29 - 0
Ryujinx.Core/OsHle/IpcServices/Apm/ServiceApm.cs

@@ -0,0 +1,29 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Apm
+{
+    class ServiceApm : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceApm()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 0, OpenSession }
+            };
+        }
+
+        public long OpenSession(ServiceCtx Context)
+        {
+            MakeObject(Context, new ISession());
+
+            return 0;
+        }
+    }
+}

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Aud/IAudioOut.cs → Ryujinx.Core/OsHle/IpcServices/Aud/IAudioOut.cs

@@ -7,9 +7,9 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 
-namespace Ryujinx.Core.OsHle.Objects.Aud
+namespace Ryujinx.Core.OsHle.IpcServices.Aud
 {
-    class IAudioOut : IIpcInterface
+    class IAudioOut : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Aud/IAudioRenderer.cs → Ryujinx.Core/OsHle/IpcServices/Aud/IAudioRenderer.cs

@@ -2,9 +2,9 @@ using Ryujinx.Core.OsHle.Handles;
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Aud
+namespace Ryujinx.Core.OsHle.IpcServices.Aud
 {
-    class IAudioRenderer : IIpcInterface
+    class IAudioRenderer : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 57 - 0
Ryujinx.Core/OsHle/IpcServices/Aud/ServiceAudOut.cs

@@ -0,0 +1,57 @@
+using ChocolArm64.Memory;
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+using System.Text;
+
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Aud
+{
+    class ServiceAudOut : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceAudOut()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 0, ListAudioOuts },
+                { 1, OpenAudioOut  },
+            };
+        }
+
+        public long ListAudioOuts(ServiceCtx Context)
+        {
+            long Position = Context.Request.ReceiveBuff[0].Position;
+
+            AMemoryHelper.WriteBytes(Context.Memory, Position, Encoding.ASCII.GetBytes("iface"));
+
+            Context.ResponseData.Write(1);
+
+            return 0;
+        }
+
+        public long OpenAudioOut(ServiceCtx Context)
+        {
+            MakeObject(Context, new IAudioOut());
+
+            Context.ResponseData.Write(48000); //Sample Rate
+            Context.ResponseData.Write(2); //Channel Count
+            Context.ResponseData.Write(2); //PCM Format
+            /*  
+                0 - Invalid
+                1 - INT8
+                2 - INT16
+                3 - INT24
+                4 - INT32
+                5 - PCM Float
+                6 - ADPCM
+            */
+            Context.ResponseData.Write(0); //Unknown
+
+            return 0;
+        }
+    }
+}

+ 51 - 0
Ryujinx.Core/OsHle/IpcServices/Aud/ServiceAudRen.cs

@@ -0,0 +1,51 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Aud
+{
+    class ServiceAudRen : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceAudRen()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 0, OpenAudioRenderer              },
+                { 1, GetAudioRendererWorkBufferSize },
+            };
+        }
+
+        public long OpenAudioRenderer(ServiceCtx Context)
+        {
+            MakeObject(Context, new IAudioRenderer());
+
+            return 0;
+        }
+
+        public long GetAudioRendererWorkBufferSize(ServiceCtx Context)
+        {
+            int SampleRate = Context.RequestData.ReadInt32();
+            int Unknown4   = Context.RequestData.ReadInt32();
+            int Unknown8   = Context.RequestData.ReadInt32();
+            int UnknownC   = Context.RequestData.ReadInt32();
+            int Unknown10  = Context.RequestData.ReadInt32();
+            int Unknown14  = Context.RequestData.ReadInt32();
+            int Unknown18  = Context.RequestData.ReadInt32();
+            int Unknown1c  = Context.RequestData.ReadInt32();
+            int Unknown20  = Context.RequestData.ReadInt32();
+            int Unknown24  = Context.RequestData.ReadInt32();
+            int Unknown28  = Context.RequestData.ReadInt32();
+            int Unknown2c  = Context.RequestData.ReadInt32();
+            int Rev1Magic  = Context.RequestData.ReadInt32();
+
+            Context.ResponseData.Write(0x400L);
+
+            return 0;
+        }
+    }
+}

+ 1 - 1
Ryujinx.Core/OsHle/Objects/ErrorCode.cs → Ryujinx.Core/OsHle/IpcServices/ErrorCode.cs

@@ -1,4 +1,4 @@
-namespace Ryujinx.Core.OsHle.Objects
+namespace Ryujinx.Core.OsHle.IpcServices
 {
     static class ErrorCode
     {

+ 1 - 1
Ryujinx.Core/OsHle/Objects/ErrorModule.cs → Ryujinx.Core/OsHle/IpcServices/ErrorModule.cs

@@ -1,4 +1,4 @@
-namespace Ryujinx.Core.OsHle.Objects
+namespace Ryujinx.Core.OsHle.IpcServices
 {
     enum ErrorModule
     {

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Friend/IFriendService.cs → Ryujinx.Core/OsHle/IpcServices/Friend/IFriendService.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Friend
+namespace Ryujinx.Core.OsHle.IpcServices.Friend
 {
-    class IFriendService : IIpcInterface
+    class IFriendService : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 29 - 0
Ryujinx.Core/OsHle/IpcServices/Friend/ServiceFriend.cs

@@ -0,0 +1,29 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Friend
+{
+    class ServiceFriend : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceFriend()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 0, CreateFriendService }
+            };
+        }
+
+        public static long CreateFriendService(ServiceCtx Context)
+        {
+            MakeObject(Context, new IFriendService());
+
+            return 0;
+        }
+    }
+}

+ 1 - 1
Ryujinx.Core/OsHle/Objects/FspSrv/FsErr.cs → Ryujinx.Core/OsHle/IpcServices/FspSrv/FsErr.cs

@@ -1,4 +1,4 @@
-namespace Ryujinx.Core.OsHle.Objects.FspSrv
+namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
 {
     static class FsErr
     {

+ 2 - 2
Ryujinx.Core/OsHle/Objects/FspSrv/IDirectory.cs → Ryujinx.Core/OsHle/IpcServices/FspSrv/IDirectory.cs

@@ -5,9 +5,9 @@ using System.Collections.Generic;
 using System.IO;
 using System.Text;
 
-namespace Ryujinx.Core.OsHle.Objects.FspSrv
+namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
 {
-    class IDirectory : IIpcInterface, IDisposable
+    class IDirectory : IIpcService, IDisposable
     {
         private const int DirectoryEntrySize = 0x310;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/FspSrv/IFile.cs → Ryujinx.Core/OsHle/IpcServices/FspSrv/IFile.cs

@@ -4,9 +4,9 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 
-namespace Ryujinx.Core.OsHle.Objects.FspSrv
+namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
 {
-    class IFile : IIpcInterface, IDisposable
+    class IFile : IIpcService, IDisposable
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 4 - 4
Ryujinx.Core/OsHle/Objects/FspSrv/IFileSystem.cs → Ryujinx.Core/OsHle/IpcServices/FspSrv/IFileSystem.cs

@@ -4,12 +4,12 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 
-using static Ryujinx.Core.OsHle.Objects.ErrorCode;
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
+using static Ryujinx.Core.OsHle.IpcServices.ErrorCode;
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
 
-namespace Ryujinx.Core.OsHle.Objects.FspSrv
+namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
 {
-    class IFileSystem : IIpcInterface
+    class IFileSystem : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/FspSrv/IStorage.cs → Ryujinx.Core/OsHle/IpcServices/FspSrv/IStorage.cs

@@ -3,9 +3,9 @@ using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 using System.IO;
 
-namespace Ryujinx.Core.OsHle.Objects.FspSrv
+namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
 {
-    class IStorage : IIpcInterface
+    class IStorage : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 67 - 0
Ryujinx.Core/OsHle/IpcServices/FspSrv/ServiceFspSrv.cs

@@ -0,0 +1,67 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
+
+namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
+{
+    class ServiceFspSrv : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceFspSrv()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                {    1, Initialize                      },
+                {   18, MountSdCard                     },
+                {   51, MountSaveData                   },
+                {  200, OpenDataStorageByCurrentProcess },
+                {  203, OpenRomStorage                  },
+                { 1005, GetGlobalAccessLogMode          }
+            };
+        }
+
+        public long Initialize(ServiceCtx Context)
+        {
+            return 0;
+        }
+
+        public long MountSdCard(ServiceCtx Context)
+        {
+            MakeObject(Context, new IFileSystem(Context.Ns.VFs.GetSdCardPath()));
+
+            return 0;
+        }
+
+        public long MountSaveData(ServiceCtx Context)
+        {
+            MakeObject(Context, new IFileSystem(Context.Ns.VFs.GetGameSavesPath()));
+
+            return 0;
+        }
+
+        public long OpenDataStorageByCurrentProcess(ServiceCtx Context)
+        {
+            MakeObject(Context, new IStorage(Context.Ns.VFs.RomFs));
+
+            return 0;
+        }
+
+        public long OpenRomStorage(ServiceCtx Context)
+        {
+            MakeObject(Context, new IStorage(Context.Ns.VFs.RomFs));
+
+            return 0;
+        }
+
+        public long GetGlobalAccessLogMode(ServiceCtx Context)
+        {
+            Context.ResponseData.Write(0);
+
+            return 0;
+        }        
+    }
+}

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Hid/IActiveVibrationDeviceList.cs → Ryujinx.Core/OsHle/IpcServices/Hid/IActiveVibrationDeviceList.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Hid
+namespace Ryujinx.Core.OsHle.IpcServices.Hid
 {
-    class IActiveApplicationDeviceList : IIpcInterface
+    class IActiveApplicationDeviceList : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Hid/IAppletResource.cs → Ryujinx.Core/OsHle/IpcServices/Hid/IAppletResource.cs

@@ -2,9 +2,9 @@ using Ryujinx.Core.OsHle.Handles;
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Hid
+namespace Ryujinx.Core.OsHle.IpcServices.Hid
 {
-    class IAppletResource : IIpcInterface
+    class IAppletResource : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 98 - 0
Ryujinx.Core/OsHle/IpcServices/Hid/ServiceHid.cs

@@ -0,0 +1,98 @@
+using Ryujinx.Core.OsHle.Handles;
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Hid
+{
+    class ServiceHid : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceHid()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                {   0, CreateAppletResource            },
+                {  11, ActivateTouchScreen             },
+                { 100, SetSupportedNpadStyleSet        },
+                { 101, GetSupportedNpadStyleSet        },
+                { 102, SetSupportedNpadIdType          },
+                { 103, ActivateNpad                    },
+                { 120, SetNpadJoyHoldType              },
+                { 121, GetNpadJoyHoldType              },
+                { 203, CreateActiveVibrationDeviceList },
+            };
+        }
+
+        public long CreateAppletResource(ServiceCtx Context)
+        {
+            HSharedMem HidHndData = Context.Ns.Os.Handles.GetData<HSharedMem>(Context.Ns.Os.HidHandle);
+
+            MakeObject(Context, new IAppletResource(HidHndData));
+
+            return 0;
+        }
+
+        public long ActivateTouchScreen(ServiceCtx Context)
+        {
+            long Unknown = Context.RequestData.ReadInt64();
+
+            return 0;
+        }
+
+        public long GetSupportedNpadStyleSet(ServiceCtx Context)
+        {
+            Context.ResponseData.Write(0);
+
+            return 0;
+        }
+
+        public long SetSupportedNpadStyleSet(ServiceCtx Context)
+        {
+            long Unknown0 = Context.RequestData.ReadInt64();
+            long Unknown8 = Context.RequestData.ReadInt64();
+
+            return 0;
+        }
+
+        public long SetSupportedNpadIdType(ServiceCtx Context)
+        {
+            long Unknown = Context.RequestData.ReadInt64();
+
+            return 0;
+        }
+
+        public long ActivateNpad(ServiceCtx Context)
+        {
+            long Unknown = Context.RequestData.ReadInt64();
+
+            return 0;
+        }
+
+        public long SetNpadJoyHoldType(ServiceCtx Context)
+        {
+            long Unknown0 = Context.RequestData.ReadInt64();
+            long Unknown8 = Context.RequestData.ReadInt64();
+
+            return 0;
+        }
+
+        public long GetNpadJoyHoldType(ServiceCtx Context)
+        {
+            Context.ResponseData.Write(0L);
+
+            return 0;
+        }
+
+        public long CreateActiveVibrationDeviceList(ServiceCtx Context)
+        {
+            MakeObject(Context, new IActiveApplicationDeviceList());
+
+            return 0;
+        }
+    }
+}

+ 2 - 2
Ryujinx.Core/OsHle/Objects/IIpcInterface.cs → Ryujinx.Core/OsHle/IpcServices/IIpcService.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects
+namespace Ryujinx.Core.OsHle.IpcServices
 {
-    interface IIpcInterface
+    interface IIpcService
     {
         IReadOnlyDictionary<int, ServiceProcessRequest> Commands { get; } 
     }

+ 27 - 0
Ryujinx.Core/OsHle/IpcServices/Lm/ServiceLm.cs

@@ -0,0 +1,27 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Lm
+{
+    class ServiceLm : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceLm()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 0, Initialize }
+            };
+        }
+
+        public long Initialize(ServiceCtx Context)
+        {
+            Context.Session.Initialize();
+
+            return 0;
+        }
+    }
+}

+ 29 - 12
Ryujinx.Core/OsHle/Services/ServiceNvDrv.cs → Ryujinx.Core/OsHle/IpcServices/NvServices/ServiceNvDrv.cs

@@ -6,14 +6,14 @@ using Ryujinx.Graphics.Gpu;
 using System;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Services
+namespace Ryujinx.Core.OsHle.IpcServices.NvServices
 {
-    static partial class Service
+    class ServiceNvDrv : IIpcService
     {
-        private delegate long ServiceProcessRequest(ServiceCtx Context);
+        private delegate long ServiceProcessIoctl(ServiceCtx Context);
 
-        private static Dictionary<(string, int), ServiceProcessRequest> IoctlCmds =
-                   new Dictionary<(string, int), ServiceProcessRequest>()
+        private static Dictionary<(string, int), ServiceProcessIoctl> IoctlCmds =
+                   new Dictionary<(string, int), ServiceProcessIoctl>()
         {
             { ("/dev/nvhost-as-gpu",   0x4101), NvGpuAsIoctlBindChannel           },
             { ("/dev/nvhost-as-gpu",   0x4102), NvGpuAsIoctlAllocSpace            },
@@ -42,7 +42,24 @@ namespace Ryujinx.Core.OsHle.Services
             { ("/dev/nvmap",           0x010e), NvMapIocGetId                     },
         };
 
-        public static long NvDrvOpen(ServiceCtx Context)
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceNvDrv()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 0, Open         },
+                { 1, Ioctl        },
+                { 2, Close        },
+                { 3, Initialize   },
+                { 4, QueryEvent   },
+                { 8, SetClientPid },
+            };
+        }
+
+        public static long Open(ServiceCtx Context)
         {
             long NamePtr = Context.Request.SendBuff[0].Position;
 
@@ -56,7 +73,7 @@ namespace Ryujinx.Core.OsHle.Services
             return 0;
         }
 
-        public static long NvDrvIoctl(ServiceCtx Context)
+        public static long Ioctl(ServiceCtx Context)
         {
             int Fd  = Context.RequestData.ReadInt32();
             int Cmd = Context.RequestData.ReadInt32() & 0xffff;
@@ -67,7 +84,7 @@ namespace Ryujinx.Core.OsHle.Services
 
             Context.ResponseData.Write(0);
 
-            if (IoctlCmds.TryGetValue((FdData.Name, Cmd), out ServiceProcessRequest ProcReq))
+            if (IoctlCmds.TryGetValue((FdData.Name, Cmd), out ServiceProcessIoctl ProcReq))
             {
                 return ProcReq(Context);
             }
@@ -77,7 +94,7 @@ namespace Ryujinx.Core.OsHle.Services
             }
         }
 
-        public static long NvDrvClose(ServiceCtx Context)
+        public static long Close(ServiceCtx Context)
         {
             int Fd = Context.RequestData.ReadInt32();
 
@@ -88,7 +105,7 @@ namespace Ryujinx.Core.OsHle.Services
             return 0;
         }
 
-        public static long NvDrvInitialize(ServiceCtx Context)
+        public static long Initialize(ServiceCtx Context)
         {
             long TransferMemSize   = Context.RequestData.ReadInt64();
             int  TransferMemHandle = Context.Request.HandleDesc.ToCopy[0];
@@ -98,7 +115,7 @@ namespace Ryujinx.Core.OsHle.Services
             return 0;
         }
 
-        public static long NvDrvQueryEvent(ServiceCtx Context)
+        public static long QueryEvent(ServiceCtx Context)
         {
             int Fd      = Context.RequestData.ReadInt32();
             int EventId = Context.RequestData.ReadInt32();
@@ -110,7 +127,7 @@ namespace Ryujinx.Core.OsHle.Services
             return 0;
         }
 
-        public static long NvDrvSetClientPid(ServiceCtx Context)
+        public static long SetClientPid(ServiceCtx Context)
         {
             long Pid = Context.RequestData.ReadInt64();
 

+ 1 - 1
Ryujinx.Core/OsHle/Objects/ObjHelper.cs → Ryujinx.Core/OsHle/IpcServices/ObjHelper.cs

@@ -1,7 +1,7 @@
 using Ryujinx.Core.OsHle.Handles;
 using Ryujinx.Core.OsHle.Ipc;
 
-namespace Ryujinx.Core.OsHle.Objects
+namespace Ryujinx.Core.OsHle.IpcServices
 {
     static class ObjHelper
     {

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Am/IParentalControlService.cs → Ryujinx.Core/OsHle/IpcServices/Pctl/IParentalControlService.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Am
+namespace Ryujinx.Core.OsHle.IpcServices.Pctl
 {
-    class IParentalControlService : IIpcInterface
+    class IParentalControlService : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 29 - 0
Ryujinx.Core/OsHle/IpcServices/Pctl/ServicePctl.cs

@@ -0,0 +1,29 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Pctl
+{
+    class ServicePctl : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServicePctl()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 0, CreateService }
+            };
+        }
+
+        public static long CreateService(ServiceCtx Context)
+        {
+            MakeObject(Context, new IParentalControlService());
+
+            return 0;
+        }
+    }
+}

+ 51 - 0
Ryujinx.Core/OsHle/IpcServices/Pl/ServicePl.cs

@@ -0,0 +1,51 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Pl
+{
+    class ServicePl : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServicePl()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 1, GetLoadState                 },
+                { 2, GetFontSize                  },
+                { 3, GetSharedMemoryAddressOffset },
+                { 4, GetSharedMemoryNativeHandle  }
+            };
+        }
+
+        public static long GetLoadState(ServiceCtx Context)
+        {
+            Context.ResponseData.Write(1); //Loaded
+
+            return 0;
+        }
+
+        public static long GetFontSize(ServiceCtx Context)
+        {
+            Context.ResponseData.Write(Horizon.FontSize);
+
+            return 0;
+        }
+
+        public static long GetSharedMemoryAddressOffset(ServiceCtx Context)
+        {
+            Context.ResponseData.Write(0);
+
+            return 0;
+        }
+
+        public static long GetSharedMemoryNativeHandle(ServiceCtx Context)
+        {
+            Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Context.Ns.Os.FontHandle);
+
+            return 0;
+        }
+    }
+}

+ 50 - 0
Ryujinx.Core/OsHle/IpcServices/ServiceFactory.cs

@@ -0,0 +1,50 @@
+using Ryujinx.Core.OsHle.IpcServices.Acc;
+using Ryujinx.Core.OsHle.IpcServices.Am;
+using Ryujinx.Core.OsHle.IpcServices.Apm;
+using Ryujinx.Core.OsHle.IpcServices.Aud;
+using Ryujinx.Core.OsHle.IpcServices.Friend;
+using Ryujinx.Core.OsHle.IpcServices.FspSrv;
+using Ryujinx.Core.OsHle.IpcServices.Hid;
+using Ryujinx.Core.OsHle.IpcServices.Lm;
+using Ryujinx.Core.OsHle.IpcServices.NvServices;
+using Ryujinx.Core.OsHle.IpcServices.Pctl;
+using Ryujinx.Core.OsHle.IpcServices.Pl;
+using Ryujinx.Core.OsHle.IpcServices.Set;
+using Ryujinx.Core.OsHle.IpcServices.Sm;
+using Ryujinx.Core.OsHle.IpcServices.Time;
+using Ryujinx.Core.OsHle.IpcServices.Vi;
+using System;
+
+namespace Ryujinx.Core.OsHle.IpcServices
+{
+    static class ServiceFactory
+    {
+        public static IIpcService MakeService(string Name)
+        {
+            switch (Name)
+            {
+                case "acc:u0":   return new ServiceAcc();
+                case "apm":      return new ServiceApm();
+                case "apm:p":    return new ServiceApm();
+                case "appletOE": return new ServiceAppletOE();
+                case "audout:u": return new ServiceAudOut();
+                case "audren:u": return new ServiceAudRen();
+                case "friend:a": return new ServiceFriend();
+                case "fsp-srv":  return new ServiceFspSrv();
+                case "hid":      return new ServiceHid();
+                case "lm":       return new ServiceLm();
+                case "nvdrv":    return new ServiceNvDrv();
+                case "nvdrv:a":  return new ServiceNvDrv();
+                case "pctl:a":   return new ServicePctl();
+                case "pl:u":     return new ServicePl();
+                case "set":      return new ServiceSet();
+                case "sm:":      return new ServiceSm();
+                case "time:s":   return new ServiceTime();
+                case "time:u":   return new ServiceTime();
+                case "vi:m":     return new ServiceVi();
+            }
+
+            throw new NotImplementedException(Name);
+        }
+    }
+}

+ 17 - 3
Ryujinx.Core/OsHle/Services/ServiceSet.cs → Ryujinx.Core/OsHle/IpcServices/Set/ServiceSet.cs

@@ -1,12 +1,26 @@
 using ChocolArm64.Memory;
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Services
+namespace Ryujinx.Core.OsHle.IpcServices.Set
 {
-    static partial class Service
+    class ServiceSet : IIpcService
     {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceSet()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 1, GetAvailableLanguageCodes }
+            };
+        }
+
         private const int LangCodesCount = 13;
 
-        public static long SetGetAvailableLanguageCodes(ServiceCtx Context)
+        public static long GetAvailableLanguageCodes(ServiceCtx Context)
         {
             int PtrBuffSize = Context.RequestData.ReadInt32();
 

+ 24 - 5
Ryujinx.Core/OsHle/Services/ServiceSm.cs → Ryujinx.Core/OsHle/IpcServices/Sm/ServiceSm.cs

@@ -1,20 +1,34 @@
 using Ryujinx.Core.OsHle.Handles;
 using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Services
+namespace Ryujinx.Core.OsHle.IpcServices.Sm
 {
-    static partial class Service
+    class ServiceSm : IIpcService
     {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceSm()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 0, Initialize },
+                { 1, GetService }
+            };
+        }
+
         private const int SmNotInitialized = 0x415;
 
-        public static long SmInitialize(ServiceCtx Context)
+        public long Initialize(ServiceCtx Context)
         {
             Context.Session.Initialize();
 
             return 0;
         }
 
-        public static long SmGetService(ServiceCtx Context)
+        public long GetService(ServiceCtx Context)
         {
             //Only for kernel version > 3.0.0.
             if (!Context.Session.IsInitialized)
@@ -36,7 +50,12 @@ namespace Ryujinx.Core.OsHle.Services
                 }
             }
 
-            HSession Session = new HSession(Name);
+            if (Name == string.Empty)
+            {
+                return 0;
+            }
+
+            HSession Session = new HSession(ServiceFactory.MakeService(Name));
 
             int Handle = Context.Ns.Os.Handles.GenerateId(Session);
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs → Ryujinx.Core/OsHle/IpcServices/Time/ISteadyClock.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Time
+namespace Ryujinx.Core.OsHle.IpcServices.Time
 {
-    class ISteadyClock : IIpcInterface
+    class ISteadyClock : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs → Ryujinx.Core/OsHle/IpcServices/Time/ISystemClock.cs

@@ -2,9 +2,9 @@ using Ryujinx.Core.OsHle.Ipc;
 using System;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Time
+namespace Ryujinx.Core.OsHle.IpcServices.Time
 {
-    class ISystemClock : IIpcInterface
+    class ISystemClock : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs → Ryujinx.Core/OsHle/IpcServices/Time/ITimeZoneService.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Time
+namespace Ryujinx.Core.OsHle.IpcServices.Time
 {
-    class ITimeZoneService : IIpcInterface
+    class ITimeZoneService : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 62 - 0
Ryujinx.Core/OsHle/IpcServices/Time/ServiceTime.cs

@@ -0,0 +1,62 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Time
+{
+    class ServiceTime : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceTime()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 0, GetStandardUserSystemClock    },
+                { 1, GetStandardNetworkSystemClock },
+                { 2, GetStandardSteadyClock        },
+                { 3, GetTimeZoneService            },
+                { 4, GetStandardLocalSystemClock   }
+            };
+        }
+
+        public long GetStandardUserSystemClock(ServiceCtx Context)
+        {
+            MakeObject(Context, new ISystemClock(SystemClockType.User));
+
+            return 0;
+        }
+
+        public long GetStandardNetworkSystemClock(ServiceCtx Context)
+        {
+            MakeObject(Context, new ISystemClock(SystemClockType.Network));
+
+            return 0;
+        }
+
+        public long GetStandardSteadyClock(ServiceCtx Context)
+        {
+            MakeObject(Context, new ISteadyClock());
+
+            return 0;
+        }
+
+        public long GetTimeZoneService(ServiceCtx Context)
+        {
+            MakeObject(Context, new ITimeZoneService());
+
+            return 0;
+        }
+
+        public long GetStandardLocalSystemClock(ServiceCtx Context)
+        {
+            MakeObject(Context, new ISystemClock(SystemClockType.Local));
+
+            return 0;
+        }
+
+    }
+}

+ 1 - 1
Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs → Ryujinx.Core/OsHle/IpcServices/Time/SystemClockType.cs

@@ -1,4 +1,4 @@
-namespace Ryujinx.Core.OsHle.Objects.Time
+namespace Ryujinx.Core.OsHle.IpcServices.Time
 {
     enum SystemClockType
     {

+ 4 - 4
Ryujinx.Core/OsHle/Objects/Vi/IApplicationDisplayService.cs → Ryujinx.Core/OsHle/IpcServices/Vi/IApplicationDisplayService.cs

@@ -4,12 +4,12 @@ using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 using System.IO;
 
-using static Ryujinx.Core.OsHle.Objects.Android.Parcel;
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
+using static Ryujinx.Core.OsHle.IpcServices.Android.Parcel;
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
 
-namespace Ryujinx.Core.OsHle.Objects.Vi
+namespace Ryujinx.Core.OsHle.IpcServices.Vi
 {
-    class IApplicationDisplayService : IIpcInterface
+    class IApplicationDisplayService : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 3 - 3
Ryujinx.Core/OsHle/Objects/Vi/IHOSBinderDriver.cs → Ryujinx.Core/OsHle/IpcServices/Vi/IHOSBinderDriver.cs

@@ -1,12 +1,12 @@
 using ChocolArm64.Memory;
 using Ryujinx.Core.OsHle.Ipc;
-using Ryujinx.Core.OsHle.Objects.Android;
+using Ryujinx.Core.OsHle.IpcServices.Android;
 using System;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Vi
+namespace Ryujinx.Core.OsHle.IpcServices.Vi
 {
-    class IHOSBinderDriver : IIpcInterface, IDisposable
+    class IHOSBinderDriver : IIpcService, IDisposable
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Vi/IManagerDisplayService.cs → Ryujinx.Core/OsHle/IpcServices/Vi/IManagerDisplayService.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Vi
+namespace Ryujinx.Core.OsHle.IpcServices.Vi
 {
-    class IManagerDisplayService : IIpcInterface
+    class IManagerDisplayService : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 2 - 2
Ryujinx.Core/OsHle/Objects/Vi/ISystemDisplayService.cs → Ryujinx.Core/OsHle/IpcServices/Vi/ISystemDisplayService.cs

@@ -1,9 +1,9 @@
 using Ryujinx.Core.OsHle.Ipc;
 using System.Collections.Generic;
 
-namespace Ryujinx.Core.OsHle.Objects.Vi
+namespace Ryujinx.Core.OsHle.IpcServices.Vi
 {
-    class ISystemDisplayService : IIpcInterface
+    class ISystemDisplayService : IIpcService
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 

+ 31 - 0
Ryujinx.Core/OsHle/IpcServices/Vi/ServiceVi.cs

@@ -0,0 +1,31 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
+
+namespace Ryujinx.Core.OsHle.IpcServices.Vi
+{
+    class ServiceVi : IIpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ServiceVi()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 2, GetDisplayService }
+            };
+        }
+
+        public long GetDisplayService(ServiceCtx Context)
+        {
+            int Unknown = Context.RequestData.ReadInt32();
+
+            MakeObject(Context, new IApplicationDisplayService());
+
+            return 0;
+        }
+    }
+}

+ 0 - 33
Ryujinx.Core/OsHle/Services/ServiceAcc.cs

@@ -1,33 +0,0 @@
-using Ryujinx.Core.OsHle.Objects.Acc;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long AccU0ListOpenUsers(ServiceCtx Context)
-        {
-            return 0;
-        }
-
-        public static long AccU0GetProfile(ServiceCtx Context)
-        {
-            MakeObject(Context, new IProfile());
-
-            return 0;
-        }
-
-        public static long AccU0InitializeApplicationInfo(ServiceCtx Context)
-        {
-            return 0;
-        }
-
-        public static long AccU0GetBaasAccountManagerForApplication(ServiceCtx Context)
-        {
-            MakeObject(Context, new IManagerForApplication());
-
-            return 0;
-        }
-    }
-}

+ 0 - 16
Ryujinx.Core/OsHle/Services/ServiceApm.cs

@@ -1,16 +0,0 @@
-using Ryujinx.Core.OsHle.Objects.Apm;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long ApmOpenSession(ServiceCtx Context)
-        {
-            MakeObject(Context, new ISession());
-
-            return 0;
-        }
-    }
-}

+ 0 - 16
Ryujinx.Core/OsHle/Services/ServiceAppletOE.cs

@@ -1,16 +0,0 @@
-using Ryujinx.Core.OsHle.Objects.Am;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long AppletOpenApplicationProxy(ServiceCtx Context)
-        {
-            MakeObject(Context, new IApplicationProxy());
-
-            return 0;
-        }
-    }
-}

+ 0 - 71
Ryujinx.Core/OsHle/Services/ServiceAud.cs

@@ -1,71 +0,0 @@
-using ChocolArm64.Memory;
-using Ryujinx.Core.OsHle.Objects.Aud;
-using System.Text;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long AudOutListAudioOuts(ServiceCtx Context)
-        {
-            long Position = Context.Request.ReceiveBuff[0].Position;
-
-            AMemoryHelper.WriteBytes(Context.Memory, Position, Encoding.ASCII.GetBytes("iface"));
-
-            Context.ResponseData.Write(1);
-
-            return 0;
-        }
-
-        public static long AudOutOpenAudioOut(ServiceCtx Context)
-        {
-            MakeObject(Context, new IAudioOut());
-
-            Context.ResponseData.Write(48000); //Sample Rate
-            Context.ResponseData.Write(2); //Channel Count
-            Context.ResponseData.Write(2); //PCM Format
-            /*  
-                0 - Invalid
-                1 - INT8
-                2 - INT16
-                3 - INT24
-                4 - INT32
-                5 - PCM Float
-                6 - ADPCM
-            */
-            Context.ResponseData.Write(0); //Unknown
-
-            return 0;
-        }
-
-        public static long AudRenOpenAudioRenderer(ServiceCtx Context)
-        {
-            MakeObject(Context, new IAudioRenderer());
-
-            return 0;
-        }
-
-        public static long AudRenGetAudioRendererWorkBufferSize(ServiceCtx Context)
-        {
-            int SampleRate = Context.RequestData.ReadInt32();
-            int Unknown4   = Context.RequestData.ReadInt32();
-            int Unknown8   = Context.RequestData.ReadInt32();
-            int UnknownC   = Context.RequestData.ReadInt32();
-            int Unknown10  = Context.RequestData.ReadInt32();
-            int Unknown14  = Context.RequestData.ReadInt32();
-            int Unknown18  = Context.RequestData.ReadInt32();
-            int Unknown1c  = Context.RequestData.ReadInt32();
-            int Unknown20  = Context.RequestData.ReadInt32();
-            int Unknown24  = Context.RequestData.ReadInt32();
-            int Unknown28  = Context.RequestData.ReadInt32();
-            int Unknown2c  = Context.RequestData.ReadInt32();
-            int Rev1Magic  = Context.RequestData.ReadInt32();
-
-            Context.ResponseData.Write(0x400L);
-
-            return 0;
-        }
-    }
-}

+ 0 - 16
Ryujinx.Core/OsHle/Services/ServiceFriend.cs

@@ -1,16 +0,0 @@
-using Ryujinx.Core.OsHle.Objects.Friend;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long FriendCreateFriendService(ServiceCtx Context)
-        {
-            MakeObject(Context, new IFriendService());
-
-            return 0;
-        }
-    }
-}

+ 0 - 49
Ryujinx.Core/OsHle/Services/ServiceFspSrv.cs

@@ -1,49 +0,0 @@
-using Ryujinx.Core.OsHle.Objects.FspSrv;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long FspSrvInitialize(ServiceCtx Context)
-        {
-            return 0;
-        }
-
-        public static long FspSrvMountSdCard(ServiceCtx Context)
-        {
-            MakeObject(Context, new IFileSystem(Context.Ns.VFs.GetSdCardPath()));
-
-            return 0;
-        }
-
-        public static long FspSrvMountSaveData(ServiceCtx Context)
-        {
-            MakeObject(Context, new IFileSystem(Context.Ns.VFs.GetGameSavesPath()));
-
-            return 0;
-        }
-
-        public static long FspSrvOpenDataStorageByCurrentProcess(ServiceCtx Context)
-        {
-            MakeObject(Context, new IStorage(Context.Ns.VFs.RomFs));
-
-            return 0;
-        }
-
-        public static long FspSrvOpenRomStorage(ServiceCtx Context)
-        {
-            MakeObject(Context, new IStorage(Context.Ns.VFs.RomFs));
-
-            return 0;
-        }
-
-        public static long FspSrvGetGlobalAccessLogMode(ServiceCtx Context)
-        {
-            Context.ResponseData.Write(0);
-
-            return 0;
-        }        
-    }
-}

+ 0 - 77
Ryujinx.Core/OsHle/Services/ServiceHid.cs

@@ -1,77 +0,0 @@
-using Ryujinx.Core.OsHle.Handles;
-using Ryujinx.Core.OsHle.Objects.Hid;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long HidCreateAppletResource(ServiceCtx Context)
-        {
-            HSharedMem HidHndData = Context.Ns.Os.Handles.GetData<HSharedMem>(Context.Ns.Os.HidHandle);
-
-            MakeObject(Context, new IAppletResource(HidHndData));
-
-            return 0;
-        }
-
-        public static long HidActivateTouchScreen(ServiceCtx Context)
-        {
-            long Unknown = Context.RequestData.ReadInt64();
-
-            return 0;
-        }
-
-        public static long HidGetSupportedNpadStyleSet(ServiceCtx Context)
-        {
-            Context.ResponseData.Write(0);
-
-            return 0;
-        }
-
-        public static long HidSetSupportedNpadStyleSet(ServiceCtx Context)
-        {
-            long Unknown0 = Context.RequestData.ReadInt64();
-            long Unknown8 = Context.RequestData.ReadInt64();
-
-            return 0;
-        }
-
-        public static long HidSetSupportedNpadIdType(ServiceCtx Context)
-        {
-            long Unknown = Context.RequestData.ReadInt64();
-
-            return 0;
-        }
-
-        public static long HidActivateNpad(ServiceCtx Context)
-        {
-            long Unknown = Context.RequestData.ReadInt64();
-
-            return 0;
-        }
-
-        public static long HidSetNpadJoyHoldType(ServiceCtx Context)
-        {
-            long Unknown0 = Context.RequestData.ReadInt64();
-            long Unknown8 = Context.RequestData.ReadInt64();
-
-            return 0;
-        }
-
-        public static long HidGetNpadJoyHoldType(ServiceCtx Context)
-        {
-            Context.ResponseData.Write(0L);
-
-            return 0;
-        }
-
-        public static long HidCreateActiveVibrationDeviceList(ServiceCtx Context)
-        {
-            MakeObject(Context, new IActiveApplicationDeviceList());
-
-            return 0;
-        }
-    }
-}

+ 0 - 12
Ryujinx.Core/OsHle/Services/ServiceLm.cs

@@ -1,12 +0,0 @@
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long LmInitialize(ServiceCtx Context)
-        {
-            Context.Session.Initialize();
-
-            return 0;
-        }
-    }
-}

+ 0 - 16
Ryujinx.Core/OsHle/Services/ServicePctl.cs

@@ -1,16 +0,0 @@
-using Ryujinx.Core.OsHle.Objects.Am;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long PctlCreateService(ServiceCtx Context)
-        {
-            MakeObject(Context, new IParentalControlService());
-
-            return 0;
-        }
-    }
-}

+ 0 - 35
Ryujinx.Core/OsHle/Services/ServicePl.cs

@@ -1,35 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long PlGetLoadState(ServiceCtx Context)
-        {
-            Context.ResponseData.Write(1); //Loaded
-
-            return 0;
-        }
-
-        public static long PlGetFontSize(ServiceCtx Context)
-        {
-            Context.ResponseData.Write(Horizon.FontSize);
-
-            return 0;
-        }
-
-        public static long PlGetSharedMemoryAddressOffset(ServiceCtx Context)
-        {
-            Context.ResponseData.Write(0);
-
-            return 0;
-        }
-
-        public static long PlGetSharedMemoryNativeHandle(ServiceCtx Context)
-        {
-            Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Context.Ns.Os.FontHandle);
-
-            return 0;
-        }
-    }
-}

+ 0 - 45
Ryujinx.Core/OsHle/Services/ServiceTime.cs

@@ -1,45 +0,0 @@
-using Ryujinx.Core.OsHle.Objects.Time;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long TimeGetStandardUserSystemClock(ServiceCtx Context)
-        {
-            MakeObject(Context, new ISystemClock(SystemClockType.User));
-
-            return 0;
-        }
-
-        public static long TimeGetStandardNetworkSystemClock(ServiceCtx Context)
-        {
-            MakeObject(Context, new ISystemClock(SystemClockType.Network));
-
-            return 0;
-        }
-
-        public static long TimeGetStandardSteadyClock(ServiceCtx Context)
-        {
-            MakeObject(Context, new ISteadyClock());
-
-            return 0;
-        }
-
-        public static long TimeGetTimeZoneService(ServiceCtx Context)
-        {
-            MakeObject(Context, new ITimeZoneService());
-
-            return 0;
-        }
-
-        public static long TimeGetStandardLocalSystemClock(ServiceCtx Context)
-        {
-            MakeObject(Context, new ISystemClock(SystemClockType.Local));
-
-            return 0;
-        }
-
-    }
-}

+ 0 - 18
Ryujinx.Core/OsHle/Services/ServiceVi.cs

@@ -1,18 +0,0 @@
-using Ryujinx.Core.OsHle.Objects.Vi;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Services
-{
-    static partial class Service
-    {
-        public static long ViGetDisplayService(ServiceCtx Context)
-        {
-            int Unknown = Context.RequestData.ReadInt32();
-
-            MakeObject(Context, new IApplicationDisplayService());
-
-            return 0;
-        }
-    }
-}

+ 2 - 1
Ryujinx.Core/OsHle/Svc/SvcSystem.cs

@@ -3,6 +3,7 @@ using ChocolArm64.State;
 using Ryujinx.Core.OsHle.Exceptions;
 using Ryujinx.Core.OsHle.Handles;
 using Ryujinx.Core.OsHle.Ipc;
+using Ryujinx.Core.OsHle.IpcServices;
 using System;
 using System.Threading;
 
@@ -61,7 +62,7 @@ namespace Ryujinx.Core.OsHle.Svc
             //TODO: Validate that app has perms to access the service, and that the service
             //actually exists, return error codes otherwise.
 
-            HSession Session = new HSession(Name);
+            HSession Session = new HSession(ServiceFactory.MakeService(Name));
 
             ThreadState.X1 = (ulong)Ns.Os.Handles.GenerateId(Session);
             ThreadState.X0 = (int)SvcResult.Success;