mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-16 15:40:31 +00:00
Replace StructByteArrayHelpers with generated Array<byte> types
This commit is contained in:
parent
960c426501
commit
2502a9d00f
5 changed files with 9 additions and 86 deletions
|
@ -1,77 +0,0 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.Common.Memory
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Size = Size, Pack = 1)]
|
||||
public struct ByteArray128 : IArray<byte>
|
||||
{
|
||||
private const int Size = 128;
|
||||
|
||||
byte _element;
|
||||
|
||||
public int Length => Size;
|
||||
public ref byte this[int index] => ref AsSpan()[index];
|
||||
public Span<byte> AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = Size, Pack = 1)]
|
||||
public struct ByteArray256 : IArray<byte>
|
||||
{
|
||||
private const int Size = 256;
|
||||
|
||||
byte _element;
|
||||
|
||||
public int Length => Size;
|
||||
public ref byte this[int index] => ref AsSpan()[index];
|
||||
public Span<byte> AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = Size, Pack = 1)]
|
||||
public struct ByteArray512 : IArray<byte>
|
||||
{
|
||||
private const int Size = 512;
|
||||
|
||||
byte _element;
|
||||
|
||||
public int Length => Size;
|
||||
public ref byte this[int index] => ref AsSpan()[index];
|
||||
public Span<byte> AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = Size, Pack = 1)]
|
||||
public struct ByteArray1024 : IArray<byte>
|
||||
{
|
||||
private const int Size = 1024;
|
||||
|
||||
byte _element;
|
||||
|
||||
public int Length => Size;
|
||||
public ref byte this[int index] => ref AsSpan()[index];
|
||||
public Span<byte> AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = Size, Pack = 1)]
|
||||
public struct ByteArray2048 : IArray<byte>
|
||||
{
|
||||
private const int Size = 2048;
|
||||
|
||||
byte _element;
|
||||
|
||||
public int Length => Size;
|
||||
public ref byte this[int index] => ref AsSpan()[index];
|
||||
public Span<byte> AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = Size, Pack = 1)]
|
||||
public struct ByteArray4096 : IArray<byte>
|
||||
{
|
||||
private const int Size = 4096;
|
||||
|
||||
byte _element;
|
||||
|
||||
public int Length => Size;
|
||||
public ref byte this[int index] => ref AsSpan()[index];
|
||||
public Span<byte> AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size);
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Applets.Browser
|
|||
{
|
||||
public WebExitReason ExitReason;
|
||||
public uint Padding;
|
||||
public ByteArray4096 LastUrl;
|
||||
public Array4096<byte> LastUrl;
|
||||
public ulong LastUrlSize;
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error
|
|||
{
|
||||
public uint ErrorNumber;
|
||||
public ulong LanguageCode;
|
||||
public ByteArray2048 MessageText;
|
||||
public ByteArray2048 DetailsText;
|
||||
public Array2048<byte> MessageText;
|
||||
public Array2048<byte> DetailsText;
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Services.Ro
|
|||
public ulong ApplicationIdMask;
|
||||
public ulong ApplicationIdPattern;
|
||||
private Array16<byte> _reserved;
|
||||
public ByteArray256 Modulus;
|
||||
public ByteArray256 Signature;
|
||||
public Array256<byte> Modulus;
|
||||
public Array256<byte> Signature;
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Ro
|
|||
public uint KeyGeneration; // 9.0.0+
|
||||
private Array8<byte> _reserved;
|
||||
public NRRCertification Certification;
|
||||
public ByteArray256 Signature;
|
||||
public Array256<byte> Signature;
|
||||
public ulong TitleId;
|
||||
public uint Size;
|
||||
public byte Kind; // 7.0.0+
|
||||
|
|
Loading…
Reference in a new issue