Просмотр исходного кода

Rename services with the official interface names

gdkchan 8 лет назад
Родитель
Сommit
69e32e5bbc
29 измененных файлов с 236 добавлено и 196 удалено
  1. 4 4
      Ryujinx.Core/OsHle/Process.cs
  2. 2 2
      Ryujinx.Core/OsHle/Services/Acc/IAccountServiceForApplication.cs
  3. 2 2
      Ryujinx.Core/OsHle/Services/Am/IApplicationProxyService.cs
  4. 2 2
      Ryujinx.Core/OsHle/Services/Apm/IManager.cs
  5. 2 2
      Ryujinx.Core/OsHle/Services/Aud/IAudioDeviceService.cs
  6. 1 1
      Ryujinx.Core/OsHle/Services/Aud/IAudioRendererManager.cs
  7. 8 0
      Ryujinx.Core/OsHle/Services/Bsd/BsdError.cs
  8. 18 0
      Ryujinx.Core/OsHle/Services/Bsd/BsdSocket.cs
  9. 69 109
      Ryujinx.Core/OsHle/Services/Bsd/IClient.cs
  10. 2 2
      Ryujinx.Core/OsHle/Services/Friend/IServiceCreator.cs
  11. 3 3
      Ryujinx.Core/OsHle/Services/FspSrv/IFileSystemProxy.cs
  12. 2 2
      Ryujinx.Core/OsHle/Services/Hid/IHidServer.cs
  13. 2 2
      Ryujinx.Core/OsHle/Services/Lm/ILogService.cs
  14. 2 2
      Ryujinx.Core/OsHle/Services/Nifm/IStaticService.cs
  15. 2 2
      Ryujinx.Core/OsHle/Services/Ns/IAddOnContentManager.cs
  16. 3 3
      Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs
  17. 2 2
      Ryujinx.Core/OsHle/Services/Pctl/IParentalControlServiceFactory.cs
  18. 2 2
      Ryujinx.Core/OsHle/Services/Pl/ISharedFontManager.cs
  19. 26 28
      Ryujinx.Core/OsHle/Services/ServiceFactory.cs
  20. 2 2
      Ryujinx.Core/OsHle/Services/Set/ISettingsServer.cs
  21. 3 3
      Ryujinx.Core/OsHle/Services/Set/ISystemSettingsServer.cs
  22. 3 3
      Ryujinx.Core/OsHle/Services/Sfdnsres/IResolver.cs
  23. 2 2
      Ryujinx.Core/OsHle/Services/Sm/IUserInterface.cs
  24. 3 3
      Ryujinx.Core/OsHle/Services/Ssl/ISslService.cs
  25. 2 2
      Ryujinx.Core/OsHle/Services/Time/IStaticService.cs
  26. 29 0
      Ryujinx.Core/OsHle/Services/Vi/IApplicationRootService.cs
  27. 2 4
      Ryujinx.Core/OsHle/Services/Vi/IManagerRootService.cs
  28. 29 0
      Ryujinx.Core/OsHle/Services/Vi/ISystemRootService.cs
  29. 7 7
      Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs

+ 4 - 4
Ryujinx.Core/OsHle/Process.cs

@@ -354,11 +354,11 @@ namespace Ryujinx.Core.OsHle
                     }
                     }
                 }
                 }
 
 
-                ServiceNvDrv.Fds.DeleteProcess(this);
+                INvDrvServices.Fds.DeleteProcess(this);
 
 
-                ServiceNvDrv.NvMaps    .DeleteProcess(this);
-                ServiceNvDrv.NvMapsById.DeleteProcess(this);
-                ServiceNvDrv.NvMapsFb  .DeleteProcess(this);
+                INvDrvServices.NvMaps    .DeleteProcess(this);
+                INvDrvServices.NvMapsById.DeleteProcess(this);
+                INvDrvServices.NvMapsFb  .DeleteProcess(this);
 
 
                 Scheduler.Dispose();
                 Scheduler.Dispose();
 
 

+ 2 - 2
Ryujinx.Core/OsHle/Services/Acc/ServiceAcc.cs → Ryujinx.Core/OsHle/Services/Acc/IAccountServiceForApplication.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Acc
 namespace Ryujinx.Core.OsHle.Services.Acc
 {
 {
-    class ServiceAcc : IpcService
+    class IAccountServiceForApplication : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceAcc()
+        public IAccountServiceForApplication()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 2 - 2
Ryujinx.Core/OsHle/Services/Am/ServiceAppletOE.cs → Ryujinx.Core/OsHle/Services/Am/IApplicationProxyService.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Am
 namespace Ryujinx.Core.OsHle.Services.Am
 {
 {
-    class ServiceAppletOE : IpcService
+    class IApplicationProxyService : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceAppletOE()
+        public IApplicationProxyService()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 2 - 2
Ryujinx.Core/OsHle/Services/Apm/ServiceApm.cs → Ryujinx.Core/OsHle/Services/Apm/IManager.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Apm
 namespace Ryujinx.Core.OsHle.Services.Apm
 {
 {
-    class ServiceApm : IpcService
+    class IManager : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceApm()
+        public IManager()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 2 - 2
Ryujinx.Core/OsHle/Services/Aud/IAudioDevice.cs → Ryujinx.Core/OsHle/Services/Aud/IAudioDeviceService.cs

@@ -5,13 +5,13 @@ using System.Text;
 
 
 namespace Ryujinx.Core.OsHle.Services.Aud
 namespace Ryujinx.Core.OsHle.Services.Aud
 {
 {
-    class IAudioDevice : IpcService
+    class IAudioDeviceService : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public IAudioDevice()
+        public IAudioDeviceService()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 1 - 1
Ryujinx.Core/OsHle/Services/Aud/IAudioRendererManager.cs

@@ -51,7 +51,7 @@ namespace Ryujinx.Core.OsHle.Services.Aud
         {
         {
             long UserId = Context.RequestData.ReadInt64();
             long UserId = Context.RequestData.ReadInt64();
 
 
-            MakeObject(Context, new IAudioDevice());
+            MakeObject(Context, new IAudioDeviceService());
 
 
             return 0;
             return 0;
         }
         }

+ 8 - 0
Ryujinx.Core/OsHle/Services/Bsd/BsdError.cs

@@ -0,0 +1,8 @@
+namespace Ryujinx.Core.OsHle.Services.Bsd
+{
+    //bsd_errno == (SocketException.ErrorCode - 10000)
+    public enum BsdError
+    {
+        Timeout = 60
+    }
+}

+ 18 - 0
Ryujinx.Core/OsHle/Services/Bsd/BsdSocket.cs

@@ -0,0 +1,18 @@
+using System.Net;
+using System.Net.Sockets;
+
+namespace Ryujinx.Core.OsHle.Services.Bsd
+{
+    class BsdSocket
+    {
+        public int Family;
+        public int Type;
+        public int Protocol;
+
+        public IPAddress IpAddress;
+
+        public IPEndPoint RemoteEP;
+
+        public Socket Handle;
+    }
+}

+ 69 - 109
Ryujinx.Core/OsHle/Services/Bsd/ServiceBsd.cs → Ryujinx.Core/OsHle/Services/Bsd/IClient.cs

@@ -1,7 +1,6 @@
 using ChocolArm64.Memory;
 using ChocolArm64.Memory;
 using Ryujinx.Core.OsHle.Ipc;
 using Ryujinx.Core.OsHle.Ipc;
 using Ryujinx.Core.OsHle.Utilities;
 using Ryujinx.Core.OsHle.Utilities;
-using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.IO;
 using System.IO;
 using System.Net;
 using System.Net;
@@ -10,56 +9,15 @@ using System.Threading.Tasks;
 
 
 namespace Ryujinx.Core.OsHle.Services.Bsd
 namespace Ryujinx.Core.OsHle.Services.Bsd
 {
 {
-
-    //bsd_errno == (SocketException.ErrorCode - 10000)
-    //https://github.com/freebsd/freebsd/blob/master/sys/sys/errno.h
-    public enum BsdError
-    {
-        ENOTSOCK        = 38, /* Socket operation on non-socket */
-        EDESTADDRREQ    = 39, /* Destination address required */
-        EMSGSIZE        = 40, /* Message too long */
-        EPROTOTYPE      = 41, /* Protocol wrong type for socket */
-        ENOPROTOOPT     = 42, /* Protocol not available */
-        EPROTONOSUPPORT = 43, /* Protocol not supported */
-        ESOCKTNOSUPPORT = 44, /* Socket type not supported */
-        EOPNOTSUPP      = 45, /* Operation not supported */
-        EPFNOSUPPORT    = 46, /* Protocol family not supported */
-        EAFNOSUPPORT    = 47, /* Address family not supported by protocol family */
-        EADDRINUSE      = 48, /* Address already in use */
-        EADDRNOTAVAIL   = 49, /* Can't assign requested address */
-        ENETDOWN        = 50, /* Network is down */
-        ENETUNREACH     = 51, /* Network is unreachable */
-        ENETRESET       = 52, /* Network dropped connection on reset */
-        ECONNABORTED    = 53, /* Software caused connection abort */
-        ECONNRESET      = 54, /* Connection reset by peer */
-        ENOBUFS         = 55, /* No buffer space available */
-        EISCONN         = 56, /* Socket is already connected */
-        ENOTCONN        = 57, /* Socket is not connected */
-        ESHUTDOWN       = 58, /* Can't send after socket shutdown */
-        ETOOMANYREFS    = 59, /* Too many references: can't splice */
-        ETIMEDOUT       = 60, /* Operation timed out */
-        ECONNREFUSED    = 61  /* Connection refused */
-    }
-
-    class SocketBsd
-    {
-        public int Family;
-        public int Type;
-        public int Protocol;
-        public IPAddress IpAddress;
-        public IPEndPoint RemoteEP;
-        public Socket Handle;
-    }
-
-    class ServiceBsd : IpcService
+    class IClient : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        private List<SocketBsd> Sockets = new List<SocketBsd>();
+        private List<BsdSocket> Sockets = new List<BsdSocket>();
 
 
-        public ServiceBsd()
+        public IClient()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {
@@ -95,11 +53,6 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
             } BsdBufferConfig;
             } BsdBufferConfig;
             */
             */
 
 
-            long Pid = Context.RequestData.ReadInt64();
-            long TransferMemorySize = Context.RequestData.ReadInt64();
-
-            // Two other args are unknown!
-
             Context.ResponseData.Write(0);
             Context.ResponseData.Write(0);
 
 
             //Todo: Stub
             //Todo: Stub
@@ -118,18 +71,18 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
         //(u32 domain, u32 type, u32 protocol) -> (i32 ret, u32 bsd_errno)
         //(u32 domain, u32 type, u32 protocol) -> (i32 ret, u32 bsd_errno)
         public long Socket(ServiceCtx Context)
         public long Socket(ServiceCtx Context)
         {
         {
-            SocketBsd NewBSDSocket = new SocketBsd
+            BsdSocket NewBsdSocket = new BsdSocket
             {
             {
                 Family   = Context.RequestData.ReadInt32(),
                 Family   = Context.RequestData.ReadInt32(),
                 Type     = Context.RequestData.ReadInt32(),
                 Type     = Context.RequestData.ReadInt32(),
                 Protocol = Context.RequestData.ReadInt32()
                 Protocol = Context.RequestData.ReadInt32()
             };
             };
 
 
-            Sockets.Add(NewBSDSocket);
+            Sockets.Add(NewBsdSocket);
 
 
-            Sockets[Sockets.Count - 1].Handle = new Socket((AddressFamily)Sockets[Sockets.Count - 1].Family,
-                                                           (SocketType)Sockets[Sockets.Count - 1].Type,
-                                                           (ProtocolType)Sockets[Sockets.Count - 1].Protocol);
+            NewBsdSocket.Handle = new Socket((AddressFamily)NewBsdSocket.Family,
+                                                (SocketType)NewBsdSocket.Type,
+                                              (ProtocolType)NewBsdSocket.Protocol);
 
 
             Context.ResponseData.Write(Sockets.Count - 1);
             Context.ResponseData.Write(Sockets.Count - 1);
             Context.ResponseData.Write(0);
             Context.ResponseData.Write(0);
@@ -149,12 +102,13 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
             //https://github.com/TuxSH/ftpd/blob/switch_pr/source/ftp.c#L1634
             //https://github.com/TuxSH/ftpd/blob/switch_pr/source/ftp.c#L1634
             //https://linux.die.net/man/2/poll
             //https://linux.die.net/man/2/poll
 
 
-            byte[] SentBuffer     = AMemoryHelper.ReadBytes(Context.Memory, 
-                                                            Context.Request.SendBuff[0].Position, 
-                                                            Context.Request.SendBuff[0].Size);
-            int SocketId          = Get32(SentBuffer, 0);
-            short RequestedEvents = (short)Get16(SentBuffer, 4);
-            short ReturnedEvents  = (short)Get16(SentBuffer, 6);
+            byte[] SentBuffer = AMemoryHelper.ReadBytes(Context.Memory,
+                                                        Context.Request.SendBuff[0].Position,
+                                                        Context.Request.SendBuff[0].Size);
+
+            int SocketId        = Get32(SentBuffer, 0);
+            int RequestedEvents = Get16(SentBuffer, 4);
+            int ReturnedEvents  = Get16(SentBuffer, 6);
 
 
             //Todo: Stub - Need to implemented the Type-22 buffer.
             //Todo: Stub - Need to implemented the Type-22 buffer.
 
 
@@ -167,18 +121,20 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
         //(u32 socket, u32 flags) -> (i32 ret, u32 bsd_errno, buffer<i8, 0x22, 0> message)
         //(u32 socket, u32 flags) -> (i32 ret, u32 bsd_errno, buffer<i8, 0x22, 0> message)
         public long Recv(ServiceCtx Context)
         public long Recv(ServiceCtx Context)
         {
         {
+            int SocketId    = Context.RequestData.ReadInt32();
+            int SocketFlags = Context.RequestData.ReadInt32();
+
+            byte[] ReceivedBuffer = new byte[Context.Request.ReceiveBuff[0].Size];
+
             try
             try
             {
             {
-                int SocketId          = Context.RequestData.ReadInt32();
-                int SocketFlags       = Context.RequestData.ReadInt32();
-                byte[] ReceivedBuffer = new byte[Context.Request.ReceiveBuff[0].Size];
-                int ReadedBytes       = Sockets[SocketId].Handle.Receive(ReceivedBuffer);
+                int BytesRead = Sockets[SocketId].Handle.Receive(ReceivedBuffer);
 
 
                 //Logging.Debug("Received Buffer:" + Environment.NewLine + Logging.HexDump(ReceivedBuffer));
                 //Logging.Debug("Received Buffer:" + Environment.NewLine + Logging.HexDump(ReceivedBuffer));
 
 
                 AMemoryHelper.WriteBytes(Context.Memory, Context.Request.ReceiveBuff[0].Position, ReceivedBuffer);
                 AMemoryHelper.WriteBytes(Context.Memory, Context.Request.ReceiveBuff[0].Position, ReceivedBuffer);
 
 
-                Context.ResponseData.Write(ReadedBytes);
+                Context.ResponseData.Write(BytesRead);
                 Context.ResponseData.Write(0);
                 Context.ResponseData.Write(0);
             }
             }
             catch (SocketException Ex)
             catch (SocketException Ex)
@@ -193,15 +149,16 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
         //(u32 socket, u32 flags, buffer<i8, 0x21, 0>) -> (i32 ret, u32 bsd_errno)
         //(u32 socket, u32 flags, buffer<i8, 0x21, 0>) -> (i32 ret, u32 bsd_errno)
         public long Send(ServiceCtx Context)
         public long Send(ServiceCtx Context)
         {
         {
-            int SocketId      = Context.RequestData.ReadInt32();
-            int SocketFlags   = Context.RequestData.ReadInt32();
-            byte[] SentBuffer = AMemoryHelper.ReadBytes(Context.Memory, 
-                                                        Context.Request.SendBuff[0].Position, 
+            int SocketId    = Context.RequestData.ReadInt32();
+            int SocketFlags = Context.RequestData.ReadInt32();
+
+            byte[] SentBuffer = AMemoryHelper.ReadBytes(Context.Memory,
+                                                        Context.Request.SendBuff[0].Position,
                                                         Context.Request.SendBuff[0].Size);
                                                         Context.Request.SendBuff[0].Size);
 
 
             try
             try
             {
             {
-                //Logging.Debug("Sended Buffer:" + Environment.NewLine + Logging.HexDump(SendedBuffer));
+                //Logging.Debug("Sent Buffer:" + Environment.NewLine + Logging.HexDump(SentBuffer));
 
 
                 int BytesSent = Sockets[SocketId].Handle.Send(SentBuffer);
                 int BytesSent = Sockets[SocketId].Handle.Send(SentBuffer);
 
 
@@ -220,13 +177,15 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
         //(u32 socket, u32 flags, buffer<i8, 0x21, 0>, buffer<sockaddr, 0x21, 0>) -> (i32 ret, u32 bsd_errno)
         //(u32 socket, u32 flags, buffer<i8, 0x21, 0>, buffer<sockaddr, 0x21, 0>) -> (i32 ret, u32 bsd_errno)
         public long SendTo(ServiceCtx Context)
         public long SendTo(ServiceCtx Context)
         {
         {
-            int SocketId         = Context.RequestData.ReadInt32();
-            int SocketFlags      = Context.RequestData.ReadInt32();
-            byte[] SentBuffer    = AMemoryHelper.ReadBytes(Context.Memory, 
-                                                           Context.Request.SendBuff[0].Position, 
-                                                           Context.Request.SendBuff[0].Size);
-            byte[] AddressBuffer = AMemoryHelper.ReadBytes(Context.Memory, 
-                                                           Context.Request.SendBuff[1].Position, 
+            int SocketId    = Context.RequestData.ReadInt32();
+            int SocketFlags = Context.RequestData.ReadInt32();
+
+            byte[] SentBuffer = AMemoryHelper.ReadBytes(Context.Memory,
+                                                        Context.Request.SendBuff[0].Position,
+                                                        Context.Request.SendBuff[0].Size);
+
+            byte[] AddressBuffer = AMemoryHelper.ReadBytes(Context.Memory,
+                                                           Context.Request.SendBuff[1].Position,
                                                            Context.Request.SendBuff[1].Size);
                                                            Context.Request.SendBuff[1].Size);
 
 
             if (!Sockets[SocketId].Handle.Connected)
             if (!Sockets[SocketId].Handle.Connected)
@@ -246,7 +205,7 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
 
 
             try
             try
             {
             {
-                //Logging.Debug("Sended Buffer:" + Environment.NewLine + Logging.HexDump(SendedBuffer));
+                //Logging.Debug("Sent Buffer:" + Environment.NewLine + Logging.HexDump(SentBuffer));
 
 
                 int BytesSent = Sockets[SocketId].Handle.Send(SentBuffer);
                 int BytesSent = Sockets[SocketId].Handle.Send(SentBuffer);
 
 
@@ -265,12 +224,13 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
         //(u32 socket) -> (i32 ret, u32 bsd_errno, u32 addrlen, buffer<sockaddr, 0x22, 0> addr)
         //(u32 socket) -> (i32 ret, u32 bsd_errno, u32 addrlen, buffer<sockaddr, 0x22, 0> addr)
         public long Accept(ServiceCtx Context)
         public long Accept(ServiceCtx Context)
         {
         {
-            int SocketId       = Context.RequestData.ReadInt32();
+            int SocketId = Context.RequestData.ReadInt32();
+
             long AddrBufferPtr = Context.Request.ReceiveBuff[0].Position;
             long AddrBufferPtr = Context.Request.ReceiveBuff[0].Position;
 
 
             Socket HandleAccept = null;
             Socket HandleAccept = null;
 
 
-            var TimeOut = Task.Factory.StartNew(() =>
+            Task TimeOut = Task.Factory.StartNew(() =>
             {
             {
                 try
                 try
                 {
                 {
@@ -287,40 +247,38 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
 
 
             if (HandleAccept != null)
             if (HandleAccept != null)
             {
             {
-                SocketBsd NewBSDSocket = new SocketBsd
+                BsdSocket NewBsdSocket = new BsdSocket
                 {
                 {
                     IpAddress = ((IPEndPoint)Sockets[SocketId].Handle.LocalEndPoint).Address,
                     IpAddress = ((IPEndPoint)Sockets[SocketId].Handle.LocalEndPoint).Address,
                     RemoteEP  = ((IPEndPoint)Sockets[SocketId].Handle.LocalEndPoint),
                     RemoteEP  = ((IPEndPoint)Sockets[SocketId].Handle.LocalEndPoint),
                     Handle    = HandleAccept
                     Handle    = HandleAccept
                 };
                 };
 
 
-                Sockets.Add(NewBSDSocket);
+                Sockets.Add(NewBsdSocket);
 
 
                 using (MemoryStream MS = new MemoryStream())
                 using (MemoryStream MS = new MemoryStream())
                 {
                 {
                     BinaryWriter Writer = new BinaryWriter(MS);
                     BinaryWriter Writer = new BinaryWriter(MS);
 
 
                     Writer.Write((byte)0);
                     Writer.Write((byte)0);
-                    Writer.Write((byte)Sockets[Sockets.Count - 1].Handle.AddressFamily);
-                    Writer.Write((Int16)((IPEndPoint)Sockets[Sockets.Count - 1].Handle.LocalEndPoint).Port);
 
 
-                    string[] IpAdress = Sockets[Sockets.Count - 1].IpAddress.ToString().Split('.');
-                    Writer.Write(byte.Parse(IpAdress[0]));
-                    Writer.Write(byte.Parse(IpAdress[1]));
-                    Writer.Write(byte.Parse(IpAdress[2]));
-                    Writer.Write(byte.Parse(IpAdress[3]));
+                    Writer.Write((byte)NewBsdSocket.Handle.AddressFamily);
 
 
-                    AMemoryHelper.WriteBytes(Context.Memory, AddrBufferPtr, MS.ToArray());
+                    Writer.Write((short)((IPEndPoint)NewBsdSocket.Handle.LocalEndPoint).Port);
+
+                    byte[] IpAdress = NewBsdSocket.IpAddress.GetAddressBytes();
+
+                    AMemoryHelper.WriteBytes(Context.Memory, AddrBufferPtr, IpAdress);
 
 
                     Context.ResponseData.Write(Sockets.Count - 1);
                     Context.ResponseData.Write(Sockets.Count - 1);
                     Context.ResponseData.Write(0);
                     Context.ResponseData.Write(0);
-                    Context.ResponseData.Write(MS.Length);
+                    Context.ResponseData.Write(IpAdress.Length);
                 }
                 }
             }
             }
             else
             else
             {
             {
                 Context.ResponseData.Write(-1);
                 Context.ResponseData.Write(-1);
-                Context.ResponseData.Write((int)BsdError.ETIMEDOUT);
+                Context.ResponseData.Write((int)BsdError.Timeout);
             }
             }
 
 
             return 0;
             return 0;
@@ -331,8 +289,8 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
         {
         {
             int SocketId = Context.RequestData.ReadInt32();
             int SocketId = Context.RequestData.ReadInt32();
 
 
-            byte[] AddressBuffer = AMemoryHelper.ReadBytes(Context.Memory, 
-                                                           Context.Request.SendBuff[0].Position, 
+            byte[] AddressBuffer = AMemoryHelper.ReadBytes(Context.Memory,
+                                                           Context.Request.SendBuff[0].Position,
                                                            Context.Request.SendBuff[0].Size);
                                                            Context.Request.SendBuff[0].Size);
 
 
             try
             try
@@ -356,8 +314,8 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
         {
         {
             int SocketId = Context.RequestData.ReadInt32();
             int SocketId = Context.RequestData.ReadInt32();
 
 
-            byte[] AddressBuffer = AMemoryHelper.ReadBytes(Context.Memory, 
-                                                           Context.Request.SendBuff[0].Position, 
+            byte[] AddressBuffer = AMemoryHelper.ReadBytes(Context.Memory,
+                                                           Context.Request.SendBuff[0].Position,
                                                            Context.Request.SendBuff[0].Size);
                                                            Context.Request.SendBuff[0].Size);
 
 
             try
             try
@@ -404,19 +362,20 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
         //(u32 socket, u32 level, u32 option_name, buffer<unknown, 0x21, 0>) -> (i32 ret, u32 bsd_errno)
         //(u32 socket, u32 level, u32 option_name, buffer<unknown, 0x21, 0>) -> (i32 ret, u32 bsd_errno)
         public long SetSockOpt(ServiceCtx Context)
         public long SetSockOpt(ServiceCtx Context)
         {
         {
-            int SocketId         = Context.RequestData.ReadInt32();
-            int SocketLevel      = Context.RequestData.ReadInt32();
-            int SocketOptionName = Context.RequestData.ReadInt32();
+            int SocketId = Context.RequestData.ReadInt32();
 
 
-            byte[] SocketOptionValue = AMemoryHelper.ReadBytes(Context.Memory, 
-                                                               Context.Request.PtrBuff[0].Position, 
+            SocketOptionLevel SocketLevel      = (SocketOptionLevel)Context.RequestData.ReadInt32();
+            SocketOptionName  SocketOptionName =  (SocketOptionName)Context.RequestData.ReadInt32();
+
+            byte[] SocketOptionValue = AMemoryHelper.ReadBytes(Context.Memory,
+                                                               Context.Request.PtrBuff[0].Position,
                                                                Context.Request.PtrBuff[0].Size);
                                                                Context.Request.PtrBuff[0].Size);
 
 
+            int OptionValue = Get32(SocketOptionValue, 0);
+
             try
             try
             {
             {
-                Sockets[SocketId].Handle.SetSocketOption((SocketOptionLevel)SocketLevel, 
-                                                         (SocketOptionName)SocketOptionName,
-                                                         Get32(SocketOptionValue, 0));
+                Sockets[SocketId].Handle.SetSocketOption(SocketLevel, SocketOptionName, OptionValue);
 
 
                 Context.ResponseData.Write(0);
                 Context.ResponseData.Write(0);
                 Context.ResponseData.Write(0);
                 Context.ResponseData.Write(0);
@@ -461,10 +420,11 @@ namespace Ryujinx.Core.OsHle.Services.Bsd
                 int Size   = Reader.ReadByte();
                 int Size   = Reader.ReadByte();
                 int Family = Reader.ReadByte();
                 int Family = Reader.ReadByte();
                 int Port   = EndianSwap.Swap16(Reader.ReadInt16());
                 int Port   = EndianSwap.Swap16(Reader.ReadInt16());
-                string IpAddress = Reader.ReadByte().ToString() +
-                                   "." + Reader.ReadByte().ToString() +
-                                   "." + Reader.ReadByte().ToString() +
-                                   "." + Reader.ReadByte().ToString();
+
+                string IpAddress = Reader.ReadByte().ToString() + "." +
+                                   Reader.ReadByte().ToString() + "." +
+                                   Reader.ReadByte().ToString() + "." +
+                                   Reader.ReadByte().ToString();
 
 
                 Logging.Debug($"Try to connect to {IpAddress}:{Port}");
                 Logging.Debug($"Try to connect to {IpAddress}:{Port}");
 
 

+ 2 - 2
Ryujinx.Core/OsHle/Services/Friend/ServiceFriend.cs → Ryujinx.Core/OsHle/Services/Friend/IServiceCreator.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Friend
 namespace Ryujinx.Core.OsHle.Services.Friend
 {
 {
-    class ServiceFriend : IpcService
+    class IServiceCreator : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceFriend()
+        public IServiceCreator()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 3 - 3
Ryujinx.Core/OsHle/Services/FspSrv/ServiceFspSrv.cs → Ryujinx.Core/OsHle/Services/FspSrv/IFileSystemProxy.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.FspSrv
 namespace Ryujinx.Core.OsHle.Services.FspSrv
 {
 {
-    class ServiceFspSrv : IpcService
+    class IFileSystemProxy : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceFspSrv()
+        public IFileSystemProxy()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {
@@ -60,6 +60,6 @@ namespace Ryujinx.Core.OsHle.Services.FspSrv
             Context.ResponseData.Write(0);
             Context.ResponseData.Write(0);
 
 
             return 0;
             return 0;
-        }        
+        }
     }
     }
 }
 }

+ 2 - 2
Ryujinx.Core/OsHle/Services/Hid/ServiceHid.cs → Ryujinx.Core/OsHle/Services/Hid/IHidServer.cs

@@ -4,13 +4,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Hid
 namespace Ryujinx.Core.OsHle.Services.Hid
 {
 {
-    class ServiceHid : IpcService
+    class IHidServer : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceHid()
+        public IHidServer()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 2 - 2
Ryujinx.Core/OsHle/Services/Lm/ServiceLm.cs → Ryujinx.Core/OsHle/Services/Lm/ILogService.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Lm
 namespace Ryujinx.Core.OsHle.Services.Lm
 {
 {
-    class ServiceLm : IpcService
+    class ILogService : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceLm()
+        public ILogService()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 2 - 2
Ryujinx.Core/OsHle/Services/Nifm/ServiceNifm.cs → Ryujinx.Core/OsHle/Services/Nifm/IStaticService.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Nifm
 namespace Ryujinx.Core.OsHle.Services.Nifm
 {
 {
-    class ServiceNifm : IpcService
+    class IStaticService : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceNifm()
+        public IStaticService()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 2 - 2
Ryujinx.Core/OsHle/Services/Ns/ServiceNs.cs → Ryujinx.Core/OsHle/Services/Ns/IAddOnContentManager.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Ns
 namespace Ryujinx.Core.OsHle.Services.Ns
 {
 {
-    class ServiceNs : IpcService
+    class IAddOnContentManager : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceNs()
+        public IAddOnContentManager()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 3 - 3
Ryujinx.Core/OsHle/Services/Nv/ServiceNvDrv.cs → Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs

@@ -9,7 +9,7 @@ using System.IO;
 
 
 namespace Ryujinx.Core.OsHle.Services.Nv
 namespace Ryujinx.Core.OsHle.Services.Nv
 {
 {
-    class ServiceNvDrv : IpcService, IDisposable
+    class INvDrvServices : IpcService, IDisposable
     {
     {
         private delegate long ServiceProcessIoctl(ServiceCtx Context);
         private delegate long ServiceProcessIoctl(ServiceCtx Context);
 
 
@@ -27,7 +27,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv
 
 
         private KEvent Event;
         private KEvent Event;
 
 
-        public ServiceNvDrv()
+        public INvDrvServices()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {
@@ -74,7 +74,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv
             Event = new KEvent();
             Event = new KEvent();
         }
         }
 
 
-        static ServiceNvDrv()
+        static INvDrvServices()
         {
         {
             Fds = new GlobalStateTable();
             Fds = new GlobalStateTable();
 
 

+ 2 - 2
Ryujinx.Core/OsHle/Services/Pctl/ServicePctl.cs → Ryujinx.Core/OsHle/Services/Pctl/IParentalControlServiceFactory.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Pctl
 namespace Ryujinx.Core.OsHle.Services.Pctl
 {
 {
-    class ServicePctl : IpcService
+    class IParentalControlServiceFactory : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServicePctl()
+        public IParentalControlServiceFactory()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 2 - 2
Ryujinx.Core/OsHle/Services/Pl/ServicePl.cs → Ryujinx.Core/OsHle/Services/Pl/ISharedFontManager.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Pl
 namespace Ryujinx.Core.OsHle.Services.Pl
 {
 {
-    class ServicePl : IpcService
+    class ISharedFontManager : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServicePl()
+        public ISharedFontManager()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 26 - 28
Ryujinx.Core/OsHle/Services/ServiceFactory.cs

@@ -7,7 +7,6 @@ using Ryujinx.Core.OsHle.Services.Friend;
 using Ryujinx.Core.OsHle.Services.FspSrv;
 using Ryujinx.Core.OsHle.Services.FspSrv;
 using Ryujinx.Core.OsHle.Services.Hid;
 using Ryujinx.Core.OsHle.Services.Hid;
 using Ryujinx.Core.OsHle.Services.Lm;
 using Ryujinx.Core.OsHle.Services.Lm;
-using Ryujinx.Core.OsHle.Services.Nifm;
 using Ryujinx.Core.OsHle.Services.Ns;
 using Ryujinx.Core.OsHle.Services.Ns;
 using Ryujinx.Core.OsHle.Services.Nv;
 using Ryujinx.Core.OsHle.Services.Nv;
 using Ryujinx.Core.OsHle.Services.Pctl;
 using Ryujinx.Core.OsHle.Services.Pctl;
@@ -16,7 +15,6 @@ using Ryujinx.Core.OsHle.Services.Set;
 using Ryujinx.Core.OsHle.Services.Sfdnsres;
 using Ryujinx.Core.OsHle.Services.Sfdnsres;
 using Ryujinx.Core.OsHle.Services.Sm;
 using Ryujinx.Core.OsHle.Services.Sm;
 using Ryujinx.Core.OsHle.Services.Ssl;
 using Ryujinx.Core.OsHle.Services.Ssl;
-using Ryujinx.Core.OsHle.Services.Time;
 using Ryujinx.Core.OsHle.Services.Vi;
 using Ryujinx.Core.OsHle.Services.Vi;
 using System;
 using System;
 
 
@@ -29,19 +27,19 @@ namespace Ryujinx.Core.OsHle.Services
             switch (Name)
             switch (Name)
             {
             {
                 case "acc:u0":
                 case "acc:u0":
-                    return new ServiceAcc();
+                    return new IAccountServiceForApplication();
 
 
                 case "aoc:u":
                 case "aoc:u":
-                    return new ServiceNs();
+                    return new IAddOnContentManager();
 
 
                 case "apm":
                 case "apm":
-                    return new ServiceApm();
+                    return new IManager();
 
 
                 case "apm:p":
                 case "apm:p":
-                    return new ServiceApm();
+                    return new IManager();
 
 
                 case "appletOE":
                 case "appletOE":
-                    return new ServiceAppletOE();
+                    return new IApplicationProxyService();
 
 
                 case "audout:u":
                 case "audout:u":
                     return new IAudioOutManager();
                     return new IAudioOutManager();
@@ -50,67 +48,67 @@ namespace Ryujinx.Core.OsHle.Services
                     return new IAudioRendererManager();
                     return new IAudioRendererManager();
 
 
                 case "bsd:s":
                 case "bsd:s":
-                    return new ServiceBsd();
+                    return new IClient();
 
 
                 case "bsd:u":
                 case "bsd:u":
-                    return new ServiceBsd();
+                    return new IClient();
 
 
                 case "friend:a":
                 case "friend:a":
-                    return new ServiceFriend();
+                    return new IServiceCreator();
 
 
                 case "fsp-srv":
                 case "fsp-srv":
-                    return new ServiceFspSrv();
+                    return new IFileSystemProxy();
 
 
                 case "hid":
                 case "hid":
-                    return new ServiceHid();
+                    return new IHidServer();
 
 
                 case "lm":
                 case "lm":
-                    return new ServiceLm();
+                    return new ILogService();
 
 
                 case "nifm:u":
                 case "nifm:u":
-                    return new ServiceNifm();
+                    return new Nifm.IStaticService();
 
 
                 case "nvdrv":
                 case "nvdrv":
-                    return new ServiceNvDrv();
+                    return new INvDrvServices();
 
 
                 case "nvdrv:a":
                 case "nvdrv:a":
-                    return new ServiceNvDrv();
+                    return new INvDrvServices();
 
 
                 case "pctl:a":
                 case "pctl:a":
-                    return new ServicePctl();
+                    return new IParentalControlServiceFactory();
 
 
                 case "pl:u":
                 case "pl:u":
-                    return new ServicePl();
+                    return new ISharedFontManager();
 
 
                 case "set":
                 case "set":
-                    return new ServiceSet();
+                    return new ISettingsServer();
 
 
                 case "set:sys":
                 case "set:sys":
-                    return new ServiceSetSys();
+                    return new ISystemSettingsServer();
 
 
                 case "sfdnsres":
                 case "sfdnsres":
-                    return new ServiceSfdnsres();
+                    return new IResolver();
 
 
                 case "sm:":
                 case "sm:":
-                    return new ServiceSm();
+                    return new IUserInterface();
 
 
                 case "ssl":
                 case "ssl":
-                    return new ServiceSsl();
+                    return new ISslService();
 
 
                 case "time:s":
                 case "time:s":
-                    return new ServiceTime();
+                    return new Time.IStaticService();
 
 
                 case "time:u":
                 case "time:u":
-                    return new ServiceTime();
+                    return new Time.IStaticService();
 
 
                 case "vi:m":
                 case "vi:m":
-                    return new ServiceVi();
+                    return new IManagerRootService();
 
 
                 case "vi:s":
                 case "vi:s":
-                    return new ServiceVi();
+                    return new ISystemRootService();
 
 
                 case "vi:u":
                 case "vi:u":
-                    return new ServiceVi();
+                    return new IApplicationRootService();
             }
             }
 
 
             throw new NotImplementedException(Name);
             throw new NotImplementedException(Name);

+ 2 - 2
Ryujinx.Core/OsHle/Services/Set/ServiceSet.cs → Ryujinx.Core/OsHle/Services/Set/ISettingsServer.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Set
 namespace Ryujinx.Core.OsHle.Services.Set
 {
 {
-    class ServiceSet : IpcService
+    class ISettingsServer : IpcService
     {
     {
         private static string[] LanguageCodes = new string[]
         private static string[] LanguageCodes = new string[]
         {
         {
@@ -30,7 +30,7 @@ namespace Ryujinx.Core.OsHle.Services.Set
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceSet()
+        public ISettingsServer()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 3 - 3
Ryujinx.Core/OsHle/Services/Set/ServiceSetSys.cs → Ryujinx.Core/OsHle/Services/Set/ISystemSettingsServer.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Set
 namespace Ryujinx.Core.OsHle.Services.Set
 {
 {
-    class ServiceSetSys : IpcService
+    class ISystemSettingsServer : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceSetSys()
+        public ISystemSettingsServer()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {
@@ -26,7 +26,7 @@ namespace Ryujinx.Core.OsHle.Services.Set
         }
         }
 
 
         public static long SetColorSetId(ServiceCtx Context)
         public static long SetColorSetId(ServiceCtx Context)
-        {            
+        {
             return 0;
             return 0;
         }
         }
     }
     }

+ 3 - 3
Ryujinx.Core/OsHle/Services/Sfdnsres/ServiceSfdnsres.cs → Ryujinx.Core/OsHle/Services/Sfdnsres/IResolver.cs

@@ -3,17 +3,17 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Sfdnsres
 namespace Ryujinx.Core.OsHle.Services.Sfdnsres
 {
 {
-    class ServiceSfdnsres : IpcService
+    class IResolver : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceSfdnsres()
+        public IResolver()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {
-                //{ 0, Function }
+                //...
             };
             };
         }
         }
     }
     }

+ 2 - 2
Ryujinx.Core/OsHle/Services/Sm/ServiceSm.cs → Ryujinx.Core/OsHle/Services/Sm/IUserInterface.cs

@@ -4,7 +4,7 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Sm
 namespace Ryujinx.Core.OsHle.Services.Sm
 {
 {
-    class ServiceSm : IpcService
+    class IUserInterface : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
@@ -12,7 +12,7 @@ namespace Ryujinx.Core.OsHle.Services.Sm
 
 
         private bool IsInitialized;
         private bool IsInitialized;
 
 
-        public ServiceSm()
+        public IUserInterface()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 3 - 3
Ryujinx.Core/OsHle/Services/Ssl/ServiceSsl.cs → Ryujinx.Core/OsHle/Services/Ssl/ISslService.cs

@@ -3,17 +3,17 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Ssl
 namespace Ryujinx.Core.OsHle.Services.Ssl
 {
 {
-    class ServiceSsl : IpcService
+    class ISslService : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceSsl()
+        public ISslService()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {
-                //{ 0, Function }
+                //...
             };
             };
         }
         }
     }
     }

+ 2 - 2
Ryujinx.Core/OsHle/Services/Time/ServiceTime.cs → Ryujinx.Core/OsHle/Services/Time/IStaticService.cs

@@ -3,13 +3,13 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Time
 namespace Ryujinx.Core.OsHle.Services.Time
 {
 {
-    class ServiceTime : IpcService
+    class IStaticService : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceTime()
+        public IStaticService()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {

+ 29 - 0
Ryujinx.Core/OsHle/Services/Vi/IApplicationRootService.cs

@@ -0,0 +1,29 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+namespace Ryujinx.Core.OsHle.Services.Vi
+{
+    class IApplicationRootService : IpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public IApplicationRootService()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 0, GetDisplayService }
+            };
+        }
+
+        public long GetDisplayService(ServiceCtx Context)
+        {
+            int ServiceType = Context.RequestData.ReadInt32();
+
+            MakeObject(Context, new IApplicationDisplayService());
+
+            return 0;
+        }
+    }
+}

+ 2 - 4
Ryujinx.Core/OsHle/Services/Vi/ServiceVi.cs → Ryujinx.Core/OsHle/Services/Vi/IManagerRootService.cs

@@ -3,18 +3,16 @@ using System.Collections.Generic;
 
 
 namespace Ryujinx.Core.OsHle.Services.Vi
 namespace Ryujinx.Core.OsHle.Services.Vi
 {
 {
-    class ServiceVi : IpcService
+    class IManagerRootService : IpcService
     {
     {
         private Dictionary<int, ServiceProcessRequest> m_Commands;
         private Dictionary<int, ServiceProcessRequest> m_Commands;
 
 
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
         public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
 
 
-        public ServiceVi()
+        public IManagerRootService()
         {
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
             {
-                { 0, GetDisplayService },
-                { 1, GetDisplayService },
                 { 2, GetDisplayService }
                 { 2, GetDisplayService }
             };
             };
         }
         }

+ 29 - 0
Ryujinx.Core/OsHle/Services/Vi/ISystemRootService.cs

@@ -0,0 +1,29 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+namespace Ryujinx.Core.OsHle.Services.Vi
+{
+    class ISystemRootService : IpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ISystemRootService()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 1, GetDisplayService }
+            };
+        }
+
+        public long GetDisplayService(ServiceCtx Context)
+        {
+            int ServiceType = Context.RequestData.ReadInt32();
+
+            MakeObject(Context, new IApplicationDisplayService());
+
+            return 0;
+        }
+    }
+}

+ 7 - 7
Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs

@@ -62,7 +62,7 @@ namespace Ryujinx.Core.OsHle.Services.Android
         private BufferEntry[] BufferQueue;
         private BufferEntry[] BufferQueue;
 
 
         private ManualResetEvent WaitBufferFree;
         private ManualResetEvent WaitBufferFree;
-        
+
         private object RenderQueueLock;
         private object RenderQueueLock;
 
 
         private int RenderQueueCount;
         private int RenderQueueCount;
@@ -85,7 +85,7 @@ namespace Ryujinx.Core.OsHle.Services.Android
                 { ("android.gui.IGraphicBufferProducer", 0xb), GbpDisconnect     },
                 { ("android.gui.IGraphicBufferProducer", 0xb), GbpDisconnect     },
                 { ("android.gui.IGraphicBufferProducer", 0xe), GbpPreallocBuffer }
                 { ("android.gui.IGraphicBufferProducer", 0xe), GbpPreallocBuffer }
             };
             };
-            
+
             this.Renderer     = Renderer;
             this.Renderer     = Renderer;
             this.ReleaseEvent = ReleaseEvent;
             this.ReleaseEvent = ReleaseEvent;
 
 
@@ -139,7 +139,7 @@ namespace Ryujinx.Core.OsHle.Services.Android
             using (MemoryStream MS = new MemoryStream())
             using (MemoryStream MS = new MemoryStream())
             {
             {
                 BinaryWriter Writer = new BinaryWriter(MS);
                 BinaryWriter Writer = new BinaryWriter(MS);
-                
+
                 BufferEntry Entry = BufferQueue[Slot];
                 BufferEntry Entry = BufferQueue[Slot];
 
 
                 int  BufferCount = 1; //?
                 int  BufferCount = 1; //?
@@ -243,7 +243,7 @@ namespace Ryujinx.Core.OsHle.Services.Android
         private long GbpPreallocBuffer(ServiceCtx Context, BinaryReader ParcelReader)
         private long GbpPreallocBuffer(ServiceCtx Context, BinaryReader ParcelReader)
         {
         {
             int Slot = ParcelReader.ReadInt32();
             int Slot = ParcelReader.ReadInt32();
-            
+
             int  BufferCount = ParcelReader.ReadInt32();
             int  BufferCount = ParcelReader.ReadInt32();
             long BufferSize  = ParcelReader.ReadInt64();
             long BufferSize  = ParcelReader.ReadInt64();
 
 
@@ -290,10 +290,10 @@ namespace Ryujinx.Core.OsHle.Services.Android
 
 
             NvMap Map = GetNvMap(Context, Slot);
             NvMap Map = GetNvMap(Context, Slot);
 
 
-            NvMapFb MapFb = (NvMapFb)ServiceNvDrv.NvMapsFb.GetData(Context.Process, 0);
+            NvMapFb MapFb = (NvMapFb)INvDrvServices.NvMapsFb.GetData(Context.Process, 0);
 
 
             long Address = Map.CpuAddress;
             long Address = Map.CpuAddress;
-            
+
             if (MapFb.HasBufferOffset(Slot))
             if (MapFb.HasBufferOffset(Slot))
             {
             {
                 Address += MapFb.GetBufferOffset(Slot);
                 Address += MapFb.GetBufferOffset(Slot);
@@ -413,7 +413,7 @@ namespace Ryujinx.Core.OsHle.Services.Android
                 NvMapHandle = BitConverter.ToInt32(RawValue, 0);
                 NvMapHandle = BitConverter.ToInt32(RawValue, 0);
             }
             }
 
 
-            return ServiceNvDrv.NvMaps.GetData<NvMap>(Context.Process, NvMapHandle);
+            return INvDrvServices.NvMaps.GetData<NvMap>(Context.Process, NvMapHandle);
         }
         }
 
 
         private int GetFreeSlotBlocking(int Width, int Height)
         private int GetFreeSlotBlocking(int Width, int Height)