Initial support for the new 12.x IPC system (#2182)
* Rename CommandAttribute as CommandHIpcAttribute to prepare for 12.x changes * Implement inital support for TIPC and adds SM command ids * *Ipc to *ipc * Missed a ref in last commit... * CommandAttributeTIpc to CommandAttributeTipc * Addresses comment and fixes some bugs around TIPC doesn't have any padding requirements as buffer C isn't a thing Fix for RegisterService inverting two argument only on TIPC
This commit is contained in:
parent
faa654dbaf
commit
0746b83edf
132 changed files with 1077 additions and 951 deletions
|
@ -1,4 +1,5 @@
|
|||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.Exceptions;
|
||||
using Ryujinx.HLE.HOS.Ipc;
|
||||
using Ryujinx.HLE.HOS.Kernel;
|
||||
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||
|
@ -36,7 +37,8 @@ namespace Ryujinx.HLE.HOS.Services.Sm
|
|||
_commonServer = new ServerBase(context, "CommonServer");
|
||||
}
|
||||
|
||||
[Command(0)]
|
||||
[CommandHipc(0)]
|
||||
[CommandTipc(0)] // 12.0.0+
|
||||
// Initialize(pid, u64 reserved)
|
||||
public ResultCode Initialize(ServiceCtx context)
|
||||
{
|
||||
|
@ -45,7 +47,8 @@ namespace Ryujinx.HLE.HOS.Services.Sm
|
|||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(1)]
|
||||
[CommandHipc(1)]
|
||||
[CommandTipc(1)] // 12.0.0+
|
||||
// GetService(ServiceName name) -> handle<move, session>
|
||||
public ResultCode GetService(ServiceCtx context)
|
||||
{
|
||||
|
@ -111,9 +114,9 @@ namespace Ryujinx.HLE.HOS.Services.Sm
|
|||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(2)]
|
||||
// RegisterService(ServiceName name, u8, u32 maxHandles) -> handle<move, port>
|
||||
public ResultCode RegisterService(ServiceCtx context)
|
||||
[CommandHipc(2)]
|
||||
// RegisterService(ServiceName name, u8 isLight, u32 maxHandles) -> handle<move, port>
|
||||
public ResultCode RegisterServiceHipc(ServiceCtx context)
|
||||
{
|
||||
if (!_isInitialized)
|
||||
{
|
||||
|
@ -130,6 +133,33 @@ namespace Ryujinx.HLE.HOS.Services.Sm
|
|||
|
||||
int maxSessions = context.RequestData.ReadInt32();
|
||||
|
||||
return RegisterService(context, name, isLight, maxSessions);
|
||||
}
|
||||
|
||||
[CommandTipc(2)] // 12.0.0+
|
||||
// RegisterService(ServiceName name, u32 maxHandles, u8 isLight) -> handle<move, port>
|
||||
public ResultCode RegisterServiceTipc(ServiceCtx context)
|
||||
{
|
||||
if (!_isInitialized)
|
||||
{
|
||||
return ResultCode.NotInitialized;
|
||||
}
|
||||
|
||||
long namePosition = context.RequestData.BaseStream.Position;
|
||||
|
||||
string name = ReadName(context);
|
||||
|
||||
context.RequestData.BaseStream.Seek(namePosition + 8, SeekOrigin.Begin);
|
||||
|
||||
int maxSessions = context.RequestData.ReadInt32();
|
||||
|
||||
bool isLight = (context.RequestData.ReadInt32() & 1) != 0;
|
||||
|
||||
return RegisterService(context, name, isLight, maxSessions);
|
||||
}
|
||||
|
||||
private ResultCode RegisterService(ServiceCtx context, string name, bool isLight, int maxSessions)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
return ResultCode.InvalidName;
|
||||
|
@ -154,7 +184,8 @@ namespace Ryujinx.HLE.HOS.Services.Sm
|
|||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(3)]
|
||||
[CommandHipc(3)]
|
||||
[CommandTipc(3)] // 12.0.0+
|
||||
// UnregisterService(ServiceName name)
|
||||
public ResultCode UnregisterService(ServiceCtx context)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue