Merge pull request #6134 from unknownbrackets/replace-funcs

Trigger memchecks in replaced funcs, call gpu->UpdateMemory()
This commit is contained in:
Henrik Rydgård committed 2014-05-25 09:13:07 +02:00
commit dee3e39b2b
1 file changed
+35
+35
View File
@@ -20,6 +20,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "Core/Debugger/Breakpoints.h"
#include "Core/MemMap.h"
#include "Core/MIPS/JitCommon/JitCommon.h"
#include "Core/MIPS/MIPSAnalyst.h"
@@ -27,6 +28,7 @@
#include "Core/HLE/FunctionWrappers.h"
#include "GPU/Math3D.h"
#include "GPU/GPUInterface.h"
#if defined(_M_IX86) || defined(_M_X64)
#include <emmintrin.h>
@@ -108,6 +110,13 @@ static int Replace_memcpy() {
memmove(dst, src, bytes);
}
RETURN(destPtr);
#ifndef MOBILE_DEVICE
CBreakPoints::ExecMemCheck(srcPtr, false, bytes, currentMIPS->pc);
CBreakPoints::ExecMemCheck(destPtr, true, bytes, currentMIPS->pc);
#endif
if (Memory::IsVRAMAddress(destPtr) || Memory::IsVRAMAddress(srcPtr)) {
gpu->UpdateMemory(destPtr, srcPtr, bytes);
}
return 10 + bytes / 4; // approximation
}
@@ -121,6 +130,13 @@ static int Replace_memcpy16() {
memmove(dst, src, bytes);
}
RETURN(destPtr);
#ifndef MOBILE_DEVICE
CBreakPoints::ExecMemCheck(srcPtr, false, bytes, currentMIPS->pc);
CBreakPoints::ExecMemCheck(destPtr, true, bytes, currentMIPS->pc);
#endif
if (Memory::IsVRAMAddress(destPtr) || Memory::IsVRAMAddress(srcPtr)) {
gpu->UpdateMemory(destPtr, srcPtr, bytes);
}
return 10 + bytes / 4; // approximation
}
@@ -134,6 +150,13 @@ static int Replace_memmove() {
memmove(dst, src, bytes);
}
RETURN(destPtr);
#ifndef MOBILE_DEVICE
CBreakPoints::ExecMemCheck(srcPtr, false, bytes, currentMIPS->pc);
CBreakPoints::ExecMemCheck(destPtr, true, bytes, currentMIPS->pc);
#endif
if (Memory::IsVRAMAddress(destPtr) || Memory::IsVRAMAddress(srcPtr)) {
gpu->UpdateMemory(destPtr, srcPtr, bytes);
}
return 10 + bytes / 4; // approximation
}
@@ -144,6 +167,12 @@ static int Replace_memset() {
u32 bytes = PARAM(2);
memset(dst, value, bytes);
RETURN(destPtr);
#ifndef MOBILE_DEVICE
CBreakPoints::ExecMemCheck(destPtr, true, bytes, currentMIPS->pc);
#endif
if (Memory::IsVRAMAddress(destPtr) || Memory::IsVRAMAddress(destPtr)) {
gpu->UpdateMemory(destPtr, destPtr, bytes);
}
return 10 + bytes / 4; // approximation
}
@@ -355,6 +384,12 @@ static int Replace_dl_write_matrix() {
#endif
}
#ifndef MOBILE_DEVICE
CBreakPoints::ExecMemCheck(PARAM(2), false, count * sizeof(float), currentMIPS->pc);
CBreakPoints::ExecMemCheck(PARAM(0) + 2 * sizeof(u32), true, sizeof(u32), currentMIPS->pc);
CBreakPoints::ExecMemCheck(dlStruct[2], true, (count + 1) * sizeof(u32), currentMIPS->pc);
#endif
dlStruct[2] += (1 + count) * 4;
RETURN(dlStruct[2]);
return 60;