Clean up command line output and use a sensible out filename.

This commit is contained in:
Admiral H. Curtiss
2014-05-29 21:01:58 +02:00
parent 2c6499ce7f
commit bb7e14a877
2 changed files with 13 additions and 7 deletions

View File

@@ -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;
}

10
blz.cs
View File

@@ -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;
}