Correctly identify a blockwise memcpy.

Oops, I didn't realize this one went in blocks of 16.
This commit is contained in:
Unknown W. Brackets
2013-12-27 21:39:05 -08:00
parent 7a643f3c78
commit ed759d32ff
4 changed files with 23 additions and 3 deletions
+17 -1
View File
@@ -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);
}
}
+2 -1
View File
@@ -363,6 +363,7 @@
<None Include="..\android\jni\Android.mk" />
<None Include="..\android\jni\Application.mk" />
<None Include="..\android\jni\Locals.mk" />
<None Include="..\assets\knownfuncs.ini" />
<None Include="..\assets\langregion.ini" />
<None Include="..\atlasscript.txt" />
<None Include="..\atlasscript_lowmem.txt" />
@@ -414,4 +415,4 @@
<UserProperties RESOURCE_FILE="DaSh.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>
</Project>
+3
View File
@@ -299,6 +299,9 @@
<None Include="..\ios\ViewController.mm">
<Filter>Other Platforms</Filter>
</None>
<None Include="..\assets\knownfuncs.ini">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ppsspp.rc">
+1 -1
View File
@@ -38,7 +38,7 @@
1a7564fa3e25c992:844 = memcpy
1aad94c0723edfc0:124 = vmmul_t_transp
1ab33b12b3cb8cb0:28 = vqmul_q
1ac05627df1f87f4:112 = memcpy
1ac05627df1f87f4:112 = memcpy16
1bdf3600844373fd:112 = strstr
1c967be07917ddc9:92 = strcat
1d03fa48334ca966:556 = _strtol_r