First post, by nemo
Hi all,
I'd like to share a tool I've been building for reverse engineering 32-bit DOS and early Windows games: retro-kit (open source, Apache 2.0).
https://github.com/nemo22/retrokit
It wraps headless Ghidra in a pipeline aimed at the games of roughly 1993-2010: DOS/4GW, DOS/32A, PMODE/W, CauseWay and DOS/4G-bound LE/LX executables built with Watcom C/C++, and Win32 PE (mostly MSVC). You point it at an EXE and get a workspace with one decompiled C file of every function, plus indexes (functions, call graph, strings, pointer tables) that you can grep, split up, or hand to an AI agent.
DOS side
- Its own LE/LX loader for Ghidra 12 (objects, fixups applied and recorded, BW bind chains, OS/2 LX imports), checked against an independent Python model of each image
- Watcom calling conventions: both register (-3r/-5r) and stack (-3s/-5s), detected automatically from the code
- Functions found from fixups and pointer tables (state machines and handler tables are where much of the game logic lives), switch tables kept inside their functions, parameter counts recovered from call-site cleanup
- Library signatures: the Watcom C run-time, math and C++ libraries are named and typed (built from Open Watcom; a fuzzy tier handles the old 10.x/11.0 run-time that differs byte for byte), zlib and IJG libjpeg too. If you own an original Watcom or MSVC, you can build signatures from its libraries locally.
- retrokit libs recognises ~20 period libraries from strings, imports and data files: Miles/AIL, HMI SOS, DIGPAK/MIDPAK, Smacker, Bink, PKWARE DCL, VESA/UniVBE, ...
- retrokit convert: XMIDI (Miles), HMI/HMP (HMI SOS) -> standard MIDI, VOC -> WAV, Smacker/Bink/FLIC -> MP4 via FFmpeg
Win32 side
- DirectX 3-9 calls through COM vtables com(*dd->lpVtbl->CreateSurface)(dd,&desc,&primary,0) instead of (**(code **)(*dd + 0x18))(...)
- Imports from Miles (MSS32), Smacker, Binktotypes
- C++ classes, base classes and vtables from MSVC RTTI; compiler version from the Rich header
How good is it?
Everything is measured on small synthetic programs built with Open Watcom in several configurations (stack/register convention, -od, DOS/4GW, DOS/32A, PMODE/W, st the linker map. On those, all ownfunctions are found, parameter counts match for 27 of 28 functions, all string literals show up as literals, and about 90% of the run-time library is named. On a rhe signatures name around a hundred run-time functions. It is a starting point for your own reading, not a one-click source code generator: you still name things,
and it keeps track of your names and re-expo
There is also an MCP server, so an AI agent functions, xrefs, strings and tables andrecord name proposals while you review them. Totally optional, everything works from the command line and plain files.
Runs on Windows and Linux. Needs Python 3.10+, a JDK 21 and Ghidra 12.
The repository contains no game files and no decompiled game code, and I'd ask to keep it that way in any feedback.
It's meant for software you own and for reimk.
I'd be very glad for feedback, especially:
- DOS extenders, compilers or packers it dompressed executables aren't supported yet)
- sound/video libraries or data formats worth adding to the catalog
- bug reports: the output of retrokit ini] for the EXE is usually enough to start
Thanks!