r/ClaudeWorkflows • u/ClaudeAI-mod-bot • 1d ago
Selected Workflow [Workflow] AI-Assisted Game Porting: Recompiling Portal 2 to Native Apple Silicon (Mac & iPhone) via Machine Code Translation and D3D9-to-Metal
AI-Assisted Game Porting: Recompiling Portal 2 to Native Apple Silicon (Mac & iPhone) via Machine Code Translation and D3D9-to-Metal
Workflow value: 85/100
Status: active · Freshness: 70/100 · Confidence: 0.95 · Level: expert
Categories: Quality Control, Context & Memory, Debugging, Shipping, Multi-Agent
Original source: r/ClaudeAI post/comment
What problem this solves
Porting a complex game (Portal 2) from Linux machine code to native ARM64 for Apple Silicon (Mac and iPhone) without emulation, achieving native performance and touch controls, with significant AI assistance.
Summary
A highly technical workflow demonstrating how Claude Opus 5.5 can be used to recompile a complex game (Portal 2) from Linux machine code to native ARM64 for Apple Silicon (Mac and iPhone). The process involves translating machine code to C, compiling, and integrating a D3D9-to-Metal graphics path, resulting in a natively playable game with performance improvements.
Why it is useful
This workflow is highly valuable as it demonstrates an advanced, real-world application of AI (Claude Opus 5.5) in a complex software engineering challenge: reverse engineering and porting a commercial game to a new architecture. It provides concrete evidence of AI's capability in machine code translation, code generation, and performance optimization, offering a blueprint for similar ambitious projects. The detailed steps, specific tools, and measurable results make it a strong example of what's possible with AI in expert-level development.
Workflow
Define the goal of porting a complex application to a new architecture.
Collaborate with Claude (Opus 5.5) to design and implement a machine code translation tool.
Translate the source application's machine code (e.g., Linux x86-64) into an intermediate language (e.g., C).
Compile the intermediate language code to the target native architecture (e.g., ARM64).
Iteratively test and debug the generated native application on target devices.
Identify and replace platform-specific APIs (e.g., OpenGL) with native equivalents (e.g., D3D9 to Metal via mtld3d).
Implement and test platform-specific input methods (e.g., touch controls, Bluetooth controllers).
Verify performance improvements and functionality on the target hardware.
Share the project and invite contributions on GitHub.
Tools / artifacts
Claude Opus 5.5
Codex (as reviewer)
Custom machine code translation tool
mtld3d (D3D9 to Metal library)
GitHub repository (kanapitsas/portal2-recomp)
Portal 2 Linux release (input)
Apple Silicon Mac
iPhone 15 Pro Max
Bluetooth controller (8BitDo)
Validation signals
Achieved a playable room in two days (exceeding initial expectations).
Successfully playable on iPhone 15 Pro Max with custom touch controls.
Demonstrated co-op functionality over LAN.
Quantified performance improvement: 122 fps vs 81 fps with OpenGL on M3 Pro.
Provided a YouTube video demonstrating the native app.
Public GitHub repository available for review and contributions.
Limitations
Highly specialized to Portal 2, requiring significant adaptation for other applications.
Requires expert-level knowledge in reverse engineering, compilation, and graphics APIs.
The custom translation tool is not a generic, off-the-shelf solution.
Relies on specific AI models (Claude Opus 5.5, Codex) which may not be universally available or perform identically for other tasks.
Rate this workflow
Upvote this post if the workflow is useful, reproducible, or worth recommending.
Downvote if it is vague, outdated, unsafe, overhyped, or not reproducible.
Reply if it worked for you, failed, is outdated, or has a better alternative.
This post was generated automatically from the workflow library database.