GB - mask peek and poke memory functions, fixes potential exceptions when calling on bogus addresses for that domain
This commit is contained in:
parent
2988217d77
commit
06bd1b979a
|
@ -501,7 +501,7 @@ namespace BizHawk.Emulation.Consoles.GB
|
||||||
System.Runtime.InteropServices.Marshal.Copy(data, CachedMemory, 0, length);
|
System.Runtime.InteropServices.Marshal.Copy(data, CachedMemory, 0, length);
|
||||||
readneeded = false;
|
readneeded = false;
|
||||||
}
|
}
|
||||||
return CachedMemory[addr];
|
return CachedMemory[addr & (CachedMemory.Length - 1)];
|
||||||
}
|
}
|
||||||
public void Poke(int addr, byte val)
|
public void Poke(int addr, byte val)
|
||||||
{
|
{
|
||||||
|
@ -513,7 +513,7 @@ namespace BizHawk.Emulation.Consoles.GB
|
||||||
System.Runtime.InteropServices.Marshal.Copy(data, CachedMemory, 0, length);
|
System.Runtime.InteropServices.Marshal.Copy(data, CachedMemory, 0, length);
|
||||||
readneeded = false;
|
readneeded = false;
|
||||||
}
|
}
|
||||||
CachedMemory[addr] = val;
|
CachedMemory[addr & (CachedMemory.Length - 1)] = val;
|
||||||
writeneeded = true;
|
writeneeded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue