From f385752705de73b04cbbda735a71f14c19e241a6 Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Fri, 1 Feb 2013 00:33:30 -0500 Subject: memcpy vs memmove: memmove correctly handles overlapping source and destination memory buffers, but is slower than memcpy in many implementations. When memory buffers don't overlap, memcpy may be more efficient. The DS2 SDK is such an implementation, so change many memmoves into memcpys. --- source/cheats.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/cheats.cpp') diff --git a/source/cheats.cpp b/source/cheats.cpp index dc388d2..9c4a8f2 100644 --- a/source/cheats.cpp +++ b/source/cheats.cpp @@ -190,8 +190,11 @@ const char *S9xGameGenieToRaw (const char *code, uint32 *address, uint8 *byte) void S9xStartCheatSearch (SCheatData *d) { + // memmove may be required: Source is usually a different malloc, but could be pointed to d->CWRAM [Neb] memmove (d->CWRAM, d->RAM, 0x20000); + // memmove may be required: Source is usually a different malloc, but could be pointed to d->CSRAM [Neb] memmove (d->CSRAM, d->SRAM, 0x10000); + // memmove may be required: Source is usually a different malloc, but could be pointed to d->CIRAM [Neb] memmove (d->CIRAM, &d->FillRAM [0x3000], 0x2000); memset ((char *) d->WRAM_BITS, 0xff, 0x20000 >> 3); memset ((char *) d->SRAM_BITS, 0xff, 0x10000 >> 3); -- cgit v1.2.3