Adjust naming conventions and general refactoring in HLE Project (#527)
* Rename enum fields * Naming conventions * Remove unneeded ".this" * Remove unneeded semicolons * Remove unused Usings * Don't use var * Remove unneeded enum underlying types * Explicitly label class visibility * Remove unneeded @ prefixes * Remove unneeded commas * Remove unneeded if expressions * Method doesn't use unsafe code * Remove unneeded casts * Initialized objects don't need an empty constructor * Remove settings from DotSettings * Revert "Explicitly label class visibility" This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51. * Small changes * Revert external enum renaming * Changes from feedback * Apply previous refactorings to the merged code
This commit is contained in:
parent
3615a70cae
commit
fb1d9493a3
298 changed files with 12034 additions and 12037 deletions
|
@ -8,20 +8,20 @@ namespace Ryujinx.HLE.HOS.Ipc
|
|||
public long Size { get; private set; }
|
||||
public int Flags { get; private set; }
|
||||
|
||||
public IpcBuffDesc(BinaryReader Reader)
|
||||
public IpcBuffDesc(BinaryReader reader)
|
||||
{
|
||||
long Word0 = Reader.ReadUInt32();
|
||||
long Word1 = Reader.ReadUInt32();
|
||||
long Word2 = Reader.ReadUInt32();
|
||||
long word0 = reader.ReadUInt32();
|
||||
long word1 = reader.ReadUInt32();
|
||||
long word2 = reader.ReadUInt32();
|
||||
|
||||
Position = Word1;
|
||||
Position |= (Word2 << 4) & 0x0f00000000;
|
||||
Position |= (Word2 << 34) & 0x7000000000;
|
||||
Position = word1;
|
||||
Position |= (word2 << 4) & 0x0f00000000;
|
||||
Position |= (word2 << 34) & 0x7000000000;
|
||||
|
||||
Size = Word0;
|
||||
Size |= (Word2 << 8) & 0xf00000000;
|
||||
Size = word0;
|
||||
Size |= (word2 << 8) & 0xf00000000;
|
||||
|
||||
Flags = (int)Word2 & 3;
|
||||
Flags = (int)word2 & 3;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,80 +12,80 @@ namespace Ryujinx.HLE.HOS.Ipc
|
|||
public int[] ToCopy { get; private set; }
|
||||
public int[] ToMove { get; private set; }
|
||||
|
||||
public IpcHandleDesc(BinaryReader Reader)
|
||||
public IpcHandleDesc(BinaryReader reader)
|
||||
{
|
||||
int Word = Reader.ReadInt32();
|
||||
int word = reader.ReadInt32();
|
||||
|
||||
HasPId = (Word & 1) != 0;
|
||||
HasPId = (word & 1) != 0;
|
||||
|
||||
ToCopy = new int[(Word >> 1) & 0xf];
|
||||
ToMove = new int[(Word >> 5) & 0xf];
|
||||
ToCopy = new int[(word >> 1) & 0xf];
|
||||
ToMove = new int[(word >> 5) & 0xf];
|
||||
|
||||
PId = HasPId ? Reader.ReadInt64() : 0;
|
||||
PId = HasPId ? reader.ReadInt64() : 0;
|
||||
|
||||
for (int Index = 0; Index < ToCopy.Length; Index++)
|
||||
for (int index = 0; index < ToCopy.Length; index++)
|
||||
{
|
||||
ToCopy[Index] = Reader.ReadInt32();
|
||||
ToCopy[index] = reader.ReadInt32();
|
||||
}
|
||||
|
||||
for (int Index = 0; Index < ToMove.Length; Index++)
|
||||
for (int index = 0; index < ToMove.Length; index++)
|
||||
{
|
||||
ToMove[Index] = Reader.ReadInt32();
|
||||
ToMove[index] = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
public IpcHandleDesc(int[] Copy, int[] Move)
|
||||
public IpcHandleDesc(int[] copy, int[] move)
|
||||
{
|
||||
ToCopy = Copy ?? throw new ArgumentNullException(nameof(Copy));
|
||||
ToMove = Move ?? throw new ArgumentNullException(nameof(Move));
|
||||
ToCopy = copy ?? throw new ArgumentNullException(nameof(copy));
|
||||
ToMove = move ?? throw new ArgumentNullException(nameof(move));
|
||||
}
|
||||
|
||||
public IpcHandleDesc(int[] Copy, int[] Move, long PId) : this(Copy, Move)
|
||||
public IpcHandleDesc(int[] copy, int[] move, long pId) : this(copy, move)
|
||||
{
|
||||
this.PId = PId;
|
||||
PId = pId;
|
||||
|
||||
HasPId = true;
|
||||
}
|
||||
|
||||
public static IpcHandleDesc MakeCopy(params int[] Handles)
|
||||
public static IpcHandleDesc MakeCopy(params int[] handles)
|
||||
{
|
||||
return new IpcHandleDesc(Handles, new int[0]);
|
||||
return new IpcHandleDesc(handles, new int[0]);
|
||||
}
|
||||
|
||||
public static IpcHandleDesc MakeMove(params int[] Handles)
|
||||
public static IpcHandleDesc MakeMove(params int[] handles)
|
||||
{
|
||||
return new IpcHandleDesc(new int[0], Handles);
|
||||
return new IpcHandleDesc(new int[0], handles);
|
||||
}
|
||||
|
||||
public byte[] GetBytes()
|
||||
{
|
||||
using (MemoryStream MS = new MemoryStream())
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
BinaryWriter Writer = new BinaryWriter(MS);
|
||||
BinaryWriter writer = new BinaryWriter(ms);
|
||||
|
||||
int Word = HasPId ? 1 : 0;
|
||||
int word = HasPId ? 1 : 0;
|
||||
|
||||
Word |= (ToCopy.Length & 0xf) << 1;
|
||||
Word |= (ToMove.Length & 0xf) << 5;
|
||||
word |= (ToCopy.Length & 0xf) << 1;
|
||||
word |= (ToMove.Length & 0xf) << 5;
|
||||
|
||||
Writer.Write(Word);
|
||||
writer.Write(word);
|
||||
|
||||
if (HasPId)
|
||||
{
|
||||
Writer.Write((long)PId);
|
||||
writer.Write(PId);
|
||||
}
|
||||
|
||||
foreach (int Handle in ToCopy)
|
||||
foreach (int handle in ToCopy)
|
||||
{
|
||||
Writer.Write(Handle);
|
||||
writer.Write(handle);
|
||||
}
|
||||
|
||||
foreach (int Handle in ToMove)
|
||||
foreach (int handle in ToMove)
|
||||
{
|
||||
Writer.Write(Handle);
|
||||
writer.Write(handle);
|
||||
}
|
||||
|
||||
return MS.ToArray();
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,61 +8,61 @@ namespace Ryujinx.HLE.HOS.Ipc
|
|||
static class IpcHandler
|
||||
{
|
||||
public static long IpcCall(
|
||||
Switch Device,
|
||||
KProcess Process,
|
||||
MemoryManager Memory,
|
||||
KSession Session,
|
||||
IpcMessage Request,
|
||||
long CmdPtr)
|
||||
Switch device,
|
||||
KProcess process,
|
||||
MemoryManager memory,
|
||||
KSession session,
|
||||
IpcMessage request,
|
||||
long cmdPtr)
|
||||
{
|
||||
IpcMessage Response = new IpcMessage();
|
||||
IpcMessage response = new IpcMessage();
|
||||
|
||||
using (MemoryStream Raw = new MemoryStream(Request.RawData))
|
||||
using (MemoryStream raw = new MemoryStream(request.RawData))
|
||||
{
|
||||
BinaryReader ReqReader = new BinaryReader(Raw);
|
||||
BinaryReader reqReader = new BinaryReader(raw);
|
||||
|
||||
if (Request.Type == IpcMessageType.Request ||
|
||||
Request.Type == IpcMessageType.RequestWithContext)
|
||||
if (request.Type == IpcMessageType.Request ||
|
||||
request.Type == IpcMessageType.RequestWithContext)
|
||||
{
|
||||
Response.Type = IpcMessageType.Response;
|
||||
response.Type = IpcMessageType.Response;
|
||||
|
||||
using (MemoryStream ResMS = new MemoryStream())
|
||||
using (MemoryStream resMs = new MemoryStream())
|
||||
{
|
||||
BinaryWriter ResWriter = new BinaryWriter(ResMS);
|
||||
BinaryWriter resWriter = new BinaryWriter(resMs);
|
||||
|
||||
ServiceCtx Context = new ServiceCtx(
|
||||
Device,
|
||||
Process,
|
||||
Memory,
|
||||
Session,
|
||||
Request,
|
||||
Response,
|
||||
ReqReader,
|
||||
ResWriter);
|
||||
ServiceCtx context = new ServiceCtx(
|
||||
device,
|
||||
process,
|
||||
memory,
|
||||
session,
|
||||
request,
|
||||
response,
|
||||
reqReader,
|
||||
resWriter);
|
||||
|
||||
Session.Service.CallMethod(Context);
|
||||
session.Service.CallMethod(context);
|
||||
|
||||
Response.RawData = ResMS.ToArray();
|
||||
response.RawData = resMs.ToArray();
|
||||
}
|
||||
}
|
||||
else if (Request.Type == IpcMessageType.Control ||
|
||||
Request.Type == IpcMessageType.ControlWithContext)
|
||||
else if (request.Type == IpcMessageType.Control ||
|
||||
request.Type == IpcMessageType.ControlWithContext)
|
||||
{
|
||||
long Magic = ReqReader.ReadInt64();
|
||||
long CmdId = ReqReader.ReadInt64();
|
||||
long magic = reqReader.ReadInt64();
|
||||
long cmdId = reqReader.ReadInt64();
|
||||
|
||||
switch (CmdId)
|
||||
switch (cmdId)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Request = FillResponse(Response, 0, Session.Service.ConvertToDomain());
|
||||
request = FillResponse(response, 0, session.Service.ConvertToDomain());
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 3:
|
||||
{
|
||||
Request = FillResponse(Response, 0, 0x500);
|
||||
request = FillResponse(response, 0, 0x500);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -71,73 +71,73 @@ namespace Ryujinx.HLE.HOS.Ipc
|
|||
case 2:
|
||||
case 4:
|
||||
{
|
||||
int Unknown = ReqReader.ReadInt32();
|
||||
int unknown = reqReader.ReadInt32();
|
||||
|
||||
if (Process.HandleTable.GenerateHandle(Session, out int Handle) != KernelResult.Success)
|
||||
if (process.HandleTable.GenerateHandle(session, out int handle) != KernelResult.Success)
|
||||
{
|
||||
throw new InvalidOperationException("Out of handles!");
|
||||
}
|
||||
|
||||
Response.HandleDesc = IpcHandleDesc.MakeMove(Handle);
|
||||
response.HandleDesc = IpcHandleDesc.MakeMove(handle);
|
||||
|
||||
Request = FillResponse(Response, 0);
|
||||
request = FillResponse(response, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: throw new NotImplementedException(CmdId.ToString());
|
||||
default: throw new NotImplementedException(cmdId.ToString());
|
||||
}
|
||||
}
|
||||
else if (Request.Type == IpcMessageType.CloseSession)
|
||||
else if (request.Type == IpcMessageType.CloseSession)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException(Request.Type.ToString());
|
||||
throw new NotImplementedException(request.Type.ToString());
|
||||
}
|
||||
|
||||
Memory.WriteBytes(CmdPtr, Response.GetBytes(CmdPtr));
|
||||
memory.WriteBytes(cmdPtr, response.GetBytes(cmdPtr));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static IpcMessage FillResponse(IpcMessage Response, long Result, params int[] Values)
|
||||
private static IpcMessage FillResponse(IpcMessage response, long result, params int[] values)
|
||||
{
|
||||
using (MemoryStream MS = new MemoryStream())
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
BinaryWriter Writer = new BinaryWriter(MS);
|
||||
BinaryWriter writer = new BinaryWriter(ms);
|
||||
|
||||
foreach (int Value in Values)
|
||||
foreach (int value in values)
|
||||
{
|
||||
Writer.Write(Value);
|
||||
writer.Write(value);
|
||||
}
|
||||
|
||||
return FillResponse(Response, Result, MS.ToArray());
|
||||
return FillResponse(response, result, ms.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
private static IpcMessage FillResponse(IpcMessage Response, long Result, byte[] Data = null)
|
||||
private static IpcMessage FillResponse(IpcMessage response, long result, byte[] data = null)
|
||||
{
|
||||
Response.Type = IpcMessageType.Response;
|
||||
response.Type = IpcMessageType.Response;
|
||||
|
||||
using (MemoryStream MS = new MemoryStream())
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
BinaryWriter Writer = new BinaryWriter(MS);
|
||||
BinaryWriter writer = new BinaryWriter(ms);
|
||||
|
||||
Writer.Write(IpcMagic.Sfco);
|
||||
Writer.Write(Result);
|
||||
writer.Write(IpcMagic.Sfco);
|
||||
writer.Write(result);
|
||||
|
||||
if (Data != null)
|
||||
if (data != null)
|
||||
{
|
||||
Writer.Write(Data);
|
||||
writer.Write(data);
|
||||
}
|
||||
|
||||
Response.RawData = MS.ToArray();
|
||||
response.RawData = ms.ToArray();
|
||||
}
|
||||
|
||||
return Response;
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,183 +30,185 @@ namespace Ryujinx.HLE.HOS.Ipc
|
|||
ObjectIds = new List<int>();
|
||||
}
|
||||
|
||||
public IpcMessage(byte[] Data, long CmdPtr) : this()
|
||||
public IpcMessage(byte[] data, long cmdPtr) : this()
|
||||
{
|
||||
using (MemoryStream MS = new MemoryStream(Data))
|
||||
using (MemoryStream ms = new MemoryStream(data))
|
||||
{
|
||||
BinaryReader Reader = new BinaryReader(MS);
|
||||
BinaryReader reader = new BinaryReader(ms);
|
||||
|
||||
Initialize(Reader, CmdPtr);
|
||||
Initialize(reader, cmdPtr);
|
||||
}
|
||||
}
|
||||
|
||||
private void Initialize(BinaryReader Reader, long CmdPtr)
|
||||
private void Initialize(BinaryReader reader, long cmdPtr)
|
||||
{
|
||||
int Word0 = Reader.ReadInt32();
|
||||
int Word1 = Reader.ReadInt32();
|
||||
int word0 = reader.ReadInt32();
|
||||
int word1 = reader.ReadInt32();
|
||||
|
||||
Type = (IpcMessageType)(Word0 & 0xffff);
|
||||
Type = (IpcMessageType)(word0 & 0xffff);
|
||||
|
||||
int PtrBuffCount = (Word0 >> 16) & 0xf;
|
||||
int SendBuffCount = (Word0 >> 20) & 0xf;
|
||||
int RecvBuffCount = (Word0 >> 24) & 0xf;
|
||||
int XchgBuffCount = (Word0 >> 28) & 0xf;
|
||||
int ptrBuffCount = (word0 >> 16) & 0xf;
|
||||
int sendBuffCount = (word0 >> 20) & 0xf;
|
||||
int recvBuffCount = (word0 >> 24) & 0xf;
|
||||
int xchgBuffCount = (word0 >> 28) & 0xf;
|
||||
|
||||
int RawDataSize = (Word1 >> 0) & 0x3ff;
|
||||
int RecvListFlags = (Word1 >> 10) & 0xf;
|
||||
bool HndDescEnable = ((Word1 >> 31) & 0x1) != 0;
|
||||
int rawDataSize = (word1 >> 0) & 0x3ff;
|
||||
int recvListFlags = (word1 >> 10) & 0xf;
|
||||
bool hndDescEnable = ((word1 >> 31) & 0x1) != 0;
|
||||
|
||||
if (HndDescEnable)
|
||||
if (hndDescEnable)
|
||||
{
|
||||
HandleDesc = new IpcHandleDesc(Reader);
|
||||
HandleDesc = new IpcHandleDesc(reader);
|
||||
}
|
||||
|
||||
for (int Index = 0; Index < PtrBuffCount; Index++)
|
||||
for (int index = 0; index < ptrBuffCount; index++)
|
||||
{
|
||||
PtrBuff.Add(new IpcPtrBuffDesc(Reader));
|
||||
PtrBuff.Add(new IpcPtrBuffDesc(reader));
|
||||
}
|
||||
|
||||
void ReadBuff(List<IpcBuffDesc> Buff, int Count)
|
||||
void ReadBuff(List<IpcBuffDesc> buff, int count)
|
||||
{
|
||||
for (int Index = 0; Index < Count; Index++)
|
||||
for (int index = 0; index < count; index++)
|
||||
{
|
||||
Buff.Add(new IpcBuffDesc(Reader));
|
||||
buff.Add(new IpcBuffDesc(reader));
|
||||
}
|
||||
}
|
||||
|
||||
ReadBuff(SendBuff, SendBuffCount);
|
||||
ReadBuff(ReceiveBuff, RecvBuffCount);
|
||||
ReadBuff(ExchangeBuff, XchgBuffCount);
|
||||
ReadBuff(SendBuff, sendBuffCount);
|
||||
ReadBuff(ReceiveBuff, recvBuffCount);
|
||||
ReadBuff(ExchangeBuff, xchgBuffCount);
|
||||
|
||||
RawDataSize *= 4;
|
||||
rawDataSize *= 4;
|
||||
|
||||
long RecvListPos = Reader.BaseStream.Position + RawDataSize;
|
||||
long recvListPos = reader.BaseStream.Position + rawDataSize;
|
||||
|
||||
long Pad0 = GetPadSize16(Reader.BaseStream.Position + CmdPtr);
|
||||
long pad0 = GetPadSize16(reader.BaseStream.Position + cmdPtr);
|
||||
|
||||
Reader.BaseStream.Seek(Pad0, SeekOrigin.Current);
|
||||
reader.BaseStream.Seek(pad0, SeekOrigin.Current);
|
||||
|
||||
int RecvListCount = RecvListFlags - 2;
|
||||
int recvListCount = recvListFlags - 2;
|
||||
|
||||
if (RecvListCount == 0)
|
||||
if (recvListCount == 0)
|
||||
{
|
||||
RecvListCount = 1;
|
||||
recvListCount = 1;
|
||||
}
|
||||
else if (RecvListCount < 0)
|
||||
else if (recvListCount < 0)
|
||||
{
|
||||
RecvListCount = 0;
|
||||
recvListCount = 0;
|
||||
}
|
||||
|
||||
RawData = Reader.ReadBytes(RawDataSize);
|
||||
RawData = reader.ReadBytes(rawDataSize);
|
||||
|
||||
Reader.BaseStream.Seek(RecvListPos, SeekOrigin.Begin);
|
||||
reader.BaseStream.Seek(recvListPos, SeekOrigin.Begin);
|
||||
|
||||
for (int Index = 0; Index < RecvListCount; Index++)
|
||||
for (int index = 0; index < recvListCount; index++)
|
||||
{
|
||||
RecvListBuff.Add(new IpcRecvListBuffDesc(Reader));
|
||||
RecvListBuff.Add(new IpcRecvListBuffDesc(reader));
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] GetBytes(long CmdPtr)
|
||||
public byte[] GetBytes(long cmdPtr)
|
||||
{
|
||||
using (MemoryStream MS = new MemoryStream())
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
BinaryWriter Writer = new BinaryWriter(MS);
|
||||
BinaryWriter writer = new BinaryWriter(ms);
|
||||
|
||||
int Word0;
|
||||
int Word1;
|
||||
int word0;
|
||||
int word1;
|
||||
|
||||
Word0 = (int)Type;
|
||||
Word0 |= (PtrBuff.Count & 0xf) << 16;
|
||||
Word0 |= (SendBuff.Count & 0xf) << 20;
|
||||
Word0 |= (ReceiveBuff.Count & 0xf) << 24;
|
||||
Word0 |= (ExchangeBuff.Count & 0xf) << 28;
|
||||
word0 = (int)Type;
|
||||
word0 |= (PtrBuff.Count & 0xf) << 16;
|
||||
word0 |= (SendBuff.Count & 0xf) << 20;
|
||||
word0 |= (ReceiveBuff.Count & 0xf) << 24;
|
||||
word0 |= (ExchangeBuff.Count & 0xf) << 28;
|
||||
|
||||
byte[] HandleData = new byte[0];
|
||||
byte[] handleData = new byte[0];
|
||||
|
||||
if (HandleDesc != null)
|
||||
{
|
||||
HandleData = HandleDesc.GetBytes();
|
||||
handleData = HandleDesc.GetBytes();
|
||||
}
|
||||
|
||||
int DataLength = RawData?.Length ?? 0;
|
||||
int dataLength = RawData?.Length ?? 0;
|
||||
|
||||
int Pad0 = (int)GetPadSize16(CmdPtr + 8 + HandleData.Length);
|
||||
int pad0 = (int)GetPadSize16(cmdPtr + 8 + handleData.Length);
|
||||
|
||||
//Apparently, padding after Raw Data is 16 bytes, however when there is
|
||||
//padding before Raw Data too, we need to subtract the size of this padding.
|
||||
//This is the weirdest padding I've seen so far...
|
||||
int Pad1 = 0x10 - Pad0;
|
||||
int pad1 = 0x10 - pad0;
|
||||
|
||||
DataLength = (DataLength + Pad0 + Pad1) / 4;
|
||||
dataLength = (dataLength + pad0 + pad1) / 4;
|
||||
|
||||
Word1 = DataLength & 0x3ff;
|
||||
word1 = dataLength & 0x3ff;
|
||||
|
||||
if (HandleDesc != null)
|
||||
{
|
||||
Word1 |= 1 << 31;
|
||||
word1 |= 1 << 31;
|
||||
}
|
||||
|
||||
Writer.Write(Word0);
|
||||
Writer.Write(Word1);
|
||||
Writer.Write(HandleData);
|
||||
writer.Write(word0);
|
||||
writer.Write(word1);
|
||||
writer.Write(handleData);
|
||||
|
||||
MS.Seek(Pad0, SeekOrigin.Current);
|
||||
ms.Seek(pad0, SeekOrigin.Current);
|
||||
|
||||
if (RawData != null)
|
||||
{
|
||||
Writer.Write(RawData);
|
||||
writer.Write(RawData);
|
||||
}
|
||||
|
||||
Writer.Write(new byte[Pad1]);
|
||||
writer.Write(new byte[pad1]);
|
||||
|
||||
return MS.ToArray();
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
private long GetPadSize16(long Position)
|
||||
private long GetPadSize16(long position)
|
||||
{
|
||||
if ((Position & 0xf) != 0)
|
||||
if ((position & 0xf) != 0)
|
||||
{
|
||||
return 0x10 - (Position & 0xf);
|
||||
return 0x10 - (position & 0xf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public (long Position, long Size) GetBufferType0x21(int Index = 0)
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public (long Position, long Size) GetBufferType0x21(int index = 0)
|
||||
{
|
||||
if (PtrBuff.Count > Index &&
|
||||
PtrBuff[Index].Position != 0 &&
|
||||
PtrBuff[Index].Size != 0)
|
||||
if (PtrBuff.Count > index &&
|
||||
PtrBuff[index].Position != 0 &&
|
||||
PtrBuff[index].Size != 0)
|
||||
{
|
||||
return (PtrBuff[Index].Position, PtrBuff[Index].Size);
|
||||
return (PtrBuff[index].Position, PtrBuff[index].Size);
|
||||
}
|
||||
|
||||
if (SendBuff.Count > Index &&
|
||||
SendBuff[Index].Position != 0 &&
|
||||
SendBuff[Index].Size != 0)
|
||||
if (SendBuff.Count > index &&
|
||||
SendBuff[index].Position != 0 &&
|
||||
SendBuff[index].Size != 0)
|
||||
{
|
||||
return (SendBuff[Index].Position, SendBuff[Index].Size);
|
||||
return (SendBuff[index].Position, SendBuff[index].Size);
|
||||
}
|
||||
|
||||
return (0, 0);
|
||||
}
|
||||
|
||||
public (long Position, long Size) GetBufferType0x22(int Index = 0)
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public (long Position, long Size) GetBufferType0x22(int index = 0)
|
||||
{
|
||||
if (RecvListBuff.Count > Index &&
|
||||
RecvListBuff[Index].Position != 0 &&
|
||||
RecvListBuff[Index].Size != 0)
|
||||
if (RecvListBuff.Count > index &&
|
||||
RecvListBuff[index].Position != 0 &&
|
||||
RecvListBuff[index].Size != 0)
|
||||
{
|
||||
return (RecvListBuff[Index].Position, RecvListBuff[Index].Size);
|
||||
return (RecvListBuff[index].Position, RecvListBuff[index].Size);
|
||||
}
|
||||
|
||||
if (ReceiveBuff.Count > Index &&
|
||||
ReceiveBuff[Index].Position != 0 &&
|
||||
ReceiveBuff[Index].Size != 0)
|
||||
if (ReceiveBuff.Count > index &&
|
||||
ReceiveBuff[index].Position != 0 &&
|
||||
ReceiveBuff[index].Size != 0)
|
||||
{
|
||||
return (ReceiveBuff[Index].Position, ReceiveBuff[Index].Size);
|
||||
return (ReceiveBuff[index].Position, ReceiveBuff[index].Size);
|
||||
}
|
||||
|
||||
return (0, 0);
|
||||
|
|
|
@ -8,19 +8,19 @@ namespace Ryujinx.HLE.HOS.Ipc
|
|||
public int Index { get; private set; }
|
||||
public long Size { get; private set; }
|
||||
|
||||
public IpcPtrBuffDesc(BinaryReader Reader)
|
||||
public IpcPtrBuffDesc(BinaryReader reader)
|
||||
{
|
||||
long Word0 = Reader.ReadUInt32();
|
||||
long Word1 = Reader.ReadUInt32();
|
||||
long word0 = reader.ReadUInt32();
|
||||
long word1 = reader.ReadUInt32();
|
||||
|
||||
Position = Word1;
|
||||
Position |= (Word0 << 20) & 0x0f00000000;
|
||||
Position |= (Word0 << 30) & 0x7000000000;
|
||||
Position = word1;
|
||||
Position |= (word0 << 20) & 0x0f00000000;
|
||||
Position |= (word0 << 30) & 0x7000000000;
|
||||
|
||||
Index = ((int)Word0 >> 0) & 0x03f;
|
||||
Index |= ((int)Word0 >> 3) & 0x1c0;
|
||||
Index = ((int)word0 >> 0) & 0x03f;
|
||||
Index |= ((int)word0 >> 3) & 0x1c0;
|
||||
|
||||
Size = (ushort)(Word0 >> 16);
|
||||
Size = (ushort)(word0 >> 16);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,13 +7,13 @@ namespace Ryujinx.HLE.HOS.Ipc
|
|||
public long Position { get; private set; }
|
||||
public long Size { get; private set; }
|
||||
|
||||
public IpcRecvListBuffDesc(BinaryReader Reader)
|
||||
public IpcRecvListBuffDesc(BinaryReader reader)
|
||||
{
|
||||
long Value = Reader.ReadInt64();
|
||||
long value = reader.ReadInt64();
|
||||
|
||||
Position = Value & 0xffffffffffff;
|
||||
Position = value & 0xffffffffffff;
|
||||
|
||||
Size = (ushort)(Value >> 48);
|
||||
Size = (ushort)(value >> 48);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.HLE.HOS.Ipc
|
||||
{
|
||||
delegate long ServiceProcessRequest(ServiceCtx Context);
|
||||
delegate long ServiceProcessRequest(ServiceCtx context);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue