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

Update am service (#98)

* am services implementations

Implement:
- IAllSystemAppletProxiesService
- IApplicationCreator
- IGlobalStateController
- IHomeMenuFunctions
  * RequestToGetForeground stub.
  * GetPopFromGeneralChannelEvent stub event.
- ISystemAppletProxy
  * GetCommonStateGetter
  * GetSelfController
  * GetWindowController
  * GetAudioController
  * GetDisplayController
  * GetLibraryAppletCreator
  * GetHomeMenuFunctions
  * GetGlobalStateController
  * GetApplicationCreator
  * GetDebugFunctions

* Update ServiceFactory.cs

* Update IHomeMenuFunctions.cs

* Update IHomeMenuFunctions.cs

* Update ServiceFactory.cs
Ac_K 8 лет назад
Родитель
Сommit
434e40b8a0

+ 27 - 0
Ryujinx.Core/OsHle/Services/Am/IAllSystemAppletProxiesService.cs

@@ -0,0 +1,27 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+namespace Ryujinx.Core.OsHle.Services.Am
+{
+    class IAllSystemAppletProxiesService : IpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public IAllSystemAppletProxiesService()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 100, OpenSystemAppletProxy }
+            };
+        }
+
+        public long OpenSystemAppletProxy(ServiceCtx Context)
+        {
+            MakeObject(Context, new ISystemAppletProxy());
+
+            return 0;
+        }
+    }
+}

+ 20 - 0
Ryujinx.Core/OsHle/Services/Am/IApplicationCreator.cs

@@ -0,0 +1,20 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+namespace Ryujinx.Core.OsHle.Services.Am
+{
+    class IApplicationCreator : IpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public IApplicationCreator()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                //...
+            };
+        }
+    }
+}

+ 20 - 0
Ryujinx.Core/OsHle/Services/Am/IGlobalStateController.cs

@@ -0,0 +1,20 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+namespace Ryujinx.Core.OsHle.Services.Am
+{
+    class IGlobalStateController : IpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public IGlobalStateController()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                //...
+            };
+        }
+    }
+}

+ 45 - 0
Ryujinx.Core/OsHle/Services/Am/IHomeMenuFunctions.cs

@@ -0,0 +1,45 @@
+using Ryujinx.Core.OsHle.Handles;
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+namespace Ryujinx.Core.OsHle.Services.Am
+{
+    class IHomeMenuFunctions : IpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        private KEvent ChannelEvent;
+
+        public IHomeMenuFunctions()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                { 10, RequestToGetForeground        },
+                { 21, GetPopFromGeneralChannelEvent }
+            };
+
+            //ToDo: Signal this Event somewhere in future.
+            ChannelEvent = new KEvent();
+        }
+
+        public long RequestToGetForeground(ServiceCtx Context)
+        {
+            Logging.Stub(LogClass.ServiceAm, "Stubbed");
+
+            return 0;
+        }
+
+        public long GetPopFromGeneralChannelEvent(ServiceCtx Context)
+        {
+            int Handle = Context.Process.HandleTable.OpenHandle(ChannelEvent);
+
+            Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
+
+            Logging.Stub(LogClass.ServiceAm, "Stubbed");
+
+            return 0;
+        }
+    }
+}

+ 99 - 0
Ryujinx.Core/OsHle/Services/Am/ISystemAppletProxy.cs

@@ -0,0 +1,99 @@
+using Ryujinx.Core.OsHle.Ipc;
+using System.Collections.Generic;
+
+namespace Ryujinx.Core.OsHle.Services.Am
+{
+    class ISystemAppletProxy : IpcService
+    {
+        private Dictionary<int, ServiceProcessRequest> m_Commands;
+
+        public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+        public ISystemAppletProxy()
+        {
+            m_Commands = new Dictionary<int, ServiceProcessRequest>()
+            {
+                {    0, GetCommonStateGetter     },
+                {    1, GetSelfController        },
+                {    2, GetWindowController      },
+                {    3, GetAudioController       },
+                {    4, GetDisplayController     },
+                {   11, GetLibraryAppletCreator  },
+                {   20, GetHomeMenuFunctions     },
+                {   21, GetGlobalStateController },
+                {   22, GetApplicationCreator    },
+                { 1000, GetDebugFunctions        }
+            };
+        }
+
+        public long GetCommonStateGetter(ServiceCtx Context)
+        {
+            MakeObject(Context, new ICommonStateGetter());
+
+            return 0;
+        }
+
+        public long GetSelfController(ServiceCtx Context)
+        {
+            MakeObject(Context, new ISelfController());
+
+            return 0;
+        }
+
+        public long GetWindowController(ServiceCtx Context)
+        {
+            MakeObject(Context, new IWindowController());
+
+            return 0;
+        }
+
+        public long GetAudioController(ServiceCtx Context)
+        {
+            MakeObject(Context, new IAudioController());
+
+            return 0;
+        }
+
+        public long GetDisplayController(ServiceCtx Context)
+        {
+            MakeObject(Context, new IDisplayController());
+
+            return 0;
+        }
+
+        public long GetLibraryAppletCreator(ServiceCtx Context)
+        {
+            MakeObject(Context, new ILibraryAppletCreator());
+
+            return 0;
+        }
+
+        public long GetHomeMenuFunctions(ServiceCtx Context)
+        {
+            MakeObject(Context, new IHomeMenuFunctions());
+
+            return 0;
+        }
+
+        public long GetGlobalStateController(ServiceCtx Context)
+        {
+            MakeObject(Context, new IGlobalStateController());
+
+            return 0;
+        }
+
+        public long GetApplicationCreator(ServiceCtx Context)
+        {
+            MakeObject(Context, new IApplicationCreator());
+
+            return 0;
+        }
+
+        public long GetDebugFunctions(ServiceCtx Context)
+        {
+            MakeObject(Context, new IDebugFunctions());
+
+            return 0;
+        }
+    }
+}

+ 4 - 1
Ryujinx.Core/OsHle/Services/ServiceFactory.cs

@@ -38,6 +38,9 @@ namespace Ryujinx.Core.OsHle.Services
                 case "apm:p":
                     return new IManager();
 
+                case "appletAE":
+                    return new IAllSystemAppletProxiesService();
+                    
                 case "appletOE":
                     return new IApplicationProxyService();
 
@@ -114,4 +117,4 @@ namespace Ryujinx.Core.OsHle.Services
             throw new NotImplementedException(Name);
         }
     }
-}
+}