From 8cd1e3c8e1fd24edd746f94e4930460cb4d7ad52 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Fri, 30 May 2014 18:58:08 +0200 Subject: [PATCH] Fix ARM9 footer. --- Program.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Program.cs b/Program.cs index cb03a08..ed4454f 100644 --- a/Program.cs +++ b/Program.cs @@ -140,25 +140,25 @@ namespace WfcPatcher { int newSize = data.Length; int diff = (int)len - newSize; - /* // copy back footer if ( diff > 0 ) { List footer = new List(); nds.Position = pos + len; - while ( nds.PeekUInt32() != 0xFFFFFFFF ) { - for ( int i = 0; i < 4; ++i ) { footer.Add( (byte)nds.ReadByte() ); } + if ( nds.PeekUInt32() == 0xDEC00621 ) { + for ( int j = 0; j < 12; ++j ) { + footer.Add( (byte)nds.ReadByte() ); + } + + nds.Position = pos + newSize; + nds.Write( footer.ToArray(), 0, footer.Count ); } - nds.Position = pos + newSize; - nds.Write( footer.ToArray(), 0, footer.Count ); + // padding + for ( int j = 0; j < diff; ++j ) { + nds.WriteByte( 0xFF ); + } } - // padding - for ( int j = 0; j < diff; ++j ) { - nds.WriteByte( 0xFF ); - } - */ - // write new size byte[] newSizeBytes = BitConverter.GetBytes( newSize ); nds.Position = 0x2C;