UPDATE (August 28th 2015): The "wolf3d" subdirectory has been renamed "w3d_plus", now that the same codebase can be used to recreate (ignoring debugging information differences) the EXE for the DOS port of Super 3-D Noah's Ark, v1.0. The same applies to the .diff file. Other than this edit, I haven't touched the original post.
UPDATE (June 27th 2015): Blake Stone EXEs can be recreated as well now, with another post added to here on this topic. To summarize, versions 2.1 and 3.0 of Blake Stone: Aliens of Gold, Shareware and Registered, as well as versions 1.00 and 1.01 of Planet Strike, can be rebuilt using Borland C++ 3.1 and LZEXE 0.91. The rest of this post is untouched.
Hey there, I think it's a good time to link to the following repository (you may be interested in the "wolf3d" subdirectory): https://bitbucket.org/NY00123/gamesrc-ver-recreation/
The topic's description should briefly tell what is this, so it may be good to tell how did I get to all of that.
Back in September of 2014, following a campaign to acquire the rights to publish the "lost" episode of Commander Keen known as "Keen Dreams", original sources for this episode were made available. These include sources not just for one, but apparently all versions of Keen Dreams originally made in the 90s for DOS, with the possible exception of 1.93 (which isn't that different from 1.92 anyway and could also be reconstructed).
It looked to me like the sources were in a relatively good state, and that the released forms were not greatly different from the originals. It's also stated that Borland C++ 2.0 was originally used to build the EXEs, and it also looks clear that a lot of the EXEs were originally packed using LZEXE 0.91.
Therefore, I decided to have a little attempt, using Borland C++ 2.0 and LZEXE 0.91 to build and pack version 1.13 (Shareware release). Turns out, I got the exact same EXE as created in 1992, byte-by-byte. I also got such results with at least a few other versions.
This looks like the main motivation behind starting the "gamesrc-ver-recreation" repository above (although originally under a different location). I think that initially, I wanted to try and recreate the Catacomb Abyss v1.13 EXE. Eventually, this followed with the Catacomb 3-D v1.0 EXE and the Catacomb Abyss v1.24 EXE. To compare, the Catacombs sources as released on June of 2014 can be used to build the Catacomb 3-D v1.22 EXE, as well as an EXE *very* close to Catacomb Abyss v1.24. However, for some reason, in order to get exactly the original v1.24 EXE, STARTTILE8 has to be edited in GFXE_ABS.EQU, but not in GFXE_ABS.H (there's some function in ID_VW_AE.ASM which shouldn't be called but is compiled into the EXE, for which this has an effect). The exact same edit is also required for recreation of the v1.13 EXE.
Eventually, I decided to fiddle with the Wolf3D/SOD sources for similar purposes, gradually adding projects for recreation of certain EXEs over time. With a few exceptions, the right tools can now be used to build original EXEs from the sources above, byte-by-byte. The EXEs I refer to are these:
- Wolfenstein 3D Shareware v1.0+1.1+1.2+1.4, Apogee releases (with cheats).
- Wolfenstein 3D Registered v1.1+1.2+1.4, Apogee releases (with cheats).
- Wolfenstein 3D Registered v1.4, early GT Interactive release.
- Wolfenstein 3D Registered v1.4, ID Software release (same EXE as in the early
GT Interactive release, except for a different logo in the signon screen).
- Wolfenstein 3D Registered v1.4, late GT Interactive release
(no three-letter code is shown after completing an episode).
- Wolfenstein 3D Registered v1.4, Activision release.
- Spear of Destiny demo v1.0, FormGen release.
- Spear of Destiny v1.0+1.4, FormGen releases (copy protected).
- Spear of Destiny v1.4, Activision release (no copy protection).
It should be noted that the original SOD v1.0 EXE, as well as the originally released Activision EXEs (as currently available from Steam), appear to be a bit different. The former has the "LZ91" string from its first 32 bytes replaced with NUL bytes, while the latter two have "shifted" LZEXE signatures. In addition, the very beginning of the SOD v1.0 EXE has a couple of bytes differing from what you may currently get from the sources, implying an increased so-called "BSS section". The STRIPBSS tool included in the same repository wasn't made with this in mind, and I'm not sure about this. However, apparently it was very common to use modified EXEs in which the copy protection is skipped or removed, and this may further add some confusion.
There are also a few EXEs which are *not* reproduced by any project above, and there are great chances they won't be (but at least we have all of the above!):
- A release of SOD v1.4 made for FormGen, mistakenly labelled as v1.0 in the signon screen. (If it's just the v1.4 FormGen EXE, but with another signon screen, then it should be relatively easy to recreate it now.)
- Any translated release.
Unfortunately, there aren't exactly tools I'm aware of that can automatically compare two EXEs from different revisions of very similar source codes, given the EXEs and one source code revision as an input. Hence, the differences had to be manually located. There are still enough ways to ease the work, though. Obviously disassemblers can be used so we don't have to look just at machine code. Furthermore, Borland C++'s linker can generate a MAP file that shows the locations of most functions and variables in the EXE (as segment:offset pairs).
It's not just a matter of modifying the C/H/ASM/EQU files themselves, though. Project settings (like optimizations) had to be guessed for at least 2-3 projects, the ordering of a few source files to had to change in certain projects, there are files that should be removed from some projects (possibly most), and the GAMEPAL data has to be linked in different ways for different projects (either into its own segment, or as a part of the data segment).
Finally, these are still not exactly the original revisions of the sources, since we don't have access to them. However, what can be done now, is telling differences between versions as expressed in the compiled EXE files (e.g., the differences in secret elevator handling between Shareware versions 1.1 and 1.2, although these were basically known for a while).
Last edited by NY00123 on Fri Dec 25, 2015 7:14 pm; edited 3 times in total