Opened 8 months ago

Closed 8 months ago

#12390 closed defect (fixed)

AGS: Quest for Glory II Remake: Saving from the game's save screen, overwrites 2nd slot

Reported by: OmerMor Owned by: criezy
Priority: blocker Component: Engine: AGS
Version: Keywords: ags qfg2agdi qfg2vga qfg2 save
Cc: OmerMor, tomasz89 Game: Quest for Glory 2

Description

ScummVM version: ScummVM 2.3.0git15005-gf13eb59e6c (Apr 9 2021 06:26:50)
OS: Windows 10

When saving from the game's save screen (F5), the game always overwrites the 2nd save slot.

When saving from ScummVM's save screen (CTRL-F5, Save), you can explicitly pick the save slot and it works. However it occasionally crashes the game (probably an unrelated bug).

Change History (6)

comment:1 by tomasz89, 8 months ago

Cc: tomasz89 added
Priority: highblocker

comment:2 by tomasz89, 8 months ago

Crash on saves, and one save slot is pretty hampering for play testing.

comment:3 by criezy, 8 months ago

I might have an idea about what is wrong.
The AGS engines lists the savegames from most recent to older. In ScummVM we don't actually have access to the files modification dates, so we don't do this sorting. That means they are sorted with the ScummVM default sorting, which is by increasing slot number (which usually means from oldest to most recent). We could try to parse the save date string from the save, but an easy change I can make is to at least sort by decreasing slot numbers rather than increasing slot numbers.

It is possible that QFG II Remake uses this savegame list and assumes the most recent is also the higher slot and thus always use the slot from the first savegame in the list + 1. That would explain why it always overwrite the second savegame. And sorting by decreasing slot number would solve that. I will make some tests tonight to validate this hypothesis and try to fix the issue.

comment:4 by criezy, 8 months ago

I made the change, but unfortunately that did not fix it.
This appears to be controlled by game scripts, and I have not idea what the game scripts logic is in this game.

One thing I noticed is that it uses a ".Qfg2Sav" suffix for the savegame files (e.g. agssave.001.Qfg2Sav), which we drop in ScummVM as this is not supported. I wonder if that could be related...

comment:5 by criezy, 8 months ago

After a bit more investigation, the suffix does not seem to be the issue as the issue.
It would really help to know what the script does here to pinpoint the issue.

comment:6 by criezy, 8 months ago

Owner: set to criezy
Resolution: fixed
Status: newclosed

Looking at the game scripts helped me understand what was not working in this game when saving with the game's save screen. This was related to checking if a file already exists, that was not working properly in ScummVM. This is now fixed.

I also looked at the crash when saving (and loading) using the ScummVM menu. I am assuming the error you got is the same I saw: "This command cannot be used within non-blocking events such as repeatedly_execute_always". The AGS engine indeed does not support this. So I have now disabled loading and saving from the GMM menu when we are within such a non-blocking event.

Thanks again you for the bug report. This was a fun one to debug and gave me some good insight on AGS scripts :-)

Note: See TracTickets for help on using tickets.