r/emulation • u/Zertrox01 • 11h ago
AI-assisted elf64-recomp: I built a static x86_64-to-ARM64 recompiler from scratch and got Portal: Revolution (Win64 / Direct3D 11) running natively on macOS Apple Silicon (Metal, no Rosetta, no Wine, no JIT)
Hi everyone,
I've been working on elf64-recomp, an open-source (MIT) ahead-of-time static recompiler for macOS Apple Silicon that translates 64-bit x86_64 Windows (PE32+) and Linux (ELF64) binaries to C and compiles them into native ARM64 Mach-O executables with Clang — no Rosetta 2, no Wine, no JIT, and no virtualization.
I just got Portal: Revolution (Strata Source, Windows x64 + Direct3D 11) running natively on my MacBook Pro M4 Pro.
How it works under the hood:
- Static lifting (x86_64 -> C -> ARM64): All 31 Windows x64 PE32+ modules (revolution.exe, engine.dll, client.dll, server.dll, shaderapidx11.dll, panorama.dll, etc.) are statically lifted to C and compiled into native ARM64 Mach-O.
- Unified 64-bit address space: Binaries are mapped above macOS ARM64's GPU carveout (0x70000000000+, 16 KiB aligned) so guest pointers equal native ARM64 pointers with zero pointer marshalling.
- Direct3D 11 -> Apple Metal: Custom Win64 COM vtable bridge + live DXBC (SM4/SM5) to Metal Shading Language (MSL) shader translator (d3d11_metal.m / dxbc_msl.c).
- Panorama UI: Bridged MSVC x64 V8 directly to Apple's native JavaScriptCore, paired with Cairo/Pango/FreeType.
- Linux ELF64 + Vulkan: Also includes a Linux System V AMD64 frontend and an 865+ command Vulkan bridge to libMoltenVK.dylib.
GitHub repo: https://github.com/Zertrox123/elf64-recomp
(Note: The repo only contains the recompiler, runtime, and bridges — no game assets or copyrighted files are included. You need your own Steam copy of Portal: Revolution.)
Happy to answer any questions.

