aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Horizon/Sm/Ipc/UserService.cs
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2023-01-08 13:13:39 +0100
committerGitHub <noreply@github.com>2023-01-08 12:13:39 +0000
commit550747eac6c0f6da14070c8b6d208bde6f1d1eb9 (patch)
tree1be203777156dae17a4221589c852c638b273d94 /Ryujinx.Horizon/Sm/Ipc/UserService.cs
parent3ffceab1fb220c13f5982de599d788f2e3e7cc47 (diff)
Horizon: Impl Prepo, Fixes bugs, Clean things (#4220)
* Horizon: Impl Prepo, Fixes bugs, Clean things * remove ToArray() * resultCode > status * Remove old services * Addresses gdkchan's comments and more cleanup * Addresses Gdkchan's feedback 2 * Reorganize services, make sure service are loaded before guest Co-Authored-By: gdkchan <5624669+gdkchan@users.noreply.github.com> * Create interfaces for lm and sm Co-authored-by: gdkchan <5624669+gdkchan@users.noreply.github.com>
Diffstat (limited to 'Ryujinx.Horizon/Sm/Ipc/UserService.cs')
-rw-r--r--Ryujinx.Horizon/Sm/Ipc/UserService.cs66
1 files changed, 66 insertions, 0 deletions
diff --git a/Ryujinx.Horizon/Sm/Ipc/UserService.cs b/Ryujinx.Horizon/Sm/Ipc/UserService.cs
new file mode 100644
index 00000000..d093913a
--- /dev/null
+++ b/Ryujinx.Horizon/Sm/Ipc/UserService.cs
@@ -0,0 +1,66 @@
+using Ryujinx.Horizon.Common;
+using Ryujinx.Horizon.Sdk.Sf;
+using Ryujinx.Horizon.Sdk.Sm;
+using Ryujinx.Horizon.Sm.Impl;
+
+namespace Ryujinx.Horizon.Sm.Ipc
+{
+ partial class UserService : IUserService
+ {
+ private readonly ServiceManager _serviceManager;
+
+ private ulong _clientProcessId;
+ private bool _initialized;
+
+ public UserService(ServiceManager serviceManager)
+ {
+ _serviceManager = serviceManager;
+ }
+
+ [CmifCommand(0)]
+ public Result Initialize([ClientProcessId] ulong clientProcessId)
+ {
+ _clientProcessId = clientProcessId;
+ _initialized = true;
+
+ return Result.Success;
+ }
+
+ [CmifCommand(1)]
+ public Result GetService([MoveHandle] out int handle, ServiceName name)
+ {
+ if (!_initialized)
+ {
+ handle = 0;
+
+ return SmResult.InvalidClient;
+ }
+
+ return _serviceManager.GetService(out handle, _clientProcessId, name);
+ }
+
+ [CmifCommand(2)]
+ public Result RegisterService([MoveHandle] out int handle, ServiceName name, int maxSessions, bool isLight)
+ {
+ if (!_initialized)
+ {
+ handle = 0;
+
+ return SmResult.InvalidClient;
+ }
+
+ return _serviceManager.RegisterService(out handle, _clientProcessId, name, maxSessions, isLight);
+ }
+
+ [CmifCommand(3)]
+ public Result UnregisterService(ServiceName name)
+ {
+ if (!_initialized)
+ {
+ return SmResult.InvalidClient;
+ }
+
+ return _serviceManager.UnregisterService(_clientProcessId, name);
+ }
+ }
+} \ No newline at end of file