From bb7e14a877fd4fec60357c4bb8e73336f17a439a Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Thu, 29 May 2014 21:01:58 +0200 Subject: [PATCH] Clean up command line output and use a sensible out filename. --- Program.cs | 10 ++++++++-- blz.cs | 10 +++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Program.cs b/Program.cs index b75d5bc..14ff480 100644 --- a/Program.cs +++ b/Program.cs @@ -18,9 +18,10 @@ namespace WfcPatcher { } static void PatchFile( string filename ) { - Console.WriteLine( "Reading & Copying ROM..." ); + Console.WriteLine( "Reading and copying " + filename + "..." ); var ndsSrc = new System.IO.FileStream( filename, System.IO.FileMode.Open ); - var nds = new System.IO.FileStream( filename + ".wfc.nds", System.IO.FileMode.Create ); + string newFilename = System.IO.Path.Combine( System.IO.Path.GetDirectoryName( filename ), System.IO.Path.GetFileNameWithoutExtension( filename ) ) + " (AltWfc)" + System.IO.Path.GetExtension( filename ); + var nds = new System.IO.FileStream( newFilename, System.IO.FileMode.Create ); Util.CopyStream( ndsSrc, nds, (int)ndsSrc.Length ); ndsSrc.Close(); @@ -37,6 +38,8 @@ namespace WfcPatcher { PatchOverlay( nds, arm9overlayoff, arm9overlaylen ); PatchOverlay( nds, arm7overlayoff, arm7overlaylen ); + Console.WriteLine(); + nds.Close(); } @@ -83,6 +86,7 @@ namespace WfcPatcher { if ( ReplaceInData( decData ) ) { // if something was replaced, put it back into the ROM if ( compressed ) { + Console.WriteLine( "Replacing and recompressing overlay " + id + "..." ); uint newCompressedSize = 0; data = blz.BLZ_Encode( decData, 0 ); @@ -93,6 +97,8 @@ namespace WfcPatcher { nds.Write( newCompressedSizeBytes, 0, 3 ); } else { + Console.WriteLine( "Replacing overlay " + id + "..." ); + data = decData; } diff --git a/blz.cs b/blz.cs index 1d0442d..90c4a83 100644 --- a/blz.cs +++ b/blz.cs @@ -161,7 +161,7 @@ namespace WfcPatcher { uint pak_len, raw_len, len, pos, inc_len, hdr_len, enc_len, dec_len; byte flags = 0, mask; - Console.Write( "- decoding" ); + //Console.Write( "- decoding" ); pak_len = (uint)pak_buffer.Length; @@ -175,7 +175,7 @@ namespace WfcPatcher { raw_len = dec_len; fileWasNotCompressed = true; - Console.WriteLine(); + //Console.WriteLine(); return pak_buffer; } else { if ( pak_len < 8 ) throw new Exception( "File has a bad header" ); @@ -250,7 +250,7 @@ namespace WfcPatcher { //Save( filename + ".dec", raw_buffer, raw_len ); - Console.WriteLine(); + //Console.WriteLine(); return raw_buffer; } @@ -260,7 +260,7 @@ namespace WfcPatcher { byte[] pak_buffer, new_buffer; uint raw_len, pak_len, new_len; - Console.Write("- encoding"); + //Console.Write("- encoding"); raw_len = (uint)raw_buffer.Length; @@ -283,7 +283,7 @@ namespace WfcPatcher { pak_buffer = retbuf; } - Console.WriteLine(); + //Console.WriteLine(); return pak_buffer; }