mirror of
https://github.com/AdAstra-LD/DS-Pokemon-Rom-Editor.git
synced 2026-10-02 14:57:59 -05:00
implemented an attempt-based fix for the arm9 decompression bug
This commit is contained in:
@@ -60,20 +60,26 @@ namespace DSPRE {
|
||||
}
|
||||
|
||||
private bool DecompressArm9() {
|
||||
if (new FileInfo(workDir + @"arm9.bin").Length < 0xBC000) {
|
||||
BinaryWriter arm9Truncate = new BinaryWriter(File.OpenWrite(workDir + @"arm9.bin"));
|
||||
long arm9Length = new FileInfo(workDir + @"arm9.bin").Length;
|
||||
arm9Truncate.BaseStream.SetLength(arm9Length - 0xc);
|
||||
arm9Truncate.Close();
|
||||
}
|
||||
int attempts = 0;
|
||||
|
||||
do {
|
||||
attempts++;
|
||||
if (new FileInfo(workDir + @"arm9.bin").Length < 0xBC000) {
|
||||
BinaryWriter arm9Truncate = new BinaryWriter(File.OpenWrite(workDir + @"arm9.bin"));
|
||||
long arm9Length = new FileInfo(workDir + @"arm9.bin").Length;
|
||||
arm9Truncate.BaseStream.SetLength(arm9Length - 0xc);
|
||||
arm9Truncate.Close();
|
||||
|
||||
Process decompress = new Process();
|
||||
decompress.StartInfo.FileName = @"Tools\blz.exe";
|
||||
decompress.StartInfo.Arguments = @" -d " + '"' + workDir + "arm9.bin" + '"';
|
||||
decompress.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
|
||||
decompress.StartInfo.CreateNoWindow = true;
|
||||
decompress.Start();
|
||||
decompress.WaitForExit();
|
||||
}
|
||||
} while (new FileInfo(workDir + @"arm9.bin").Length < 1122000 && attempts < 2);
|
||||
|
||||
Process decompress = new Process();
|
||||
decompress.StartInfo.FileName = @"Tools\blz.exe";
|
||||
decompress.StartInfo.Arguments = @" -d " + '"' + workDir + "arm9.bin" + '"';
|
||||
decompress.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
|
||||
decompress.StartInfo.CreateNoWindow = true;
|
||||
decompress.Start();
|
||||
decompress.WaitForExit();
|
||||
return (new FileInfo(workDir + @"arm9.bin").Length > 1122000);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user