The goal of this repository is to document and re-implement some functions of the original game to enable the modding community. It is NOT to do matching compilation, or decompile the game entirely.
The current source of truth is data_symbols.syms
for global variables and src/generated/hook_generated.c
for functions (Generated by scripts/GenerateHooks.py
on hook_generated_c.j2
)
The project is heavily influenced by the OpenJKDF2 project.
For the time being, the HD replacement mod is another separate project located in the dinput_hook/
directory here.
It uses knowledge such as function location and global variable locations from the decompilation project in order to replace the rendering functions.
You can find releases of this mod here
All this work, discussion and collaboration is done in the official Discord server
The progress here lists the functions which have been analysed (not necessarily re-implemented)
- 25 October 2023, 30.54% (656 / 2148).
- 30 March 2024, 51.3% (1106 / 2156)
- 5 February 2025: Initial release of the 3D model HD replacement pack
- git
- Ghidra 10.2.2 for decompilation
- x32dbg as an assembly level debugger
Original file format decompilation is done in this repository. The project is a Blender addon to decompress and recompress the original game files
This repository still lacks a lot of functions, symbols and global variables.
If you want to contribute, you'll need python, a windows C compiler and Ghidra.
Symbols can be imported using scripts in the scripts/Ghidra
directory. You should "Parse C source" on the src/types.h
file
before using the scripts to import functions prototypes via headers.
One can import the master_header.h
generated by GenerateMasterHeader.py
into Ghidra by running ImportHeaderInfos.py
inside Ghidra.
Global variables can be imported from the data_symbols.syms
file using scripts/Ghidra/importDataSymbols.py
and running it inside Ghidra.
Use 32-Bit MinGW and CMake to build the dinput.dll
hook (WinLibs GCC 13.2.0 (POSIX threads) + MinGW-w64 11.0.1 UCRT (release 5) i686 is known to work). If -DGAME_DIR=<game directory>
is passed as a CMake parameter the compiled dinput.dll
is automatically placed into the game directory.
- USE_RELEASE_HOOK
- GAME_DIR="pathToGame" (Move the compiled
dinput.dll
directly into the game directory) - PYTHON_EXECUTABLE="pathToPython" (Cmake Specific)
The hook writes debug information into hook.log
while running and makes all original game functions callable, as long as they have a valid address and function prototype in ./src
.
To test the decompilation of single functions they can be marked with a // 0xADDRESS HOOK
comment to replace the original function in the game:
// 0x004238d0 HOOK
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int nCmdShow)
{
... this function will be called instead of the original WinMain function.
}
Remove the word HOOK
if you don't want to replace the original function:
// 0x004238d0
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int nCmdShow)
{
... this function will NOT be called.
}
The freshly installed GOG version of the game (SWEP1RCR.EXE
) has the following md5: e1fcf50c8de2dbef70e6ad8e09371322
Other versions are not yet tested
Download the vcpp5 iso for original compiler configuration here: https://winworldpc.com/product/visual-c/5x
See NOTES.md for more infos
Special thanks goes to
- George Lucas
- the LucasArt team that made all these years of fun possible,
- JayFoxRox for the original work on the decompilation back in 2018,
- LightningPirate and Galeforce from the SWEP1RCR discord community for their work on asset packing and decomp,
- Aphex from the SWEP1RCR discord for his work on asset export to modern file formats and decompilation symbols.
- Urgon from the Indiana Jones and the Infernal Machine decomp project, for his bindiff with swe1r
- Ben1138 for the custom Tracks decomp, code and hooks
- Angello from the SWEP1RCR discord for decompilation
The original game (Star Wars Episode 1 Racer) is a property of the LucasArts Entertainment Company LLC.
The content provided on this repository is for informational and educational purposes only. It is not intended to infringe upon any copyrighted material.
If you believe that any content on this repository violates your copyright or intellectual property rights, please contact us immediately to seek resolution.
I am not liable for any loss or damage, including but not limited to indirect or consequential loss or damage, arising from the use of or reliance on any content found on this repository.