Allow all methods to read from non-contiguous locations

This commit is contained in:
gdkchan 2018-11-22 00:57:31 -03:00
parent 104e98bc27
commit 964e0069fd
17 changed files with 288 additions and 181 deletions

View file

@ -1,13 +0,0 @@
using System;
namespace ChocolArm64.Exceptions
{
public class VmmAccessException : Exception
{
private const string ExMsg = "Memory region at 0x{0:X16} with size 0x{1:X16} is not contiguous!";
public VmmAccessException() { }
public VmmAccessException(long position, long size) : base(string.Format(ExMsg, position, size)) { }
}
}

View file

@ -26,22 +26,26 @@ namespace ChocolArm64.Memory
{
long size = Marshal.SizeOf<T>();
memory.EnsureRangeIsValid(position, size);
byte[] data = memory.ReadBytes(position, size);
IntPtr ptr = (IntPtr)memory.Translate(position);
return Marshal.PtrToStructure<T>(ptr);
fixed (byte* ptr = data)
{
return Marshal.PtrToStructure<T>((IntPtr)ptr);
}
}
public unsafe static void Write<T>(MemoryManager memory, long position, T value) where T : struct
{
long size = Marshal.SizeOf<T>();
memory.EnsureRangeIsValid(position, size);
byte[] data = new byte[size];
IntPtr ptr = (IntPtr)memory.TranslateWrite(position);
fixed (byte* ptr = data)
{
Marshal.StructureToPtr<T>(value, (IntPtr)ptr, false);
}
Marshal.StructureToPtr<T>(value, ptr, false);
memory.WriteBytes(position, data);
}
public static string ReadAsciiString(MemoryManager memory, long position, long maxSize = -1)

View file

@ -362,9 +362,36 @@ namespace ChocolArm64.Memory
public void ReadBytes(long position, byte[] data, int startIndex, int size)
{
//Note: This will be moved later.
EnsureRangeIsValid(position, (uint)size);
long endAddr = position + size;
Marshal.Copy((IntPtr)Translate(position), data, startIndex, size);
if ((ulong)size > int.MaxValue)
{
throw new ArgumentOutOfRangeException(nameof(size));
}
if ((ulong)endAddr < (ulong)position)
{
throw new ArgumentOutOfRangeException(nameof(position));
}
int offset = startIndex;
while ((ulong)position < (ulong)endAddr)
{
long pageLimit = (position + PageSize) & ~(long)PageMask;
if ((ulong)pageLimit > (ulong)endAddr)
{
pageLimit = endAddr;
}
int copySize = (int)(pageLimit - position);
Marshal.Copy((IntPtr)Translate(position), data, offset, copySize);
position += copySize;
offset += copySize;
}
}
public void WriteSByte(long position, sbyte value)
@ -533,22 +560,48 @@ namespace ChocolArm64.Memory
public void WriteBytes(long position, byte[] data, int startIndex, int size)
{
//Note: This will be moved later.
//Using Translate instead of TranslateWrite is on purpose.
EnsureRangeIsValid(position, (uint)size);
long endAddr = position + size;
Marshal.Copy(data, startIndex, (IntPtr)Translate(position), size);
if ((ulong)endAddr < (ulong)position)
{
throw new ArgumentOutOfRangeException(nameof(position));
}
int offset = startIndex;
while ((ulong)position < (ulong)endAddr)
{
long pageLimit = (position + PageSize) & ~(long)PageMask;
if ((ulong)pageLimit > (ulong)endAddr)
{
pageLimit = endAddr;
}
int copySize = (int)(pageLimit - position);
Marshal.Copy(data, offset, (IntPtr)TranslateWrite(position), copySize);
position += copySize;
offset += copySize;
}
}
public void CopyBytes(long src, long dst, long size)
{
//Note: This will be moved later.
EnsureRangeIsValid(src, size);
EnsureRangeIsValid(dst, size);
if (IsContiguous(src, size) &&
IsContiguous(dst, size))
{
byte* srcPtr = Translate(src);
byte* dstPtr = TranslateWrite(dst);
byte* srcPtr = Translate(src);
byte* dstPtr = TranslateWrite(dst);
Buffer.MemoryCopy(srcPtr, dstPtr, size, size);
Buffer.MemoryCopy(srcPtr, dstPtr, size, size);
}
else
{
WriteBytes(dst, ReadBytes(src, size));
}
}
public void Map(long va, long pa, long size)
@ -797,14 +850,21 @@ Unmapped:
}
}
public IntPtr GetHostAddress(long position, long size)
public bool TryGetHostAddress(long position, long size, out IntPtr ptr)
{
EnsureRangeIsValid(position, size);
if (IsContiguous(position, size))
{
ptr = (IntPtr)Translate(position);
return (IntPtr)Translate(position);
return true;
}
ptr = IntPtr.Zero;
return false;
}
internal void EnsureRangeIsValid(long position, long size)
private bool IsContiguous(long position, long size)
{
long endPos = position + size;
@ -818,12 +878,14 @@ Unmapped:
if (pa != expectedPa)
{
throw new VmmAccessException(position, size);
return false;
}
position += PageSize;
expectedPa += PageSize;
}
return true;
}
public bool IsValidPosition(long position)

View file

@ -1,5 +1,3 @@
using System;
namespace Ryujinx.Graphics.Gal
{
public struct GalVertexAttrib
@ -7,7 +5,7 @@ namespace Ryujinx.Graphics.Gal
public int Index { get; private set; }
public bool IsConst { get; private set; }
public int Offset { get; private set; }
public IntPtr Pointer { get; private set; }
public byte[] Data { get; private set; }
public GalVertexAttribSize Size { get; private set; }
public GalVertexAttribType Type { get; private set; }
@ -18,14 +16,14 @@ namespace Ryujinx.Graphics.Gal
int Index,
bool IsConst,
int Offset,
IntPtr Pointer,
byte[] Data,
GalVertexAttribSize Size,
GalVertexAttribType Type,
bool IsBgra)
{
this.Index = Index;
this.IsConst = IsConst;
this.Pointer = Pointer;
this.Data = Data;
this.Offset = Offset;
this.Size = Size;
this.Type = Type;

View file

@ -12,5 +12,6 @@ namespace Ryujinx.Graphics.Gal
bool IsCached(long Key, long Size);
void SetData(long Key, long Size, IntPtr HostAddress);
void SetData(long Key, byte[] Data);
}
}

View file

@ -22,6 +22,7 @@ namespace Ryujinx.Graphics.Gal
bool IsIboCached(long Key, long DataSize);
void CreateVbo(long Key, int DataSize, IntPtr HostAddress);
void CreateVbo(long Key, byte[] Data);
void CreateIbo(long Key, int DataSize, IntPtr HostAddress);
void CreateIbo(long Key, int DataSize, byte[] Buffer);

View file

