How talhamudo/nfsu2recomp works
NFSU2Recomp is a native Apple Silicon port of Need for Speed: Underground 2, combining an ahead-of-time x86-to-C lifter with a runtime that emulates the game’s Win32 and DirectX-facing interfaces. The player selects a game installation and options in the launcher, then starts the engine; lifted game code runs through runtime services for memory, system APIs, graphics, input and audio. The launcher also supports mods, portable copies and save management. Some runtime files are unsampled, so those subsystem links rely on README descriptions rather than inspected call sites.
Main entry points: Model.swift Launcher model · dispatch.c Call dispatch and thunks · boot.c Engine entry · main.swift Launcher UI
Components 23
Launcher and player setup
- Launcher UI
launcher/main.swift - Launcher model
launcher/Model.swift - Game discovery
launcher/Game.swift - Settings
launcher/Settings.swift - Mod management
launcher/Mods.swift - Portable copy
launcher/Portable.swift - Save management
launcher/SaveStore.swift - Save archives and views
launcher/SaveArchive.swift
Static translation
- Function discovery
tools/lifter/genall.py - x86-to-C lifter
tools/lifter/lift.py - Generated game code
tools/lifter/genall.py
Native game runtime
- Engine entry
runtime/boot.c - CPU and guest memory
runtime/cpu.h - Call dispatch and thunks
runtime/dispatch.c - Win32 services
runtime/win32.c - Files and resources
runtime/fileio.c - Direct3D COM bridge
runtime/com.c - Shader and effects support
runtime/d3dx_hle.c - Controller input
runtime/xtinput.c - Audio and input COM
runtime/vsemu.c
Game extensions
- HD enhancements
runtime/enhance.c
Other components
- Player
- Player game installation
Connections 23
- Player → Launcher UI: opens
- Launcher UI → Launcher model: uses
launcher/main.swift - Launcher model → Game discovery: checks installation
launcher/Model.swift - Launcher model → Settings: loads options
launcher/Model.swift - Launcher model → Mod management: manages mods
launcher/Model.swift - Launcher model → Portable copy: creates copy
launcher/Model.swift - Launcher model → Save management: manages saves
- Save management → Save archives and views: archives saves
- Player game installation → Game discovery: is selected
- Launcher UI → Engine entry: starts engine
- Function discovery → x86-to-C lifter: invokes
tools/lifter/genall.py - x86-to-C lifter → Generated game code: translates functions
tools/lifter/genall.py - Generated game code → Engine entry: runs in
- Engine entry → CPU and guest memory: initializes guest
- Engine entry → Call dispatch and thunks: runs guest code
- Call dispatch and thunks → CPU and guest memory: accesses state
- Call dispatch and thunks → Win32 services: dispatches APIs
- Win32 services → Files and resources: uses file services
- Call dispatch and thunks → Direct3D COM bridge: dispatches COM calls
- Direct3D COM bridge → Shader and effects support: uses effect HLE
runtime/com.c - Direct3D COM bridge → HD enhancements: enables HD features
- Call dispatch and thunks → Controller input: routes input
- Call dispatch and thunks → Audio and input COM: dispatches COM calls