Skip to main content

Crate romkit

Crate romkit 

Source
Expand description

Identify game ROMs and extract their data and assets as structured files.

romkit reads ROMs in layers, each knowing nothing about the ones above it:

  • io: ByteSource, random access to bytes that may live in memory, in a file, or behind a browser Blob. Only the bytes a parser needs are ever read.
  • platforms: what a ROM is, from its header, and the DS and 3DS filesystems.
  • formats: file formats found inside ROMs, such as NARC archives and DS 3D models.
  • media: what romkit produces besides data: images (PNG), audio (WAV), and 3D models (glTF).
  • games: the catalog of recognized games and their extractors, each with a typed API and the uniform Game asset view.

Rom ties the layers together for hosts that take any ROM:

use romkit::Rom;
use romkit::io::FileSource;

let rom = Rom::open(FileSource::open("game.nds")?)?;
println!("{}", rom.identity());
if let Some(game) = rom.game() {
    for path in game.assets()? {
        let contents = game.extract(&path)?;
        println!("{path}: {} bytes", contents.len());
    }
}

Programs that need one game’s data use its typed handle instead, such as Gen4.

Re-exports§

pub use games::Game;
pub use games::GameId;
pub use io::ByteSource;
pub use platforms::Identity;
pub use platforms::Platform;
pub use platforms::identify;

Modules§

formats
File formats found inside ROMs, independent of any one game.
games
Games: the catalog of recognized titles, the Game trait that every extractor implements, and one module per game family.
io
Random-access byte sources: how every parser reads a ROM.
media
Media romkit produces from game data, in formats every viewer understands: images become PNG, audio becomes WAV, music becomes MIDI, 3D models become glTF. Decoders in formats and the games build these types; hosts only ever see the encoded files.
platforms
Platforms: what a ROM image is, read from its header.

Structs§

FileInfo
A file in the ROM’s filesystem, or a member of an archive.
Manifest
Written last by Rom::export, describing the ROM and the assets extracted from it.
Overview
What a host shows first.
Rom
An identified ROM, with its game’s extractor when romkit has one. Opening reads only headers and tables; everything else is read on first use and kept.

Enums§

Error

Type Aliases§

Result