Opened 12 years ago

Closed 12 years ago

Last modified 12 months ago

#3311 closed defect (fixed)

AGI: The -x command-line option appears to be broken

Reported by: eriktorbjorn Owned by: bluegr
Priority: normal Component: Engine: AGI
Keywords: Cc:
Game:

Description

Latest SVN snapshot

If I try to use the -x command-line option to restore a saved game, things don't seem to work quite as intended. I tried with the English PC versions of King's Quest 1, Space Quest 2, and Leisure Suite Larry 1, where I saved at the very beginning of the game.

In LSL1, it restored the game but didn't give me a command prompt.

In SQ2, it restored the game, but showed me the end of the intro cutscene.

In KQ1 it seemed to work, but...

...perhaps just as seriously, if I tried to restore another savegame from within the game, it would fail with a warning like:

WARNING: This save seems to be from a different AGI game (save from KQ1, running ), not loaded!

It appears that _game.id isn't properly set. I think this is usually done by a set_game_id() opcode.

Ticket imported from: #1751483. Ticket imported from: bugs/3311.

Change History (10)

comment:1 by SF/buddha_, 12 years ago

I'll try to nail this bug during the next few days.

comment:2 by SF/buddha_, 12 years ago

Owner: set to SF/buddha_

comment:3 by SF/buddha_, 12 years ago

I don't seem to get the -x / --save-slot parameter to work at all. It doesn't restore
anything. Tried with KQ2 and PQ1 PC versions and with ScummVM 0.10.0 and the latest SVN.
Investigating...

comment:4 by SF/buddha_, 12 years ago

Using the newest SVN it seems that --save-slot=NUM / -x NUM is indeed correctly parsed from
command line and set as the save_slot-key's value in the configuration manager. But for some
unknown reason that value doesn't get to the AGI engine's end at all. If I try
ConfMan.hasKey("save_slot") in the AGI engine I get false and ConfMan.getInt("save_slot")
results in -1. I'm flabbergasted as to why.

comment:5 by eriktorbjorn, 12 years ago

Strange, the "save_slot" setting reaches the engine just fine for me, and agiInit() calls loadGame() because of it.

comment:6 by SF/buddha_, 12 years ago

Oh well, it seems that I just wasn't using the command line parameter correctly. I did give the --save-slot=NUM i.e. -x NUM parameter alright but didn't give a game on the command line but instead chose it using the launcher.

The save_slot gets put in a transient domain (kTransientDomain) in the configuration manager and the whole transient domain gets cleared when loading a game using the launcher. So no wonder the value never got to the AGI engine :-).

Now I can reproduce the bug. It's broken alright. I also got the menus to disappear when loading some savegame for Police Quest I's PC version. And when I tried accessing the menus I got thrown back to the debugger with an error message.

As I didn't come up with a good way to fix this and I'm starting work on finishing the Apple IIGS sound support I'll put this one back to the pool.

comment:7 by SF/buddha_, 12 years ago

Owner: SF/buddha_ removed

comment:8 by bluegr, 12 years ago

Owner: set to bluegr
Resolution: fixed
Status: newclosed

comment:9 by bluegr, 12 years ago

The problem here is that we're trying to load a game before the game runs its initial scripts. If these don't run, the game's menu is never created, thus all those weird issues occur.

I made the assumption that the game finishes initializing right after it has created the menu, which is where I've moved the code that loads savegames from the command line.

Initial testing with almost all Sierra AGI games shows them to be working, therefore I'm closing this for now

comment:10 by digitall, 12 months ago

Component: Engine: AGI
Note: See TracTickets for help on using tickets.