Added iospatcher to lib and CLI

Everything but the no-shared flag is working right now. Getting no-shared to work properly will take a little more work because right now there's nothing to guarantee that the content records are synced between the TMD and content objects in a title. This means that updating any content in a title will result in the records being out of sync and the written TMD will not match the actual state of the content when it was dumped.
To mitigate this, I intend on making the content records in the content struct a reference to the content records in the TMD, so that they are the same object and therefore always in sync.
This commit is contained in:
2026-02-27 19:05:24 -05:00
parent 02db260138
commit 0d34fbc383
20 changed files with 342 additions and 23 deletions

View File

@@ -1,7 +1,7 @@
// main.rs from ruswtii (c) 2025 NinjaCheetah & Contributors
// https://github.com/NinjaCheetah/rustwii
//
// Base for the rustii CLI that handles argument parsing and directs execution to the proper module.
// Base for the rustwii CLI that handles argument parsing and directs execution to the proper module.
mod archive;
mod title;
@@ -36,7 +36,7 @@ enum Commands {
Fakesign {
/// The path to a TMD, Ticket, or WAD
input: String,
/// An (optional) output name; defaults to overwriting input file if not provided
/// An optional output path; defaults to overwriting input file if not provided
#[arg(short, long)]
output: Option<String>,
},
@@ -45,6 +45,25 @@ enum Commands {
/// The path to a TMD, Ticket, or WAD
input: String,
},
/// Apply patches to an IOS
IosPatch {
/// The IOS WAD to apply patches to
input: String,
#[arg(short, long)]
/// An optional output path; default to overwriting input file if not provided
output: Option<String>,
/// Set a new IOS version (0-65535)
#[arg(short, long)]
version: Option<u16>,
/// Set the slot that this IOS will install into
#[arg(short, long)]
slot: Option<u8>,
/// Set all patched content to be non-shared
#[arg(short, long, action)]
no_shared: bool,
#[command(flatten)]
enabled_patches: title::iospatcher::EnabledPatches,
},
/// Compress/decompress data using LZ77 compression
Lz77 {
#[command(subcommand)]
@@ -118,6 +137,24 @@ fn main() -> Result<()> {
Some(Commands::Info { input }) => {
info::info(input)?
},
Some(Commands::IosPatch {
input,
output,
version,
slot,
no_shared,
enabled_patches
}
) => {
title::iospatcher::patch_ios(
input,
output,
version,
slot,
no_shared,
enabled_patches,
)?
}
Some(Commands::Lz77 { command }) => {
match command {
archive::lz77::Commands::Compress { input, output } => {