Use NRO0 verification instead of ASET verification

This commit is contained in:
Ryan Teal 2019-07-03 21:02:59 +01:00
parent 012b1df5d8
commit 07fb87b441
No known key found for this signature in database
GPG Key ID: 8DBEE0F12C7E2D23

View File

@ -73,24 +73,10 @@ public class NroMeta {
public static boolean verifyFile(String file) { public static boolean verifyFile(String file) {
try { try {
RandomAccessFile f = new RandomAccessFile(file, "r"); RandomAccessFile f = new RandomAccessFile(file, "r");
f.seek(0x18); // Skip to NroHeader.size f.seek(0x10); // Skip to NroHeader.magic
int asetOffset = Integer.reverseBytes(f.readInt());
f.seek(asetOffset); // Skip to the offset specified by NroHeader.size
byte[] buffer = new byte[4]; byte[] buffer = new byte[4];
f.read(buffer); f.read(buffer);
if (!(new String(buffer).equals("ASET"))) if (!(new String(buffer).equals("NRO0")))
return false;
f.skipBytes(0x4);
long iconOffset = Long.reverseBytes(f.readLong());
int iconSize = Integer.reverseBytes(f.readInt());
if (iconOffset == 0 || iconSize == 0)
return false;
f.seek(asetOffset + 0x18);
long nacpOffset = Long.reverseBytes(f.readLong());
long nacpSize = Long.reverseBytes(f.readLong());
if (nacpOffset == 0 || nacpSize == 0)
return false; return false;
} catch (IOException e) { } catch (IOException e) {
return false; return false;