Slattstudio / BetrayedAllianceBook1

Betrayed Alliance is a fanmade DOS-based game with classic handmade EGA pixel art and type-parser interface. Book 1 is the first installment of a planned trilogy of games, each expanding on the world, characters, and story.

Home Page:https://www.slattstudio.com/betrayed-alliance/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

game crash when looking at notes

getaaron opened this issue · comments

just started 1.3.2

got marbles, read note, talked to wizard, got map, got book in closet (have 5 points)

looking at the books in my inventory says i can read books in menu bar

I don't see anything about books in the menu bar but I saw a notes option in the character menu

when i click it i get

ERROR: [sci-fanmade-fallback 0/997 TheMenuBar::handleEvent @ 0468]: Uninitialized read for temp 507!

I am playing this in the latest build of scummvm (that's where sci-fanmade-fallback comes from — but the uninitialized read part looks like a game bug perhaps?

ScummVM SCI dev here, just to note - this hints to an internal script bug. We let unknown uninitialized temp reads fly for release builds (simply because we don't want to ruin a users play time), but script errors like these may cause all sorts of issues. We pretend that the temp was set to zero for release builds, but that may cause game bugs, because some scripts expect specific values there instead of 0. Temp space was not initialized by the Sierra interpreter and their compiler didn't check for these either.

That's good to know moving forward, thanks for the insight.

Also it's nice to see that ScummVM now has an SCI fangame fallback profile!

Is the 0 value fallback configurable in a daily build from the website or do I need to build from source? IIRC the fanmade profile is not available in the latest release.

I think it's hard-coded, you would have to build it yourself to change it.
for developer daily builds it's a hard error, so that people notice. If it was just a warning, people (who are testing) would miss it. And as I said these script bugs caused several issues down the line for us and originally it took ages to even figure out what was actually going wrong. Normally we would add a workaround to workarounds.cpp, or create a script patch, but for this I think it would be better to get the script bug actually fixed.

But actually a good idea, maybe I should add a debug flag or a console command to disable the hard error for developer builds. It should default to the hard error though, otherwise issues like this may get missed.

I tracked it down. So there's a temporary variable in MenuBar's handleEvent method called hPause that is no longer used. In the SCI Template Game it's used in the MenuBar case MENU_PAUSE but this case no longer exists in Book 1. So hPause is never defined and never used. Removing it is an easy fix.

EDIT: Hmm maybe that's not it. Just running with the latest ScummVM daily build and that didn't work. I'll keep hunting.

Maybe take a look using SCI Viewer. It's temp 507.
You can also use the ScummVM SCI debugger to figure out which temp contains what, maybe that will help. You can use it after getting the error.

For example use command "vm_vars temp xx" to view the content of a temp.
You can also use command "vm_vars temp" to view all temp variables.

The last temp variable isn't being defined before it's referenced in one of the handleEvent cases (specifically the Notes menu option). I defined the temp and recompiled but now ScummVM refuses to recognize it as a sci-fanmade-fallback and lists a bunch of SCI demos instead and now I can't run it at all. Under the originally recognized game profile in ScummVM it just said "game data not found."

EDIT: And now for no apparent reason it's working again.
The change worked. ScummVM no longer crashes on the Notes menu option.

Thanks everyone. We've patched this in staging-v1.4.0 if any of you would like to test it out in ScummVM 🙏
018bf79