aboutsummaryrefslogtreecommitdiff
path: root/engines/drascula
diff options
context:
space:
mode:
authorFilippos Karapetis2008-06-08 15:56:48 +0000
committerFilippos Karapetis2008-06-08 15:56:48 +0000
commit069ffd4b701db0ff8faf1bd163945c3a0d99b494 (patch)
tree49ef3490fe723be4052e9747815539f64c1bf4b1 /engines/drascula
parente2e4c90bb3b36f96ca0d0b763d723882599dc458 (diff)
downloadscummvm-rg350-069ffd4b701db0ff8faf1bd163945c3a0d99b494.tar.gz
scummvm-rg350-069ffd4b701db0ff8faf1bd163945c3a0d99b494.tar.bz2
scummvm-rg350-069ffd4b701db0ff8faf1bd163945c3a0d99b494.zip
Removed the MiVideoSSN buffer, using screenSurface instead. Added a FIXME for decodeOffset (as it can incorrectly write beyond 64000 bytes, up to 64256)
svn-id: r32619
Diffstat (limited to 'engines/drascula')
-rw-r--r--engines/drascula/drascula.h1
-rw-r--r--engines/drascula/graphics.cpp37
2 files changed, 19 insertions, 19 deletions
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 76814e5844..56ec856675 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -287,7 +287,6 @@ public:
byte *frontSurface;
byte *textSurface;
byte *memPtr;
- byte *MiVideoSSN;
byte *mSession;
byte cPal[768];
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp
index 054e8f13aa..a9f754d0f2 100644
--- a/engines/drascula/graphics.cpp
+++ b/engines/drascula/graphics.cpp
@@ -28,7 +28,10 @@
namespace Drascula {
void DrasculaEngine::allocMemory() {
- screenSurface = (byte *)malloc(64000);
+ // FIXME: decodeOffset writes beyond 64000, so this
+ // buffer has been initialized to 64256 bytes (like
+ // the original did with the MiVideoSSN buffer)
+ screenSurface = (byte *)malloc(64256);
assert(screenSurface);
frontSurface = (byte *)malloc(64000);
assert(frontSurface);
@@ -464,12 +467,9 @@ void DrasculaEngine::screenSaver() {
void DrasculaEngine::playFLI(const char *filefli, int vel) {
// Open file
- MiVideoSSN = (byte *)malloc(64256);
globalSpeed = 1000 / vel;
FrameSSN = 0;
UsingMem = 0;
- if (MiVideoSSN == NULL)
- return;
_arj.open(filefli);
mSession = TryInMem();
LastFrame = _system->getMillis();
@@ -479,7 +479,6 @@ void DrasculaEngine::playFLI(const char *filefli, int vel) {
term_int = 1;
}
- free(MiVideoSSN);
if (UsingMem)
free(memPtr);
else
@@ -529,13 +528,13 @@ int DrasculaEngine::playFrameSSN() {
memcpy(BufferSSN, mSession, Lengt);
mSession += Lengt;
}
- decodeRLE(BufferSSN, MiVideoSSN);
+ decodeRLE(BufferSSN, screenSurface);
free(BufferSSN);
waitFrameSSN();
if (FrameSSN)
- mixVideo(VGA, MiVideoSSN);
+ mixVideo(VGA, screenSurface);
else
- memcpy(VGA, MiVideoSSN, 64000);
+ memcpy(VGA, screenSurface, 64000);
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
_system->updateScreen();
FrameSSN++;
@@ -548,13 +547,13 @@ int DrasculaEngine::playFrameSSN() {
memcpy(BufferSSN, mSession, Lengt);
mSession += Lengt;
}
- decodeOffset(BufferSSN, MiVideoSSN, Lengt);
+ decodeOffset(BufferSSN, screenSurface, Lengt);
free(BufferSSN);
waitFrameSSN();
if (FrameSSN)
- mixVideo(VGA, MiVideoSSN);
+ mixVideo(VGA, screenSurface);
else
- memcpy(VGA, MiVideoSSN, 64000);
+ memcpy(VGA, screenSurface, 64000);
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
_system->updateScreen();
FrameSSN++;
@@ -590,15 +589,17 @@ byte *DrasculaEngine::TryInMem() {
void DrasculaEngine::decodeOffset(byte *BufferOFF, byte *MiVideoOFF, int length) {
int x = 0;
- unsigned char Reps;
- int Offset;
+ int size;
+ int offset;
- memset(MiVideoSSN, 0, 64000);
+ memset(screenSurface, 0, 64000);
while (x < length) {
- Offset = BufferOFF[x] + BufferOFF[x + 1] * 256;
- Reps = BufferOFF[x + 2];
- memcpy(MiVideoOFF + Offset, &BufferOFF[x + 3], Reps);
- x += 3 + Reps;
+ offset = BufferOFF[x] + BufferOFF[x + 1] * 256;
+ // FIXME: this writes beyond 64000, so the buffer has been initialized
+ // to 64256 bytes (like the original did)
+ size = BufferOFF[x + 2];
+ memcpy(MiVideoOFF + offset, &BufferOFF[x + 3], size);
+ x += 3 + size;
}
}