DMG/CGB/AGB emulator, rewrite in Rust

Overview

GameGirl

A Gameboy (Color/Advance) emulator and debugger written in Rust, whose GG/GGC core is a rewrite of gamelin.
NDS support is in the works!

Try it in your browser!

Screenshots

Playing Pokemon Emerald

Gamegirl playing Pokemon Emerald

Playing Pokemon Crystal Clear

Gamegirl playing Pokemon Crystal Clear

Pokemon Pinball with running debugger and memory viewer

Gamegirl playing Pokemon Pinball

TLoZ: Oracle of Ages with some visual debugging tools open

Gamegirl playing Oracle of Ages

Status

The DMG/CGB emulator is in a good and usable state. Both DMG and CGB emulation is complete and quite accurate, enough to make most commercial games run perfectly.
AGB support is getting there. Some things are still missing; especially the PPU needs a few more features implemented. Most games are playable, but with minor graphical glitches.

Features

General

  • Highly configurable, including input
  • Savegame support in common .sav format (Basic RTC support)
  • Support for creating and loading save states with "undo last load" function
  • Fast forwarding hotkeys, both toggle and hold
  • Rewinding support with little memory use (~1MB per second of rewinding at 60fps)
  • Debugger with:
    • Line-by-line advance
    • PC and write breakpoints
    • Memory, register and stack view
    • Cartridge Info Viewer
    • Visual debugging tools: VRAM and map viewers
  • Automated running of a bunch of different tests

GG(C)

  • Accurate scheduler-based emulation of the system
  • Complete and M-cycle cycle-accurate DMG/CGB implementation, including running DMG games on CGB
  • Colour correction for CGB

GGA

  • Accurate scheduler-based emulation of the system
  • A cached interpreter
  • Remote debugger support (GDB server)
  • Support for playing ELF files

System emulation

  • DMG/CGB

    • Most commercial games running glitch-free
    • Full SM83 CPU
      • Full instruction set implemented and passing tests
      • M-cycle accuracy
      • Highly accurate interrupts (Pinball Fantasy)
    • PPU
      • Passing visual tests
      • OAM bug
      • Variable OAM scan timings
    • Timer
      • Passing blargg tests
      • Passing mooneye tests
    • OAM DMA
    • APU
    • Cartridge mappers
      • MBC1
      • MBC2
      • MBC3
      • MBC5
    • CGB features
      • 2x Speed
      • HDMA
      • Banking
      • PPU: DMG compatibility mode
  • AGB

    • Most commercial games running glitch-free
    • Full ARM7DTMI CPU
      • Instruction-level accuracy
      • Accurate interrupts
      • Accurate waitstates
      • Cached interpreter
    • Open bus behavior
    • PPU
      • Passing visual tests
      • Text mode Backgrounds
      • Bitmap mode Backgrounds
      • Objects
      • Priority
      • Blending
      • Affine BGs/objects
      • Windows
      • Window blending
      • Semi-transparent OBJs
    • APU
      • CGB sound channels
      • DMA sound channels
      • All Volume control registers
    • DMAs
      • General transfers
      • Fine register behavior (Not replacing address if invalid, etc)
      • APU FIFO transfers
      • GamePak EEPROM transfers
      • DMA3 Video Capture
    • Timers
      • Scheduled timers
      • Cascading timers
      • APU FIFO ticking
    • Cartridge save types
      • EEPROM
      • SRAM
      • Flash

Planned Features

  • Controller support
  • Save export on Web/WASM
  • Fix savestates/rewinding on WASM

Goals

The main goals of this emulator is to create a nice-to-use emulator with many comfort features that should be able to run well in the browser. Accuracy is also a goal however, with the only exception being details that noticeably hurt performance to implement.

Missing console features

  • GG: Some MBC3 controllers have a built-in RTC for keeping track of time; gamegirl implements it, but in a very simple format incompatible with other emulators that has a high chance of not working with most games (it was tested with Pokemon Crystal and successfully kept time after turning the game off overnight - needs more testing). It is the same format used by Gamelin.

Build

cargo build --release
# Release binary now in target/release/gamegirl_bin.

You will probably get an error about missing firmware files for PSX and NDS - if you do not plan on using those cores, simply supply empty files.

Testing

Test ROMs can be run automatically:

# Run GGA test roms
cargo run -p tests --release

# Also run GG test roms
cargo run -p tests --release -- --gg

GG/GGC

  • Blargg
    • Sound tests (some wave RAM issues)
    • oam_bug (untested)
    • Everything else
  • Mooneye
    • acceptance: 42/70 (Some tests for DMG/MGB/SGB-specific behavior disabled)
    • emulator-only: 27/28 (MBC1M, not supported)
  • Acid2
    • dmg-acid2
    • dmg-acid2 in CGB mode
    • cgb-acid2

GGA

  • mgba's suite
    • Memory: 1552/1552
    • I/O read: 123/123
    • Timing: 1272/2020
    • Timer count-up: Freezes...
    • Timer IRQ: 65/90
    • Shifter: 140/140
    • Carry: 93/93
    • Multiply long: 52/72 (cosidered complete; carry is still not researched in general)
    • BIOS math: 625/625
    • DMA tests: 1248/1256
      • "0 Imm H/W R+0x10" tests fail (DMA0 with ROM?)
    • Misc. edge case tests: 7/10
    • Video Tests
      • Basic Mode 3
      • Basic Mode 4
      • Degenerate OBJ transforms
      • Layer toggle
      • OAM Update Delay
  • AGS Aging Cartridge
    • Memory: 8/9 (Prefetch buffer fails)
    • LCD
    • Timer: 2/3 (Timer Connect fails)
    • DMA
    • COM
    • Key Input
    • Interrupt
  • jsmolka's gba-tests
    • arm
    • memory
    • thumb
    • save (All of them)
    • ppu (All of them)
    • nes
    • bios
  • destoer's gba_tests
    • cond_invalid
    • hello_world
    • if_ack
    • Unsure of how to interpret results of the rest...
  • ladystarbreeze's GBA test collection
  • FuzzARM, all 5 precompiled tests
  • ARMWrestler

Thanks To

General

GG/GGC

GGA

You might also like...
NES emulator written in Rust

sprocketnes is an emulator for the Nintendo Entertainment System written in the Rust programming language. Its purpose is to serve as a technology dem

NES emulator in rust
NES emulator in rust

NES emulator in Rust plastic is a NES emulator built from scratch using Rust. This is a personal project for fun and to experience emulating hardware

ZX Spectrum emulator written in Rust
ZX Spectrum emulator written in Rust

rustzx ZX Spectrum emulator which I writing in rust. I develop this project just for fun and for learning the basics of computer architecture. License

Intel 8080 cpu emulator by Rust
Intel 8080 cpu emulator by Rust

i8080 i8080 is a emulator for Intel 8080 cpu. 8080 Programmers Manual 8080 opcodes [dependencies] i8080 = { git = "https://github.com/mohanson/i8080"

CHIP-8 emulator written in Rust
CHIP-8 emulator written in Rust

CHIP-8 emulator written in Rust. This is intended to be a project for gaining experience writing emulators and practice Rust.

A CHIP-8 emulator for Rust in ~350 LOC
A CHIP-8 emulator for Rust in ~350 LOC

chip8 An implementation of the CHIP-8 for Rust in ~350 lines of code. What is CHIP-8? CHIP-8 is a virtual machine (along with a supporting programming

Rudroid - Writing the World's worst Android Emulator in Rust 🦀
Rudroid - Writing the World's worst Android Emulator in Rust 🦀

Rudroid - Writing the World's worst Android Emulator in Rust 🦀 Introduction Rudroid - this might arguably be one of the worst Android emulators possi

A 6502 emulator written in Rust.

v6502 This package contains an emulator for the 6502 microprocessor. It doesn't support binary decimal (BCD) mode yet. To run the debug version: cargo

Spaghetti Chip8 Emulator Written In Rust

How to run? Command is simple: cargo run FILENAME. files are stored in the /c8games folder, use one of them. Example: cargo run INVADERS Keymap use 1

Owner
ellie leela
hello! i like rust
ellie leela
NES emulator written in Rust to learn Rust

OxideNES A NES emulator in Rust. CPU should be accurate, PPU is mostly accurate, timing between the 2 is off for some corner cases and hardware qui

null 37 Nov 7, 2022
Chip8 emulator written in pure rust, using rust-sdl2 for graphics

Rust-8 chip8 emulator written in rust, using rust-sdl2 for graphics. Features Fully implemented all 35 original chip8 opcodes. This emulator does NOT

Chris Hinson 7 Dec 28, 2022
Commodore 64 emulator written in Rust

Rust64 - a C64 emulator written in Rust This is my attempt to study the Rust programming language and have fun at the same time. The goal is to presen

Krzysztof Kondrak 214 Dec 27, 2022
A Flash Player emulator written in Rust

website | demo | nightly builds | wiki Ruffle Ruffle is an Adobe Flash Player emulator written in the Rust programming language. Ruffle targets both t

Ruffle 11.2k Jan 8, 2023
A Game Boy research project and emulator written in Rust

Mooneye GB Mooneye GB is a Game Boy research project and emulator written in Rust. The main goals of this project are accuracy and documentation. Some

Joonas Javanainen 802 Dec 28, 2022
A Gameboy Emulator in Rust

RBoy A Gameboy Color Emulator written in Rust Implemented CPU All instructions correct All timings correct Double speed mode GPU Normal mode Color mod

Mathijs van de Nes 512 Dec 23, 2022
RGB (Rust Game Boy) is a simple emulator for the original game boy

RGB RGB (Rust Game Boy) is a simple emulator for the original game boy and the color game boy. Warning: This no longer compiles in the latest versions

Niven Achenjang 18 Dec 2, 2022
Full featured Cross-platform GameBoy emulator by Rust. Forever boys!.

Gameboy Full featured Cross-platform GameBoy emulator. Forever boys!. You can start a game with the following command, here with a built-in game "Boxe

Mohanson 1.2k Jan 2, 2023
RustBoyAdvance-NG is a Nintendoâ„¢ Game Boy Advance emulator and debugger, written in the rust programming language.

RustBoyAdvance-NG Nintendo GameBoy Advance â„¢ emulator and debugger, written in rust. WebAssembly Demo: https://michelhe.github.io/rustboyadvance-ng/ P

MishMish 510 Dec 30, 2022
An NES emulator written in Rust

Pinky Pinky is an NES emulator written in Rust completely from scratch based only on publicly available documentation. You can run it in your Web brow

Koute 709 Dec 23, 2022