Nintendo™ Game Boy Advance emulator and debugger.
This repository has been archived on 2024-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
Michel Heily f0aa671674 optimize/cpu: Pass Arm/Thumb Instruction and other large structs as references.
Also, get rid of unnecessary derive Copy.

Since the ArmInstruction (and Thumb) derived from Copy, the compiler
always saves them to the stack when they are passed by value to other
functions, thus making some unwanted performance overhead.

I removed the derive Copy, and also pass them as references. This
project has a lot of "derive Copy" everywhere, and I should take note if
this is happenning elsewhere aswell.


Former-commit-id: 2f94c6050fa26c5b777244bd26706d4e6e2f0dc9
2020-03-28 16:14:59 +03:00
.vscode chore: Update launch.json 2020-02-01 11:28:56 +02:00
assets windows: Add file icon to build targets 2020-02-12 22:18:58 +02:00
external Bump gba-suite git submodule 2020-02-07 17:36:32 +02:00
media docs: update README.md 2020-01-12 02:04:44 +02:00
rustboyadvance-jni feat/jni: More work on JNI bindings 2020-02-28 15:11:02 +02:00
rustboyadvance-minifb chore: Make GameBoyAdvance the the bios argument as boxed slice rather then a Vec 2020-02-28 15:11:02 +02:00
rustboyadvance-sdl2 chore: Make GameBoyAdvance the the bios argument as boxed slice rather then a Vec 2020-02-28 15:11:02 +02:00
src optimize/cpu: Pass Arm/Thumb Instruction and other large structs as references. 2020-03-28 16:14:59 +03:00
.gitignore Initial commit 2019-06-24 16:36:20 +03:00
.gitmodules Bump gba-suite git submodule 2020-02-07 17:36:32 +02:00
.travis.yml chore: Update .travis.yml 2020-02-21 22:07:06 +02:00
Cargo.lock chore: Update Cargo.lock 2020-02-28 15:11:02 +02:00
Cargo.toml feat/jni: Add rustboyadvance-jni crate to export some simple JNI bindings 2020-02-23 00:30:38 +02:00
LICENSE Create LICENSE 2019-06-24 16:36:20 +03:00
README.md refactor: split "plat" binaries into separate crates 2020-02-23 00:30:38 +02:00

RustBoyAdvance-NG

license Build Status

icon

Nintendo GameBoy Advance ™ emulator and debugger, written in rust.

Progress

Pokemon Emerald

Supported features:

  • Display modes 0,1,2,3,4
  • PCM Audio channels
  • Snapshots (AKA savestates)
  • Cartridge backup saves

Todo:

  • CGB audio (4 wave generator channels)
  • web.asm frontend
  • Andriod & IOS applications
  • color correction
  • Configurable keybindings
  • Controller support

Build and usage

The following instructions build the rba-sdl2 target which is currently the main platform. (rba-minifb is also available without audio support)

To get started, you need to get a stable rust toolchain.

Linux build dependencies

Install SDL2 dependencies

sudo apt-get -y install libsdl2-dev libsdl2-image-dev

Windows build dependencies

Download SDL2 runtime binaries for windows (either 32bit or 64bit depending on the target machine) https://www.libsdl.org/download-2.0.php https://www.libsdl.org/projects/SDL_image/

Extract all the DLLs into the project root (Yeah, its dirty and a build script will be written in the future to automate this)

Build & Usage

You need to obtain a gba bios binary. An open source GBA bios is also available and supported.

Place the bios file in the repository root and name it gba_bios.bin (or alternatively use the -b command line option)

Build and run in release mode (performance is terrible in the dev profile)

$ cargo run --release -p rustboyadvance-sdl2 -- path/to/rom

You can also drag&drop rom files or any zip files containing .gba files inside into the emulator window and a new rom will be loaded.

Key bindings

Currently the key bindings are not configureable.

GBA key bindings:

Keyboard GBA
Up Up
Down Down
Left Right
Right Right
Z B Button
X A Button
Return Start
Backspace Select
A L
S R

Special key bindings

Key Function
Space (hold) Disable 60fps cap
F1 Custom debugger (requires --features debugger)
F2 Spawn gdbserver (experimetnal, requires --features gdb)
F5 Save snapshot file
F9 Load snapshot file

Why is this project needed ?

It's actually not. There are quite a lot of GBA emulators, and even some written in rust. Actually, I couldn't find any game capable emulators written in rust.

I'm only doing this as a side project intended for learning rust.

This is my third take on this project. My first go at this was about 3 years ago, but I didn't like rust much at the time so it got abandoned. I tried to resurrect it a year ago but didn't have the time to get invested in a side-project, let alone learning rust.

I've grown to like rust a lot since then, so here we go again. You know what they say, third time's a charm.

More Screenshots

Kirby - Nightmare in Dreamland Dragon Ball - Legacy of Goku 2

Links and attribution

  • ARM7TDMI Technical Reference Manual Technical Reference Manuals are fun.
  • GBATEK A single webpage written by no$gba developer Martin Korth. This page has pretty much everything. Seriously, it's the best.
  • TONC A comprehensive GBA dev guide that I used a-lot in order to understand the GBA system. Comes with neat demo roms that really helped me during development and debugging.
  • NanoboyAdvance A GameBoy Advance emulator written in C++17 by a nice person called fleroviux. I've used this for debugging.
  • Eggvance gba-suite Incredible test suite for the arm7tdmi interpreter that I'm using, written by Julian Smolka.