Rust crate for reading GameCube and Wii disc images
Go to file
Luke Street b8b06dcd5c README updates 2024-11-22 00:33:51 -07:00
.github/workflows Resolve CI issues 2024-11-22 00:11:48 -07:00
nod README updates 2024-11-22 00:33:51 -07:00
nodtool README updates 2024-11-22 00:33:51 -07:00
.gitignore Restore all functionality, split lib/bin & integrate redump validation 2024-02-21 23:14:07 -07:00
Cargo.lock Add conversion support & large refactor 2024-11-22 00:01:26 -07:00
Cargo.toml Resolve CI issues 2024-11-22 00:11:48 -07:00
LICENSE-APACHE Fix LICENSE copyright 2021-08-25 14:54:52 -04:00
LICENSE-MIT Fix LICENSE copyright 2021-08-25 14:54:52 -04:00
README.md README updates 2024-11-22 00:33:51 -07:00
deny.toml Resolve CI issues 2024-11-22 00:11:48 -07:00
rustfmt.toml Add conversion support & large refactor 2024-11-22 00:01:26 -07:00

README.md

nod Build Status Latest Version Api Rustdoc Rust Version

Library for reading and writing Nintendo Optical Disc (GameCube and Wii) images.

Originally based on the C++ library nod, but with extended format support and many additional features.

Currently supported file formats:

  • ISO (GCM)
  • WIA / RVZ
  • WBFS (+ NKit 2 lossless)
  • CISO (+ NKit 2 lossless)
  • NFS (Wii U VC, read-only)
  • GCZ
  • TGC

CLI tool

This crate includes a command-line tool called nodtool.

Download the latest release from the releases page, or install it using Cargo:

cargo install --locked nodtool

info

Displays information about a disc image.

nodtool info /path/to/game.iso

extract

Extracts the contents of a disc image to a directory.

nodtool extract /path/to/game.iso [outdir]

For Wii U VC titles, use content/hif_000000.nfs:

nodtool extract /path/to/game/content/hif_000000.nfs [outdir]

convert

Converts a disc image to any supported format.

See nodtool convert --help for more information.

nodtool convert /path/to/game.iso /path/to/game.rvz

verify

Verifies a disc image against an internal Redump database.

nodtool verify /path/to/game.iso

Library example

Opening a disc image and reading a file:

use std::io::Read;

// Open a disc image and the first data partition.
let disc = nod::Disc::new("path/to/file.iso")
    .expect("Failed to open disc");
let mut partition = disc.open_partition_kind(nod::PartitionKind::Data)
    .expect("Failed to open data partition");

// Read partition metadata and the file system table.
let meta = partition.meta()
    .expect("Failed to read partition metadata");
let fst = meta.fst()
    .expect("File system table is invalid");

// Find a file by path and read it into a string.
if let Some((_, node)) = fst.find("/MP3/Worlds.txt") {
    let mut s = String::new();
    partition
        .open_file(node)
        .expect("Failed to open file stream")
        .read_to_string(&mut s)
        .expect("Failed to read file");
    println!("{}", s);
}

Converting a disc image to raw ISO:

// Enable `rebuild_encryption` to ensure the output is a valid ISO.
let options = nod::OpenOptions { rebuild_encryption: true, ..Default::default() };
let mut disc = nod::Disc::new_with_options("path/to/file.rvz", &options)
    .expect("Failed to open disc");

// Read directly from the open disc and write to the output file.
let mut out = std::fs::File::create("output.iso")
    .expect("Failed to create output file");
std::io::copy(&mut disc, &mut out)
    .expect("Failed to write data");

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.