summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorVladimir Panteleev <git@thecybershadow.net>2017-10-06 12:32:24 +0000
committerVladimir Panteleev <git@thecybershadow.net>2017-10-06 12:47:10 +0000
commite691ec126fbb1e987b7d8910694347b2d38dfca7 (patch)
treeb334216772dedf5d39bf9fdd6e8c9acfb2472761 /Source/Core
parent5f0de43828666aef78e59d6f822cdb1392106e3e (diff)
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.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/ActionReplay.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp
index c36beba268..aedfc3e609 100644
--- a/Source/Core/Core/ActionReplay.cpp
+++ b/Source/Core/Core/ActionReplay.cpp
@@ -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("--------");
}