@ -44,6 +44,14 @@ namespace Ryujinx.Graphics.Gal.OpenGL
}
}
public void SetData(long Key, byte[] Data)
{
if (Cache.TryGetValue(Key, out OGLStreamBuffer Buffer))
{
Buffer.SetData(Data);
}
}
public bool TryGetUbo(long Key, out int UboHandle)
{
if (Cache.TryGetValue(Key, out OGLStreamBuffer Buffer))

View file

@ -600,122 +600,125 @@ namespace Ryujinx.Graphics.Gal.OpenGL
ThrowUnsupportedAttrib(Attrib);
}
if (Attrib.Type == GalVertexAttribType.Unorm)
fixed (byte* Ptr = Attrib.Data)
{
switch (Attrib.Size)
if (Attrib.Type == GalVertexAttribType.Unorm)
{
case GalVertexAttribSize._8:
case GalVertexAttribSize._8_8:
case GalVertexAttribSize._8_8_8:
case GalVertexAttribSize._8_8_8_8:
GL.VertexAttrib4N((uint)Attrib.Index, (byte*)Attrib.Pointer);
break;
switch (Attrib.Size)
{
case GalVertexAttribSize._8:
case GalVertexAttribSize._8_8:
case GalVertexAttribSize._8_8_8:
case GalVertexAttribSize._8_8_8_8:
GL.VertexAttrib4N((uint)Attrib.Index, Ptr);
break;
case GalVertexAttribSize._16:
case GalVertexAttribSize._16_16:
case GalVertexAttribSize._16_16_16:
case GalVertexAttribSize._16_16_16_16:
GL.VertexAttrib4N((uint)Attrib.Index, (ushort*)Attrib.Pointer);
break;
case GalVertexAttribSize._16:
case GalVertexAttribSize._16_16:
case GalVertexAttribSize._16_16_16:
case GalVertexAttribSize._16_16_16_16:
GL.VertexAttrib4N((uint)Attrib.Index, (ushort*)Ptr);
break;
case GalVertexAttribSize._32:
case GalVertexAttribSize._32_32:
case GalVertexAttribSize._32_32_32:
case GalVertexAttribSize._32_32_32_32:
GL.VertexAttrib4N((uint)Attrib.Index, (uint*)Attrib.Pointer);
break;
case GalVertexAttribSize._32:
case GalVertexAttribSize._32_32:
case GalVertexAttribSize._32_32_32:
case GalVertexAttribSize._32_32_32_32:
GL.VertexAttrib4N((uint)Attrib.Index, (uint*)Ptr);
break;
}
}
}
else if (Attrib.Type == GalVertexAttribType.Snorm)
{
switch (Attrib.Size)
else if (Attrib.Type == GalVertexAttribType.Snorm)
{
case GalVertexAttribSize._8:
case GalVertexAttribSize._8_8:
case GalVertexAttribSize._8_8_8:
case GalVertexAttribSize._8_8_8_8:
GL.VertexAttrib4N((uint)Attrib.Index, (sbyte*)Attrib.Pointer);
break;
switch (Attrib.Size)
{
case GalVertexAttribSize._8:
case GalVertexAttribSize._8_8:
case GalVertexAttribSize._8_8_8:
case GalVertexAttribSize._8_8_8_8:
GL.VertexAttrib4N((uint)Attrib.Index, (sbyte*)Ptr);
break;
case GalVertexAttribSize._16:
case GalVertexAttribSize._16_16:
case GalVertexAttribSize._16_16_16:
case GalVertexAttribSize._16_16_16_16:
GL.VertexAttrib4N((uint)Attrib.Index, (short*)Attrib.Pointer);
break;
case GalVertexAttribSize._16:
case GalVertexAttribSize._16_16:
case GalVertexAttribSize._16_16_16:
case GalVertexAttribSize._16_16_16_16:
GL.VertexAttrib4N((uint)Attrib.Index, (short*)Ptr);
break;
case GalVertexAttribSize._32:
case GalVertexAttribSize._32_32:
case GalVertexAttribSize._32_32_32:
case GalVertexAttribSize._32_32_32_32:
GL.VertexAttrib4N((uint)Attrib.Index, (int*)Attrib.Pointer);
break;
case GalVertexAttribSize._32:
case GalVertexAttribSize._32_32:
case GalVertexAttribSize._32_32_32:
case GalVertexAttribSize._32_32_32_32:
GL.VertexAttrib4N((uint)Attrib.Index, (int*)Ptr);
break;
}
}
}
else if (Attrib.Type == GalVertexAttribType.Uint)
{
switch (Attrib.Size)
else if (Attrib.Type == GalVertexAttribType.Uint)
{
case GalVertexAttribSize._8:
case GalVertexAttribSize._8_8:
case GalVertexAttribSize._8_8_8:
case GalVertexAttribSize._8_8_8_8:
GL.VertexAttribI4((uint)Attrib.Index, (byte*)Attrib.Pointer);
break;
switch (Attrib.Size)
{
case GalVertexAttribSize._8:
case GalVertexAttribSize._8_8:
case GalVertexAttribSize._8_8_8:
case GalVertexAttribSize._8_8_8_8:
GL.VertexAttribI4((uint)Attrib.Index, Ptr);
break;
case GalVertexAttribSize._16:
case GalVertexAttribSize._16_16:
case GalVertexAttribSize._16_16_16:
case GalVertexAttribSize._16_16_16_16:
GL.VertexAttribI4((uint)Attrib.Index, (ushort*)Attrib.Pointer);
break;
case GalVertexAttribSize._16:
case GalVertexAttribSize._16_16:
case GalVertexAttribSize._16_16_16:
case GalVertexAttribSize._16_16_16_16:
GL.VertexAttribI4((uint)Attrib.Index, (ushort*)Ptr);
break;
case GalVertexAttribSize._32:
case GalVertexAttribSize._32_32:
case GalVertexAttribSize._32_32_32:
case GalVertexAttribSize._32_32_32_32:
GL.VertexAttribI4((uint)Attrib.Index, (uint*)Attrib.Pointer);
break;
case GalVertexAttribSize._32:
case GalVertexAttribSize._32_32:
case GalVertexAttribSize._32_32_32:
case GalVertexAttribSize._32_32_32_32:
GL.VertexAttribI4((uint)Attrib.Index, (uint*)Ptr);
break;
}
}
}
else if (Attrib.Type == GalVertexAttribType.Sint)
{
switch (Attrib.Size)
else if (Attrib.Type == GalVertexAttribType.Sint)
{
case GalVertexAttribSize._8:
case GalVertexAttribSize._8_8:
case GalVertexAttribSize._8_8_8:
case GalVertexAttribSize._8_8_8_8:
GL.VertexAttribI4((uint)Attrib.Index, (sbyte*)Attrib.Pointer);
break;
switch (Attrib.Size)
{
case GalVertexAttribSize._8:
case GalVertexAttribSize._8_8:
case GalVertexAttribSize._8_8_8:
case GalVertexAttribSize._8_8_8_8:
GL.VertexAttribI4((uint)Attrib.Index, (sbyte*)Ptr);
break;
case GalVertexAttribSize._16:
case GalVertexAttribSize._16_16:
case GalVertexAttribSize._16_16_16:
case GalVertexAttribSize._16_16_16_16:
GL.VertexAttribI4((uint)Attrib.Index, (short*)Attrib.Pointer);
break;
case GalVertexAttribSize._16:
case GalVertexAttribSize._16_16:
case GalVertexAttribSize._16_16_16:
case GalVertexAttribSize._16_16_16_16:
GL.VertexAttribI4((uint)Attrib.Index, (short*)Ptr);
break;
case GalVertexAttribSize._32:
case GalVertexAttribSize._32_32:
case GalVertexAttribSize._32_32_32:
case GalVertexAttribSize._32_32_32_32:
GL.VertexAttribI4((uint)Attrib.Index, (int*)Attrib.Pointer);
break;
case GalVertexAttribSize._32:
case GalVertexAttribSize._32_32:
case GalVertexAttribSize._32_32_32:
case GalVertexAttribSize._32_32_32_32:
GL.VertexAttribI4((uint)Attrib.Index, (int*)Ptr);
break;
}
}
}
else if (Attrib.Type == GalVertexAttribType.Float)
{
switch (Attrib.Size)
else if (Attrib.Type == GalVertexAttribType.Float)
{
case GalVertexAttribSize._32:
case GalVertexAttribSize._32_32:
case GalVertexAttribSize._32_32_32:
case GalVertexAttribSize._32_32_32_32:
GL.VertexAttrib4(Attrib.Index, (float*)Attrib.Pointer);
break;
switch (Attrib.Size)
{
case GalVertexAttribSize._32:
case GalVertexAttribSize._32_32:
case GalVertexAttribSize._32_32_32:
case GalVertexAttribSize._32_32_32_32:
GL.VertexAttrib4(Attrib.Index, (float*)Ptr);
break;
default: ThrowUnsupportedAttrib(Attrib); break;
default: ThrowUnsupportedAttrib(Attrib); break;
}
}
}
}

