From 434e40b8a07a2a350d72581e41e313213ee25663 Mon Sep 17 00:00:00 2001 From: Ac_K Date: Sat, 21 Apr 2018 19:30:06 +0000 Subject: [PATCH] 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 --- .../Am/IAllSystemAppletProxiesService.cs | 27 +++++ .../OsHle/Services/Am/IApplicationCreator.cs | 20 ++++ .../Services/Am/IGlobalStateController.cs | 20 ++++ .../OsHle/Services/Am/IHomeMenuFunctions.cs | 45 +++++++++ .../OsHle/Services/Am/ISystemAppletProxy.cs | 99 +++++++++++++++++++ Ryujinx.Core/OsHle/Services/ServiceFactory.cs | 5 +- 6 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 Ryujinx.Core/OsHle/Services/Am/IAllSystemAppletProxiesService.cs create mode 100644 Ryujinx.Core/OsHle/Services/Am/IApplicationCreator.cs create mode 100644 Ryujinx.Core/OsHle/Services/Am/IGlobalStateController.cs create mode 100644 Ryujinx.Core/OsHle/Services/Am/IHomeMenuFunctions.cs create mode 100644 Ryujinx.Core/OsHle/Services/Am/ISystemAppletProxy.cs diff --git a/Ryujinx.Core/OsHle/Services/Am/IAllSystemAppletProxiesService.cs b/Ryujinx.Core/OsHle/Services/Am/IAllSystemAppletProxiesService.cs new file mode 100644 index 0000000000..0d20f94cb7 --- /dev/null +++ b/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 m_Commands; + + public override IReadOnlyDictionary Commands => m_Commands; + + public IAllSystemAppletProxiesService() + { + m_Commands = new Dictionary() + { + { 100, OpenSystemAppletProxy } + }; + } + + public long OpenSystemAppletProxy(ServiceCtx Context) + { + MakeObject(Context, new ISystemAppletProxy()); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Am/IApplicationCreator.cs b/Ryujinx.Core/OsHle/Services/Am/IApplicationCreator.cs new file mode 100644 index 0000000000..1114897b33 --- /dev/null +++ b/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 m_Commands; + + public override IReadOnlyDictionary Commands => m_Commands; + + public IApplicationCreator() + { + m_Commands = new Dictionary() + { + //... + }; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Am/IGlobalStateController.cs b/Ryujinx.Core/OsHle/Services/Am/IGlobalStateController.cs new file mode 100644 index 0000000000..d5810154e1 --- /dev/null +++ b/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 m_Commands; + + public override IReadOnlyDictionary Commands => m_Commands; + + public IGlobalStateController() + { + m_Commands = new Dictionary() + { + //... + }; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Am/IHomeMenuFunctions.cs b/Ryujinx.Core/OsHle/Services/Am/IHomeMenuFunctions.cs new file mode 100644 index 0000000000..2b81eede50 --- /dev/null +++ b/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 m_Commands; + + public override IReadOnlyDictionary Commands => m_Commands; + + private KEvent ChannelEvent; + + public IHomeMenuFunctions() + { + m_Commands = new Dictionary() + { + { 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; + } + } +} diff --git a/Ryujinx.Core/OsHle/Services/Am/ISystemAppletProxy.cs b/Ryujinx.Core/OsHle/Services/Am/ISystemAppletProxy.cs new file mode 100644 index 0000000000..2d477b34cd --- /dev/null +++ b/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 m_Commands; + + public override IReadOnlyDictionary Commands => m_Commands; + + public ISystemAppletProxy() + { + m_Commands = new Dictionary() + { + { 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; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceFactory.cs b/Ryujinx.Core/OsHle/Services/ServiceFactory.cs index 76adcfa54c..0a9760ba3a 100644 --- a/Ryujinx.Core/OsHle/Services/ServiceFactory.cs +++ b/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); } } -} \ No newline at end of file +}