Crates.io | chip8_db |
lib.rs | chip8_db |
version | 2.1.0 |
source | src |
created_at | 2023-07-01 01:05:43.43351 |
updated_at | 2023-07-03 02:05:49.444061 |
description | Embed the CHIP-8 DB in your own CHIP-8 implementation |
homepage | |
repository | https://github.com/Estus-Dev/chip-8-database-rs |
max_upload_size | |
id | 905160 |
size | 488,877 |
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.
// 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}");
}
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"] }