mirror of
https://github.com/NinjaCheetah/rustii.git
synced 2025-06-05 23:11:02 -04:00
Fix for possible crash when getting info for some TMDs
This commit is contained in:
parent
e147a953a5
commit
97fe838b8c
@ -26,12 +26,11 @@ fn print_tmd_info(tmd: tmd::TMD, cert: Option<cert::Certificate>) {
|
|||||||
} else {
|
} else {
|
||||||
println!(" Title ID: {}", hex::encode(tmd.title_id).to_uppercase());
|
println!(" Title ID: {}", hex::encode(tmd.title_id).to_uppercase());
|
||||||
}
|
}
|
||||||
if hex::encode(tmd.title_id)[..8].eq("00000001") {
|
let converted_ver = versions::dec_to_standard(tmd.title_version, &hex::encode(tmd.title_id), Some(tmd.is_vwii != 0));
|
||||||
if hex::encode(tmd.title_id).eq("0000000100000001") {
|
if hex::encode(tmd.title_id).eq("0000000100000001") {
|
||||||
println!(" Title Version: {} (boot2v{})", tmd.title_version, tmd.title_version);
|
println!(" Title Version: {} (boot2v{})", tmd.title_version, tmd.title_version);
|
||||||
} else {
|
} else if hex::encode(tmd.title_id)[..8].eq("00000001") && converted_ver.is_some() {
|
||||||
println!(" Title Version: {} ({})", tmd.title_version, versions::dec_to_standard(tmd.title_version, &hex::encode(tmd.title_id), Some(tmd.is_vwii != 0)).unwrap());
|
println!(" Title Version: {} ({})", tmd.title_version, converted_ver.unwrap());
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
println!(" Title Version: {}", tmd.title_version);
|
println!(" Title Version: {}", tmd.title_version);
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,9 @@ fn main() {
|
|||||||
match &cli.command {
|
match &cli.command {
|
||||||
Some(Commands::Wad { command }) => {
|
Some(Commands::Wad { command }) => {
|
||||||
match command {
|
match command {
|
||||||
|
Some(wad::Commands::Convert { input, output }) => {
|
||||||
|
wad::convert_wad(input, output)
|
||||||
|
},
|
||||||
Some(wad::Commands::Pack { input, output}) => {
|
Some(wad::Commands::Pack { input, output}) => {
|
||||||
wad::pack_wad(input, output)
|
wad::pack_wad(input, output)
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
use std::{str, fs};
|
use std::{str, fs};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use clap::Subcommand;
|
use clap::{Subcommand, Args};
|
||||||
use glob::glob;
|
use glob::glob;
|
||||||
use rustii::title::{cert, tmd, ticket, content, wad};
|
use rustii::title::{cert, tmd, ticket, content, wad};
|
||||||
use rustii::title;
|
use rustii::title;
|
||||||
@ -13,18 +13,40 @@ use rustii::title;
|
|||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
#[command(arg_required_else_help = true)]
|
#[command(arg_required_else_help = true)]
|
||||||
pub enum Commands {
|
pub enum Commands {
|
||||||
|
/// Re-encrypt a WAD file with a different key
|
||||||
|
Convert {
|
||||||
|
/// The path to the WAD to convert
|
||||||
|
input: String,
|
||||||
|
/// An (optional) WAD name; defaults to <input name>_<new type>.wad
|
||||||
|
#[arg(short, long)]
|
||||||
|
output: Option<String>,
|
||||||
|
},
|
||||||
/// Pack a directory into a WAD file
|
/// Pack a directory into a WAD file
|
||||||
Pack {
|
Pack {
|
||||||
|
/// The directory to pack into a WAD
|
||||||
input: String,
|
input: String,
|
||||||
|
/// The name of the packed WAD file
|
||||||
output: String
|
output: String
|
||||||
},
|
},
|
||||||
/// Unpack a WAD file into a directory
|
/// Unpack a WAD file into a directory
|
||||||
Unpack {
|
Unpack {
|
||||||
|
/// The path to the WAD to unpack
|
||||||
input: String,
|
input: String,
|
||||||
|
/// The directory to extract the WAD to
|
||||||
output: String
|
output: String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Args)]
|
||||||
|
#[group(multiple = false, required = true)]
|
||||||
|
struct ConvertTargets {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn convert_wad(input: &str, output: &Option<String>) {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn pack_wad(input: &str, output: &str) {
|
pub fn pack_wad(input: &str, output: &str) {
|
||||||
let in_path = Path::new(input);
|
let in_path = Path::new(input);
|
||||||
if !in_path.exists() {
|
if !in_path.exists() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user