Flush icache before memcpys.

Maybe there's a way to optimize this better...
This commit is contained in:
Unknown W. Brackets 2014-07-05 13:23:33 -07:00
parent d2e7dfcc51
commit 2910f7e7a2
2 changed files with 12 additions and 0 deletions

View File

@ -107,6 +107,9 @@ static int Replace_memcpy() {
u32 srcPtr = PARAM(1);
u32 bytes = PARAM(2);
bool skip = false;
// Some games use memcpy on executable code. We need to flush emuhack ops.
currentMIPS->InvalidateICache(srcPtr, bytes);
if (Memory::IsVRAMAddress(destPtr) || Memory::IsVRAMAddress(srcPtr)) {
skip = gpu->PerformMemoryCopy(destPtr, srcPtr, bytes);
}
@ -140,6 +143,9 @@ static int Replace_memcpy16() {
u32 srcPtr = PARAM(1);
u32 bytes = PARAM(2) * 16;
bool skip = false;
// Some games use memcpy on executable code. We need to flush emuhack ops.
currentMIPS->InvalidateICache(srcPtr, bytes);
if (Memory::IsVRAMAddress(destPtr) || Memory::IsVRAMAddress(srcPtr)) {
skip = gpu->PerformMemoryCopy(destPtr, srcPtr, bytes);
}
@ -195,6 +201,9 @@ static int Replace_memmove() {
u32 srcPtr = PARAM(1);
u32 bytes = PARAM(2);
bool skip = false;
// Some games use memcpy on executable code. We need to flush emuhack ops.
currentMIPS->InvalidateICache(srcPtr, bytes);
if (Memory::IsVRAMAddress(destPtr) || Memory::IsVRAMAddress(srcPtr)) {
skip = gpu->PerformMemoryCopy(destPtr, srcPtr, bytes);
}

View File

@ -623,6 +623,9 @@ u32 sceKernelMemcpy(u32 dst, u32 src, u32 size)
{
DEBUG_LOG(SCEKERNEL, "sceKernelMemcpy(dest=%08x, src=%08x, size=%i)", dst, src, size);
// Some games copy from executable code. We need to flush emuhack ops.
currentMIPS->InvalidateICache(src, size);
bool skip = false;
if (Memory::IsVRAMAddress(src) || Memory::IsVRAMAddress(dst)) {
skip = gpu->PerformMemoryCopy(dst, src, size);