View file

@ -92,7 +92,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
{
int Handle = GL.GenBuffer();
VboCache.AddOrUpdate(Key, Handle, (uint)DataSize);
VboCache.AddOrUpdate(Key, Handle, DataSize);
IntPtr Length = new IntPtr(DataSize);
@ -100,6 +100,18 @@ namespace Ryujinx.Graphics.Gal.OpenGL
GL.BufferData(BufferTarget.ArrayBuffer, Length, HostAddress, BufferUsageHint.StreamDraw);
}
public void CreateVbo(long Key, byte[] Data)
{
int Handle = GL.GenBuffer();
VboCache.AddOrUpdate(Key, Handle, Data.Length);
IntPtr Length = new IntPtr(Data.Length);
GL.BindBuffer(BufferTarget.ArrayBuffer, Handle);
GL.BufferData(BufferTarget.ArrayBuffer, Length, Data, BufferUsageHint.StreamDraw);
}
public void CreateIbo(long Key, int DataSize, IntPtr HostAddress)
{
int Handle = GL.GenBuffer();
@ -116,7 +128,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
{
int Handle = GL.GenBuffer();
IboCache.AddOrUpdate(Key, Handle, (uint)DataSize);
IboCache.AddOrUpdate(Key, Handle, DataSize);
IntPtr Length = new IntPtr(Buffer.Length);

View file

@ -30,6 +30,13 @@ namespace Ryujinx.Graphics.Gal.OpenGL
GL.BufferSubData(Target, IntPtr.Zero, (IntPtr)Size, HostAddress);
}
public void SetData(byte[] Data)
{
GL.BindBuffer(Target, Handle);
GL.BufferSubData(Target, IntPtr.Zero, (IntPtr)Data.Length, Data);
}
public void Dispose()
{
Dispose(true);

View file

@ -243,9 +243,9 @@ namespace Ryujinx.Graphics.Memory
return Cache.IsRegionModified(Memory, BufferType, PA, Size);
}
public IntPtr GetHostAddress(long Position, long Size)
public bool TryGetHostAddress(long Position, long Size, out IntPtr Ptr)
{
return Memory.GetHostAddress(GetPhysicalAddress(Position), Size);
return Memory.TryGetHostAddress(GetPhysicalAddress(Position), Size, out Ptr);
}
public byte ReadByte(long Position)

View file

@ -615,9 +615,14 @@ namespace Ryujinx.Graphics
if (Gpu.ResourceManager.MemoryRegionModified(Vmm, Key, Cb.Size, NvGpuBufferType.ConstBuffer))
{
IntPtr Source = Vmm.GetHostAddress(Cb.Position, Cb.Size);
Gpu.Renderer.Buffer.SetData(Key, Cb.Size, Source);
if (Vmm.TryGetHostAddress(Cb.Position, Cb.Size, out IntPtr CbPtr))
{
Gpu.Renderer.Buffer.SetData(Key, Cb.Size, CbPtr);
}
else
{
Gpu.Renderer.Buffer.SetData(Key, Vmm.ReadBytes(Cb.Position, Cb.Size));
}
}
State.ConstBufferKeys[Stage][DeclInfo.Cbuf] = Key;
@ -660,9 +665,14 @@ namespace Ryujinx.Graphics
{
if (!UsesLegacyQuads)
{
IntPtr DataAddress = Vmm.GetHostAddress(IbPosition, IbSize);
Gpu.Renderer.Rasterizer.CreateIbo(IboKey, IbSize, DataAddress);
if (Vmm.TryGetHostAddress(IbPosition, IbSize, out IntPtr IbPtr))
{
Gpu.Renderer.Rasterizer.CreateIbo(IboKey, IbSize, IbPtr);
}
else
{
Gpu.Renderer.Rasterizer.CreateIbo(IboKey, IbSize, Vmm.ReadBytes(IbPosition, IbSize));
}
}
else
{
@ -711,22 +721,22 @@ namespace Ryujinx.Graphics
Attribs[ArrayIndex] = new List<GalVertexAttrib>();
}
long VertexPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.VertexArrayNAddress + ArrayIndex * 4);
long VbPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.VertexArrayNAddress + ArrayIndex * 4);
bool IsConst = ((Packed >> 6) & 1) != 0;
int Offset = (Packed >> 7) & 0x3fff;
GalVertexAttribSize Size = (GalVertexAttribSize)((Packed >> 21) & 0x3f);
GalVertexAttribType Type = (GalVertexAttribType)((Packed >> 27) & 0x7);
bool IsRgba = ((Packed >> 31) & 1) != 0;
//Note: 16 is the maximum size of an attribute,
//having a component size of 32-bits with 4 elements (a vec4).
IntPtr Pointer = Vmm.GetHostAddress(VertexPosition + Offset, 16);
byte[] Data = Vmm.ReadBytes(VbPosition + Offset, 16);
Attribs[ArrayIndex].Add(new GalVertexAttrib(
Attr,
((Packed >> 6) & 0x1) != 0,
Offset,
Pointer,
(GalVertexAttribSize)((Packed >> 21) & 0x3f),
(GalVertexAttribType)((Packed >> 27) & 0x7),
((Packed >> 31) & 0x1) != 0));
Attribs[ArrayIndex].Add(new GalVertexAttrib(Attr, IsConst, Offset, Data, Size, Type, IsRgba));
}
State.VertexBindings = new GalVertexBinding[32];
@ -747,8 +757,8 @@ namespace Ryujinx.Graphics
continue;
}
long VertexPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.VertexArrayNAddress + Index * 4);
long VertexEndPos = MakeInt64From2xInt32(NvGpuEngine3dReg.VertexArrayNEndAddr + Index * 2);
long VbPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.VertexArrayNAddress + Index * 4);
long VbEndPos = MakeInt64From2xInt32(NvGpuEngine3dReg.VertexArrayNEndAddr + Index * 2);
int VertexDivisor = ReadRegister(NvGpuEngine3dReg.VertexArrayNDivisor + Index * 4);
@ -758,26 +768,31 @@ namespace Ryujinx.Graphics
if (Instanced && VertexDivisor != 0)
{
VertexPosition += Stride * (CurrentInstance / VertexDivisor);
VbPosition += Stride * (CurrentInstance / VertexDivisor);
}
if (VertexPosition > VertexEndPos)
if (VbPosition > VbEndPos)
{
//Instance is invalid, ignore the draw call
continue;
}
long VboKey = Vmm.GetPhysicalAddress(VertexPosition);
long VboKey = Vmm.GetPhysicalAddress(VbPosition);
long VbSize = (VertexEndPos - VertexPosition) + 1;
long VbSize = (VbEndPos - VbPosition) + 1;
bool VboCached = Gpu.Renderer.Rasterizer.IsVboCached(VboKey, VbSize);
if (!VboCached || Gpu.ResourceManager.MemoryRegionModified(Vmm, VboKey, VbSize, NvGpuBufferType.Vertex))
{
IntPtr DataAddress = Vmm.GetHostAddress(VertexPosition, VbSize);
Gpu.Renderer.Rasterizer.CreateVbo(VboKey, (int)VbSize, DataAddress);
if (Vmm.TryGetHostAddress(VbPosition, VbSize, out IntPtr VbPtr))
{
Gpu.Renderer.Rasterizer.CreateVbo(VboKey, (int)VbSize, VbPtr);
}
else
{
Gpu.Renderer.Rasterizer.CreateVbo(VboKey, Vmm.ReadBytes(VbPosition, VbSize));
}
}
State.VertexBindings[Index].Enabled = true;

View file

@ -62,6 +62,8 @@ namespace Ryujinx.HLE.HOS
internal LinkedList<KProcess> Processes;
internal bool EnableVersionChecks { get; private set; }
internal AppletStateMgr AppletState { get; private set; }
internal KSharedMemory HidSharedMem { get; private set; }

View file

@ -1,6 +1,8 @@
using ChocolArm64;
using ChocolArm64.Events;
using ChocolArm64.Memory;
using Ryujinx.Common;
using Ryujinx.Common.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
@ -343,19 +345,22 @@ namespace Ryujinx.HLE.HOS.Kernel
uint RequiredKernelVersionMajor = (uint)Capabilities.KernelReleaseVersion >> 19;
uint RequiredKernelVersionMinor = ((uint)Capabilities.KernelReleaseVersion >> 15) & 0xf;
if (RequiredKernelVersionMajor > KernelVersionMajor)
if (System.EnableVersionChecks)
{
return KernelResult.InvalidCombination;
}
if (RequiredKernelVersionMajor > KernelVersionMajor)
{
return KernelResult.InvalidCombination;
}
if (RequiredKernelVersionMajor != KernelVersionMajor && RequiredKernelVersionMajor < 3)
{
return KernelResult.InvalidCombination;
}
if (RequiredKernelVersionMajor != KernelVersionMajor && RequiredKernelVersionMajor < 3)
{
return KernelResult.InvalidCombination;
}
if (RequiredKernelVersionMinor > KernelVersionMinor)
{
return KernelResult.InvalidCombination;
if (RequiredKernelVersionMinor > KernelVersionMinor)
{
return KernelResult.InvalidCombination;
}
}
KernelResult Result = AllocateThreadLocalStorage(out ulong UserExceptionContextAddress);
@ -985,9 +990,9 @@ namespace Ryujinx.HLE.HOS.Kernel
}
}
private void CpuTraceHandler(object sender, EventArgs e)
private void CpuTraceHandler(object sender, CpuTraceEventArgs e)
{
System.Scheduler.GetCurrentThread().PrintGuestStackTrace();
Logger.PrintInfo(LogClass.Cpu, $"Executing at 0x{e.Position:X16}.");
}
}
}

View file

@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Kernel
{
ulong Size = ThreadState.X1;
if ((Size & 0xFFFFFFFE001FFFFF) != 0)
if ((Size & 0xfffffffe001fffff) != 0)
{
Logger.PrintWarning(LogClass.KernelSvc, $"Heap size 0x{Size:x16} is not aligned!");

View file

@ -112,6 +112,8 @@ namespace Ryujinx.HLE.HOS
for (int Index = 0; Index < StaticObjects.Length; Index++)
{
Logger.PrintInfo(LogClass.Loader, $"Loading image {Index} at 0x{NsoBase[Index]:x16}...");
IExecutable StaticObject = StaticObjects[Index];
ulong TextStart = NsoBase[Index] + (ulong)StaticObject.TextOffset;

View file

@ -204,7 +204,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr
{
return MakeError(ErrorModule.Loader, LoaderErr.BadSize);
}
else if (BssSize != 0 && (BssAddress + BssSize) <= BssAddress)
else if (BssSize != 0 && BssAddress + BssSize <= BssAddress)
{
return MakeError(ErrorModule.Loader, LoaderErr.BadSize);
}