aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2007-01-09 11:50:22 +0000
committerJohannes Schickel2007-01-09 11:50:22 +0000
commitd61a84e0ab125c6a0208f8d19e91b6b410d0f4f8 (patch)
tree57e6cc888ba920435644fe5f0e21c73a9ec782d8
parent49f773d2f853f36c724eecb0c4bf383e315f0b26 (diff)
downloadscummvm-rg350-d61a84e0ab125c6a0208f8d19e91b6b410d0f4f8.tar.gz
scummvm-rg350-d61a84e0ab125c6a0208f8d19e91b6b410d0f4f8.tar.bz2
scummvm-rg350-d61a84e0ab125c6a0208f8d19e91b6b410d0f4f8.zip
Fix for bug #1631352 ("KYRA1: Graphics heavily broken and ScummVM crash"), I tried memmove here, but it also crashed on Win32 with memmove, so I reverted it back to how it was.
svn-id: r25059
-rw-r--r--engines/kyra/screen.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 80cb2abc65..b170f613ba 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -1414,7 +1414,9 @@ void Screen::decodeFrame4(const uint8 *src, uint8 *dst, uint32 dstSize) {
int len = MIN(count, (code >> 4) + 3); //upper half of code is the length
int offs = ((code & 0xF) << 8) | *src++; //lower half of code as byte 2 of offset.
const uint8 *dstOffs = dst - offs;
- memcpy(dst, dstOffs, len); dst += len;
+ while (len--) {
+ *dst++ = *dstOffs++;
+ }
} else if (code & 0x40) { // 7th bit is set
int len = (code & 0x3F) + 3;
if (code == 0xFE) {
@@ -1432,12 +1434,16 @@ void Screen::decodeFrame4(const uint8 *src, uint8 *dst, uint32 dstSize) {
len = count;
}
const uint8 *dstOffs = dstOrig + offs;
- memcpy(dst, dstOffs, len); dst += len;
+ while (len--) {
+ *dst++ = *dstOffs++;
+ }
}
} else if (code != 0x80) { // not just the 8th bit set.
//Copy some bytes from source to dest.
int len = MIN(count, code & 0x3F);
- memcpy(dst, src, len); dst += len; src += len;
+ while (len--) {
+ *dst++ = *src++;
+ }
} else {
break;
}
@@ -1499,7 +1505,7 @@ void Screen::decodeFrameDeltaPage(uint8 *dst, const uint8 *src, int pitch, bool
template<bool noXor>
void Screen::wrapped_decodeFrameDeltaPage(uint8 *dst, const uint8 *src, int pitch) {
- debugC(9, kDebugLevelScreen, "Screen::decodeFrameDeltaPage(%p, %p, %d)", (const void *)dst, (const void *)src, pitch);
+ debugC(9, kDebugLevelScreen, "Screen::wrapped_decodeFrameDeltaPage(%p, %p, %d)", (const void *)dst, (const void *)src, pitch);
int count = 0;
uint8 *dstNext = dst;
while (1) {