Gameboy

Gameboy is a comprehensive GameBoy emulator designed to run across multiple platforms, developed in the Rust programming language. This emulator supports audio, various scaling options, and has been tested extensively on Windows, Ubuntu, and Mac.

sample.gif sample.gif

Features

  • Cross-platform compatibility: Tested on Windows, Ubuntu, and Mac.
  • Audio support: Enable audio with the --enable-audio flag.
  • Scalable video: Adjust video scaling by factors of 1, 2, 4, or 8.
  • Robust performance: Ensures smooth gameplay on supported platforms.

Running the Emulator

To start a game, you can use the following command, demonstrated here with the built-in game "SUPER MARIOLAND":

$ cargo run --release -- "./res/sml.gb"

Command-line Options

The emulator supports the following options:

  • -a, --enable-audio: Enable audio (default is false).
  • -x, --scale-factor: Scale the video by a factor of 1, 2, 4, or 8.

Dependencies

Gameboy relies on several Rust libraries with native dependencies:

  • cpal: For audio support.
  • minifb: For framebuffer management.

Installing Dependencies

Ubuntu

sudo apt install libasound2-dev # CPAL dependencies
sudo apt install libxkbcommon-dev libwayland-cursor0 libwayland-dev # MiniFB dependencies

Windows

Install Microsoft C++ Build Tools.

Controls

The emulator's controls are mapped to the following keys:

                _n_________________
                |_|_______________|_|
                |  ,-------------.  |
                | |  .---------.  | |
                | |  |         |  | |
                | |  |         |  | |
                | |  |         |  | |
                | |  |         |  | |
                | |  `---------'  | |
                | `---------------' |
                |   _ GAME BOY      |
   Up           | _| |_         ,-. | ----> Z
Left/Right <--- ||_ O _|   ,-. "._,"|
  Down          |  |_|    "._,"   A | ----> X
                |    _  _    B      |
                |   // //           |
                |  // //    \\\\\\  | ----> Enter/BackSpace
                |  `  `      \\\\\\ ,
                |________...______,"

Tests

Thanks to Blargg's Gameboy hardware test ROMs, Gameboy's code can be verified with thorough testing. Run the tests using:

$ cargo run --example blargg
Test NameResult
cpu_instrsimg img
instr_timingimg img

Similar Projects

Rustfinity.com

Links

  1. Home
  2. Learn Rust
  3. Get Started
  4. Practice Rust
  5. Challenges
  6. Tutorials
  7. Blog
  8. Open source
  9. Learn Gleam

Socials

  1. GitHub
  2. X

Legal

  1. Privacy Policy
  2. Terms of Service