mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-12 12:09:15 +00:00
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.
This commit is contained in:
parent
5ea32efbb0
commit
c3335657f7
@ -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 },
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user