Restunts

From Stunts Wiki
Revision as of 22:06, 6 November 2023 by Cas (talk | contribs) (→‎History)

Restunts is the name given to a project originally started in the community with the purpose of disassembling Stunts and then translating it to C and thus obtain a source code we can handle and modify. This was desired because attempts to get to the original source code failed and it appears to not exist anymore. Nowadays, the term sometimes extends to other related efforts, which include modification and recompilation of the assembly source code as well as recreation of parts of the code.

Many extensive forum threads make up vital parts of the history and progress of the project. At its current stage, the dissassembly was completed and recompilation was achieved successfully. Some mods have been created based on this source code and a huge amount of information was learned from reading and analysing it. The knowledge of the Stunts internals has increased significantly thanks to this project and variables and structures have been named and tagged, while the source is already very well commented in many sections. On the other hand, translation into C is minimal as of November 2023.

The source code in its current status has been mirrored and can be found at https://bitbucket.org/dreadnaut/restunts/

History

During the decade of 2000, there had been several moments when wishes of getting the original game source code were expressed. At some point, the community managed to get in touch the Stunts' main programmer Kevin Pickell, who said he didn't have the source and that it was almost certainly lost. With time, there were fewer talks about finding that source code and more about reverse engineering the game one day.

In July 2004, a forum thread was started by user Cyberman in which he tells about his observations on file compression in Stunts. He noticed that the "P" in file extensions stands for "packed". He later continues to notice that the main executable appears to be combined with DIF files for the different graphics cards. While this thread does not progress much at that point, it would later become a spark that starts a fire.

In May 2006, an anonymous user started this one asking about obtaining the source code. Bonzai Joe answers that Kevin Pickell has already said the source code does not exist any more. Cas says later that he has begun disassembling LOAD.EXE, but it's very large and would be better to split it and work in a team. He managed to decompress the binary, but he didn't combine it with the DIF files at that point. This was later abandoned when Cas entered hiatus. Yet, he does talk about what the different car files contain, showing that this was already well known back then. He says he has disassembled STUNTS.COM and that it's nothing but a loader for LOAD.EXE that passes parameters based on the configuration.

In March 2008, dstien posts his analysis on RES files in the first thread and later, he mentions that he has reversed the first decompession pass. Soon, many community members become interested in start participating. This marks the beginning of the complete understanding of Stunts data files and opens the door to car making, among many other things. Another great contributor throughout this thread is Duplode. This investigation apparently led to the development of wiki articles such as: Resource file format.

In January 2009 another forum thread was started by llm, which might be the first thread in the reverse-engineering section of the forum, in which he described his first efforts in decompressing LOAD.EXE. dstien says in his thread that he has been working on this too and that he intends to find the way to combine LOAD.EXE with the DIF files to produce a static binary and make it easier to reverse-engineer the code. In 22 January, Cas posts a Zip file in this thread with what he's been doing. This includes the assembly source for STUNTS.COM as well as the beginning of LOAD.EXE after being unpacked, but not combined. The amount of code is significant considering it's been done manually. At this point, the Reverse Engineering subforum was created.

In October 2009, clvn started [this thread] about bypassing LOAD.EXE, in which he describes the procedure to combine the binary with the HDR/CMN/COD/DIF files for the different graphics cards. It's at this point that in becomes a lot more straightforward to decompile Stunts.

Temporary

The following is temporary information I'm using to build this article:

https://forum.stunts.hu/index.php?topic=1137.0 https://forum.stunts.hu/index.php?topic=2303.0 https://forum.stunts.hu/index.php?topic=2454.0 https://forum.stunts.hu/index.php?topic=2482.0 > Trackdata > Stunts Cartography > Resource file format