Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Software:Pokémon Emerald

From ReverseEngineering.wiki
Software
Developer Game Freak
Publisher Nintendo / The Pokémon Company
Platforms Platform:Game Boy Advance
Versions BPEE (USA/Europe English), revision 0
On this wiki Facts · Code · Notes · Topics

Role-playing game by Game Freak (2004, Game Boy Advance). The pret/pokeemerald matching decompilation rebuilds the English ROM (game code BPEE) with agbcc.

Overview

The decompilation (https://github.com/pret/pokeemerald) builds pokeemerald.gba with SHA-1 f3ae088181bf583e55daf962a92bb46f4f1d07b7 (also in rom.sha1). Header values come from the top of its Makefile: title POKEMON EMER, game code BPEE, maker code 01, revision 0; tools/gbafix writes them (see Format:Game Boy Advance ROM image).

The save file is the common Generation 3 layout of Format:Pokémon Generation 3 save file (sector footer with signature 0x08012025, two rotating slots; include/save.h, src/save.c), and boxed Pokémon use Format:PK3.

Toolchain

  • Matching build: agbcc (not shipped in the repo; installed from pret/agbcc into tools/agbcc) with -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -g, assembled and linked with devkitARM as -mcpu=arm7tdmi and ld. Some files override the compiler: libc.o, m4a.o use old_agbcc, librfu_intr.o uses agbcc_arm with -O2.
  • make modern builds with a modern GCC (-mthumb -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder); it does not match the original ROM.
  • Link order of the C objects is in ld_script.ld; sym_ewram.txt, sym_bss.txt, sym_common.txt fix the order of RAM variables (they contain .include "src/<file>.o" lines, not addresses).

Entry

src/crt0.s is the startup code behind the header branch; it calls AgbMain. See Platform:Game Boy Advance.

Code & repositories

  • https://github.com/pret/pokeemerald @ 731ad5bfd6e6f265508d0efcca0ba42f9dcf5881 · license: none
    Matching decompilation of Pokemon Emerald (BPEE) for the Game Boy Advance. Useful without building: Makefile (header values, agbcc flags), rom.sha1, ld_script.ld (link order), src/crt0.s, tools/gbafix/gbafix.c (header layout and complement check).
    Tested on: source read, not run: Read at commit 731ad5b: Makefile, README, crt0.s, gbafix.c; not built · checked 2026-10-18; last activity 2026-10-01; no license: not reusable