Fix Mario Kart 8 Crash and SMO Glitching Issues :3

This commit is contained in:
Stossy11 2025-01-07 13:20:13 +11:00
parent 160a58e127
commit 2901f462aa
10 changed files with 28 additions and 137 deletions

View file

@ -24,13 +24,13 @@ namespace ARMeilleure.Native
public static unsafe void Copy(IntPtr dst, IntPtr src, ulong n) {
// When NativeAOT is in use, we can toggle per-thread write protection without worrying about breaking .NET code.
//pthread_jit_write_protect_np(0);
// pthread_jit_write_protect_np(0);
var srcSpan = new Span<byte>(src.ToPointer(), (int)n);
var dstSpan = new Span<byte>(dst.ToPointer(), (int)n);
srcSpan.CopyTo(dstSpan);
//pthread_jit_write_protect_np(1);
// pthread_jit_write_protect_np(1);
// Ensure that the instruction cache for this range is invalidated.
sys_icache_invalidate(dst, (IntPtr)n);

View file

@ -91,7 +91,15 @@ namespace ARMeilleure.Translation.Cache
if (OperatingSystem.IsIOS())
{
Marshal.Copy(code, 0, funcPtr, code.Length);
// Marshal.Copy(code, 0, funcPtr, code.Length);
unsafe
{
fixed (byte* codePtr = code)
{
JitSupportDarwinAot.Copy(funcPtr, (IntPtr)codePtr, (ulong)code.Length);
}
}
if (deferProtect)
{
_deferredRxProtect.Enqueue((funcOffset, code.Length));