Skip to content

VGKintsugi/Ghidra-SegaSaturn-Loader

Repository files navigation

Ghidra Sega Saturn Loader

A (WIP) Ghidra loader for the Sega Saturn. Currently supports:

  • ISO disc images
  • Mednafen Save States (MC)
  • Yabause Save States (YSS)

Grab from Releases or build from source.

Screenshots

Loader screenshot
Loader

Disassembly View w/Decompiler Disassembly View

How to Use

Sega Saturn ISOs

  • Select any Sega Saturn ISO file
  • At the "Container file detected" prompt, select "Single file"
  • The loader will create functions for main, initial program (the code that runs during the Sega logo), and security_check
  • Pros: Easy to use, useful for debugging game initialization, works great on Saturn homewbrew
  • Cons: Doesn't load any file after the first file on disc

Mednafen Save States (MC)

  • gunzip the Mednafen save state
  • Select the unzipped file in Ghidra
  • The loader will load backup cart memory, high work RAM, and low work RAM to the correct places
  • The loader will add labels for SH-2s PC, PR, and R15 registers

Yabause Save States (YSS)

  • Select any Yabause Save State (YSS)
  • The loader will load backup cart memory, high work RAM, and low work RAM to the correct places
  • The loader will add labels for SH-2s PC, PR, and R15 registers

Applying Sega Saturn Library Signatures

  • After loading in Ghidra, open "Script Manager" and execute ApplySig.py
  • Select the signature file to apply

Issues

  • Code quality needs serious improvement and refactoring
  • Memory map doesn't handle mirrored regions
  • Adding the onchip register region (0xffffffe00-0xffffffff) to the memory map made decompilation worse. So it's disabled.
  • It would be useful to label some globals to assist reversing
  • Mednafen memory cart data doesn't match Yabause's.

Building

  • gradle -PGHIDRA_INSTALL_DIR=<Absolute path to Ghidra>
  • The output zip file will be created within /dist

Installation

  • Ghidra 9.1 added SH-1/SH-2 support.
  • Copy the zip file to <Ghidra install directory>/Extensions/Ghidra.
  • Start Ghidra and use the "Install Extensions" dialog to finish the installation. (File -> Install Extensions...).
  • (Optional but recommended) Install the ApplySig script so you can use Sega Saturn library signatures. Copy to a ghidra_scripts directory.
  • (Optional but recommended) Download CyberWarriorX's Sega Saturn library signatures

Credits/References