erkyrath / lectrote

The IF interpreter in an Electron shell
Other
250 stars 28 forks source link

Support launching with a glksave file #44

Open erkyrath opened 8 years ago

erkyrath commented 8 years ago

(Or accepting glksave open-file events.) Locate the matching .ulx game file, launch the game at that point.

erkyrath commented 8 years ago

This is harder than it looks. A glksave file is player-managed (see http://eblong.com/zarf/glk/terp-saving-notes.html) which means it can only be loaded after the game is up, running, and at a @save opcode.

The sneaky way to support this: when the player first does a @save, in addition to writing a player-managed save file, we also write a terp-managed autosave file. Then, to launch a glksave file, we autorestore the stashed autosave followed by the glksave.

It's all terribly rickety. Additional problem: after the restore, the visible game text will be some old game that the player doesn't remember. Followed by a >SAVE prompt. We may have to wipe textbuffers in self-defense.

erkyrath commented 8 years ago

We'd have to stash a copy of the .ulx file in case the player has moved it.

Also, does a standard glksave file have enough info to locate our autosave folder? Both use a Glulx signature string, but they might be different lengths. Might have to search and prefix-match.

erkyrath commented 8 years ago

Gets important when we build a game-bound app!