aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2019-07-10 17:59:54 +0200
committergdkchan <gab.dark.100@gmail.com>2019-07-10 12:59:54 -0300
commit596b61ce1fc9ac0397c3ea74a1033a3be5608512 (patch)
tree28c503be420909834977df6b306023d1944bb088
parente5b88de22a6f228d83e741cf9bcff144b3eff25a (diff)
IPC services refactoring (#726)
* IPC services refactoring - Use custom Attributes to handle services. - Add a way to set the permissions and fix the bsd service to use it. - Little cleanup. - C#7.1 is required. * fix var name * fix syntax * Change Permission to Parameter * Delete BsdServicePermissionLevel.cs * Fix Linq
-rw-r--r--Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs4
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Apm/IManager.cs4
-rw-r--r--Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs6
-rw-r--r--Ryujinx.HLE/HOS/Services/Bsd/IClient.cs13
-rw-r--r--Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Es/IETicketService.cs9
-rw-r--r--Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs11
-rw-r--r--Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs9
-rw-r--r--Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Lm/ILogService.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Lr/ILocationResolverManager.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Mm/IRequest.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Ncm/IContentManager.cs7
-rw-r--r--Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs6
-rw-r--r--Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs6
-rw-r--r--Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs6
-rw-r--r--Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs4
-rw-r--r--Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/ServiceAttributes.cs17
-rw-r--r--Ryujinx.HLE/HOS/Services/ServiceConfiguration.cs7
-rw-r--r--Ryujinx.HLE/HOS/Services/ServiceFactory.cs236
-rw-r--r--Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs33
-rw-r--r--Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/IStaticService.cs5
-rw-r--r--Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs3
-rw-r--r--Ryujinx.HLE/Ryujinx.HLE.csproj1
48 files changed, 175 insertions, 299 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs
index 101cb361..3f00ae66 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<int, ServiceProcessRequest> Commands => _commands;
- public IAccountService()
+ public IAccountService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs b/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs
index 0d067b16..64bb6745 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IAllSystemAppletProxiesService()
+ public IAllSystemAppletProxiesService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs
index 88792a16..8ca05868 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IApplicationProxyService()
+ public IApplicationProxyService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Apm/IManager.cs b/Ryujinx.HLE/HOS/Services/Apm/IManager.cs
index cd86e516..02f3661a 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IManager()
+ public IManager(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs
index a276c96e..e4e037de 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<int, ServiceProcessRequest> Commands => _commands;
- public IAudioOutManager()
+ public IAudioOutManager(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs
index 18e9184c..c757d5fd 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<int, ServiceProcessRequest> Commands => _commands;
- public IAudioRendererManager()
+ public IAudioRendererManager(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs
index 0b5e12f0..e66a9fe6 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IHardwareOpusDecoderManager()
+ public IHardwareOpusDecoderManager(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs b/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs
index 6523aa63..6ed7ec3f 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IServiceCreator()
+ public IServiceCreator(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs b/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs
index 86d914d4..0d5775d5 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<WsaError, LinuxError> _errorMap = new Dictionary<WsaError, LinuxError>
{
// WSAEINTR
@@ -95,15 +96,15 @@ namespace Ryujinx.HLE.HOS.Services.Bsd
{0, 0}
};
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
private bool _isPrivileged;
private List<BsdSocket> _sockets = new List<BsdSocket>();
- public IClient(bool isPrivileged)
+ private Dictionary<int, ServiceProcessRequest> _commands;
+
+ public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
+
+ public IClient(ServiceCtx context, bool isPrivileged)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs b/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs
index 82da2451..f10095ed 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IAlbumAccessorService()
+ public IAlbumAccessorService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs b/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs
index 9273b394..e37c51e2 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IScreenshotService()
+ public IScreenshotService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Es/IETicketService.cs b/Ryujinx.HLE/HOS/Services/Es/IETicketService.cs
index 049e94db..4aa0a7fa 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- private bool _isInitialized;
-
- public IeTicketService()
+ public IeTicketService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
-
+ //...
};
}
}
-}
+} \ 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 dea9d9ae..af97391d 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<int, ServiceProcessRequest> _commands;
-
private FriendServicePermissionLevel _permissionLevel;
+ private Dictionary<int, ServiceProcessRequest> _commands;
+
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IServiceCreator(FriendServicePermissionLevel permissionLevel)
+ public IServiceCreator(ServiceCtx context, FriendServicePermissionLevel permissionLevel)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs
index a1afe9be..84869bf5 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IFileSystemProxy()
+ public IFileSystemProxy(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs
index 7e48a186..0ea7f191 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<int, ServiceProcessRequest> _commands;
@@ -40,7 +41,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IHidServer(Horizon system)
+ public IHidServer(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
@@ -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 da1fbc18..a720ef4d 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<int, ServiceProcessRequest> Commands => _commands;
- public IIrSensorServer()
+ public IIrSensorServer(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs b/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs
index 49edab59..8820e2d4 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<int, ServiceProcessRequest> _commands;
@@ -112,7 +113,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr
private bool _isInitialized;
- public IRoInterface()
+ public IRoInterface(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs b/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs
index 37621c31..0be76866 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public ILogService()
+ public ILogService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Lr/ILocationResolverManager.cs b/Ryujinx.HLE/HOS/Services/Lr/ILocationResolverManager.cs
index 4b2de6b3..00186037 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public ILocationResolverManager()
+ public ILocationResolverManager(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs b/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs
index 932e5b0d..6d450b21 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IRequest()
+ public IRequest(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>()
{
diff --git a/Ryujinx.HLE/HOS/Services/Ncm/IContentManager.cs b/Ryujinx.HLE/HOS/Services/Ncm/IContentManager.cs
index bd92a450..6dc46dc1 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IContentManager()
+ public IContentManager(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
-
+ //...
};
}
}
-}
+} \ 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 dad1026e..8350b37c 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IUserManager()
+ public IUserManager(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs b/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs
index 42d9c78e..91b4d129 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IStaticService()
+ public IStaticService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs b/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs
index 9139c9bf..fe845f87 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IAddOnContentManager()
+ public IAddOnContentManager(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs
index 8c0fa41a..88e66964 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IApplicationManagerInterface()
+ public IApplicationManagerInterface(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs
index 89dde1f9..7c42d3ed 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IServiceGetterInterface()
+ public IServiceGetterInterface(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
@@ -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 5499e235..503b2f10 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public ISystemUpdateInterface()
+ public ISystemUpdateInterface(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs
index 6b7c4193..c8a31e16 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IVulnerabilityManagerInterface()
+ public IVulnerabilityManagerInterface(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs b/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs
index dcfaef78..bfd91c44 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<int, ServiceProcessRequest>()
{
@@ -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 92500187..372560e6 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IParentalControlServiceFactory()
+ public IParentalControlServiceFactory(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs b/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs
index 1c67d356..7fc4e6cd 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public ISharedFontManager()
+ public ISharedFontManager(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs b/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs
index 35fdd547..69e221eb 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IShellInterface()
+ public IShellInterface(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs b/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs
index a3cb5cc9..09976445 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IPrepoService()
+ public IPrepoService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs b/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs
index 02bc5524..2310e8b9 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<int, ServiceProcessRequest> Commands => _commands;
- public IPsmServer()
+ public IPsmServer(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/ServiceAttributes.cs b/Ryujinx.HLE/HOS/Services/ServiceAttributes.cs
new file mode 100644
index 00000000..9ca775af
--- /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 00000000..d73c76d9
--- /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 3edb5619..00000000
--- 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 3b8e595c..d554d8c1 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public ISettingsServer()
+ public ISettingsServer(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs b/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs
index fd8ffe5e..377f484d 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public ISystemSettingsServer()
+ public ISystemSettingsServer(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs b/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs
index 5a7b9f45..1460e2ef 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IResolver()
+ public IResolver(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs
index 914862f1..4a663bd7 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<string, Type> _services;
+
private Dictionary<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> 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<int, ServiceProcessRequest>
{
@@ -30,6 +35,11 @@ namespace Ryujinx.HLE.HOS.Services.Sm
};
_registeredServices = new ConcurrentDictionary<string, KPort>();
+
+ _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 cae8d8d0..624cb074 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<int, ServiceProcessRequest> _commands;
@@ -13,7 +14,7 @@ namespace Ryujinx.HLE.HOS.Services.Spl
private RNGCryptoServiceProvider _rng;
- public IRandomInterface()
+ public IRandomInterface(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs b/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs
index 5afc8c72..67e025e8 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public ISslService()
+ public ISslService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs b/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs
index 107d0578..1406c2b5 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<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs
index 66ab16bd..27ffcc93 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IApplicationRootService()
+ public IApplicationRootService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs
index 0f0a4f26..59f76e93 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public IManagerRootService()
+ public IManagerRootService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs
index 5e255ce5..6a8aed07 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<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- public ISystemRootService()
+ public ISystemRootService(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
diff --git a/Ryujinx.HLE/Ryujinx.HLE.csproj b/Ryujinx.HLE/Ryujinx.HLE.csproj
index 50d84c3f..099a2cd9 100644
--- a/Ryujinx.HLE/Ryujinx.HLE.csproj
+++ b/Ryujinx.HLE/Ryujinx.HLE.csproj
@@ -4,6 +4,7 @@
<TargetFramework>netcoreapp2.1</TargetFramework>
<RuntimeIdentifiers>win10-x64;osx-x64;linux-x64</RuntimeIdentifiers>
<Configurations>Debug;Release;Profile Debug;Profile Release</Configurations>
+ <LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">