QUEEN: Fix loading savegame from Launcher

Loading a savegame from the Launcher for FOTAQ was broken by
commit de879dd (QUEEN: Disable load/save until game is properly
initialized). The patch comes from libretro to fix an issue
described as "ScummVM allows you to load a previous save before
the game is properly initialised. At best, this leads to
undefined behaviour. Most of the time it causes a segfault."

This commit allows loading save game earlier than the original
patch so that loading savegames from the launcher works again.
I don't know the details of the issue that was seen in libretro,
but I tested this change with both address-sanitizer and valgrind
on both Linux and macOS, and neither tool report any issue when
loading a savegame from the launcher.

This fixes bug #11327 (FOTAQ: Loading save game from the launcher
doesn't work).
This commit is contained in:
Thierry Crozat 2020-05-19 01:30:29 +01:00
parent 42a03ccc19
commit 60de72a73e

View File

@ -352,6 +352,7 @@ Common::Error QueenEngine::run() {
syncSoundSettings();
_logic->start();
_gameStarted = true;
if (ConfMan.hasKey("save_slot") && canLoadOrSave()) {
loadGameState(ConfMan.getInt("save_slot"));
}
@ -364,9 +365,6 @@ Common::Error QueenEngine::run() {
_logic->currentRoom(_logic->newRoom());
_logic->changeRoom();
_display->fullscreen(false);
// From this point onwards it is safe to use the load/save
// menu, so consider game to be 'started'
_gameStarted = true;
if (_logic->currentRoom() == _logic->newRoom()) {
_logic->newRoom(0);
}