# pokered Static recompilation of Pokemon Red into portable C, built with [GB-Recomp/gb-recompiled](https://github.com/GB-Recomp/gb-recompiled). This repo ships pre-generated C sources so it builds out of the box — you don't need an asm toolchain or the pret/pokered decompilation just to play. ## Build You need a C/C++ compiler, CMake 3.16+, SDL2, libcurl, and OpenGL ES 2. CMake fetches `gb-recompiled` automatically (no manual setup). ```sh mkdir build && cd build cmake .. cmake --build . -j$(nproc) ``` This produces a `pokered` executable. ## Run The runtime needs a ROM the first time it boots (it extracts assets into `assets/pokered/` and then runs from there on subsequent launches). Drop a Pokemon Red ROM at `roms/pokered.gb` next to the executable: ```sh mkdir -p roms cp /path/to/pokered.gb roms/pokered.gb ./pokered ``` The launcher auto-starts when only one game is registered, so you go straight into Red. Battery RAM saves to `pokered.sav` next to the binary. Press Esc in-game for the settings menu (palette, audio, savestates, **Restart Game**, etc.). ## Regenerating the C sources If you want to rebuild the C from scratch — bump `gb-recompiled`, pick up a recompiler change, or tweak the analyzer — run: ```sh tools/regen.sh /path/to/pret/pokered /path/to/gb-recompiled ``` That re-builds the ROM via the pret toolchain (requires `rgbds`), then invokes `gbrecomp` with the same flags the compilation uses, and copies the freshly generated `pokered_*.c` files into this repo. Verify with `cmake --build .` and commit. ## In a compilation If you're building a multi-cart compilation that wants to include Red, add this repo via `FetchContent` in your top-level CMakeLists: ```cmake FetchContent_Declare(pokered GIT_REPOSITORY https://github.com/GB-Recomp/pokered.git GIT_TAG main ) FetchContent_MakeAvailable(pokered) # Now link the `pokered_cart` target into your launcher executable # and call pokered_main(argc, argv) from your launcher's g_games[]. ``` The standalone `pokered` executable is only built when this repo is the top-level project, so consuming it as a subdir doesn't produce a conflicting executable target.