mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-16 11:03:45 +01:00
Correctly identify a blockwise memcpy.
Oops, I didn't realize this one went in blocks of 16.
This commit is contained in:
1 parent
7a643f3c78
commit
ed759d32ff
4 files changed
+23
-3
No files matched your search
@@ -109,6 +109,19 @@ static int Replace_memcpy() {
|
||||
return 10 + bytes / 4; // approximation
|
||||
}
|
||||
|
||||
static int Replace_memcpy16() {
|
||||
u32 destPtr = PARAM(0);
|
||||
u32 srcPtr = PARAM(1);
|
||||
u32 bytes = PARAM(2) * 16;
|
||||
if (bytes != 0) {
|
||||
u8 *dst = Memory::GetPointerUnchecked(destPtr);
|
||||
u8 *src = Memory::GetPointerUnchecked(srcPtr);
|
||||
memmove(dst, src, bytes);
|
||||
}
|
||||
RETURN(destPtr);
|
||||
return 10 + bytes / 4; // approximation
|
||||
}
|
||||
|
||||
static int Replace_memmove() {
|
||||
u32 destPtr = PARAM(0);
|
||||
u32 srcPtr = PARAM(1);
|
||||
@@ -357,6 +370,7 @@ static const ReplacementTableEntry entries[] = {
|
||||
{ "floorf", &Replace_floorf, 0, 0},
|
||||
{ "ceilf", &Replace_ceilf, 0, 0},
|
||||
{ "memcpy", &Replace_memcpy, 0, 0},
|
||||
{ "memcpy16", &Replace_memcpy16, 0, 0},
|
||||
{ "memmove", &Replace_memmove, 0, 0},
|
||||
{ "memset", &Replace_memset, 0, 0},
|
||||
{ "strlen", &Replace_strlen, 0, 0},
|
||||
@@ -386,6 +400,8 @@ void Replacement_Shutdown() {
|
||||
replacedInstructions.clear();
|
||||
}
|
||||
|
||||
// TODO: Do something on load state?
|
||||
|
||||
int GetNumReplacementFuncs() {
|
||||
return ARRAY_SIZE(entries);
|
||||
}
|
||||
@@ -423,7 +439,7 @@ void WriteReplaceInstruction(u32 address, u64 hash, int size) {
|
||||
return;
|
||||
}
|
||||
replacedInstructions[address] = prevInstr;
|
||||
INFO_LOG(HLE, "Replaced %s at %08x", entries[index].name, address);
|
||||
INFO_LOG(HLE, "Replaced %s at %08x with hash %016llx", entries[index].name, address, hash);
|
||||
Memory::Write_U32(MIPS_EMUHACK_CALL_REPLACEMENT | (int)index, address);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user