Refactor SVC handler (#540)
* Refactor SVC handler * Get rid of KernelErr * Split kernel code files into multiple folders
This commit is contained in:
parent
2534a7f10c
commit
0039bb6394
105 changed files with 1894 additions and 1982 deletions
33
Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs
Normal file
33
Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
28
Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs
Normal file
28
Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
16
Ryujinx.HLE/HOS/Kernel/Ipc/KServerPort.cs
Normal file
16
Ryujinx.HLE/HOS/Kernel/Ipc/KServerPort.cs
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
31
Ryujinx.HLE/HOS/Kernel/Ipc/KSession.cs
Normal file
31
Ryujinx.HLE/HOS/Kernel/Ipc/KSession.cs
Normal file
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue