diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-12-18 03:33:36 -0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-18 03:33:36 -0200 |
| commit | 0039bb639493b2d1e2764cae380311ba8e87704b (patch) | |
| tree | 63a912a95c8261775c2acb8a5b9ca0f10ad4ae33 /Ryujinx.HLE/HOS/Kernel/Ipc | |
| parent | 2534a7f10c627810e6e0272b4cc9758e90f733c1 (diff) | |
Refactor SVC handler (#540)
* Refactor SVC handler
* Get rid of KernelErr
* Split kernel code files into multiple folders
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel/Ipc')
| -rw-r--r-- | Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs | 33 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs | 28 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Kernel/Ipc/KServerPort.cs | 16 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Kernel/Ipc/KSession.cs | 31 |
4 files changed, 108 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs b/Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs new file mode 100644 index 00000000..ddfe2096 --- /dev/null +++ b/Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs @@ -0,0 +1,33 @@ +using Ryujinx.HLE.HOS.Kernel.Common; + +namespace Ryujinx.HLE.HOS.Kernel.Ipc +{ + class KClientPort : KSynchronizationObject + { + private int _sessionsCount; + private int _currentCapacity; + private int _maxSessions; + + private KPort _parent; + + public KClientPort(Horizon system) : base(system) { } + + public void Initialize(KPort parent, int maxSessions) + { + _maxSessions = maxSessions; + _parent = parent; + } + + public new static KernelResult RemoveName(Horizon system, string name) + { + KAutoObject foundObj = FindNamedObject(system, name); + + if (!(foundObj is KClientPort)) + { + return KernelResult.NotFound; + } + + return KAutoObject.RemoveName(system, name); + } + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs b/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs new file mode 100644 index 00000000..16e9a111 --- /dev/null +++ b/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs @@ -0,0 +1,28 @@ +using Ryujinx.HLE.HOS.Kernel.Common; + +namespace Ryujinx.HLE.HOS.Kernel.Ipc +{ + class KPort : KAutoObject + { + public KServerPort ServerPort { get; private set; } + public KClientPort ClientPort { get; private set; } + + private long _nameAddress; + private bool _isLight; + + public KPort(Horizon system) : base(system) + { + ServerPort = new KServerPort(system); + ClientPort = new KClientPort(system); + } + + public void Initialize(int maxSessions, bool isLight, long nameAddress) + { + ServerPort.Initialize(this); + ClientPort.Initialize(this, maxSessions); + + _isLight = isLight; + _nameAddress = nameAddress; + } + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Kernel/Ipc/KServerPort.cs b/Ryujinx.HLE/HOS/Kernel/Ipc/KServerPort.cs new file mode 100644 index 00000000..d4d3bcd2 --- /dev/null +++ b/Ryujinx.HLE/HOS/Kernel/Ipc/KServerPort.cs @@ -0,0 +1,16 @@ +using Ryujinx.HLE.HOS.Kernel.Common; + +namespace Ryujinx.HLE.HOS.Kernel.Ipc +{ + class KServerPort : KSynchronizationObject + { + private KPort _parent; + + public KServerPort(Horizon system) : base(system) { } + + public void Initialize(KPort parent) + { + _parent = parent; + } + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Kernel/Ipc/KSession.cs b/Ryujinx.HLE/HOS/Kernel/Ipc/KSession.cs new file mode 100644 index 00000000..f2b30493 --- /dev/null +++ b/Ryujinx.HLE/HOS/Kernel/Ipc/KSession.cs @@ -0,0 +1,31 @@ +using Ryujinx.HLE.HOS.Services; +using System; + +namespace Ryujinx.HLE.HOS.Kernel.Ipc +{ + class KSession : IDisposable + { + public IpcService Service { get; private set; } + + public string ServiceName { get; private set; } + + public KSession(IpcService service, string serviceName) + { + Service = service; + ServiceName = serviceName; + } + + public void Dispose() + { + Dispose(true); + } + + protected virtual void Dispose(bool disposing) + { + if (disposing && Service is IDisposable disposableService) + { + disposableService.Dispose(); + } + } + } +}
\ No newline at end of file |
