0

Ok, I've started playing Zork, the old video game, and I have found that it saves its games in Quetzal file format. I have looked at the od output for it, but can't seem to make any sense out of it. When I Google "quetzal save file", I come across Wikipedia, which gave me this:

The magic-number reading of the files are often shown as:

'IFF data, Z-machine or Glulx saved game file (Quetzal)'

I am sure that it is in Quetzal format, because file returns: IFF data, Z-machine or Glulx saved game file (Quetzal), which is the same as the magic-number (coincedence?).

So, what does magic-number mean, and how can I write a C program to decode it, presumably into an IFZF-like format?

Textmode
  • 509
  • 3
  • 18
built1n
  • 1,518
  • 14
  • 25
  • `Magic-number reading...` is the clue here. All it means is that when `od` looked at the file, it looked at certain well-known locations in the file and found data there that identified the file as being a Quetzal file. – Dave Newman Apr 12 '13 at 22:05
  • 3
    You will need to read this [document](http://ifarchive.giga.or.at/if-archive/infocom/interpreters/specification/savefile_14.txt) on the Quetzal file format. It will probably help to read about the Z-Machine as well as several articles mentioned on its [wiki](http://en.wikipedia.org/wiki/Z-machine) page. Writing a C program to decode a Quetzal file into XML, will go much smoother once you understand the Z-Machine and the Queztal file. Another information source is [Jzip a Z-Machine emulator](http://jzip.sourceforge.net). I believe its sources includes code for reading/writing Quetzal files. – Dave Newman Apr 12 '13 at 22:13

1 Answers1

2

The "magic number" refers to the unique characteristics of a file format that allow commands like file to identify them. For example, Quetzal save files begin with the four-byte sequence IFZS that identifies their Interchange File Format (IFF) document type. You can verify this with a text editor or hex dump.

You can find the Z-machine Common Save-File Format Standard online. You can find various compilers, tools, and specifications at the Interactive Fiction Archive for Z-machine games, which may help you with source code for the format. Note especially the interpreters, which include facilities for saving and restoring games.

Bradd Szonye
  • 280
  • 5
  • 14