Skip to content

joshleaves/ghidra-snes

Repository files navigation

SNES tooling for Ghidra.

This project provides a Ghidra extension for loading and working with SNES ROMs. It currently includes:

  • a SNES ROM loader
  • a 65816 language specification tailored for SNES analysis
  • SNES memory helpers (MMIO, WRAM, mirrors) and register/vector labels

Features

SNES ROM loader

The loader maps SNES ROMs into the SNES CPU address space at import time instead of treating them as raw binary blobs.

Supported mappings (canonical):

  • LoROM: 80–FF:8000–FFFF
  • HiROM: C0–FF:0000–FFFF
  • WRAM: 7E–7F:0000–FFFF
  • SNES MMIO register ranges

ROM mapping detection is score-based and compares LoROM and HiROM header candidates. It also supports optional 0x200-byte SMC header adjustment.

The loader creates primary (canonical) ROM banks and required mirror banks (00:0000-5FFF for SNES system RAM & I/O, and 00:8000-FFFF for ROM). Other mirrors can be managed by the (coming next) plugin UI.

Loader implementation:

  • src/main/java/ghidra_snes/loader/SnesRomLoader.java

Carts support

  • LoROM: Supported.
  • HiROM: Supported.
  • ExHiROM: Supported.
  • SA-1: Supported.
  • GSU-n: Supported.
  • Capcom CX-4: Supported.
  • DSP-n: Supported.
  • OBC1: Supported.
  • ⚠️ S-DD1: Partial support. Canonical ROM views are available, but some mappings currently differ from emulator behavior.
  • ⚠️ SPC7110: Partial support. Canonical ROM views are available, but some mappings currently differ from emulator behavior.

More details: Functional tests

65816 language support

The extension includes a SNES-oriented 65816 language definition:

  • language id: 65816:LE:24:snes
  • compiler spec: default

This allows imported ROMs to use native 24-bit 65816 addressing directly in Ghidra.

Build

Set GHIDRA_INSTALL_DIR to your local Ghidra install and run:

GHIDRA_INSTALL_DIR=/path/to/ghidra ./gradlew clean buildExtension

The built extension zip will be created in dist/.

Install

  1. Open Ghidra.
  2. Go to File → Install Extensions...
  3. Click + and select the zip from dist/.
  4. Restart Ghidra.

When importing a ROM, select the SNES ROM Loader format.

Third-party code notice

  • This project includes code originally sourced from ghidra-65816, licensed under the MIT License. Parts of the codebase, notably the 65816 language specification, are derived from that repository, with modifications for compatibility, fixes, and integration.

  • Parts of the SPC7110 checksum behavior were implemented based on observations from SuperFamiCheck, licensed under the MIT License.

Additional resources

Special thanks

Special thanks to Near (formerly known as byuu), whose contributions to SNES documentation, emulation, and preservation have had a lasting impact on the community.

About

Ghidra scripts for SNES ROM reverse engineering

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages