diff --git a/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs index 101cb361c..3f00ae66a 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs @@ -11,6 +11,8 @@ using static Ryujinx.HLE.HOS.ErrorCode; namespace Ryujinx.HLE.HOS.Services.Acc { + [Service("acc:u0")] + [Service("acc:u1")] class IAccountService : IpcService { private bool _userRegistrationRequestPermitted = false; @@ -21,7 +23,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc public override IReadOnlyDictionary Commands => _commands; - public IAccountService() + public IAccountService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs b/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs index 0d067b169..64bb67451 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Am { + [Service("appletAE")] class IAllSystemAppletProxiesService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IAllSystemAppletProxiesService() + public IAllSystemAppletProxiesService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs index 88792a165..8ca058685 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Am { + [Service("appletOE")] class IApplicationProxyService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IApplicationProxyService() + public IApplicationProxyService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Apm/IManager.cs b/Ryujinx.HLE/HOS/Services/Apm/IManager.cs index cd86e5169..02f3661a0 100644 --- a/Ryujinx.HLE/HOS/Services/Apm/IManager.cs +++ b/Ryujinx.HLE/HOS/Services/Apm/IManager.cs @@ -3,13 +3,15 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Apm { + [Service("apm")] + [Service("apm:p")] class IManager : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IManager() + public IManager(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs index a276c96e3..e4e037dea 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs @@ -11,6 +11,7 @@ using static Ryujinx.HLE.HOS.ErrorCode; namespace Ryujinx.HLE.HOS.Services.Aud { + [Service("audout:u")] class IAudioOutManager : IpcService { private const string DefaultAudioOutput = "DeviceOut"; @@ -23,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud public override IReadOnlyDictionary Commands => _commands; - public IAudioOutManager() + public IAudioOutManager(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs index 18e9184cf..c757d5fd5 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs @@ -9,6 +9,7 @@ using static Ryujinx.HLE.HOS.ErrorCode; namespace Ryujinx.HLE.HOS.Services.Aud { + [Service("audren:u")] class IAudioRendererManager : IpcService { private const int Rev0Magic = ('R' << 0) | @@ -24,7 +25,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud public override IReadOnlyDictionary Commands => _commands; - public IAudioRendererManager() + public IAudioRendererManager(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs index 0b5e12f09..e66a9fe60 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Aud { + [Service("hwopus")] class IHardwareOpusDecoderManager : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IHardwareOpusDecoderManager() + public IHardwareOpusDecoderManager(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs b/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs index 6523aa632..6ed7ec3fc 100644 --- a/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs @@ -3,13 +3,17 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Bcat { + [Service("bcat:a")] + [Service("bcat:m")] + [Service("bcat:u")] + [Service("bcat:s")] class IServiceCreator : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IServiceCreator() + public IServiceCreator(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs b/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs index 86d914d4d..0d5775d58 100644 --- a/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs +++ b/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs @@ -8,9 +8,10 @@ using System.Text; namespace Ryujinx.HLE.HOS.Services.Bsd { + [Service("bsd:s", true)] + [Service("bsd:u", false)] class IClient : IpcService { - private static Dictionary _errorMap = new Dictionary { // WSAEINTR @@ -95,15 +96,15 @@ namespace Ryujinx.HLE.HOS.Services.Bsd {0, 0} }; - private Dictionary _commands; - - public override IReadOnlyDictionary Commands => _commands; - private bool _isPrivileged; private List _sockets = new List(); - public IClient(bool isPrivileged) + private Dictionary _commands; + + public override IReadOnlyDictionary Commands => _commands; + + public IClient(ServiceCtx context, bool isPrivileged) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs b/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs index 82da2451a..f10095edf 100644 --- a/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs +++ b/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Caps { + [Service("caps:a")] class IAlbumAccessorService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IAlbumAccessorService() + public IAlbumAccessorService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs b/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs index 9273b3940..e37c51e24 100644 --- a/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs +++ b/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Caps { + [Service("caps:ss")] class IScreenshotService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IScreenshotService() + public IScreenshotService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Es/IETicketService.cs b/Ryujinx.HLE/HOS/Services/Es/IETicketService.cs index 049e94dbc..4aa0a7fa1 100644 --- a/Ryujinx.HLE/HOS/Services/Es/IETicketService.cs +++ b/Ryujinx.HLE/HOS/Services/Es/IETicketService.cs @@ -3,20 +3,19 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Es { + [Service("es")] class IeTicketService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - private bool _isInitialized; - - public IeTicketService() + public IeTicketService(ServiceCtx context) { _commands = new Dictionary { - + //... }; } } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs b/Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs index dea9d9ae1..af97391d0 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs @@ -7,15 +7,20 @@ using static Ryujinx.HLE.HOS.ErrorCode; namespace Ryujinx.HLE.HOS.Services.Friend { + [Service("friend:a", FriendServicePermissionLevel.Admin)] + [Service("friend:m", FriendServicePermissionLevel.Manager)] + [Service("friend:s", FriendServicePermissionLevel.System)] + [Service("friend:u", FriendServicePermissionLevel.User)] + [Service("friend:v", FriendServicePermissionLevel.Overlay)] class IServiceCreator : IpcService { - private Dictionary _commands; - private FriendServicePermissionLevel _permissionLevel; + private Dictionary _commands; + public override IReadOnlyDictionary Commands => _commands; - public IServiceCreator(FriendServicePermissionLevel permissionLevel) + public IServiceCreator(ServiceCtx context, FriendServicePermissionLevel permissionLevel) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs index a1afe9beb..84869bf55 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs @@ -15,13 +15,14 @@ using static Ryujinx.HLE.Utilities.StringUtils; namespace Ryujinx.HLE.HOS.Services.FspSrv { + [Service("fsp-srv")] class IFileSystemProxy : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IFileSystemProxy() + public IFileSystemProxy(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index 7e48a1869..0ea7f1917 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Hid { + [Service("hid")] class IHidServer : IpcService { private Dictionary _commands; @@ -40,7 +41,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid public override IReadOnlyDictionary Commands => _commands; - public IHidServer(Horizon system) + public IHidServer(ServiceCtx context) { _commands = new Dictionary { @@ -149,9 +150,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid { 1001, GetNpadCommunicationMode } }; - _npadStyleSetUpdateEvent = new KEvent(system); - _xpadIdEvent = new KEvent(system); - _palmaOperationCompleteEvent = new KEvent(system); + _npadStyleSetUpdateEvent = new KEvent(context.Device.System); + _xpadIdEvent = new KEvent(context.Device.System); + _palmaOperationCompleteEvent = new KEvent(context.Device.System); _npadJoyHoldType = HidNpadJoyHoldType.Vertical; _npadStyleSet = HidNpadStyle.FullKey | HidNpadStyle.Dual | HidNpadStyle.Left | HidNpadStyle.Right | HidNpadStyle.Handheld; diff --git a/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs b/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs index da1fbc189..a720ef4de 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Hid.Irs { + [Service("irs")] class IIrSensorServer : IpcService { private int _irsensorSharedMemoryHandle = 0; @@ -15,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs public override IReadOnlyDictionary Commands => _commands; - public IIrSensorServer() + public IIrSensorServer(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs b/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs index 49edab59e..8820e2d4b 100644 --- a/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs @@ -95,6 +95,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr } } + [Service("ldr:ro")] class IRoInterface : IpcService { private Dictionary _commands; @@ -112,7 +113,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr private bool _isInitialized; - public IRoInterface() + public IRoInterface(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs b/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs index 37621c317..0be76866b 100644 --- a/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs +++ b/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Lm { + [Service("lm")] class ILogService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public ILogService() + public ILogService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Lr/ILocationResolverManager.cs b/Ryujinx.HLE/HOS/Services/Lr/ILocationResolverManager.cs index 4b2de6b38..00186037c 100644 --- a/Ryujinx.HLE/HOS/Services/Lr/ILocationResolverManager.cs +++ b/Ryujinx.HLE/HOS/Services/Lr/ILocationResolverManager.cs @@ -4,13 +4,14 @@ using Ryujinx.HLE.FileSystem; namespace Ryujinx.HLE.HOS.Services.Lr { + [Service("lr")] class ILocationResolverManager : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public ILocationResolverManager() + public ILocationResolverManager(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs b/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs index 932e5b0d6..6d450b21b 100644 --- a/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs +++ b/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs @@ -4,13 +4,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Mm { + [Service("mm:u")] class IRequest : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IRequest() + public IRequest(ServiceCtx context) { _commands = new Dictionary() { diff --git a/Ryujinx.HLE/HOS/Services/Ncm/IContentManager.cs b/Ryujinx.HLE/HOS/Services/Ncm/IContentManager.cs index bd92a4506..6dc46dc13 100644 --- a/Ryujinx.HLE/HOS/Services/Ncm/IContentManager.cs +++ b/Ryujinx.HLE/HOS/Services/Ncm/IContentManager.cs @@ -3,18 +3,19 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Ncm { + [Service("ncm")] class IContentManager : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IContentManager() + public IContentManager(ServiceCtx context) { _commands = new Dictionary { - + //... }; } } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs index dad1026ec..8350b37c6 100644 --- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs +++ b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp { + [Service("nfp:user")] class IUserManager : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IUserManager() + public IUserManager(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs b/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs index 42d9c78e7..91b4d1294 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Nifm { + [Service("nifm:u")] class IStaticService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IStaticService() + public IStaticService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs b/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs index 9139c9bfc..fe845f874 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs @@ -4,13 +4,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Ns { + [Service("aoc:u")] class IAddOnContentManager : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IAddOnContentManager() + public IAddOnContentManager(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs index 8c0fa41a8..88e669642 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs @@ -6,13 +6,14 @@ using System.Text; namespace Ryujinx.HLE.HOS.Services.Ns { + [Service("ns:am")] class IApplicationManagerInterface : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IApplicationManagerInterface() + public IApplicationManagerInterface(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs index 89dde1f9b..7c42d3ede 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs @@ -3,13 +3,15 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Ns { + [Service("ns:am2")] + [Service("ns:ec")] class IServiceGetterInterface : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IServiceGetterInterface() + public IServiceGetterInterface(ServiceCtx context) { _commands = new Dictionary { @@ -19,7 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Ns public long GetApplicationManagerInterface(ServiceCtx context) { - MakeObject(context, new IApplicationManagerInterface()); + MakeObject(context, new IApplicationManagerInterface(context)); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs index 5499e235f..503b2f10d 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Ns { + [Service("ns:su")] class ISystemUpdateInterface : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public ISystemUpdateInterface() + public ISystemUpdateInterface(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs index 6b7c41934..c8a31e160 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Ns { + [Service("ns:vm")] class IVulnerabilityManagerInterface : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IVulnerabilityManagerInterface() + public IVulnerabilityManagerInterface(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs b/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs index dcfaef789..bfd91c44b 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs @@ -14,6 +14,8 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Nv { + [Service("nvdrv")] + [Service("nvdrv:a")] class INvDrvServices : IpcService { private delegate int IoctlProcessor(ServiceCtx context, int cmd); @@ -38,7 +40,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv private KEvent _event; - public INvDrvServices(Horizon system) + public INvDrvServices(ServiceCtx context) { _commands = new Dictionary() { @@ -53,7 +55,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv { 13, FinishInitialize } }; - _event = new KEvent(system); + _event = new KEvent(context.Device.System); } static INvDrvServices() diff --git a/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs index 92500187c..372560e68 100644 --- a/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs +++ b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs @@ -3,13 +3,17 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Pctl { + [Service("pctl")] + [Service("pctl:a")] + [Service("pctl:r")] + [Service("pctl:s")] class IParentalControlServiceFactory : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IParentalControlServiceFactory() + public IParentalControlServiceFactory(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs b/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs index 1c67d3568..7fc4e6cd7 100644 --- a/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs +++ b/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs @@ -6,13 +6,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Pl { + [Service("pl:u")] class ISharedFontManager : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public ISharedFontManager() + public ISharedFontManager(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs b/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs index 35fdd5472..69e221eb5 100644 --- a/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Pm { + [Service("pm:shell")] class IShellInterface : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IShellInterface() + public IShellInterface(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs b/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs index a3cb5cc90..099764451 100644 --- a/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs +++ b/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs @@ -4,13 +4,15 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Prepo { + [Service("prepo:a")] + [Service("prepo:u")] class IPrepoService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IPrepoService() + public IPrepoService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs b/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs index 02bc5524e..2310e8b90 100644 --- a/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs +++ b/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Psm { + [Service("psm")] class IPsmServer : IpcService { enum ChargerType @@ -17,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm public override IReadOnlyDictionary Commands => _commands; - public IPsmServer() + public IPsmServer(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/ServiceAttributes.cs b/Ryujinx.HLE/HOS/Services/ServiceAttributes.cs new file mode 100644 index 000000000..9ca775afe --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/ServiceAttributes.cs @@ -0,0 +1,17 @@ +using System; + +namespace Ryujinx.HLE.HOS.Services +{ + [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] + public class ServiceAttribute : Attribute + { + public readonly string Name; + public readonly object Parameter; + + public ServiceAttribute(string name, object parameter = null) + { + Name = name; + Parameter = parameter; + } + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/ServiceConfiguration.cs b/Ryujinx.HLE/HOS/Services/ServiceConfiguration.cs new file mode 100644 index 000000000..d73c76d9c --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/ServiceConfiguration.cs @@ -0,0 +1,7 @@ +namespace Ryujinx.HLE.HOS.Services +{ + public static class ServiceConfiguration + { + public static bool IgnoreMissingServices { get; set; } + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/ServiceFactory.cs b/Ryujinx.HLE/HOS/Services/ServiceFactory.cs deleted file mode 100644 index 3edb5619e..000000000 --- a/Ryujinx.HLE/HOS/Services/ServiceFactory.cs +++ /dev/null @@ -1,236 +0,0 @@ -using Ryujinx.Common.Logging; -using Ryujinx.HLE.HOS.Services.Acc; -using Ryujinx.HLE.HOS.Services.Am; -using Ryujinx.HLE.HOS.Services.Apm; -using Ryujinx.HLE.HOS.Services.Aud; -using Ryujinx.HLE.HOS.Services.Bsd; -using Ryujinx.HLE.HOS.Services.Caps; -using Ryujinx.HLE.HOS.Services.Es; -using Ryujinx.HLE.HOS.Services.FspSrv; -using Ryujinx.HLE.HOS.Services.Hid; -using Ryujinx.HLE.HOS.Services.Hid.Irs; -using Ryujinx.HLE.HOS.Services.Ldr; -using Ryujinx.HLE.HOS.Services.Lm; -using Ryujinx.HLE.HOS.Services.Mm; -using Ryujinx.HLE.HOS.Services.Ncm; -using Ryujinx.HLE.HOS.Services.Nfc.Nfp; -using Ryujinx.HLE.HOS.Services.Ns; -using Ryujinx.HLE.HOS.Services.Nv; -using Ryujinx.HLE.HOS.Services.Pctl; -using Ryujinx.HLE.HOS.Services.Pl; -using Ryujinx.HLE.HOS.Services.Pm; -using Ryujinx.HLE.HOS.Services.Prepo; -using Ryujinx.HLE.HOS.Services.Psm; -using Ryujinx.HLE.HOS.Services.Set; -using Ryujinx.HLE.HOS.Services.Sfdnsres; -using Ryujinx.HLE.HOS.Services.Sm; -using Ryujinx.HLE.HOS.Services.Spl; -using Ryujinx.HLE.HOS.Services.Ssl; -using Ryujinx.HLE.HOS.Services.Vi; -using System; - -namespace Ryujinx.HLE.HOS.Services -{ - public static class ServiceConfiguration - { - public static bool IgnoreMissingServices { get; set; } - } - - static class ServiceFactory - { - public static IpcService MakeService(Horizon system, string name) - { - switch (name) - { - case "acc:u0": - return new IAccountService(); - - case "acc:u1": - return new IAccountService(); - - case "aoc:u": - return new IAddOnContentManager(); - - case "apm": - return new IManager(); - - case "apm:p": - return new IManager(); - - case "appletAE": - return new IAllSystemAppletProxiesService(); - - case "appletOE": - return new IApplicationProxyService(); - - case "audout:u": - return new IAudioOutManager(); - - case "audren:u": - return new IAudioRendererManager(); - - case "bcat:a": - return new Bcat.IServiceCreator(); - - case "bcat:m": - return new Bcat.IServiceCreator(); - - case "bcat:u": - return new Bcat.IServiceCreator(); - - case "bcat:s": - return new Bcat.IServiceCreator(); - - case "bsd:s": - return new IClient(true); - - case "bsd:u": - return new IClient(false); - - case "caps:a": - return new IAlbumAccessorService(); - - case "caps:ss": - return new IScreenshotService(); - - case "csrng": - return new IRandomInterface(); - - case "es": - return new IeTicketService(); - - case "friend:a": - return new Friend.IServiceCreator(Friend.FriendServicePermissionLevel.Admin); - - case "friend:u": - return new Friend.IServiceCreator(Friend.FriendServicePermissionLevel.User); - - case "friend:v": - return new Friend.IServiceCreator(Friend.FriendServicePermissionLevel.Overlay); - - case "friend:m": - return new Friend.IServiceCreator(Friend.FriendServicePermissionLevel.Manager); - - case "friend:s": - return new Friend.IServiceCreator(Friend.FriendServicePermissionLevel.System); - - case "fsp-srv": - return new IFileSystemProxy(); - - case "hid": - return new IHidServer(system); - - case "irs": - return new IIrSensorServer(); - - case "ldr:ro": - return new IRoInterface(); - - case "hwopus": - return new IHardwareOpusDecoderManager(); - - case "lm": - return new ILogService(); - - case "mm:u": - return new IRequest(); - - case "ncm": - return new IContentManager(); - - case "nfp:user": - return new IUserManager(); - - case "nifm:u": - return new Nifm.IStaticService(); - - case "ns:am": - return new IApplicationManagerInterface(); - - case "ns:am2": - case "ns:ec": - return new IServiceGetterInterface(); - - case "ns:su": - return new ISystemUpdateInterface(); - - case "ns:vm": - return new IVulnerabilityManagerInterface(); - - case "nvdrv": - return new INvDrvServices(system); - - case "nvdrv:a": - return new INvDrvServices(system); - - case "pctl:s": - return new IParentalControlServiceFactory(); - - case "pctl:r": - return new IParentalControlServiceFactory(); - - case "pctl:a": - return new IParentalControlServiceFactory(); - - case "pctl": - return new IParentalControlServiceFactory(); - - case "pl:u": - return new ISharedFontManager(); - - case "pm:shell": - return new IShellInterface(); - - case "prepo:a": - return new IPrepoService(); - - case "prepo:u": - return new IPrepoService(); - - case "psm": - return new IPsmServer(); - - case "set": - return new ISettingsServer(); - - case "set:sys": - return new ISystemSettingsServer(); - - case "sfdnsres": - return new IResolver(); - - case "sm:": - return new IUserInterface(); - - case "ssl": - return new ISslService(); - - case "time:a": - return new Time.IStaticService(); - - case "time:s": - return new Time.IStaticService(); - - case "time:u": - return new Time.IStaticService(); - - case "vi:m": - return new IManagerRootService(); - - case "vi:s": - return new ISystemRootService(); - - case "vi:u": - return new IApplicationRootService(); - } - - if (ServiceConfiguration.IgnoreMissingServices) - { - Logger.PrintWarning(LogClass.Service, $"Missing service {name} ignored"); - return new DummyService(name); - } - - throw new NotImplementedException(name); - } - } -} diff --git a/Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs b/Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs index 3b8e595c4..d554d8c17 100644 --- a/Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs +++ b/Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs @@ -8,13 +8,14 @@ using static Ryujinx.HLE.HOS.ErrorCode; namespace Ryujinx.HLE.HOS.Services.Set { + [Service("set")] class ISettingsServer : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public ISettingsServer() + public ISettingsServer(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs b/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs index fd8ffe5ef..377f484df 100644 --- a/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs +++ b/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs @@ -11,13 +11,14 @@ using System.Text; namespace Ryujinx.HLE.HOS.Services.Set { + [Service("set:sys")] class ISystemSettingsServer : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public ISystemSettingsServer() + public ISystemSettingsServer(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs b/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs index 5a7b9f459..1460e2ef4 100644 --- a/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs +++ b/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs @@ -10,13 +10,14 @@ using static Ryujinx.HLE.HOS.ErrorCode; namespace Ryujinx.HLE.HOS.Services.Sfdnsres { + [Service("sfdnsres")] class IResolver : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IResolver() + public IResolver(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs index 914862f1c..4a663bd7e 100644 --- a/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs @@ -6,11 +6,16 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; +using System.Linq; +using System.Reflection; namespace Ryujinx.HLE.HOS.Services.Sm { + [Service("sm:")] class IUserInterface : IpcService { + private Dictionary _services; + private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; @@ -19,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.Sm private bool _isInitialized; - public IUserInterface() + public IUserInterface(ServiceCtx context = null) { _commands = new Dictionary { @@ -30,6 +35,11 @@ namespace Ryujinx.HLE.HOS.Services.Sm }; _registeredServices = new ConcurrentDictionary(); + + _services = Assembly.GetExecutingAssembly().GetTypes() + .SelectMany(type => type.GetCustomAttributes(typeof(ServiceAttribute), true) + .Select(service => (((ServiceAttribute)service).Name, type))) + .ToDictionary(service => service.Name, service => service.type); } public static void InitializePort(Horizon system) @@ -75,7 +85,26 @@ namespace Ryujinx.HLE.HOS.Services.Sm } else { - session.ClientSession.Service = ServiceFactory.MakeService(context.Device.System, name); + if (_services.TryGetValue(name, out Type type)) + { + ServiceAttribute serviceAttribute = (ServiceAttribute)type.GetCustomAttributes(typeof(ServiceAttribute)).First(service => ((ServiceAttribute)service).Name == name); + + session.ClientSession.Service = serviceAttribute.Parameter != null ? (IpcService)Activator.CreateInstance(type, context, serviceAttribute.Parameter) + : (IpcService)Activator.CreateInstance(type, context); + } + else + { + if (ServiceConfiguration.IgnoreMissingServices) + { + Logger.PrintWarning(LogClass.Service, $"Missing service {name} ignored"); + + session.ClientSession.Service = new DummyService(name); + } + else + { + throw new NotImplementedException(name); + } + } } if (context.Process.HandleTable.GenerateHandle(session.ClientSession, out int handle) != KernelResult.Success) diff --git a/Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs b/Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs index cae8d8d02..624cb0749 100644 --- a/Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs @@ -5,6 +5,7 @@ using System.Security.Cryptography; namespace Ryujinx.HLE.HOS.Services.Spl { + [Service("csrng")] class IRandomInterface : IpcService, IDisposable { private Dictionary _commands; @@ -13,7 +14,7 @@ namespace Ryujinx.HLE.HOS.Services.Spl private RNGCryptoServiceProvider _rng; - public IRandomInterface() + public IRandomInterface(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs b/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs index 5afc8c72e..67e025e86 100644 --- a/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs +++ b/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs @@ -4,13 +4,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Ssl { + [Service("ssl")] class ISslService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public ISslService() + public ISslService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs b/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs index 107d0578d..1406c2b56 100644 --- a/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs +++ b/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs @@ -5,6 +5,9 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Time { + [Service("time:a")] + [Service("time:s")] + [Service("time:u")] class IStaticService : IpcService { private int _timeSharedMemoryNativeHandle = 0; @@ -15,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Time private static readonly DateTime StartupDate = DateTime.UtcNow; - public IStaticService() + public IStaticService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs index 66ab16bdd..27ffcc931 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Vi { + [Service("vi:u")] class IApplicationRootService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IApplicationRootService() + public IApplicationRootService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs index 0f0a4f264..59f76e933 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Vi { + [Service("vi:m")] class IManagerRootService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public IManagerRootService() + public IManagerRootService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs index 5e255ce5a..6a8aed074 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Vi { + [Service("vi:s")] class ISystemRootService : IpcService { private Dictionary _commands; public override IReadOnlyDictionary Commands => _commands; - public ISystemRootService() + public ISystemRootService(ServiceCtx context) { _commands = new Dictionary { diff --git a/Ryujinx.HLE/Ryujinx.HLE.csproj b/Ryujinx.HLE/Ryujinx.HLE.csproj index 50d84c3fd..099a2cd98 100644 --- a/Ryujinx.HLE/Ryujinx.HLE.csproj +++ b/Ryujinx.HLE/Ryujinx.HLE.csproj @@ -4,6 +4,7 @@ netcoreapp2.1 win10-x64;osx-x64;linux-x64 Debug;Release;Profile Debug;Profile Release + 7.1