Skip to content

Commit

Permalink
loose idb header restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
rbran authored and emesare committed Oct 24, 2024
1 parent 6d7b73e commit 1d10013
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,12 @@ impl IDBHeader {
checksums: [u32; 3],
unk30_zeroed: u32,
unk33_checksum: u32,
unk38_zeroed: [u8; 6],
}

let v1_raw: V1Raw = bincode::deserialize_from(input)?;
ensure!(v1_raw.unk30_zeroed == 0, "unk30 not zeroed");
ensure!(v1_raw.id2_offset == 0, "id2 in V1 is not zeroed");
ensure!(v1_raw.unk38_zeroed == [0; 6], "unk38 is not zeroed");
// TODO ensure all offsets point to after the header

Ok(Self {
magic_version: magic,
Expand Down Expand Up @@ -335,8 +334,6 @@ impl IDBHeader {
unk33_checksum: u32,
unk38_zeroed: [u8; 8],
unk40_v5c: u32,
unk44_zeroed: [u8; 8],
_unk4c: [u8; 16],
}

let v4_raw: V4Raw = bincode::deserialize_from(input)?;
Expand All @@ -345,7 +342,6 @@ impl IDBHeader {
ensure!(v4_raw.id2_offset == 0, "id2 in V4 is not zeroed");
ensure!(v4_raw.unk38_zeroed == [0; 8], "unk38 is not zeroed");
ensure!(v4_raw.unk40_v5c == 0x5c, "unk40 is not 0x5C");
ensure!(v4_raw.unk44_zeroed == [0; 8], "unk44 is not zeroed");
// TODO ensure all offsets point to after the header

Ok(Self {
Expand Down Expand Up @@ -379,8 +375,6 @@ impl IDBHeader {
id2_offset_zeroed: u64,
final_checksum: u32,
unk0_v7c: u32,
unk1_zeroed: [u8; 16],
_unk2: [u8; 16],
}
let v5_raw: V5Raw = bincode::deserialize_from(input)?;
let id0_offset =
Expand All @@ -394,7 +388,6 @@ impl IDBHeader {
ensure!(v5_raw.id2_offset_zeroed == 0, "id2 in V5 is not zeroed");
ensure!(v5_raw.seg_offset_zeroed == 0, "seg in V5 is not zeroed");
ensure!(v5_raw.unk0_v7c == 0x7C, "unk0 not 0x7C");
ensure!(v5_raw.unk1_zeroed == [0; 16], "unk1 is not zeroed");
// TODO ensure all offsets point to after the header

Ok(Self {
Expand Down Expand Up @@ -429,8 +422,6 @@ impl IDBHeader {
id2_offset: u64,
final_checksum: u32,
unk0_v7c: u32,
unk1_zeroed: [u8; 16],
_unk2: [u8; 16],
}
let v6_raw: V6Raw = bincode::deserialize_from(input)?;
let id0_offset =
Expand All @@ -441,7 +432,6 @@ impl IDBHeader {
ensure!(v6_raw.unk4_zeroed == [0; 4], "unk4 not zeroed");
ensure!(v6_raw.seg_offset_zeroed == 0, "seg in V6 is not zeroed");
ensure!(v6_raw.unk0_v7c == 0x7C, "unk0 not 0x7C");
ensure!(v6_raw.unk1_zeroed == [0; 16], "unk1 is not zeroed");
// TODO ensure all offsets point to after the header

Ok(Self {
Expand Down

0 comments on commit 1d10013

Please sign in to comment.