#chip8 #rom #metadata #hash

chip8_db

Embed the CHIP-8 DB in your own CHIP-8 implementation

3 stable releases

2.1.0 Jul 3, 2023
2.0.0 Jul 2, 2023
1.0.0 Jul 1, 2023

#198 in Emulators

MIT license

145KB
592 lines

CHIP-8 Database RS

Github Badge Docs.rs Badge Build Badge License Badge Crates.io Badge

Easily access the data from the CHIP-8 Database from your own CHIP-8 implementation written in Rust.

Use this data to automatically apply the needed quirks for a specific ROM, or give the user more information about individual games. You can show the name of the game in the titlebar, or display a description of the ROM underneath the main window.

You can also provide descriptions of the various CHIP-8 platforms out there, or describe the effects of enabling various quirks.

Isn't this "cheating"? If I'm trying to learn how to build an emulator, why would I pull in this package?

Don't worry. The only things in this crate that you should use in your emulator's core are the ROM lookup functions, to determine which quirks to apply. It's still up to you to build your emulator and implement those quirks.

The goal of the rest of this crate is to help with the polish in your emulator's frontend. If you wouldn't shy away from using a crate like winit or eframe to create a window, you shouldn't worry about using this either.

Usage

// The CHIP-8 Database is included in this library, no need to open or download files
let db = Database::new();

// Get metadata from a rom directly
let metadata = db.get_metadata(&rom);

// Get metadata from a hash string
let metadata = db.get_metadata_from_hash("0df2789f661358d8f7370e6cf93490c5bcd44b01");
let program = metadata.program.unwrap();

println!("Title: {} ({})", program.title, metadata.hash);

// Most fields are optional in the base schema
if let Some(description) = program.description {
    println!("Description: {description}");
}

Features

While the ROM database is always enabled, there is additional data from platforms.json and quirks.json that you can choose to include with the extra-data feature.

chip_8_database_rs = { version = "2.0.0", features = ["extra-data"] }

Dependencies

~1–2MB
~44K SLoC