Skip to content

DMG/CGB/AGB emulator, rewrite in Rust

License

GPL-3.0, MPL-2.0 licenses found

Licenses found

GPL-3.0
LICENSE-GPL
MPL-2.0
LICENSE-MPL
Notifications You must be signed in to change notification settings

aurelilia/gamegirl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
      • Mosaic
    • 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

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

  • All Blargg tests (oam_bug untested)
  • Mooneye
    • acceptance: 41/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: 130/130
    • Timing: 1266/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/+{IW,EW}RAM" 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