More than two decades after its 2003 debut, BioWare and LucasArts’ Star Wars: Knights of the Old Republic remains widely celebrated as one of the greatest role-playing games ever crafted. From the moral complexity of the Jedi Civil War to the unforgettable narrative twist of Darth Revan, KotOR defined an entire era of cinematic storytelling. Yet for modern PC gamers, revisiting the galaxy on Windows 10 or 11 is an exercise in frustration: unhandled graphics driver crashes, characters freezing after combat above 60 Hz, broken grass rendering, and zero native controller support. Now, a transformative preservation effort is rewriting history: Star Wars: Knights of the Old Republic has been statically recompiled into native C.
The project—spearheaded by prolific systems engineer sp00nznet and hosted on GitHub as sp00nznet/kotor-recomp—utilizes the pcrecomp binary translation framework. Unlike reverse-engineered engine reimplementations (such as reone or xoreos), kotor-recomp lifts BioWare's actual shipping retail x86 machine code directly into compilable, modern C. By running BioWare's authentic game logic atop a clean host architecture, the project aims to fix the engine’s long-standing technical ailments directly within the game's own code.
The Lifting Feat: 29,617 Functions Across 4.2 Million Lines of C
BioWare's proprietary Odyssey Engine—developed as a 3D evolution of the Aurora Engine that powered Neverwinter Nights—is a complex maze of C++ virtual hierarchies, custom scripting interpreters, Miles Sound System audio routing, and fixed-function OpenGL 1.x graphics pipelines. The kotor-recomp toolchain achieves complete static translation directly from the Steam release (swkotor.exe v1.03):
Zero Translation Errors Across 29,617 Functions: The lifting pipeline analyzed the retail binary, mapped 96.6% of the .text code section without relying on IDA Pro, and generated 29,617 discrete functions across 4.2 million lines of C with zero lift errors. Additionally, the tool recovered 233 virtual method tables (vtables) and 1,852 virtual methods.
- Instant DRM De-wrapping: The retail Steam binary is protected by SteamStub 2.x with an encrypted code payload. The toolchain incorporates an automated decryptor (
steamstub.py) that extracts the AES-256-CBC payload and recovers the Original Entry Point (OEP) in under a single second. - Self-Contained Host Binary: The resulting C code compiles cleanly under Microsoft Visual C++ (MSVC) or Clang-CL into a standalone 32-bit executable (
kotor.exe) with a statically linked C runtime, requiring zero external DLL redistributables. - Conformance Validation: The project features an automated conformance test harness (
conformance.py) that validates 11 discrete execution milestones from cold boot to the opening Endar Spire dialog, guaranteeing zero code regressions.
Solving Two Decades of PC Engine Bugs in Native Code
While the initial alpha release focuses on core execution bring-up, the primary raison d'être of kotor-recomp is addressing the notorious bugs that have plagued the PC version on modern hardware:

| Legacy Engine Flaw | Behavior in Retail KotOR PC (2003) | kotor-recomp Modern Solution |
|---|---|---|
| The Grass Bug | Severe stuttering or instant CTDs on modern AMD and NVIDIA drivers when grass is enabled. | Lifting OpenGL 1.x pipeline into C enables modernized vertex buffer allocation and batching. |
| High Refresh Freeze | Characters freeze in place after combat when running above 60 Hz due to physics/VSync coupling. | Game simulation loop and frame presentation are completely decoupled from host refresh rates. |
| Deprecated Shader Extensions | Missing specular reflections, lightsaber blooms, and shield effects on modern drivers. | Rewrites obsolete NVIDIA register combiners and GL_ATI_fragment_shader calls into modern shaders. |
| Controller Support | Completely absent; keyboard and mouse only. | Native XInput Gamepad Support: Full thumbstick, trigger, and button mapping built into the host. |
| Widescreen & UI Distortion | Hardcoded 4:3 aspect ratios; community hex-edits break turret minigames and swoop racing. | Native viewport resolution scaling with centered, undistorted HUD elements. |
| FMV Movie Playback | Unscaled 640×480 Bink video windows; frequent crashing during level transitions. | Clean windowed presentation and borderless scaling without display mode thrashing. |
Native XInput Gamepad Integration
When BioWare originally ported Knights of the Old Republic from the original Xbox to Windows in late 2003, they famously excised all gamepad support, forcing players to navigate menus and combat strictly via mouse clicks and keyboard hotkeys. For couch play, handheld PCs like the Steam Deck, and living room gaming, this was a massive drawback.
First-Class Controller Integration: kotor-recomp builds native XInput gamepad support directly into the host runtime. Analog sticks seamlessly translate into character navigation and camera orbit, triggers handle weapon and target cycling, and face buttons map cleanly to combat actions—bringing the intuitive feel of the original Xbox console release to PC without third-party key-remapping software.
Current Status: Endar Spire Playability
The project has reached v0.1.0-dev alpha. Through automated headless testing harnesses (--headless --record out.mp4), the recompiled binary successfully executes the complete opening of the game:
- Intro & Logos: LucasArts and BioWare intro logos render cleanly.
- Main Menu & Character Generation: Custom character class selection, attribute points, skill allocation, and portrait selection function properly.
- The Endar Spire Opening: The game loads the Endar Spire starship, triggers the opening cinematic cutscene, and loads into real-time gameplay.
- Dialogue & HUD: The player can engage with Trask Ulgo, progress through branching dialogue trees, and interact with the full HUD and tutorial popups—all executing entirely in lifted C code.
Clean-Room Architecture & How to Build
In accordance with open-source software preservation ethics, kotor-recomp distributes zero copyrighted LucasArts or BioWare game assets, textures, models, audio banks, or binaries. The entire recompilation pipeline operates locally against the user’s legitimately owned Steam installation:
- Ensure prerequisites are installed (Python 3.10+, Visual Studio 2022 C++ tools, CMake 3.20+, and Ninja).
- The script automatically locates your Steam copy of Star Wars: Knights of the Old Republic, decrypts the Steam wrapper, extracts vtables, generates the function catalog via
disasm32, lifts 29,617 functions to C, and compilesbuild/kotor.exe. - Launch the game with
KotOR (recomp).cmd. Use--soundto enable audio playback, or connect an Xbox controller for instant gamepad play.
Run the automated setup utility:
Setup.cmdClone or download the repository from GitHub:
git clone https://github.com/sp00nznet/kotor-recomp.gitThe Renaissance of Classic RPG Preservation
Following the static recompilations of Need for Speed Underground 2 and Command & Conquer: Tiberian Sun, kotor-recomp proves that complex early-2000s 3D RPGs are prime candidates for binary recompilation. By unlocking BioWare’s legendary Odyssey Engine from the constraints of 32-bit Windows and legacy OpenGL drivers, this breakthrough paves the way for a definitive, high-framerate, modern remaster of one of the greatest Star Wars stories ever told.
Resources & Community Links
- GitHub Repository: sp00nznet/kotor-recomp on GitHub
- Core Recomp Toolchain: pcrecomp by sp00nznet
- Target Game Build: Steam release of Star Wars: Knights of the Old Republic (swkotor.exe v1.03)