From fba0bf873257c4ac17f4584036661be08a1694d3 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 25 Feb 2018 01:34:16 -0300 Subject: [PATCH] Refactor IPC services to have commands into separate classes, fix readme url --- README.md | 2 +- Ryujinx.Core/OsHle/Handles/HSession.cs | 10 +- Ryujinx.Core/OsHle/Ipc/IpcHandler.cs | 78 ++------------- .../Acc/IManagerForApplication.cs | 4 +- .../{Objects => IpcServices}/Acc/IProfile.cs | 4 +- .../OsHle/IpcServices/Acc/ServiceAcc.cs | 49 ++++++++++ .../Am/IApplicationFunctions.cs | 6 +- .../Am/IApplicationProxy.cs | 6 +- .../Am/IAudioController.cs | 4 +- .../Am/ICommonStateGetter.cs | 4 +- .../Am/IDebugFunctions.cs | 4 +- .../Am/IDisplayController.cs | 4 +- .../Am/ILibraryAppletCreator.cs | 4 +- .../Am/ISelfController.cs | 4 +- .../{Objects => IpcServices}/Am/IStorage.cs | 6 +- .../Am/IStorageAccessor.cs | 4 +- .../Am/IWindowController.cs | 4 +- .../OsHle/IpcServices/Am/ServiceAppletOE.cs | 29 ++++++ .../Android/GbpBuffer.cs | 2 +- .../Android/NvFlinger.cs | 4 +- .../Android/Parcel.cs | 2 +- .../{Objects => IpcServices}/Apm/ISession.cs | 4 +- .../OsHle/IpcServices/Apm/ServiceApm.cs | 29 ++++++ .../{Objects => IpcServices}/Aud/IAudioOut.cs | 4 +- .../Aud/IAudioRenderer.cs | 4 +- .../OsHle/IpcServices/Aud/ServiceAudOut.cs | 57 +++++++++++ .../OsHle/IpcServices/Aud/ServiceAudRen.cs | 51 ++++++++++ .../{Objects => IpcServices}/ErrorCode.cs | 2 +- .../{Objects => IpcServices}/ErrorModule.cs | 2 +- .../Friend/IFriendService.cs | 4 +- .../OsHle/IpcServices/Friend/ServiceFriend.cs | 29 ++++++ .../{Objects => IpcServices}/FspSrv/FsErr.cs | 2 +- .../FspSrv/IDirectory.cs | 4 +- .../{Objects => IpcServices}/FspSrv/IFile.cs | 4 +- .../FspSrv/IFileSystem.cs | 8 +- .../FspSrv/IStorage.cs | 4 +- .../OsHle/IpcServices/FspSrv/ServiceFspSrv.cs | 67 +++++++++++++ .../Hid/IActiveVibrationDeviceList.cs | 4 +- .../Hid/IAppletResource.cs | 4 +- .../OsHle/IpcServices/Hid/ServiceHid.cs | 98 +++++++++++++++++++ .../IIpcService.cs} | 4 +- .../OsHle/IpcServices/Lm/ServiceLm.cs | 27 +++++ .../NvServices}/ServiceNvDrv.cs | 41 +++++--- .../{Objects => IpcServices}/ObjHelper.cs | 2 +- .../Pctl}/IParentalControlService.cs | 4 +- .../OsHle/IpcServices/Pctl/ServicePctl.cs | 29 ++++++ .../OsHle/IpcServices/Pl/ServicePl.cs | 51 ++++++++++ .../OsHle/IpcServices/ServiceFactory.cs | 50 ++++++++++ .../Set}/ServiceSet.cs | 20 +++- .../{Services => IpcServices/Sm}/ServiceSm.cs | 29 +++++- .../Time/ISteadyClock.cs | 4 +- .../Time/ISystemClock.cs | 4 +- .../Time/ITimeZoneService.cs | 4 +- .../OsHle/IpcServices/Time/ServiceTime.cs | 62 ++++++++++++ .../Time/SystemClockType.cs | 2 +- .../Vi/IApplicationDisplayService.cs | 8 +- .../Vi/IHOSBinderDriver.cs | 6 +- .../Vi/IManagerDisplayService.cs | 4 +- .../Vi/ISystemDisplayService.cs | 4 +- .../OsHle/IpcServices/Vi/ServiceVi.cs | 31 ++++++ Ryujinx.Core/OsHle/Services/ServiceAcc.cs | 33 ------- Ryujinx.Core/OsHle/Services/ServiceApm.cs | 16 --- .../OsHle/Services/ServiceAppletOE.cs | 16 --- Ryujinx.Core/OsHle/Services/ServiceAud.cs | 71 -------------- Ryujinx.Core/OsHle/Services/ServiceFriend.cs | 16 --- Ryujinx.Core/OsHle/Services/ServiceFspSrv.cs | 49 ---------- Ryujinx.Core/OsHle/Services/ServiceHid.cs | 77 --------------- Ryujinx.Core/OsHle/Services/ServiceLm.cs | 12 --- Ryujinx.Core/OsHle/Services/ServicePctl.cs | 16 --- Ryujinx.Core/OsHle/Services/ServicePl.cs | 35 ------- Ryujinx.Core/OsHle/Services/ServiceTime.cs | 45 --------- Ryujinx.Core/OsHle/Services/ServiceVi.cs | 18 ---- Ryujinx.Core/OsHle/Svc/SvcSystem.cs | 3 +- 73 files changed, 825 insertions(+), 583 deletions(-) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Acc/IManagerForApplication.cs (88%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Acc/IProfile.cs (91%) create mode 100644 Ryujinx.Core/OsHle/IpcServices/Acc/ServiceAcc.cs rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Am/IApplicationFunctions.cs (93%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Am/IApplicationProxy.cs (93%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Am/IAudioController.cs (82%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Am/ICommonStateGetter.cs (95%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Am/IDebugFunctions.cs (82%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Am/IDisplayController.cs (82%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Am/ILibraryAppletCreator.cs (82%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Am/ISelfController.cs (95%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Am/IStorage.cs (83%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Am/IStorageAccessor.cs (94%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Am/IWindowController.cs (89%) create mode 100644 Ryujinx.Core/OsHle/IpcServices/Am/ServiceAppletOE.cs rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Android/GbpBuffer.cs (97%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Android/NvFlinger.cs (99%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Android/Parcel.cs (96%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Apm/ISession.cs (89%) create mode 100644 Ryujinx.Core/OsHle/IpcServices/Apm/ServiceApm.cs rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Aud/IAudioOut.cs (98%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Aud/IAudioRenderer.cs (96%) create mode 100644 Ryujinx.Core/OsHle/IpcServices/Aud/ServiceAudOut.cs create mode 100644 Ryujinx.Core/OsHle/IpcServices/Aud/ServiceAudRen.cs rename Ryujinx.Core/OsHle/{Objects => IpcServices}/ErrorCode.cs (81%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/ErrorModule.cs (55%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Friend/IFriendService.cs (82%) create mode 100644 Ryujinx.Core/OsHle/IpcServices/Friend/ServiceFriend.cs rename Ryujinx.Core/OsHle/{Objects => IpcServices}/FspSrv/FsErr.cs (79%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/FspSrv/IDirectory.cs (97%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/FspSrv/IFile.cs (96%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/FspSrv/IFileSystem.cs (98%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/FspSrv/IStorage.cs (94%) create mode 100644 Ryujinx.Core/OsHle/IpcServices/FspSrv/ServiceFspSrv.cs rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Hid/IActiveVibrationDeviceList.cs (79%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Hid/IAppletResource.cs (89%) create mode 100644 Ryujinx.Core/OsHle/IpcServices/Hid/ServiceHid.cs rename Ryujinx.Core/OsHle/{Objects/IIpcInterface.cs => IpcServices/IIpcService.cs} (69%) create mode 100644 Ryujinx.Core/OsHle/IpcServices/Lm/ServiceLm.cs rename Ryujinx.Core/OsHle/{Services => IpcServices/NvServices}/ServiceNvDrv.cs (94%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/ObjHelper.cs (93%) rename Ryujinx.Core/OsHle/{Objects/Am => IpcServices/Pctl}/IParentalControlService.cs (81%) create mode 100644 Ryujinx.Core/OsHle/IpcServices/Pctl/ServicePctl.cs create mode 100644 Ryujinx.Core/OsHle/IpcServices/Pl/ServicePl.cs create mode 100644 Ryujinx.Core/OsHle/IpcServices/ServiceFactory.cs rename Ryujinx.Core/OsHle/{Services => IpcServices/Set}/ServiceSet.cs (57%) rename Ryujinx.Core/OsHle/{Services => IpcServices/Sm}/ServiceSm.cs (56%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Time/ISteadyClock.cs (83%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Time/ISystemClock.cs (92%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Time/ITimeZoneService.cs (82%) create mode 100644 Ryujinx.Core/OsHle/IpcServices/Time/ServiceTime.cs rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Time/SystemClockType.cs (64%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Vi/IApplicationDisplayService.cs (96%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Vi/IHOSBinderDriver.cs (93%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Vi/IManagerDisplayService.cs (89%) rename Ryujinx.Core/OsHle/{Objects => IpcServices}/Vi/ISystemDisplayService.cs (85%) create mode 100644 Ryujinx.Core/OsHle/IpcServices/Vi/ServiceVi.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServiceAcc.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServiceApm.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServiceAppletOE.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServiceAud.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServiceFriend.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServiceFspSrv.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServiceHid.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServiceLm.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServicePctl.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServicePl.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServiceTime.cs delete mode 100644 Ryujinx.Core/OsHle/Services/ServiceVi.cs diff --git a/README.md b/README.md index 6a24112796..841a8258c0 100644 --- a/README.md +++ b/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). diff --git a/Ryujinx.Core/OsHle/Handles/HSession.cs b/Ryujinx.Core/OsHle/Handles/HSession.cs index 8aa1c06bcb..f30e91f98d 100644 --- a/Ryujinx.Core/OsHle/Handles/HSession.cs +++ b/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; } diff --git a/Ryujinx.Core/OsHle/Ipc/IpcHandler.cs b/Ryujinx.Core/OsHle/Ipc/IpcHandler.cs index 5785dbf303..2495d7014c 100644 --- a/Ryujinx.Core/OsHle/Ipc/IpcHandler.cs +++ b/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()}"; } diff --git a/Ryujinx.Core/OsHle/Objects/Acc/IManagerForApplication.cs b/Ryujinx.Core/OsHle/IpcServices/Acc/IManagerForApplication.cs similarity index 88% rename from Ryujinx.Core/OsHle/Objects/Acc/IManagerForApplication.cs rename to Ryujinx.Core/OsHle/IpcServices/Acc/IManagerForApplication.cs index afbfab2407..ab491eac79 100644 --- a/Ryujinx.Core/OsHle/Objects/Acc/IManagerForApplication.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Acc/IProfile.cs b/Ryujinx.Core/OsHle/IpcServices/Acc/IProfile.cs similarity index 91% rename from Ryujinx.Core/OsHle/Objects/Acc/IProfile.cs rename to Ryujinx.Core/OsHle/IpcServices/Acc/IProfile.cs index 94d171833a..77fe2b48cb 100644 --- a/Ryujinx.Core/OsHle/Objects/Acc/IProfile.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/IpcServices/Acc/ServiceAcc.cs b/Ryujinx.Core/OsHle/IpcServices/Acc/ServiceAcc.cs new file mode 100644 index 0000000000..8844bb5d1c --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceAcc() + { + m_Commands = new Dictionary() + { + { 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; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Objects/Am/IApplicationFunctions.cs b/Ryujinx.Core/OsHle/IpcServices/Am/IApplicationFunctions.cs similarity index 93% rename from Ryujinx.Core/OsHle/Objects/Am/IApplicationFunctions.cs rename to Ryujinx.Core/OsHle/IpcServices/Am/IApplicationFunctions.cs index 939ad2486e..30020c1d80 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/IApplicationFunctions.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Am/IApplicationProxy.cs b/Ryujinx.Core/OsHle/IpcServices/Am/IApplicationProxy.cs similarity index 93% rename from Ryujinx.Core/OsHle/Objects/Am/IApplicationProxy.cs rename to Ryujinx.Core/OsHle/IpcServices/Am/IApplicationProxy.cs index 4a164daf12..5417d7f045 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/IApplicationProxy.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Am/IAudioController.cs b/Ryujinx.Core/OsHle/IpcServices/Am/IAudioController.cs similarity index 82% rename from Ryujinx.Core/OsHle/Objects/Am/IAudioController.cs rename to Ryujinx.Core/OsHle/IpcServices/Am/IAudioController.cs index c37042fdba..1212f1e241 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/IAudioController.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Am/ICommonStateGetter.cs b/Ryujinx.Core/OsHle/IpcServices/Am/ICommonStateGetter.cs similarity index 95% rename from Ryujinx.Core/OsHle/Objects/Am/ICommonStateGetter.cs rename to Ryujinx.Core/OsHle/IpcServices/Am/ICommonStateGetter.cs index 83d61fa647..2999bbbae7 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/ICommonStateGetter.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Am/IDebugFunctions.cs b/Ryujinx.Core/OsHle/IpcServices/Am/IDebugFunctions.cs similarity index 82% rename from Ryujinx.Core/OsHle/Objects/Am/IDebugFunctions.cs rename to Ryujinx.Core/OsHle/IpcServices/Am/IDebugFunctions.cs index d04d8363f9..944e58d81e 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/IDebugFunctions.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Am/IDisplayController.cs b/Ryujinx.Core/OsHle/IpcServices/Am/IDisplayController.cs similarity index 82% rename from Ryujinx.Core/OsHle/Objects/Am/IDisplayController.cs rename to Ryujinx.Core/OsHle/IpcServices/Am/IDisplayController.cs index 9eafa70dc9..979e842a69 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/IDisplayController.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Am/ILibraryAppletCreator.cs b/Ryujinx.Core/OsHle/IpcServices/Am/ILibraryAppletCreator.cs similarity index 82% rename from Ryujinx.Core/OsHle/Objects/Am/ILibraryAppletCreator.cs rename to Ryujinx.Core/OsHle/IpcServices/Am/ILibraryAppletCreator.cs index 10e0f4f4af..9f5b5e69c1 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/ILibraryAppletCreator.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Am/ISelfController.cs b/Ryujinx.Core/OsHle/IpcServices/Am/ISelfController.cs similarity index 95% rename from Ryujinx.Core/OsHle/Objects/Am/ISelfController.cs rename to Ryujinx.Core/OsHle/IpcServices/Am/ISelfController.cs index 712874e876..90ddd54b8e 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/ISelfController.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Am/IStorage.cs b/Ryujinx.Core/OsHle/IpcServices/Am/IStorage.cs similarity index 83% rename from Ryujinx.Core/OsHle/Objects/Am/IStorage.cs rename to Ryujinx.Core/OsHle/IpcServices/Am/IStorage.cs index b30059ba29..375b960b1b 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/IStorage.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Am/IStorageAccessor.cs b/Ryujinx.Core/OsHle/IpcServices/Am/IStorageAccessor.cs similarity index 94% rename from Ryujinx.Core/OsHle/Objects/Am/IStorageAccessor.cs rename to Ryujinx.Core/OsHle/IpcServices/Am/IStorageAccessor.cs index df260cc3e9..6d83e6f94f 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/IStorageAccessor.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Am/IWindowController.cs b/Ryujinx.Core/OsHle/IpcServices/Am/IWindowController.cs similarity index 89% rename from Ryujinx.Core/OsHle/Objects/Am/IWindowController.cs rename to Ryujinx.Core/OsHle/IpcServices/Am/IWindowController.cs index aa6e961e03..ddc73bced0 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/IWindowController.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/IpcServices/Am/ServiceAppletOE.cs b/Ryujinx.Core/OsHle/IpcServices/Am/ServiceAppletOE.cs new file mode 100644 index 0000000000..b60c93dd5e --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceAppletOE() + { + m_Commands = new Dictionary() + { + { 0, OpenApplicationProxy } + }; + } + + public long OpenApplicationProxy(ServiceCtx Context) + { + MakeObject(Context, new IApplicationProxy()); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Objects/Android/GbpBuffer.cs b/Ryujinx.Core/OsHle/IpcServices/Android/GbpBuffer.cs similarity index 97% rename from Ryujinx.Core/OsHle/Objects/Android/GbpBuffer.cs rename to Ryujinx.Core/OsHle/IpcServices/Android/GbpBuffer.cs index edd115237e..5fe585d068 100644 --- a/Ryujinx.Core/OsHle/Objects/Android/GbpBuffer.cs +++ b/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 { diff --git a/Ryujinx.Core/OsHle/Objects/Android/NvFlinger.cs b/Ryujinx.Core/OsHle/IpcServices/Android/NvFlinger.cs similarity index 99% rename from Ryujinx.Core/OsHle/Objects/Android/NvFlinger.cs rename to Ryujinx.Core/OsHle/IpcServices/Android/NvFlinger.cs index 11069cb22f..85a06cea41 100644 --- a/Ryujinx.Core/OsHle/Objects/Android/NvFlinger.cs +++ b/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 { diff --git a/Ryujinx.Core/OsHle/Objects/Android/Parcel.cs b/Ryujinx.Core/OsHle/IpcServices/Android/Parcel.cs similarity index 96% rename from Ryujinx.Core/OsHle/Objects/Android/Parcel.cs rename to Ryujinx.Core/OsHle/IpcServices/Android/Parcel.cs index cd7179e1ed..3404c227ef 100644 --- a/Ryujinx.Core/OsHle/Objects/Android/Parcel.cs +++ b/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 { diff --git a/Ryujinx.Core/OsHle/Objects/Apm/ISession.cs b/Ryujinx.Core/OsHle/IpcServices/Apm/ISession.cs similarity index 89% rename from Ryujinx.Core/OsHle/Objects/Apm/ISession.cs rename to Ryujinx.Core/OsHle/IpcServices/Apm/ISession.cs index 3ab3300557..500f7596cd 100644 --- a/Ryujinx.Core/OsHle/Objects/Apm/ISession.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/IpcServices/Apm/ServiceApm.cs b/Ryujinx.Core/OsHle/IpcServices/Apm/ServiceApm.cs new file mode 100644 index 0000000000..d6c0400acf --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceApm() + { + m_Commands = new Dictionary() + { + { 0, OpenSession } + }; + } + + public long OpenSession(ServiceCtx Context) + { + MakeObject(Context, new ISession()); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Objects/Aud/IAudioOut.cs b/Ryujinx.Core/OsHle/IpcServices/Aud/IAudioOut.cs similarity index 98% rename from Ryujinx.Core/OsHle/Objects/Aud/IAudioOut.cs rename to Ryujinx.Core/OsHle/IpcServices/Aud/IAudioOut.cs index 061c63763b..a45b23ccd5 100644 --- a/Ryujinx.Core/OsHle/Objects/Aud/IAudioOut.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Aud/IAudioRenderer.cs b/Ryujinx.Core/OsHle/IpcServices/Aud/IAudioRenderer.cs similarity index 96% rename from Ryujinx.Core/OsHle/Objects/Aud/IAudioRenderer.cs rename to Ryujinx.Core/OsHle/IpcServices/Aud/IAudioRenderer.cs index 0535647733..bfde0b65b1 100644 --- a/Ryujinx.Core/OsHle/Objects/Aud/IAudioRenderer.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/IpcServices/Aud/ServiceAudOut.cs b/Ryujinx.Core/OsHle/IpcServices/Aud/ServiceAudOut.cs new file mode 100644 index 0000000000..eb923562bf --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceAudOut() + { + m_Commands = new Dictionary() + { + { 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; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/IpcServices/Aud/ServiceAudRen.cs b/Ryujinx.Core/OsHle/IpcServices/Aud/ServiceAudRen.cs new file mode 100644 index 0000000000..eccc699c43 --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceAudRen() + { + m_Commands = new Dictionary() + { + { 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; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Objects/ErrorCode.cs b/Ryujinx.Core/OsHle/IpcServices/ErrorCode.cs similarity index 81% rename from Ryujinx.Core/OsHle/Objects/ErrorCode.cs rename to Ryujinx.Core/OsHle/IpcServices/ErrorCode.cs index 659ed8b947..a4e197b225 100644 --- a/Ryujinx.Core/OsHle/Objects/ErrorCode.cs +++ b/Ryujinx.Core/OsHle/IpcServices/ErrorCode.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.Core.OsHle.Objects +namespace Ryujinx.Core.OsHle.IpcServices { static class ErrorCode { diff --git a/Ryujinx.Core/OsHle/Objects/ErrorModule.cs b/Ryujinx.Core/OsHle/IpcServices/ErrorModule.cs similarity index 55% rename from Ryujinx.Core/OsHle/Objects/ErrorModule.cs rename to Ryujinx.Core/OsHle/IpcServices/ErrorModule.cs index 0221031b41..0d15db60a6 100644 --- a/Ryujinx.Core/OsHle/Objects/ErrorModule.cs +++ b/Ryujinx.Core/OsHle/IpcServices/ErrorModule.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.Core.OsHle.Objects +namespace Ryujinx.Core.OsHle.IpcServices { enum ErrorModule { diff --git a/Ryujinx.Core/OsHle/Objects/Friend/IFriendService.cs b/Ryujinx.Core/OsHle/IpcServices/Friend/IFriendService.cs similarity index 82% rename from Ryujinx.Core/OsHle/Objects/Friend/IFriendService.cs rename to Ryujinx.Core/OsHle/IpcServices/Friend/IFriendService.cs index e98e27cad6..e3e03da855 100644 --- a/Ryujinx.Core/OsHle/Objects/Friend/IFriendService.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/IpcServices/Friend/ServiceFriend.cs b/Ryujinx.Core/OsHle/IpcServices/Friend/ServiceFriend.cs new file mode 100644 index 0000000000..674877f67f --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceFriend() + { + m_Commands = new Dictionary() + { + { 0, CreateFriendService } + }; + } + + public static long CreateFriendService(ServiceCtx Context) + { + MakeObject(Context, new IFriendService()); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Objects/FspSrv/FsErr.cs b/Ryujinx.Core/OsHle/IpcServices/FspSrv/FsErr.cs similarity index 79% rename from Ryujinx.Core/OsHle/Objects/FspSrv/FsErr.cs rename to Ryujinx.Core/OsHle/IpcServices/FspSrv/FsErr.cs index d9aa60ae73..656d529f2c 100644 --- a/Ryujinx.Core/OsHle/Objects/FspSrv/FsErr.cs +++ b/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 { diff --git a/Ryujinx.Core/OsHle/Objects/FspSrv/IDirectory.cs b/Ryujinx.Core/OsHle/IpcServices/FspSrv/IDirectory.cs similarity index 97% rename from Ryujinx.Core/OsHle/Objects/FspSrv/IDirectory.cs rename to Ryujinx.Core/OsHle/IpcServices/FspSrv/IDirectory.cs index 785b1ba387..54dbec746b 100644 --- a/Ryujinx.Core/OsHle/Objects/FspSrv/IDirectory.cs +++ b/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; diff --git a/Ryujinx.Core/OsHle/Objects/FspSrv/IFile.cs b/Ryujinx.Core/OsHle/IpcServices/FspSrv/IFile.cs similarity index 96% rename from Ryujinx.Core/OsHle/Objects/FspSrv/IFile.cs rename to Ryujinx.Core/OsHle/IpcServices/FspSrv/IFile.cs index 82706f609a..ac2100f29e 100644 --- a/Ryujinx.Core/OsHle/Objects/FspSrv/IFile.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/FspSrv/IFileSystem.cs b/Ryujinx.Core/OsHle/IpcServices/FspSrv/IFileSystem.cs similarity index 98% rename from Ryujinx.Core/OsHle/Objects/FspSrv/IFileSystem.cs rename to Ryujinx.Core/OsHle/IpcServices/FspSrv/IFileSystem.cs index 6b86a4739d..ee9de8bc8c 100644 --- a/Ryujinx.Core/OsHle/Objects/FspSrv/IFileSystem.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/FspSrv/IStorage.cs b/Ryujinx.Core/OsHle/IpcServices/FspSrv/IStorage.cs similarity index 94% rename from Ryujinx.Core/OsHle/Objects/FspSrv/IStorage.cs rename to Ryujinx.Core/OsHle/IpcServices/FspSrv/IStorage.cs index 4eca37e8e3..297461a047 100644 --- a/Ryujinx.Core/OsHle/Objects/FspSrv/IStorage.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/IpcServices/FspSrv/ServiceFspSrv.cs b/Ryujinx.Core/OsHle/IpcServices/FspSrv/ServiceFspSrv.cs new file mode 100644 index 0000000000..991f40272d --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceFspSrv() + { + m_Commands = new Dictionary() + { + { 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; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Objects/Hid/IActiveVibrationDeviceList.cs b/Ryujinx.Core/OsHle/IpcServices/Hid/IActiveVibrationDeviceList.cs similarity index 79% rename from Ryujinx.Core/OsHle/Objects/Hid/IActiveVibrationDeviceList.cs rename to Ryujinx.Core/OsHle/IpcServices/Hid/IActiveVibrationDeviceList.cs index aae3c38d3d..020e8e7e63 100644 --- a/Ryujinx.Core/OsHle/Objects/Hid/IActiveVibrationDeviceList.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Hid/IAppletResource.cs b/Ryujinx.Core/OsHle/IpcServices/Hid/IAppletResource.cs similarity index 89% rename from Ryujinx.Core/OsHle/Objects/Hid/IAppletResource.cs rename to Ryujinx.Core/OsHle/IpcServices/Hid/IAppletResource.cs index 7d56d04bab..d22e0ff23b 100644 --- a/Ryujinx.Core/OsHle/Objects/Hid/IAppletResource.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/IpcServices/Hid/ServiceHid.cs b/Ryujinx.Core/OsHle/IpcServices/Hid/ServiceHid.cs new file mode 100644 index 0000000000..5cca9319e2 --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceHid() + { + m_Commands = new Dictionary() + { + { 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(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; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Objects/IIpcInterface.cs b/Ryujinx.Core/OsHle/IpcServices/IIpcService.cs similarity index 69% rename from Ryujinx.Core/OsHle/Objects/IIpcInterface.cs rename to Ryujinx.Core/OsHle/IpcServices/IIpcService.cs index c57a097482..eebcdfbe56 100644 --- a/Ryujinx.Core/OsHle/Objects/IIpcInterface.cs +++ b/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 Commands { get; } } diff --git a/Ryujinx.Core/OsHle/IpcServices/Lm/ServiceLm.cs b/Ryujinx.Core/OsHle/IpcServices/Lm/ServiceLm.cs new file mode 100644 index 0000000000..e665253c15 --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceLm() + { + m_Commands = new Dictionary() + { + { 0, Initialize } + }; + } + + public long Initialize(ServiceCtx Context) + { + Context.Session.Initialize(); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceNvDrv.cs b/Ryujinx.Core/OsHle/IpcServices/NvServices/ServiceNvDrv.cs similarity index 94% rename from Ryujinx.Core/OsHle/Services/ServiceNvDrv.cs rename to Ryujinx.Core/OsHle/IpcServices/NvServices/ServiceNvDrv.cs index 6c5fdaedd1..1de0ab7062 100644 --- a/Ryujinx.Core/OsHle/Services/ServiceNvDrv.cs +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceNvDrv() + { + m_Commands = new Dictionary() + { + { 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(); diff --git a/Ryujinx.Core/OsHle/Objects/ObjHelper.cs b/Ryujinx.Core/OsHle/IpcServices/ObjHelper.cs similarity index 93% rename from Ryujinx.Core/OsHle/Objects/ObjHelper.cs rename to Ryujinx.Core/OsHle/IpcServices/ObjHelper.cs index a151a28799..ff71838a69 100644 --- a/Ryujinx.Core/OsHle/Objects/ObjHelper.cs +++ b/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 { diff --git a/Ryujinx.Core/OsHle/Objects/Am/IParentalControlService.cs b/Ryujinx.Core/OsHle/IpcServices/Pctl/IParentalControlService.cs similarity index 81% rename from Ryujinx.Core/OsHle/Objects/Am/IParentalControlService.cs rename to Ryujinx.Core/OsHle/IpcServices/Pctl/IParentalControlService.cs index 1feacfa642..4eb92d31d5 100644 --- a/Ryujinx.Core/OsHle/Objects/Am/IParentalControlService.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/IpcServices/Pctl/ServicePctl.cs b/Ryujinx.Core/OsHle/IpcServices/Pctl/ServicePctl.cs new file mode 100644 index 0000000000..2d5e22a462 --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServicePctl() + { + m_Commands = new Dictionary() + { + { 0, CreateService } + }; + } + + public static long CreateService(ServiceCtx Context) + { + MakeObject(Context, new IParentalControlService()); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/IpcServices/Pl/ServicePl.cs b/Ryujinx.Core/OsHle/IpcServices/Pl/ServicePl.cs new file mode 100644 index 0000000000..abc34ed213 --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServicePl() + { + m_Commands = new Dictionary() + { + { 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; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/IpcServices/ServiceFactory.cs b/Ryujinx.Core/OsHle/IpcServices/ServiceFactory.cs new file mode 100644 index 0000000000..e9613050f7 --- /dev/null +++ b/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); + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceSet.cs b/Ryujinx.Core/OsHle/IpcServices/Set/ServiceSet.cs similarity index 57% rename from Ryujinx.Core/OsHle/Services/ServiceSet.cs rename to Ryujinx.Core/OsHle/IpcServices/Set/ServiceSet.cs index 83ea5b2ce4..05e409b0d1 100644 --- a/Ryujinx.Core/OsHle/Services/ServiceSet.cs +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceSet() + { + m_Commands = new Dictionary() + { + { 1, GetAvailableLanguageCodes } + }; + } + private const int LangCodesCount = 13; - public static long SetGetAvailableLanguageCodes(ServiceCtx Context) + public static long GetAvailableLanguageCodes(ServiceCtx Context) { int PtrBuffSize = Context.RequestData.ReadInt32(); diff --git a/Ryujinx.Core/OsHle/Services/ServiceSm.cs b/Ryujinx.Core/OsHle/IpcServices/Sm/ServiceSm.cs similarity index 56% rename from Ryujinx.Core/OsHle/Services/ServiceSm.cs rename to Ryujinx.Core/OsHle/IpcServices/Sm/ServiceSm.cs index 58abed2411..a5f1b329b8 100644 --- a/Ryujinx.Core/OsHle/Services/ServiceSm.cs +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceSm() + { + m_Commands = new Dictionary() + { + { 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); diff --git a/Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs b/Ryujinx.Core/OsHle/IpcServices/Time/ISteadyClock.cs similarity index 83% rename from Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs rename to Ryujinx.Core/OsHle/IpcServices/Time/ISteadyClock.cs index 1116b84927..d20e4378ad 100644 --- a/Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs b/Ryujinx.Core/OsHle/IpcServices/Time/ISystemClock.cs similarity index 92% rename from Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs rename to Ryujinx.Core/OsHle/IpcServices/Time/ISystemClock.cs index 3aa7069150..4d4493dad4 100644 --- a/Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs b/Ryujinx.Core/OsHle/IpcServices/Time/ITimeZoneService.cs similarity index 82% rename from Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs rename to Ryujinx.Core/OsHle/IpcServices/Time/ITimeZoneService.cs index c083628bb0..9875fa2fcf 100644 --- a/Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/IpcServices/Time/ServiceTime.cs b/Ryujinx.Core/OsHle/IpcServices/Time/ServiceTime.cs new file mode 100644 index 0000000000..43f28bb80b --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceTime() + { + m_Commands = new Dictionary() + { + { 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; + } + + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs b/Ryujinx.Core/OsHle/IpcServices/Time/SystemClockType.cs similarity index 64% rename from Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs rename to Ryujinx.Core/OsHle/IpcServices/Time/SystemClockType.cs index f447ca1cfb..2314942a3b 100644 --- a/Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs +++ b/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 { diff --git a/Ryujinx.Core/OsHle/Objects/Vi/IApplicationDisplayService.cs b/Ryujinx.Core/OsHle/IpcServices/Vi/IApplicationDisplayService.cs similarity index 96% rename from Ryujinx.Core/OsHle/Objects/Vi/IApplicationDisplayService.cs rename to Ryujinx.Core/OsHle/IpcServices/Vi/IApplicationDisplayService.cs index b3ec0e90cc..a899cdd56d 100644 --- a/Ryujinx.Core/OsHle/Objects/Vi/IApplicationDisplayService.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Vi/IHOSBinderDriver.cs b/Ryujinx.Core/OsHle/IpcServices/Vi/IHOSBinderDriver.cs similarity index 93% rename from Ryujinx.Core/OsHle/Objects/Vi/IHOSBinderDriver.cs rename to Ryujinx.Core/OsHle/IpcServices/Vi/IHOSBinderDriver.cs index bbea3368cc..a89c1df824 100644 --- a/Ryujinx.Core/OsHle/Objects/Vi/IHOSBinderDriver.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Vi/IManagerDisplayService.cs b/Ryujinx.Core/OsHle/IpcServices/Vi/IManagerDisplayService.cs similarity index 89% rename from Ryujinx.Core/OsHle/Objects/Vi/IManagerDisplayService.cs rename to Ryujinx.Core/OsHle/IpcServices/Vi/IManagerDisplayService.cs index f1b3cdd0ad..5adee78d1e 100644 --- a/Ryujinx.Core/OsHle/Objects/Vi/IManagerDisplayService.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/Objects/Vi/ISystemDisplayService.cs b/Ryujinx.Core/OsHle/IpcServices/Vi/ISystemDisplayService.cs similarity index 85% rename from Ryujinx.Core/OsHle/Objects/Vi/ISystemDisplayService.cs rename to Ryujinx.Core/OsHle/IpcServices/Vi/ISystemDisplayService.cs index 4c83c25f14..d87fcbf6ec 100644 --- a/Ryujinx.Core/OsHle/Objects/Vi/ISystemDisplayService.cs +++ b/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 m_Commands; diff --git a/Ryujinx.Core/OsHle/IpcServices/Vi/ServiceVi.cs b/Ryujinx.Core/OsHle/IpcServices/Vi/ServiceVi.cs new file mode 100644 index 0000000000..2c3dd2a3c8 --- /dev/null +++ b/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 m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ServiceVi() + { + m_Commands = new Dictionary() + { + { 2, GetDisplayService } + }; + } + + public long GetDisplayService(ServiceCtx Context) + { + int Unknown = Context.RequestData.ReadInt32(); + + MakeObject(Context, new IApplicationDisplayService()); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceAcc.cs b/Ryujinx.Core/OsHle/Services/ServiceAcc.cs deleted file mode 100644 index f25113e59a..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServiceAcc.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceApm.cs b/Ryujinx.Core/OsHle/Services/ServiceApm.cs deleted file mode 100644 index e1bc0d348e..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServiceApm.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceAppletOE.cs b/Ryujinx.Core/OsHle/Services/ServiceAppletOE.cs deleted file mode 100644 index bbb2484b4a..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServiceAppletOE.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceAud.cs b/Ryujinx.Core/OsHle/Services/ServiceAud.cs deleted file mode 100644 index a8ba7dc010..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServiceAud.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceFriend.cs b/Ryujinx.Core/OsHle/Services/ServiceFriend.cs deleted file mode 100644 index d1229bd46f..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServiceFriend.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceFspSrv.cs b/Ryujinx.Core/OsHle/Services/ServiceFspSrv.cs deleted file mode 100644 index 3fe41cf061..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServiceFspSrv.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceHid.cs b/Ryujinx.Core/OsHle/Services/ServiceHid.cs deleted file mode 100644 index aed3e959ce..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServiceHid.cs +++ /dev/null @@ -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(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; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceLm.cs b/Ryujinx.Core/OsHle/Services/ServiceLm.cs deleted file mode 100644 index 1fdde55219..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServiceLm.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Ryujinx.Core.OsHle.Services -{ - static partial class Service - { - public static long LmInitialize(ServiceCtx Context) - { - Context.Session.Initialize(); - - return 0; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServicePctl.cs b/Ryujinx.Core/OsHle/Services/ServicePctl.cs deleted file mode 100644 index 9c4406bb64..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServicePctl.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServicePl.cs b/Ryujinx.Core/OsHle/Services/ServicePl.cs deleted file mode 100644 index 21e6741cdf..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServicePl.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceTime.cs b/Ryujinx.Core/OsHle/Services/ServiceTime.cs deleted file mode 100644 index a5fddcba6d..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServiceTime.cs +++ /dev/null @@ -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; - } - - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceVi.cs b/Ryujinx.Core/OsHle/Services/ServiceVi.cs deleted file mode 100644 index 75cdc31b24..0000000000 --- a/Ryujinx.Core/OsHle/Services/ServiceVi.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Svc/SvcSystem.cs b/Ryujinx.Core/OsHle/Svc/SvcSystem.cs index a69d3b4097..3b9142c789 100644 --- a/Ryujinx.Core/OsHle/Svc/SvcSystem.cs +++ b/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;