Opened 6 years ago

Closed 6 years ago

#10736 closed defect (fixed)

AGI: Fan Game Biru Quest triggers an assertion

Reported by: raziel- Owned by: digitall
Priority: normal Component: Engine: AGI
Version: Keywords:
Cc: Game: AGI Fanmade

Description

ScummVM 2.1.0git (Oct 10 2018 08:30:53)
Features compiled in: Vorbis FLAC MP3 RGB zLib MPEG2 Theora AAC FreeType2 JPEG PNG cloud (servers, local)

Starting this AGI fan game triggers an assertion:
User picked target 'agi-fanmade-73' (gameid 'agi')...

Looking for a plugin supporting this gameid... AGI preAGI + v2 + v3
Starting 'Sierra AGI game'

AGI: Using PC-BIOS font
Emulating Sierra AGI v2.917
assertion "x >= 0 && x < _videoMode.screenWidth" failed: file "backends/graphics/surfacesdl/surfacesdl-graphics.cpp", line 1548

Biri Quest 1 (DOS/English)

NB: It's called "Biri Quest 1" in .ini, but comes with the name "BiruQuest" in the .zip

AmigaOS4 - PPC - SDL - BE
gcc (adtools build 8.1.0) 8.1.0

Attachments (1)

BiruQuest(wSRC).zip (78.4 KB ) - added by raziel- 6 years ago.
The game

Download all attachments as: .zip

Change History (3)

by raziel-, 6 years ago

Attachment: BiruQuest(wSRC).zip added

The game

comment:1 by digitall, 6 years ago

Even if the fangame is badly written or contains dodgy resources, it should not cause an assertion from the backend graphics!

Have replicated the issue and now have a backtrace:

#5  0x00005555556a559d in ModularBackend::copyRectToScreen (this=0x555555a19e70, 
    buf=0x555556586f90, pitch=320, x=576, y=792, w=8, h=8) at backends/modular-backend.cpp:161
#6  0x00005555555d853c in Agi::GfxMgr::copyDisplayRectToScreen (this=0x555556514a50, x=576, 
    y=792, width=8, height=8) at engines/agi/graphics.cpp:319
#7  0x00005555555db2ed in Agi::GfxMgr::drawCharacterOnDisplay (this=0x555556514a50, x=576, 
    y=792, character=32 ' ', foreground=15 '\017', background=0 '\000', 
    transformXOR=0 '\000', transformOR=0 '\000') at engines/agi/graphics.cpp:1182
#8  0x00005555555daf8d in Agi::GfxMgr::drawCharacter (this=0x555556514a50, row=99, column=72, 
    character=32 ' ', foreground=15 '\017', background=0 '\000', disabledLook=false)
    at engines/agi/graphics.cpp:1118
#9  0x000055555560093a in Agi::TextMgr::displayCharacter (this=0x55555653a5f0, 
    character=32 ' ', disabledLook=false) at engines/agi/text.cpp:320
#10 0x00005555556007dc in Agi::TextMgr::displayText (this=0x55555653a5f0, 
    textPtr=0x555555a00940 <Agi::TextMgr::stringWordWrap(char const*, short, short*, short*)::resultWrappedBuffer> "         QUEST", disabledLook=false) at engines/agi/text.cpp:290
#11 0x00005555556006c2 in Agi::TextMgr::display (this=0x55555653a5f0, textNr=1, textRow=99, 
    textColumn=72) at engines/agi/text.cpp:254
#12 0x0000555555619ad2 in Agi::cmdDisplay (state=0x55555657f5a8, vm=0x55555657f500, 
    parameter=0x7ffffffb7d54 "cH\001") at engines/agi/op_cmd.cpp:2124
#13 0x000055555561a9a7 in Agi::AgiEngine::runLogic (this=0x55555657f500, logicNr=1)
    at engines/agi/op_cmd.cpp:2413
#14 0x000055555561653a in Agi::cmdCall (state=0x55555657f5a8, vm=0x55555657f500, 
    parameter=0x7ffffffb7e55 "\001") at engines/agi/op_cmd.cpp:1122
#15 0x00005555556165eb in Agi::cmdCallF (state=0x55555657f5a8, vm=0x55555657f500, 
    parameter=0x7ffffffb7eb4 "") at engines/agi/op_cmd.cpp:1133
#16 0x000055555561a9a7 in Agi::AgiEngine::runLogic (this=0x55555657f500, logicNr=0)
    at engines/agi/op_cmd.cpp:2413
#17 0x000055555560dc9e in Agi::AgiEngine::interpretCycle (this=0x55555657f500)
    at engines/agi/cycle.cpp:149
#18 0x000055555560e7c7 in Agi::AgiEngine::playGame (this=0x55555657f500)
    at engines/agi/cycle.cpp:442

This appears to be an issue drawing the characters in the startup logo. This is running 320x200, but the relevant part is here:

#7  0x00005555555db2ed in Agi::GfxMgr::drawCharacterOnDisplay (this=0x555556514a50, x=576, 
    y=792, character=32 ' ', foreground=15 '\017', background=0 '\000', 
    transformXOR=0 '\000', transformOR=0 '\000') at engines/agi/graphics.cpp:1182
#8  0x00005555555daf8d in Agi::GfxMgr::drawCharacter (this=0x555556514a50, row=99, column=72, 
    character=32 ' ', foreground=15 '\017', background=0 '\000', disabledLook=false)
    at engines/agi/graphics.cpp:1118

This is converting row 99, column 72 into (x, y) 576, 792 which is very much out of the 320x200 screen size. I think two fixes will be needed, a sanity clamp to prevent similar issues in future causing assertions and possibly some fix to work out why this results in this out of bound x, y ... unless the game is working on a larger screen size, but I don't think that is the issue (since even 640x480 would result in out of bounds).

comment:2 by digitall, 6 years ago

Owner: set to digitall
Resolution: fixed
Status: newclosed

Fixed by clamping the relevant graphics call parameter to within the screen area values. This does not fix the underlying graphics issue if the game data is incorrect, but it does prevent the assertions allowing further game testing and debug.

This is commit c8b98dd41cb395d56de15f447b28f6b8b3c3e2e3.

Closing as fixed.

Note: See TracTickets for help on using tickets.