Z-machine: parameters for @save

You are right, this no longer works for me either - this is an important hint though, seems in my fumbling earlier I somehow managed to get a save file that worked. So the issue seems to be that you can’t start from a normal save file. Indeed, the following code now works:

	if (f_setup.restore_mode == 1) {
		FILE *gfp = fopen(f_setup.save_name, "rb");
		if (gfp) { 
			restore_quetzal(gfp, story_fp);
			fclose (gfp);
		}
		f_setup.restore_mode = 0;
	}

Note that for the following sequence there is no zork1.tmp file when starting:

$ ./dfrotz -B "look" -L zork1.tmp -R . -m zork1.z3
>look


West of House
You are standing in an open field west of a white house, with a boarded
front door.
There is a small mailbox here.

$ ./dfrotz -B "open mailbox" -L zork1.tmp -R . -m zork1.z3 
>open mailbox


Opening the small mailbox reveals a leaflet.

$ ./dfrotz -B "read leaflet" -L zork1.tmp -R . -m zork1.z3 
>read leaflet


(Taken)
"WELCOME TO ZORK!

ZORK is a game of adventure, danger, and low cunning. In it you will
explore some of the most amazing territory ever seen by mortals. No
computer should be without one!"

Unfortunately, I don’t have the time to investigate more.

Edit: the file used for saving above is zork1.tmp.qzl and not zork1.tmp. Note that it can’t be restored as a normal save file.

I agree this is an important hint. It suggests to me that we look at what should be identical Quetzal files made by Bot Mode and Normal and see what’s different. I still suspect a pointer is not where it should be, but at least I’m getting a vaguely better idea of where and how though I can’t articulate it yet. To that end, I’ve committed your changes with some of mine so we and others can better study the problem.

I think what’s needed now is a means to dissect and edit a Quetzal file. Unfortunately, I’m unaware of any such tool, so I’ll be writing one. The ckifzs program from Jzip reports the corrupted Quetzal files as valid.

[added later]

I’ve adapted scanblorb.pl to dump the contents of a Quetzal file. This new script is available at https://gitlab.com/DavidGriffith/blorbtools as scanquetzal.pl.

After consulting the Z-machine Standard and playing around with scanquetzal.pl, I’ve determined that I need to edit quetzal.c to dump the entirety of the Z-machine’s memory into a save file to figure out where things went wrong. To make sense of this, I’ll need to alter infodump from ztools to work on a memory dump rather than a Z-code file.