mirror of
https://github.com/encounter/nod.git
synced 2026-07-10 12:18:48 -07:00
nodtool: Add scrubbing option (#11)
Useful for removing the update partition of Wii games
This commit is contained in:
@@ -34,6 +34,9 @@ pub struct Args {
|
||||
#[argp(option, short = 'c')]
|
||||
/// compression format and level (e.g. "zstd:19")
|
||||
compress: Option<String>,
|
||||
#[argp(switch, short = 's')]
|
||||
/// performs scrubbing on the disc image
|
||||
scrub: bool,
|
||||
}
|
||||
|
||||
pub fn run(args: Args) -> nod::Result<()> {
|
||||
@@ -85,5 +88,5 @@ pub fn run(args: Args) -> nod::Result<()> {
|
||||
compression.validate_level()?;
|
||||
let format_options =
|
||||
FormatOptions { format, compression, block_size: format.default_block_size() };
|
||||
convert_and_verify(&args.file, Some(&args.out), args.md5, &options, &format_options)
|
||||
convert_and_verify(&args.file, Some(&args.out), args.md5, args.scrub, &options, &format_options)
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ pub fn run(args: Args) -> nod::Result<()> {
|
||||
};
|
||||
let format_options = FormatOptions::default();
|
||||
for file in &args.file {
|
||||
convert_and_verify(file, None, args.md5, &options, &format_options)?;
|
||||
convert_and_verify(file, None, args.md5, false, &options, &format_options)?;
|
||||
println!();
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -46,6 +46,7 @@ pub fn convert_and_verify(
|
||||
in_file: &Path,
|
||||
out_file: Option<&Path>,
|
||||
md5: bool,
|
||||
scrub: bool,
|
||||
options: &DiscOptions,
|
||||
format_options: &FormatOptions,
|
||||
) -> Result<()> {
|
||||
@@ -128,7 +129,10 @@ pub fn convert_and_verify(
|
||||
digest_md5: md5,
|
||||
digest_sha1: true,
|
||||
digest_xxh64: true,
|
||||
scrub: ScrubLevel::None,
|
||||
scrub: match scrub {
|
||||
true => ScrubLevel::UpdatePartition,
|
||||
false => ScrubLevel::None,
|
||||
},
|
||||
},
|
||||
)?;
|
||||
pb.finish();
|
||||
|
||||
Reference in New Issue
Block a user