Skip to content

mxmgorin/oxgbc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1,601 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

oxGBC

A Game Boy & Game Boy Color emulator written in Rust.

๐Ÿ•น๏ธย ย Play online ย ย ย  ๐Ÿ“ฅย ย Download


Tests Android Windows macOS Linux Linux ARM

Release License Rust Dependencies

oxGBC (oxide + Game Boy Color) is built around a single portable emulation core powering Windows, macOS, Linux, Android, and WebAssembly. It aims for high accuracy through sub-instruction CPU timing and dot-level PPU emulation while providing modern features such as save states, rewind, shaders, and configurable controls.

The emulator passes a wide range of community test suites and is continuously validated against them in CI, including Blargg, Mooneye, SameSuite, DMG-acid2, CGB-acid2, CGB-acid-hell, and Magen.

Demos

Passing the CGB-acid2 and CGB-acid-hell PPU tests ย ย  Prehistorik Man

Features

Gameplay

  • Save States โ€” Multiple save slots with optional automatic save and restore
  • Rewind โ€” Configurable rewind for undoing gameplay actions
  • Speed Control โ€” Adjustable emulation speed with configurable Slow and Turbo modes
  • Custom Controls โ€” Rebindable controls for keyboard and gamepad with support for button combinations

Video & Rendering

  • Shader Support โ€” Optional OpenGL backend with custom GLSL shaders.
  • Visual Filters โ€” Grid, subpixel, scanline, dot-matrix, and vignette effects
  • Frame Blending โ€” Configurable LCD ghosting simulation with multiple blending modes
  • Palettes โ€” Multiple built-in palettes with support for user-defined palettes via palettes.json

Interface & Tooling

  • GUI & Configuration โ€” Full graphical configuration with optional manual editing of config.json
  • File Browser โ€” Browse and launch ROMs directly from the emulator
  • ROM Library โ€” Automatic ROM directory scanning with menu-based launching
  • WebAssembly Build โ€” Runs entirely in the browser with no installation required
  • Tile Viewer โ€” Real-time inspection of background and sprite tiles (SDL2 renderer)

Emulation

  • CPU โ€” Sharp LR35902 with sub-instruction timing
  • PPU โ€” Dot-level LCD controller emulation synchronized with the CPU
  • APU โ€” All four Game Boy audio channels
  • Cartridge Hardware โ€” MBC0, MBC1, MBC1M, MBC2, MBC3, and MBC5
  • Real-Time Clock โ€” Battery-backed MBC3 RTC
  • Battery-backed SRAM โ€” Persistent cartridge save data

๐ŸŽฎ Controls

Default control mappings (click to expand)
Action โŒจ๏ธ Keyboard ๐ŸŽฎ Gamepad
D-pad Up Arrow Up D-pad Up
D-pad Down Arrow Down D-pad Down
D-pad Left Arrow Left D-pad Left
D-pad Right Arrow Right D-pad Right
B Z B
A X A
Start Enter or S Start
Select Backspace or A Select
Rewind (hold) R Y
Turbo mode (hold) Tab RB
Slow mode (hold) Space LB
Main menu Esc or Q Select + Start
Screen scale Up and Down + (Equals) and - (Minus)
Fullscreen Toggle F11
Mute audio M
Invert palette I Select + X
Next palette P X
Load save state (1โ€“4) F1โ€“F4 RT or Select + RB
Create save state (1โ€“9) 1โ€“9 LT or Select + LB
Volume Up and Down PageUp and PageDown Start + D-pad Up and Start + D-pad Down
Prev and Next Save State Slot Start + D-pad Right and Start + D-pad Left
Prev and Next Shader [ and ] Select + B and Select + A
Pause/Stepping mode F5
Step frame F6
Step scanline F7
Clear screen F10
Toggle debugger (In debug build) ~

๐Ÿ“ฆ Installing

Grab the latest build for your platform โ€” Windows, macOS, Linux (x86-64 and ARM for retro handhelds), or Android โ€” from the Releases page, or play online with nothing to install.

macOS first launch

Because the app is only ad-hoc signed (no paid Apple Developer ID), Gatekeeper blocks the first launch with an "unidentified developer" warning. To open it:

  • macOS 15 (Sequoia) and later: go to System Settings โ†’ Privacy & Security, scroll to the message about oxGBC, and click Open Anyway.
  • macOS 14 (Sonoma) and earlier: right-click oxGBC โ†’ Open โ†’ Open.

Or clear the quarantine flag from a terminal (works on every version):

xattr -dr com.apple.quarantine /Applications/oxGBC.app

๐Ÿ› ๏ธ Building

First, make sure you have Rust installed. If you don't, install it with:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Then install the SDL2 development libraries for your platform:

# Arch Linux
sudo pacman -S sdl2

# Debian / Ubuntu
sudo apt install libsdl2-dev

# Fedora
sudo dnf install SDL2-devel

# macOS (Homebrew)
brew install sdl2

No system SDL2 (e.g. Windows)? Compile it from source with the bundled feature: cargo build --release -p desktop --features sdl2-bundled

After that, build the release binary:

cargo build --release

Running

Launch with a ROM:

cargo run --release -p desktop -- path/to/game.gb

Or run without arguments and use the built-in file browser / ROM scanner to pick a game from the GUI:

cargo run --release -p desktop

Support the project โญ

Bug reports, and feature requests are welcome. If a game misbehaves, please open an issue with the ROM title and what went wrong โ€” accuracy reports are especially valuable.

If you find the project useful, please give it a star on GitHub. It helps others discover it and keeps development going.

License

This project is licensed under the terms of the GNU General Public License v3.0 (GPLv3). See the LICENSE file for the full text.

References

Here are some useful resources for Game Boy development and emulation:

Acknowledgments

This project makes use of the following resources:

The web demo bundles open-source homebrew games and test ROMs โ€” see ROM credits & licenses.