2021-08-23 13:51:05 -07:00
|
|
|
# nod-rs [![Build Status]][actions] [![Latest Version]][crates.io] [![Api Rustdoc]][rustdoc] ![Rust Version]
|
2021-08-23 06:48:35 -07:00
|
|
|
|
|
|
|
[Build Status]: https://github.com/encounter/nod-rs/workflows/build/badge.svg
|
|
|
|
[actions]: https://github.com/encounter/nod-rs/actions
|
|
|
|
[Latest Version]: https://img.shields.io/crates/v/nod.svg
|
|
|
|
[crates.io]: https://crates.io/crates/nod
|
|
|
|
[Api Rustdoc]: https://img.shields.io/badge/api-rustdoc-blue.svg
|
|
|
|
[rustdoc]: https://docs.rs/nod
|
2024-02-21 22:33:48 -08:00
|
|
|
[Rust Version]: https://img.shields.io/badge/rust-1.73+-blue.svg?maxAge=3600
|
2021-08-23 06:48:35 -07:00
|
|
|
|
|
|
|
Library for traversing & reading GameCube and Wii disc images.
|
|
|
|
|
2024-02-16 21:53:37 -08:00
|
|
|
Originally based on the C++ library [nod](https://github.com/AxioDL/nod),
|
2021-08-23 06:48:35 -07:00
|
|
|
but does not currently support authoring.
|
|
|
|
|
|
|
|
Currently supported file formats:
|
2024-02-02 15:17:35 -08:00
|
|
|
- ISO (GCM)
|
|
|
|
- WIA / RVZ
|
2024-02-20 23:04:23 -08:00
|
|
|
- WBFS (+ NKit 2 lossless)
|
|
|
|
- CISO (+ NKit 2 lossless)
|
2024-02-16 21:53:37 -08:00
|
|
|
- NFS (Wii U VC)
|
2021-08-23 06:48:35 -07:00
|
|
|
|
2024-02-16 21:53:37 -08:00
|
|
|
## CLI tool
|
2021-08-23 06:48:35 -07:00
|
|
|
|
2024-02-16 21:53:37 -08:00
|
|
|
This crate includes a command-line tool called `nodtool`.
|
|
|
|
|
|
|
|
### info
|
|
|
|
|
|
|
|
Displays information about a disc image.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
nodtool info /path/to/game.iso
|
|
|
|
```
|
|
|
|
|
|
|
|
### extract
|
|
|
|
|
|
|
|
Extracts the contents of a disc image to a directory.
|
2021-08-23 06:48:35 -07:00
|
|
|
|
|
|
|
```shell
|
|
|
|
nodtool extract /path/to/game.iso [outdir]
|
|
|
|
```
|
|
|
|
|
2024-02-16 21:53:37 -08:00
|
|
|
For Wii U VC titles, use `content/hif_000000.nfs`:
|
2021-08-23 06:48:35 -07:00
|
|
|
|
|
|
|
```shell
|
|
|
|
nodtool extract /path/to/game/content/hif_000000.nfs [outdir]
|
|
|
|
```
|
|
|
|
|
2024-02-16 21:53:37 -08:00
|
|
|
### convert
|
|
|
|
|
|
|
|
Converts any supported format to raw ISO.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
nodtool convert /path/to/game.wia /path/to/game.iso
|
|
|
|
```
|
|
|
|
|
|
|
|
## Library example
|
2021-08-23 06:48:35 -07:00
|
|
|
|
|
|
|
Opening a disc image and reading a file:
|
2024-02-02 15:17:35 -08:00
|
|
|
|
2021-08-23 06:48:35 -07:00
|
|
|
```rust
|
|
|
|
use std::io::Read;
|
|
|
|
|
2024-02-16 21:53:37 -08:00
|
|
|
use nod::{Disc, PartitionKind};
|
2024-02-02 15:17:35 -08:00
|
|
|
|
|
|
|
fn main() -> nod::Result<()> {
|
2024-02-16 21:53:37 -08:00
|
|
|
let disc = Disc::new("path/to/file.iso")?;
|
|
|
|
let mut partition = disc.open_partition_kind(PartitionKind::Data)?;
|
|
|
|
let meta = partition.meta()?;
|
|
|
|
let fst = meta.fst()?;
|
|
|
|
if let Some((_, node)) = fst.find("/MP3/Worlds.txt") {
|
2024-02-02 15:17:35 -08:00
|
|
|
let mut s = String::new();
|
2024-02-02 15:26:45 -08:00
|
|
|
partition
|
2024-02-16 21:53:37 -08:00
|
|
|
.open_file(node)
|
2024-02-02 15:26:45 -08:00
|
|
|
.expect("Failed to open file stream")
|
|
|
|
.read_to_string(&mut s)
|
|
|
|
.expect("Failed to read file");
|
2024-02-02 15:17:35 -08:00
|
|
|
println!("{}", s);
|
|
|
|
}
|
|
|
|
Ok(())
|
2021-08-23 06:48:35 -07:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2024-02-16 21:53:37 -08:00
|
|
|
## License
|
2021-08-23 06:48:35 -07:00
|
|
|
|
|
|
|
Licensed under either of
|
|
|
|
|
|
|
|
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
|
|
|
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
|
|
|
|
|
|
|
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.
|