mirror of
https://github.com/LBPUnion/UnionPatcher.git
synced 2025-08-13 11:38:46 +00:00
Added filesize check; fixed formatting
This commit is contained in:
parent
8e267a9cd2
commit
58c418362b
3 changed files with 9 additions and 3 deletions
|
@ -72,7 +72,7 @@ namespace LBPUnion.UnionPatcher.Gui {
|
|||
ElfFile eboot = new(this.filePicker.FilePath);
|
||||
|
||||
if(eboot.IsValid == false) {
|
||||
this.CreateOkDialog("Eboot Error", $"{eboot.Name} is not a valid ELF file (magic number mismatch)").ShowModal();
|
||||
this.CreateOkDialog("Eboot Error", $"{eboot.Name} is not a valid ELF file (magic number mismatch)\nThe EBOOT must be decrypted before using this tool").ShowModal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,13 @@ namespace LBPUnion.UnionPatcher {
|
|||
public byte[] Contents { get; } = null;
|
||||
|
||||
public ElfFile(byte[] fileContents) {
|
||||
if(fileContents.length < 52) {
|
||||
IsValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
IsValid = fileContents[0x00..0x04].SequenceEqual(new byte[] {0x7F, (byte)'E', (byte)'L', (byte)'F'});
|
||||
if(IsValid == false) return;
|
||||
if(!IsValid) return;
|
||||
|
||||
byte identClassValue = fileContents[0x04];
|
||||
byte identDataValue = fileContents[0x05];
|
||||
|
|
|
@ -24,8 +24,9 @@ namespace LBPUnion.UnionPatcher {
|
|||
|
||||
ElfFile eboot = new(new FileInfo(args[0]));
|
||||
|
||||
if(eboot.IsValid == false) {
|
||||
if(!eboot.IsValid) {
|
||||
Console.WriteLine($"{eboot.Name} is not a valid ELF file (magic number mismatch)");
|
||||
Console.WriteLine("The EBOOT must be decrypted before using this tool");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue