mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
ActionReplay: Fix implementation of memory-copy zero codes
This fixes the implementation of the non-standard size-3 zero codes to conform to kenobi's specification.
This commit is contained in:
parent
5f0de43828
commit
e691ec126f
@ -586,10 +586,12 @@ static bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr& addr, const
|
||||
return true;
|
||||
}
|
||||
|
||||
// Looks like this is new?? - untested
|
||||
// kenobi's "memory copy" Z-code. Requires an additional master code
|
||||
// on a real AR device. Documented here:
|
||||
// https://github.com/dolphin-emu/dolphin/wiki/GameCube-Action-Replay-Code-Types#type-z4-size-3--memory-copy
|
||||
static bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr& addr, const u32 data)
|
||||
{
|
||||
const u32 addr_dest = val_last | 0x06000000;
|
||||
const u32 addr_dest = val_last & ~0x06000000;
|
||||
const u32 addr_src = addr.GCAddress();
|
||||
|
||||
const u8 num_bytes = data & 0x7FFF;
|
||||
@ -598,16 +600,20 @@ static bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr& addr, const u3
|
||||
LogInfo("Src Address: %08x", addr_src);
|
||||
LogInfo("Size: %08x", num_bytes);
|
||||
|
||||
if ((data & ~0x7FFF) == 0x0000)
|
||||
if ((data & 0xFF0000) == 0)
|
||||
{
|
||||
if ((data >> 24) != 0x0)
|
||||
{ // Memory Copy With Pointers Support
|
||||
LogInfo("Memory Copy With Pointers Support");
|
||||
LogInfo("--------");
|
||||
for (int i = 0; i < 138; ++i)
|
||||
const u32 ptr_dest = PowerPC::HostRead_U32(addr_dest);
|
||||
LogInfo("Resolved Dest Address to: %08x", ptr_dest);
|
||||
const u32 ptr_src = PowerPC::HostRead_U32(addr_src);
|
||||
LogInfo("Resolved Src Address to: %08x", ptr_src);
|
||||
for (int i = 0; i < num_bytes; ++i)
|
||||
{
|
||||
PowerPC::HostWrite_U8(PowerPC::HostRead_U8(addr_src + i), addr_dest + i);
|
||||
LogInfo("Wrote %08x to address %08x", PowerPC::HostRead_U8(addr_src + i), addr_dest + i);
|
||||
PowerPC::HostWrite_U8(PowerPC::HostRead_U8(ptr_src + i), ptr_dest + i);
|
||||
LogInfo("Wrote %08x to address %08x", PowerPC::HostRead_U8(ptr_src + i), ptr_dest + i);
|
||||
}
|
||||
LogInfo("--------");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user