Add disc commands: info, extract, convert, verify

Utilizing https://github.com/encounter/nod-rs
This commit is contained in:
2024-05-01 00:12:20 -06:00
parent 9452ca8b8c
commit 4dacf2f39a
6 changed files with 380 additions and 2 deletions

13
src/cmd/disc.rs Normal file
View File

@@ -0,0 +1,13 @@
use anyhow::{Error, Result};
use argp::FromArgs;
use nodtool::SubCommand;
#[derive(FromArgs, Debug)]
/// Commands for processing disc images.
#[argp(subcommand, name = "disc")]
pub struct Args {
#[argp(subcommand)]
command: SubCommand,
}
pub fn run(args: Args) -> Result<()> { nodtool::run(args.command).map_err(Error::new) }

View File

@@ -1,6 +1,7 @@
pub mod alf;
pub mod ar;
pub mod demangle;
pub mod disc;
pub mod dol;
pub mod dwarf;
pub mod elf;

View File

@@ -56,7 +56,7 @@ impl FromArgValue for LogLevel {
}
}
#[derive(FromArgs, PartialEq, Debug)]
#[derive(FromArgs, Debug)]
/// Yet another GameCube/Wii decompilation toolkit.
struct TopLevel {
#[argp(subcommand)]
@@ -70,18 +70,20 @@ struct TopLevel {
log_level: Option<LogLevel>,
/// Print version information and exit.
#[argp(switch, short = 'V')]
#[allow(dead_code)]
version: bool,
/// Disable color output. (env: NO_COLOR)
#[argp(switch)]
no_color: bool,
}
#[derive(FromArgs, PartialEq, Debug)]
#[derive(FromArgs, Debug)]
#[argp(subcommand)]
enum SubCommand {
Alf(cmd::alf::Args),
Ar(cmd::ar::Args),
Demangle(cmd::demangle::Args),
Disc(cmd::disc::Args),
Dol(cmd::dol::Args),
Dwarf(cmd::dwarf::Args),
Elf(cmd::elf::Args),
@@ -155,6 +157,7 @@ fn main() {
SubCommand::Alf(c_args) => cmd::alf::run(c_args),
SubCommand::Ar(c_args) => cmd::ar::run(c_args),
SubCommand::Demangle(c_args) => cmd::demangle::run(c_args),
SubCommand::Disc(c_args) => cmd::disc::run(c_args),
SubCommand::Dol(c_args) => cmd::dol::run(c_args),
SubCommand::Dwarf(c_args) => cmd::dwarf::run(c_args),
SubCommand::Elf(c_args) => cmd::elf::run(c_args),