pret/pokeruby is a reverse-engineering project that reconstructs the complete source code of Pokémon Ruby and Sapphire (Game Boy Advance) in C and ARM assembly. The build system compiles the entire game into byte-identical .gba ROMs, verified by pinned SHA1 checksums across a matrix of variants: Ruby/Sapphire, revisions 0/1/2, German localization, debug builds, and a modern-toolchain mode. The repository is the actual working source of the game engine, not documentation: it contains the battle system (turn logic, AI, animations via sprite templates and affine transforms), overworld/field state machines (weather, poison, cut, evolving, day care), Pokémon storage and save/load serialization, contest/link multiplayer subsystems, and the m4a sound driver, all written directly against GBA hardware registers and ARM7TDMI constraints. The architecture is a monolithic single-binary ROM rather than a service or library. Entry points are AgbMain() and the CB2_* main-loop callback system; game systems are orchestrated by a 16-slot task scheduler and a sprite/OAM manager. The build is driven by a sophisticated Makefile that feeds custom C++ asset pipelines — gbagfx (PNG↔GBA tile conversion, Huffman compression), preproc (charmap string embedding, INCBIN expansion), scaninc (include/incbin dependency resolution), mid2agb and wav2agb (MIDI/WAV to m4a data), mapjson/jsonproc (map JSON to assembly) — which generate C arrays and assembly that the hand-written sources consume. Data flows are: raw asset → tool → generated C/asm table → compile/link → .gba ROM → SHA1 comparison against the retail cartridge dump. Because this is a decompilation, the code carries inherent artifacts: sub_* function names, NONMATCHING stubs with NAKED asm fallbacks, unused/unreferenced data, and known UB comments. However, the project is professionally maintained with CI, organized headers, careful localization branching, and a clean separation between game code and build tooling. The tools/ directory is the most reusable asset — each utility is standalone and portable to any GBA homebrew or decomp effort — followed by small hardware-abstraction layers like include/gba/macro.h and src/trig.c.
This repository is a multi-platform decompilation of **Castlevania: Symphony of the Night**, targeting the original PlayStation (PSX), PSP, Sega Saturn, and a modern PC port. It reconstructs the game's source code from original binaries to produce byte-identical builds, while also providing a full reimplementation with a cross-platform port. The codebase is organized into per-stage, per-boss, and per-weapon overlay modules, each defining entity update tables, initialization data, and asset references. A central entity system with step-based state machines drives all game objects, and a shared `g_api` function table enables cross-overlay communication. The project includes extensive tooling for asset extraction/rebuilding (Go), automated code linting and transformation (Rust), binary diffing (Python), and duplicate function detection (Rust). While the decompilation is largely complete for the US PSX version, many PSP and Saturn functions remain as `INCLUDE_ASM` stubs, and the PC port contains several `UnsupportedEntity` placeholders. The architecture demonstrates high craftsmanship in its overlay system, entity dispatch patterns, and modular toolchain, though platform-specific `#ifdef` branching and code duplication across overlays introduce maintenance complexity.
This repository is a bit-exact decompilation of Touhou Koumakyou ~ the Embodiment of Scarlet Devil (TH06) for Windows, aiming to reconstruct the original executable from scratch using reverse engineering. It is primarily an application—a full game reimplementation with subsystems for graphics (Direct3D8), audio (DirectSound, MIDI), input (DirectInput), enemy scripting (ECL), sprite animations (ANM), replay recording, menu UI, and more. The build system uses MSVC 7.0 and DirectX 8.0 SDK, orchestrated by Python scripts and Ghidra for analysis and comparison. While the core purpose is binary-matching reconstruction, the project also functions as a research repository for understanding the game's internals, with extensive mapping data (CSV files) and Ghidra export scripts. The codebase is large, tightly coupled via global singletons, but contains several self-contained reusable components such as the Chain callback system, PBG3 archive parser, DirectSound wrapper, MIDI player, and a standalone PE file parser (pefile.py). Active development and CI indicate ongoing work to complete the decompilation.
This repository is a specialized tool for automated C code permutation to match a target compiled binary, primarily used in video game decompilation projects (e.g., Nintendo 64). The core loop reads a C source file and a target object file, then repeatedly mutates the C code using a set of predefined random transformations, compiles it, disassembles the output, and scores the resulting assembly against the target. The goal is to produce a C source that compiles to identical or nearly identical assembly, reducing manual effort in reverse engineering. The architecture is a Python CLI application with support for multi-threading and distributed computing. The main entry points are `permuter.py` (local mode), `import.py` (project setup), and `pah.py` (network client for distributed 'permuter@home'). The system relies on a vendored fork of pycparser for C parsing and AST manipulation, and it integrates with external tools: a C compiler (GCC, IDO, or MWCC), `objdump` for disassembly, and optionally Docker for sandboxed remote evaluation. A Rust server (`src/net/controller`) manages the distributed network, and a Go systray helper provides a system tray icon for the network client. Data flows are iterative: the tool seeds a candidate, applies one or more random permutations (e.g., introducing temporaries, reordering declarations, transforming expressions), compiles the result, extracts assembly, scores it using a diff-based algorithm, and keeps the best candidate. The process repeats until a perfect match is found or the user stops it. The project demonstrates high craftsmanship in its modular design, with clean abstractions for permutations, scoring, AST utilities, and networking. The vendored pycparser is heavily patched for GNU C extensions, and the custom stubs ensure type safety.
This repository is a work-in-progress decompilation of The Legend of Zelda: Twilight Princess for GameCube and Wii. It reconstructs the original game's source code from its compiled binary, aiming for byte-perfect reproducibility. The codebase is a hybrid of reversed-engineered game logic, reimplemented Nintendo SDK libraries (JSystem, Dolphin, Revolution), and a massive collection of asset resource headers that define model, animation, and collision IDs for every in-game object. The architecture follows the original game's custom actor framework (f_op/f_pc) combined with middleware from JSystem and the Nintendo SDK. The project supports multiple region and platform variants (GameCube, Wii, Nvidia Shield), with resource headers duplicated across version-specific directories. The decompilation is incomplete; many source files are stubs or placeholders (marked NONMATCHING), and the asset headers are auto-generated or manually copied from the original game's data. The code is written in C++ with Metrowerks compiler conventions, and the build system uses Python and Ninja. While not a runnable application on its own (requires a copy of the game), it represents a comprehensive reverse-engineering effort with active development and community engagement.
This repository is a reimplementation of the Deus Ex: Human Revolution Director's Cut (DXHRDC) game engine, created through manual decompilation and cleanup of the original binary, supplemented with debug information from a leaked Tomb Raider (2013) build (same engine family). It is not a matching decompilation and lacks automated resynchronization with the original binary. The engine requires original game assets (BIGFILE.* files) to run and provides core systems for rendering (DirectX 11 abstraction), audio (FMOD-based), animation (animation graph), game logic (object management, AI, player systems), input, UI (Scaleform via ImGui), resource management, and world streaming. The architecture is modular but monolithic, with a central game loop in cdcGameShell/MainG2.cpp. While the code shows evidence of structured design (interfaces, resource management, job system), it contains numerous TODOs, HACKs, and incomplete implementations, indicating ongoing work. Dependencies include DirectX 11 (or dxvk-native for Linux), FMOD, Dear ImGui, and miniz. The project is actively maintained with recent commits.