The MegaZeux world file header (for all versions) is documented here. From there, we can see that the following logic is sufficient:
Bytes 0-24 can then be used to parse the world title (codepage 437, null-terminated).
Like the instructions above:
Bytes 0-24 can then be used to parse the world title.
Like the instructions above:
The most comprehensive to detect a MegaZeux 2.00+ file is to use `checkres`, a tool built as part of the MegaZeux distribution (source code, directory src/utils):
./checkres -AV [file]
If the error code is 1, the file is not a valid MegaZeux 2.00+ file. If the error code is 0, the file is a valid MegaZeux 2.00+ file - additionally, a CSV will be output containing the file's dependencies and whether or not they have been located, for example:
Required by,Expected file,Status,Found in CAVERNS.MZX,CV_BALON.MOD,FOUND,. CAVERNS.MZX,CV_BOSS.MOD,FOUND,. CAVERNS.MZX,CV_HEVEN.MOD,FOUND,. CAVERNS.MZX,CV_MAGIC.MOD,FOUND,. CAVERNS.MZX,CV_STORY.MOD,FOUND,. CAVERNS.MZX,CV_TECH.MOD,FOUND,. CAVERNS.MZX,CV_TITLE.MOD,FOUND,.
Notice that I mentioned “2.00+” (this is also important, as for very modern files - we're talking the last few years - the format changed significantly, being effectively a ZIP file with a special file layout). For MegaZeux 1.xx worlds (the only MegaZeux worlds currently on DiscMaster), the output will be as follows:
ERROR: Worlds from MegaZeux 1.xx are not supported by this utility.
As with ZZT/Super ZZT, I am open to working on a dedicated tool to handle these (though PNG screenshot exports would be a little trickier).