mirror of
https://github.com/AdmiralCurtiss/WfcPatcher.git
synced 2026-03-22 02:14:09 -05:00
Avoid printing BLZ warnings multiple times.
This commit is contained in:
parent
b8a83611a5
commit
f90c4491c2
|
|
@ -135,7 +135,7 @@ namespace WfcPatcher {
|
|||
// new ARM is actually bigger, redo without the additional nullterm replacement
|
||||
decData = decDataUnmodified;
|
||||
ReplaceInData( decData, 0x00, false );
|
||||
data = blz.BLZ_Encode( decData, 0 );
|
||||
data = blz.BLZ_Encode( decData, 0, supressWarnings: true );
|
||||
newCompressedSize = (uint)data.Length;
|
||||
|
||||
int arm9diff = (int)len - (int)newCompressedSize;
|
||||
|
|
@ -147,7 +147,7 @@ namespace WfcPatcher {
|
|||
#if DEBUG
|
||||
System.IO.File.WriteAllBytes( "arm9-dec-without-debug.bin", decData );
|
||||
#endif
|
||||
data = blz.BLZ_Encode( decData, 0 );
|
||||
data = blz.BLZ_Encode( decData, 0, supressWarnings: true );
|
||||
newCompressedSize = (uint)data.Length;
|
||||
|
||||
arm9diff = (int)len - (int)newCompressedSize;
|
||||
|
|
@ -327,7 +327,7 @@ namespace WfcPatcher {
|
|||
if ( diff < 0 ) {
|
||||
Console.WriteLine( "Removing known debug strings and recompressing overlay " + id + "..." );
|
||||
RemoveDebugStrings( decData );
|
||||
data = blz.BLZ_Encode( decData, 0 );
|
||||
data = blz.BLZ_Encode( decData, 0, supressWarnings: true );
|
||||
newCompressedSize = (uint)data.Length;
|
||||
|
||||
newOverlaySize = data.Length;
|
||||
|
|
|
|||
20
blz.cs
20
blz.cs
|
|
@ -256,7 +256,7 @@ namespace WfcPatcher {
|
|||
}
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
public byte[] BLZ_Encode( byte[] raw_buffer, uint mode ) {
|
||||
public byte[] BLZ_Encode( byte[] raw_buffer, uint mode, bool supressWarnings = false ) {
|
||||
byte[] pak_buffer, new_buffer;
|
||||
uint raw_len, pak_len, new_len;
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ namespace WfcPatcher {
|
|||
pak_buffer = null;
|
||||
pak_len = BLZ_MAXIM + 1;
|
||||
|
||||
new_buffer = BLZ_Code(raw_buffer, raw_len, out new_len, mode);
|
||||
new_buffer = BLZ_Code( raw_buffer, raw_len, out new_len, mode, supressWarnings );
|
||||
if (new_len < pak_len) {
|
||||
pak_buffer = new_buffer;
|
||||
pak_len = new_len;
|
||||
|
|
@ -306,7 +306,7 @@ namespace WfcPatcher {
|
|||
}
|
||||
}
|
||||
//*----------------------------------------------------------------------------
|
||||
byte[] BLZ_Code( byte[] raw_buffer, uint raw_len, out uint new_len, uint best ) {
|
||||
byte[] BLZ_Code( byte[] raw_buffer, uint raw_len, out uint new_len, uint best, bool supressWarnings = false ) {
|
||||
byte[] pak_buffer;
|
||||
uint pak, raw, raw_end, flg = 0;
|
||||
byte[] tmp;
|
||||
|
|
@ -325,7 +325,9 @@ namespace WfcPatcher {
|
|||
raw_new = raw_len;
|
||||
if (arm9 != 0) {
|
||||
if (raw_len < 0x4000) {
|
||||
Console.Write(", WARNING: ARM9 must be greater as 16KB, switch [9] disabled");
|
||||
if ( !supressWarnings ) {
|
||||
Console.WriteLine( "WARNING: ARM9 must be greater than 16KB, switch [9] disabled" );
|
||||
}
|
||||
//} else if (
|
||||
// BitConverter.ToUInt32(raw_buffer, 0x0) != 0xE7FFDEFFu ||
|
||||
// BitConverter.ToUInt32(raw_buffer, 0x4) != 0xE7FFDEFFu ||
|
||||
|
|
@ -339,10 +341,12 @@ namespace WfcPatcher {
|
|||
crc = BLZ_CRC16(raw_buffer, 0x10, 0x07F0);
|
||||
byte[] crcbytes = BitConverter.GetBytes( crc );
|
||||
if (!(raw_buffer[0x0E] == crcbytes[0] && raw_buffer[0x0F] == crcbytes[1])) {
|
||||
Console.WriteLine( "NOTICE: CRC16 Secure Area 2KB do not match" );
|
||||
Console.WriteLine( " This may be indicative of a bad dump." );
|
||||
Console.WriteLine( " If you're patching a modified ROM, such as a hack or" );
|
||||
Console.WriteLine( " fan-translation, you can safely ignore this." );
|
||||
if ( !supressWarnings ) {
|
||||
Console.WriteLine( "NOTICE: CRC16 Secure Area 2KB do not match" );
|
||||
Console.WriteLine( " This may be indicative of a bad dump." );
|
||||
Console.WriteLine( " If you're patching a modified ROM, such as a hack or" );
|
||||
Console.WriteLine( " fan-translation, you can safely ignore this." );
|
||||
}
|
||||
raw_buffer[0x0E] = crcbytes[0];
|
||||
raw_buffer[0x0F] = crcbytes[1];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user