N64: Recompiled - Project Description
What is the project about?
N64: Recompiled is a static recompilation tool that converts N64 game binaries into C code. This C code can then be compiled for various platforms.
What problem does it solve?
It allows N64 code to be run natively on modern systems without the need for emulation (interpretation or dynamic recompilation). This enables porting, tool creation, and faster simulation of N64 behaviors. It also facilitates running specific parts of an N64 binary in a standalone environment.
What are the features of the project?
- Static Recompilation: Translates MIPS assembly instructions from N64 binaries into equivalent C code.
- Overlay Support: Handles both statically linked and relocatable overlays, enabling function lookups and runtime relocation.
- RSP Microcode Support: Can recompile RSP (Reality Signal Processor) microcode.
- Single File Output Mode: Allows recompiling individual functions for patching existing recompiled code, significantly speeding up development iteration.
- Configurable via TOML: Uses a TOML file to specify input/output, function stubs, skipped functions, and instruction patches.
- Jump Table Optimization: Attempts to convert jump table
jr
instructions into C switch-case statements. - Tail-Call Optimization: Recognizes and converts tail-call optimized jumps/branches into function calls.
What are the technologies used in the project?
- C++20: The core language of the recompiler.
- CMake (3.20+): Build system.
- TOML: Configuration file format.
- External Libraries:
- rabbitizer: For MIPS instruction decoding and analysis.
- ELFIO: For parsing ELF (Executable and Linkable Format) files.
- toml11: For parsing TOML files.
- fmtlib: For string formatting.
- MIPS Compilers (IDO, GCC, Clang)
What are the benefits of the project?
- Performance: Runs N64 code natively, potentially much faster than emulation.
- Portability: Allows N64 code to be compiled and run on various platforms.
- Flexibility: Enables the creation of tools and simulations based on N64 code.
- Faster Patching: Single file output mode significantly speeds up the process of patching recompiled code.
- Modding Potential: Planned support for dynamic languages (like Lua) could facilitate runtime code loading for modding.
What are the use cases of the project?
- Porting N64 games: Creating native ports of N64 games to modern platforms.
- Tool Development: Building tools that interact with or analyze N64 game code.
- Simulation: Simulating N64 behaviors at a higher speed than traditional emulators.
- Decompilation/Disassembly Aid: Used in conjunction with decompilation/disassembly efforts.
- Patching and Modding: Creating and applying patches to N64 games, with potential for runtime mod loading.
- Standalone Execution: Running specific parts of an N64 binary in isolation.
- Research: Studying and understanding the inner workings of N64 games.
