Merge pull request #9654 from LunaMoo/CWC0x6_0x1

Fix "copy type" pointer cwc
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2017-04-29 20:51:51 +02:00
commit dbd8085c3e
1 file changed
+3 -3
+3 -3
View File
@@ -439,7 +439,7 @@ void CWCheatEngine::Run() {
int count = arg2 & 0xFFFF;
int type = (arg2 >> 16) & 0xF;
for (int i = 1; i < count; i ++ ) {
if (i+1 < count) {
if (i < count) {
code = GetNextCode();
if (code.size() < 2) {
// User provided incomplete cheat. Should warn but would be very spammy...
@@ -452,8 +452,8 @@ void CWCheatEngine::Run() {
case 0x1: // type copy byte
{
int srcAddr = Memory::Read_U32(addr) + offset;
int dstAddr = Memory::Read_U16(addr + baseOffset) + (arg3 & 0x0FFFFFFF);
if (Memory::IsValidAddress(dstAddr) && Memory::IsValidAddress(srcAddr)) {
int dstAddr = Memory::Read_U32(addr + baseOffset) + (arg3 & 0x0FFFFFFF);
if (Memory::IsValidAddress(dstAddr) && Memory::IsValidAddress(srcAddr) && Memory::IsValidAddress(srcAddr + arg) && Memory::IsValidAddress(dstAddr + arg)) {
Memory::MemcpyUnchecked(dstAddr, srcAddr, arg);
}
type = -1; //Done