1
Fork 0
mirror of https://github.com/kaplanz/rugby.git synced 2026-04-01 17:09:17 -04:00
Cycle-accurate Game Boy emulation https://rugby.zakhary.dev
  • Rust 77.8%
  • Swift 14.6%
  • TypeScript 4.2%
  • JavaScript 1.1%
  • Metal 1%
  • Other 1.1%
Find a file
2026-03-31 18:00:00 -04:00
apps build(bun): initial workspace 2026-03-31 18:00:00 -04:00
arch style: standardize derive and attribute ordering 2026-03-17 23:25:00 -04:00
bind build(bun): initial workspace 2026-03-31 18:00:00 -04:00
core style(apu): replace em-dashes in comments 2026-03-17 23:55:00 -04:00
crates style: standardize derive and attribute ordering 2026-03-17 23:25:00 -04:00
docs chore: rename assets 2025-09-29 15:00:00 -04:00
examples style: format with rustfmt 2025-09-22 12:30:00 -04:00
extras style: standardize derive and attribute ordering 2026-03-17 23:25:00 -04:00
lib/retro style: standardize derive and attribute ordering 2026-03-17 23:25:00 -04:00
roms chore(git): ignore save RAM files 2025-12-01 17:00:00 -05:00
site feat(site): add demo page 2026-03-31 18:00:00 -04:00
src refactor: remove direct API dependencies 2025-03-13 00:00:00 -04:00
tests style: standardize derive and attribute ordering 2026-03-17 23:25:00 -04:00
.gitignore build(bun): initial workspace 2026-03-31 18:00:00 -04:00
bun.lock build(bun): initial workspace 2026-03-31 18:00:00 -04:00
Cargo.lock feat(cli): use facet for JSON formatting 2026-02-11 20:00:00 -05:00
Cargo.toml feat: derive facet::Facet 2026-02-10 23:00:00 -05:00
CHANGELOG.md chore(git): cliff init 2025-10-03 14:45:00 -04:00
cliff.toml chore(git): cliff init 2025-10-03 14:45:00 -04:00
clippy.toml chore(clippy): configure doc-valid-idents 2024-06-17 00:00:00 -04:00
committed.toml feat(committed): init 2024-07-08 00:00:00 -04:00
CREDITS.md docs(credits): initial document 2025-09-29 00:00:00 -04:00
deny.toml chore(deny): update crate: unicode-ident 2026-03-02 09:00:00 -05:00
Justfile revert: use cargo test as test runner 2024-07-08 00:00:00 -04:00
LICENSE-APACHE chore(license): initial release 2022-01-25 20:15:00 -05:00
LICENSE-MIT chore(license): initial release 2022-01-25 20:15:00 -05:00
package.json build(bun): initial workspace 2026-03-31 18:00:00 -04:00
PRIVACY.md docs(privacy): initial document 2025-09-29 00:00:00 -04:00
README.md feat(site): updated impl 2026-01-27 19:00:00 -05:00
rustfmt.toml chore(rustfmt): initial file 2026-03-17 23:20:00 -04:00
STYLE.md style: standardize derive and attribute ordering 2026-03-17 23:25:00 -04:00
typos.toml chore(typos): extend words 2025-10-09 17:45:00 -04:00

Rugby

A cycle accurate emulator of the original 1989 Nintendo Game Boy.

dependencies cli frontend web frontend

Important

Consider this to be pre-alpha software. I make no guarantee of the stability of any documented APIs until the first official release.

Goal

This project aims to provide high-accuracy emulation of all major components in the SM83-based Nintendo Game Boy family of consoles. Each component is modular, enabling them to be easily substituted for one another. In turn, this leads to emulator instances supporting multiple implementations of core components with different accuracy/performance margins.

Note

At this time, there are no plans to support the later Game Boy Advance, which has an entirely different architecture.

Organization

In accordance with the preference for modularity outlined above, the project is partitioned into the core, the debugger, and various emulator frontends. Useful supporting crates are independently available as well. Also packaged in this repository are several open-source ROMs. These are used internally for testing and to demo project functionality.

Workspace

Cargo — Rust's package manager — allows for a workspace of several crates to be specified within its manifest. Within this project, workspace crates are used with the structure as follows:

./
├── Cargo.lock       # cargo lockfile
├── Cargo.toml       # cargo manifest
├── Justfile         # useful dev commands
├── README.md        # this document
├── ...
├── apps/            # frontend apps
│  ├── cli/          # command-line app
│  ├── ios/          # SwiftUI iOS app
│  └── web/          # WebAssembly app
├── arch/            # arch primitives
├── bind/            # language bindings
│  ├── swift/        # Swift (UniFFI)
│  └── wasm/         # WebAssembly
├── core/            # emulation core
├── crates/          # support crates
│  ├── bfmt/         # bytes formatter
│  ├── chex/         # color hex parser
│  ├── hexd/         # hex dump printer
│  └── orng/         # wrapping ranges
├── docs/            # documentation
├── examples/        # example frontends
├── extras/          # extra emulator APIs
│  ├── cfg/          # app configuration
│  ├── gbd/          # game boy debugger
│  └── pal/          # palette presets
├── lib/             # library frontends
│  └── retro/        # libretro port
├── roms/            # open-source ROMs
│  ├── boot/         # boot ROM images
│  ├── games/        # playable demos
│  └── test/         # test ROM images
├── src/             # top-level library
└── tests/           # integration tests

Tip

For downstream library users, I recommend using the top-level rugby crate rather than directly using rugby-core, as it better structured for end users and includes useful supporting modules.

Modules

Main components of rugby are outlined below.

  • rugby: is the high-level library that provides the public API.
  • rugby-arch: defines the architecture primitives for emulation.
  • rugby-core: contains the implementation of emulator cores.

Extras

  • rugby-cfg: definition of app configuration options.
  • rugby-gbd: provides an interactive prompt debugger.
  • rugby-pal: collection of DMG color palette presets.

Frontends

  • rugby-cli: a command-line interface application with rich configuration and comprehensive debugging.
  • rugby-ios: a native iOS application built with SwiftUI.
  • rugby-web: an online web application powered by Wasm.

Bindings

  • rugby-swift: foreign function interface to Swift (UniFFI).
  • rugby-wasm: cross-compilation with bindings to WebAssembly.

Libraries

  • libretro: implementation of the libretro API.

Testing

Rigorous integration testing is provided to validate the implementation and prevent regressions in future versions.

Suite Passed Failed
Acid2 17 0
Blargg 23 22
Mealybug 0 24
Mooneye 30 39

Credits

This project would not have been possible without the people, projects, and resources that contributed to my learning and make development so fun and easy.

See the Credit Roll for a full list.

Privacy

The project does not collect or transmit any data. Any data used by the project remains solely on your device.

See the Privacy Policy for full details.

License

This project is dual-licensed under both MIT License and Apache License 2.0. You have permission to use this code under the conditions of either license pursuant to the rights granted by the chosen license.