Skip to content

ocnc/mgba-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mgba-rs

Rust bindings to libmgba, a Game Boy Advance emulator core.

Use this to build GBA emulator frontends, headless ROM testing tools, TAS (tool-assisted speedrun) utilities, or anything else that needs to run GBA software programmatically.

Quick start

Add the safe wrapper to your project:

[dependencies]
mgba = "0.1"
use mgba::Core;
use std::path::Path;

let mut core = Core::new().expect("failed to create core");
core.load_rom(Path::new("game.gba")).expect("failed to load ROM");
core.reset().expect("reset failed");

// Run one frame
core.run_frame().expect("run_frame failed");

// Read the framebuffer (240x160 XBGR8 pixels)
let pixels = core.video_buffer();

If you need the raw C API directly, use mgba-sys instead.

Crates

Crate Description
mgba Safe, high-level Rust wrapper
mgba-sys Raw FFI bindings generated by bindgen

Building

The mgba C library is built from vendored source, so you need a few system dependencies.

Prerequisites

macOS Ubuntu/Debian Windows
cmake brew install cmake sudo apt install cmake cmake.org
clang Xcode CLT (xcode-select --install) sudo apt install libclang-dev LLVM from releases.llvm.org
zlib pre-installed sudo apt install zlib1g-dev bundled by vcpkg or pre-installed with MSVC

Clone and build

git clone https://github.com/ocnc/mgba-rs.git
cd mgba-rs
cargo build

License

The Rust bindings in this repository are licensed under the MIT License.

libmgba, vendored under mgba-sys/mgba/, is licensed under the Mozilla Public License 2.0. Binary distributions that statically link libmgba must comply with MPL-2.0 requirements (notably, making the libmgba source available).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages