diff options
author | Colin Snover | 2016-05-25 13:59:09 -0500 |
---|---|---|
committer | Colin Snover | 2016-05-25 19:16:11 -0500 |
commit | 719160d4948ccd22d283d5b458cb15622db473f7 (patch) | |
tree | c9e13a604a7c1da9f3de9c4a9e6153f8881a6364 /engines/sci/graphics/compare.cpp | |
parent | c4e8ffc821af321bedecd58d8f25dbe96e5b31ad (diff) | |
download | scummvm-rg350-719160d4948ccd22d283d5b458cb15622db473f7.tar.gz scummvm-rg350-719160d4948ccd22d283d5b458cb15622db473f7.tar.bz2 scummvm-rg350-719160d4948ccd22d283d5b458cb15622db473f7.zip |
SCI32: Fix assertion failures in LSL6 hires caused by bad rects
LSL6 hires sends rectangles to kernel calls that have negative
dimensions. SSCI did not care about this and would simply accept
these invalid rects, so we do the same, at least for now.
Diffstat (limited to 'engines/sci/graphics/compare.cpp')
-rw-r--r-- | engines/sci/graphics/compare.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp index 729eeeaf81..130416ff60 100644 --- a/engines/sci/graphics/compare.cpp +++ b/engines/sci/graphics/compare.cpp @@ -162,12 +162,20 @@ reg_t GfxCompare::kernelCantBeHere32(const reg_t curObject, const reg_t listRefe // rects before operating on them, but this call leverages SCI16 engine // code that operates on inclusive rects, so the rect's bottom-right // point is not modified like in other SCI32 kernel calls - Common::Rect checkRect( - readSelectorValue(_segMan, curObject, SELECTOR(brLeft)), - readSelectorValue(_segMan, curObject, SELECTOR(brTop)), - readSelectorValue(_segMan, curObject, SELECTOR(brRight)), - readSelectorValue(_segMan, curObject, SELECTOR(brBottom)) - ); + Common::Rect checkRect; + + // At least LSL6 hires passes invalid rectangles which trigger the + // isValidRect assertion in the Rect constructor; this is avoided by + // assigning the properties after construction and then testing the + // rect for validity ourselves here. SSCI does not care about whether + // or not the rects are valid + checkRect.left = readSelectorValue(_segMan, curObject, SELECTOR(brLeft)); + checkRect.top = readSelectorValue(_segMan, curObject, SELECTOR(brTop)); + checkRect.right = readSelectorValue(_segMan, curObject, SELECTOR(brRight)); + checkRect.bottom = readSelectorValue(_segMan, curObject, SELECTOR(brBottom)); + if (!checkRect.isValidRect()) { + return make_reg(0, 0); + } uint16 result = 0; uint16 signal = readSelectorValue(_segMan, curObject, SELECTOR(signal)); |