Skip to content

Add Emerald support and PyGBA raw-state save/load#2

Open
OrekiDawson wants to merge 3 commits into
NousResearch:mainfrom
OrekiDawson:emerald-support
Open

Add Emerald support and PyGBA raw-state save/load#2
OrekiDawson wants to merge 3 commits into
NousResearch:mainfrom
OrekiDawson:emerald-support

Conversation

@OrekiDawson

@OrekiDawson OrekiDawson commented May 21, 2026

Copy link
Copy Markdown

Summary

This PR adds Pokémon Emerald/GBA support to pokemon-agent by introducing an Emerald memory reader, wiring Emerald detection/selection through the CLI and server paths, and fixing PyGBAEmulator state persistence to use mGBA raw-state APIs.

The save/load behavior now supports raw states generated by pokemon-agent's PyGBA/mGBA backend.

Validation

  • uv run pytest test_emerald.py test_imports.py
    • 6 passed
  • uv run ruff check pokemon_agent/memory/emerald.py pokemon_agent/emulator.py test_emerald.py
    • passed
  • Real Emerald ROM raw-state roundtrip:
    • state_size: 397312 bytes
    • same_after_reload: true
  • HTTP acceptance:
    • /health OK
    • /save OK
    • /action wait_60 OK
    • /load OK
    • /load returned Pokemon Emerald (USA)

Known Limitations

External mGBA .ss savestates are intentionally out of scope. Existing .ss files may depend on a different frontend, BIOS, game version, or state serialization format and are not expected to load through this backend.

@OrekiDawson

Copy link
Copy Markdown
Author

Small note on the second commit: the full Gen 1-3 species name table is used by the Emerald memory reader so decoded party/species output is readable across the Emerald Pokédex range. It does not expand the PR scope beyond Emerald/GBA support.

@OrekiDawson

Copy link
Copy Markdown
Author

Follow-up hygiene check against pokeemerald internal constants found one mismatch: Emerald HM item ids are 339-346, not the earlier 259-266 values. Added a small commit fixing those item ids and a regression test; pytest is now 6 passed and ruff remains clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant