From c87657f066ca9cbb0e07963c31cf57c96b1c5068 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Feb 2012 21:54:50 +0200 Subject: [PATCH] SCI: Added some sanity checks by digitall - Limit the LB1 cursor workaround to LB1 only (so that fanmade games aren't affected) - Error our when bad cursor hotspots are found --- engines/sci/graphics/cursor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp index b269e8ba510f..daab532d0e83 100644 --- a/engines/sci/graphics/cursor.cpp +++ b/engines/sci/graphics/cursor.cpp @@ -145,7 +145,7 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) { // Special case for the magnifier cursor in LB1 (bug #3487092). // No other SCI0 game has a cursor resource of 1, so this is handled // specifically for LB1. - if (resourceId == 1) + if (g_sci->getGameId() == GID_LAURABOW && resourceId == 1) colorMapping[3] = _screen->getColorWhite(); // Seek to actual data @@ -175,6 +175,11 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) { rawBitmap = upscaledBitmap; } + if (hotspot.x >= heightWidth || hotspot.y >= heightWidth) { + error("cursor %d's hotspot (%d, %d) is out of range of the cursor's dimensions (%dx%d)", + resourceId, hotspot.x, hotspot.y, heightWidth, heightWidth); + } + CursorMan.replaceCursor(rawBitmap, heightWidth, heightWidth, hotspot.x, hotspot.y, SCI_CURSOR_SCI0_TRANSPARENCYCOLOR); kernelShow();