diff options
author | Colin Snover | 2016-08-27 11:41:02 -0500 |
---|---|---|
committer | Colin Snover | 2016-08-27 12:03:37 -0500 |
commit | c3335657f76e84ebe687597c383b5bad2e8847ba (patch) | |
tree | 83c80af04fa97316119104d69448afbf40b57766 /engines/sci/engine | |
parent | 5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a (diff) | |
download | scummvm-rg350-c3335657f76e84ebe687597c383b5bad2e8847ba.tar.gz scummvm-rg350-c3335657f76e84ebe687597c383b5bad2e8847ba.tar.bz2 scummvm-rg350-c3335657f76e84ebe687597c383b5bad2e8847ba.zip |
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.
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kernel_tables.h | 4 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index 9c0fb2267b..6e141e7f3b 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 51437f10f8..a33fcf3167 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; } |