Giter Site home page Giter Site logo

ghidraboy's Introduction

GhidraBoy: Sharp SM83 / Game Boy extension for Ghidra

Very experimental! No compatibility guarantees!

Ghidra version: Ghidra 10.1.2_PUBLIC_20220125

Tetris disassembly

Features

  • Sharp SM83 (CPU core used in Game Boy) support for Sleigh
  • Game Boy ROM loader:
    • Can load unbanked ROMs (<= 32kB, e.g. Tetris)
    • Can load banked ROMs (> >32kB, e.g. Pokemon)
    • Can load greyscale boot ROMs (DMG/DMG0/MGB/SGB/SGB2)
    • Can load color boot ROMs (CGB/CGB0)
  • Memory blocks based on the hardware memory map
    • Banked regions use overlays (TODO: figure out if there's a better way to support them)
    • GB vs GBC differences are handled (e.g. banked WRAM)
  • Symbols for hardware registers (0xFFxx range)
    • GB vs GBC differences are handled (e.g. existence of KEY1 register)
  • Game Boy cartridge header data types
    • Enumerated types for some things

How to install

  1. Download a prebuilt GhidraBoy release, or build it yourself.
  2. Start Ghidra
  3. File -> Install Extensions
  4. Press the plus icon ("Add extension")
  5. Choose the built or downloaded GhidraBoy zip file
  6. Restart Ghidra when prompted to load the extension properly

How to build

As a prerequisite, you need to have a Ghidra installation somewhere (an actual installation, not a copy of Ghidra source code!).

export GHIDRA_INSTALL_DIR=/path/to/ghidra
./gradlew

or

./gradlew -Pghidra.dir=/path/to/ghidra

You can then find a built extension .zip in the build/distributions directory.

Open questions / problems

  • Decompiler output is difficult to read if certain instructions are used (e.g. rotates, JP HL for jumptables)
  • Default "ASM calling convention" assumes all registers can be inputs and/or outputs. Inputs/outputs are often guessed incorrectly, so manual tuning is required for almost every function
  • Are overlays the only / the best solution for handling banked memory areas? Right now in banked ROMs every function call to 0x4000-0x7fff needs to be manually resolved to the correct bank(s)

License

Licensed under the Apache License, Version 2.0.

ghidraboy's People

Contributors

ariscop avatar gekkio avatar superpupperdoggo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.