Porsche Unleashed for Apple Silicon

Porsche Unleashed for Apple Silicon is a native macOS port of Need for Speed: Porsche Unleashed made by static recompilation with widescreen and sharp rendering.

README

Porsche Unleashed for Apple Silicon

A native macOS (arm64) port of Need for Speed: Porsche Unleashed (2000), made by static recompilation: the original x86 game code is translated to C and compiled for Apple Silicon. Nothing runs through an emulator or a Windows compatibility layer: the game code runs natively, with a small native runtime in place of Windows.

Unofficial, non-commercial, personal project. Not affiliated with or endorsed by Electronic Arts or Porsche. This repository holds no game files: the port reads them from your own copy of the game.

Racing in the mountains, 8 cars, widescreen Quick race menu with the performance overlay

Highlights

  • Runs natively on Apple Silicon. 85–90 FPS with 7 opponents on an M5 Pro, about 2 W of CPU power for the game itself.
  • Widescreen. The game's wide mode is reshaped to your display, so there are no side bars, and the game draws its own HUD for that shape.
  • Sharp rendering. The 3D is drawn at the window's full Retina resolution, whatever resolution the game itself runs at.
  • Smooth frame pacing. An even 60 FPS lock in races, while menus run at the display's refresh rate.
  • Better sound. Audio is mixed at the output device's own rate (48 kHz) with cubic interpolation.
  • Gamepads. Any controller macOS knows works through SDL3, including both sticks and the triggers.
  • Performance overlay. Shows chip, macOS, display, CPU/GPU load and temperatures, RAM, power draw, FPS and a frame-time graph.
  • Standalone app. A single .app with the game inside it, so it can run from any folder or a USB drive. Saves are kept in ~/Library/Application Support/NFS Porsche.

Displays and resolution

Widescreen mode adapts to the usable area of your display so the game can fill it in full screen.

  • 16:9 display. For a display set to 1920 × 1080, 2560 × 1440, or 3840 × 2160, choose 852 × 480 in the game's video settings. This is the widescreen entry, rounded to a width the game can use.
  • MacBook with a notch. The usable area below the notch is typically close to 16:10. The same widescreen entry can show 764 × 480 or 768 × 480, depending on the display.

The dimensions shown in the game's settings control the layout of the HUD and menus. The port draws the 3D scene at the window's available pixel resolution, including the extra pixels on Retina displays.

Controls

KeysAction
Cmd+JShow / hide the performance overlay
Cmd+LToggle the 60 FPS lock
Cmd+FToggle full screen

Everything else is the game's own controls (keyboard, mouse, gamepad), configured in its options menu. Keyboard remapping was fixed in v0.93. You can change key bindings from the in-game Controls menu.

How it works

Porsche.exe / nfs5.exe  ──►  discover.py  ──►  lift.py / gen.py  ──►  C  ──►  clang (arm64)
   (x86 code)                (functions)        (x86 → C)                          │
                                                                                   ▼
                    runtime/: Windows APIs, DirectInput, DirectSound, Glide → OpenGL, SDL3
  • recomp/ is the static recompiler.
    • It finds every function, then translates each x86 instruction to C.
    • x87 floating point is emulated on doubles.
    • 64-bit integer loads and stores through the FPU are kept exact.
    • CPU flags are computed lazily.
    • 3dfx Glide driver code and the community patch DLL (nfs5.dll) are recompiled the same way.
  • runtime/ is the native environment that replaces Windows:
    • windows and input through SDL3;
    • the Win32 API subset the game uses;
    • DirectInput and DirectSound;
    • a Glide 3 implementation on OpenGL (batched draws, a specialized shader per render state).
  • recomp/tests/ checks the translation against the Unicorn CPU emulator, both per instruction and per function on random inputs (8132 of 8322 functions match; the rest differ or could not be compared, see docs/FINDINGS.md).
  • docs/ holds the plan (PLAN.md) and the findings about the game's code (FINDINGS.md).

Building

You need:

  • an Apple Silicon Mac;
  • Xcode command-line tools and Homebrew sdl3;
  • Python 3 with capstone and pefile in tools/venv;
  • your own copy of the game, with the community "Modern Patch" (nfs5.exe + nfs5.dll), in NFS PU/Need For Speed - Porsche Unleashed/.

Then build:

recomp/build_nfs5.sh                 # recompile the game code (output in build/, never committed)
runtime/build.sh                     # link the runtime -> build/nfspu
tools/app/make_app.sh --standalone   # self-contained build/NFS Porsche.app

Function discovery for Porsche.exe uses a function list exported from Ghidra (tools/ghidra_scripts/ExportFunctions.java).

Status

Changelog

Menus, races with opponents, the cockpit view, replays and saves work; not every track and mode has been played through yet. One player reported a blank screen in a quick race before the first Evolution race; it has not been reproduced. Work in progress: polishing, then HD texture replacement and higher frame rates.