[Scummvm-git-logs] scummvm master -> c3335657f76e84ebe687597c383b5bad2e8847ba
csnover
csnover at users.noreply.github.com
Sat Aug 27 19:04:00 CEST 2016
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c3335657f7 SCI32: Allow invalid bitmap references to be passed to kBitmapDestroy
Commit: c3335657f76e84ebe687597c383b5bad2e8847ba
https://github.com/scummvm/scummvm/commit/c3335657f76e84ebe687597c383b5bad2e8847ba
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-27T12:03:37-05:00
Commit Message:
SCI32: Allow invalid bitmap references to be passed to kBitmapDestroy
SSCI explicitly ignored invalid references passed to this function.
Fixes GK1 room 410, when using the Rada Drum book on the drummer.
Changed paths:
engines/sci/engine/kernel_tables.h
engines/sci/engine/kgraphics32.cpp
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 9c0fb22..6e141e7 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -380,7 +380,7 @@ static const SciKernelMapSubEntry kText_subops[] = {
// version, subId, function-mapping, signature, workarounds
static const SciKernelMapSubEntry kBitmap_subops[] = {
{ SIG_SINCE_SCI21, 0, MAP_CALL(BitmapCreate), "iiii(i)(i)(i)", NULL },
- { SIG_SINCE_SCI21, 1, MAP_CALL(BitmapDestroy), "r", NULL },
+ { SIG_SINCE_SCI21, 1, MAP_CALL(BitmapDestroy), "[r!]", NULL },
{ SIG_SINCE_SCI21, 2, MAP_CALL(BitmapDrawLine), "riiiii(i)(i)", NULL },
{ SIG_SINCE_SCI21, 3, MAP_CALL(BitmapDrawView), "riii(i)(i)(0)(i)(i)", NULL },
{ SIG_SINCE_SCI21, 4, MAP_CALL(BitmapDrawText), "rriiiiiiiiiii", NULL },
@@ -815,7 +815,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(CreateTextBitmap), SIG_EVERYWHERE, "i(.*)", NULL, NULL },
{ MAP_CALL(DeletePlane), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(DeleteScreenItem), SIG_EVERYWHERE, "o", NULL, NULL },
- { "DisposeTextBitmap", kBitmapDestroy, SIG_SCI2, SIGFOR_ALL, "r", NULL, NULL },
+ { "DisposeTextBitmap", kBitmapDestroy, SIG_SCI2, SIGFOR_ALL, "[r!]", NULL, NULL },
{ MAP_CALL(FrameOut), SIG_EVERYWHERE, "(i)", NULL, NULL },
{ MAP_CALL(GetHighPlanePri), SIG_EVERYWHERE, "", NULL, NULL },
{ MAP_CALL(InPolygon), SIG_EVERYWHERE, "iio", NULL, NULL },
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index 51437f1..a33fcf3 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -647,7 +647,16 @@ reg_t kBitmapCreate(EngineState *s, int argc, reg_t *argv) {
}
reg_t kBitmapDestroy(EngineState *s, int argc, reg_t *argv) {
- s->_segMan->freeBitmap(argv[0]);
+ const reg_t &addr = argv[0];
+ const SegmentObj *const segment = s->_segMan->getSegmentObj(addr.getSegment());
+
+ if (segment != nullptr &&
+ segment->getType() == SEG_TYPE_BITMAP &&
+ segment->isValidOffset(addr.getOffset())) {
+
+ s->_segMan->freeBitmap(addr);
+ }
+
return s->r_acc;
}
More information about the Scummvm-git-logs
mailing list