From 67908559167844a1a207d1544dfcdbd8f8ca1260 Mon Sep 17 00:00:00 2001 From: sluicebox Date: Tue, 30 Apr 2019 17:46:33 -0700 Subject: SCI: Handle recursive view loop references Fixes bug #10953 in FPFP --- engines/sci/graphics/view.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 014ddb1281..5924571660 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -286,10 +286,15 @@ void GfxView::initData(GuiResourceId resourceId) { seekEntry = loopData[0]; if (seekEntry != 255) { - if (seekEntry >= loopCount) - error("Bad loop-pointer in sci 1.1 view"); _loop[loopNo].mirrorFlag = true; - loopData = _resource->subspan(headerSize + (seekEntry * loopSize)); + + // use the root loop for mirroring. this handles rare loops that + // mirror loops that mirror loops. (FPFP view 844, bug #10953) + do { + if (seekEntry >= loopCount) + error("Bad loop-pointer in sci 1.1 view"); + loopData = _resource->subspan(headerSize + (seekEntry * loopSize)); + } while ((seekEntry = loopData[0]) != 255); } else { _loop[loopNo].mirrorFlag = false; } -- cgit v1.2.3