diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-12-01 20:23:43 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-02 00:23:43 +0100 |
| commit | cf6cd714884c41e9550757e364c2f4f5b04fc7f3 (patch) | |
| tree | bea748b4d1a350e5b8075d63ec9d39d49693829d /Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs | |
| parent | 461c24092ae6e148d896c18aa3e86220c89981f8 (diff) | |
IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel (#1458)
* IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel
* Fix for applet transfer memory + some nits
* Keep handles if possible to avoid server handle table exhaustion
* Fix IPC ZeroFill bug
* am: Correctly implement CreateManagedDisplayLayer and implement CreateManagedDisplaySeparableLayer
CreateManagedDisplaySeparableLayer is requires since 10.x+ when appletResourceUserId != 0
* Make it exit properly
* Make ServiceNotImplementedException show the full message again
* Allow yielding execution to avoid starving other threads
* Only wait if active
* Merge IVirtualMemoryManager and IAddressSpaceManager
* Fix Ro loading data from the wrong process
Co-authored-by: Thog <me@thog.eu>
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs index d8f31faf..69bb3708 100644 --- a/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs @@ -1,5 +1,6 @@ using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Kernel.Ipc; using System; @@ -11,18 +12,17 @@ using System.Reflection; namespace Ryujinx.HLE.HOS.Services.Sm { - [Service("sm:")] class IUserInterface : IpcService { private Dictionary<string, Type> _services; - private ConcurrentDictionary<string, KPort> _registeredServices; + private readonly ConcurrentDictionary<string, KPort> _registeredServices; private readonly ServerBase _commonServer; private bool _isInitialized; - public IUserInterface(ServiceCtx context = null) : base(new ServerBase("SmServer")) + public IUserInterface(KernelContext context) { _registeredServices = new ConcurrentDictionary<string, KPort>(); @@ -31,18 +31,9 @@ namespace Ryujinx.HLE.HOS.Services.Sm .Select(service => (((ServiceAttribute)service).Name, type))) .ToDictionary(service => service.Name, service => service.type); - _commonServer = new ServerBase("CommonServer"); - } - - public static void InitializePort(Horizon system) - { - KPort port = new KPort(system.KernelContext, 256, false, 0); - - port.ClientPort.SetName("sm:"); - - IUserInterface smService = new IUserInterface(); + TrySetServer(new ServerBase(context, "SmServer") { SmObject = this }); - port.ClientPort.Service = smService; + _commonServer = new ServerBase(context, "CommonServer"); } [Command(0)] @@ -92,16 +83,13 @@ namespace Ryujinx.HLE.HOS.Services.Sm : (IpcService)Activator.CreateInstance(type, context); service.TrySetServer(_commonServer); - - session.ClientSession.Service = service; + service.Server.AddSessionObj(session.ServerSession, service); } else { if (ServiceConfiguration.IgnoreMissingServices) { Logger.Warning?.Print(LogClass.Service, $"Missing service {name} ignored"); - - session.ClientSession.Service = new DummyService(name); } else { @@ -142,7 +130,7 @@ namespace Ryujinx.HLE.HOS.Services.Sm int maxSessions = context.RequestData.ReadInt32(); - if (name == string.Empty) + if (string.IsNullOrEmpty(name)) { return ResultCode.InvalidName; } @@ -185,7 +173,7 @@ namespace Ryujinx.HLE.HOS.Services.Sm int maxSessions = context.RequestData.ReadInt32(); - if (name == string.Empty) + if (string.IsNullOrEmpty(name)) { return ResultCode.InvalidName; } |
