libeuropa/structs: Fix Pak V3 TOC entry

As it turns out, the unix time is NOT junk in them. The short I identified is *before* it. Oops

The hexpat is also fixed up so it can analyze v3, v4, and v5 successfully.
This commit is contained in:
Lily Tsuru 2025-01-12 16:22:02 -05:00
parent 1aebeffb3f
commit dc95b3ba9c
2 changed files with 17 additions and 5 deletions

View file

@ -26,7 +26,12 @@ namespace europa {
// 0x4 - Starfighter
// 0x5 - Jedi Starfighter
u16 Version;
u8 pad2;
// Not sure what they were planning to use this extra byte for.
// It's always 0x0 and only present in version 4 onwards.
if(Version > 0x3) {
u8 pad2;
}
u32 tocOffset;
@ -63,6 +68,10 @@ namespace europa {
u32 offset;
u32 size;
if(parent.header.Version == 3) {
u16 unk; // always 0xff. idk what this is for
}
if(parent.header.Version == 5) {
if(parent.header.sectorAligned == 0x1) {

View file

@ -83,8 +83,8 @@ namespace europa::structs {
struct [[gnu::packed]] TocEntry {
u32 offset;
u32 size;
u32 creationUnixTime; // junk on these v3 files
u16 junk;
u16 junk; // always 0xff
u32 creationUnixTime;
};
u32 tocOffset;
@ -176,13 +176,16 @@ namespace europa::structs {
structs::PakHeader_V5::TocEntry,
structs::PakHeader_V5::TocEntry_SectorAligned>;
// Make sure all the structures defined here match observed/expected sizes.
// Otherwise, we will compile a broken program.
static_assert(sizeof(PakHeader_V3) == 0x28, "PakHeader_V3 wrong size");
static_assert(sizeof(PakHeader_V4) == 0x29, "PakHeader_V4 wrong size!!");
static_assert(sizeof(PakHeader_V5) == 0x2f, "PakHeader_V5 wrong size!!");
static_assert(sizeof(PakHeader_V3::TocEntry) == 0xe, "V3 TocEntry wrong size!");
static_assert(sizeof(PakHeader_V4::TocEntry) == 0xc, "V4 PakTocEntry wrong size!");
static_assert(sizeof(PakHeader_V5::TocEntry) == 0xc, "V5 PakTocEntry wrong size!");
static_assert(sizeof(PakHeader_V4::TocEntry) == 0xc, "V4 TocEntry wrong size!");
static_assert(sizeof(PakHeader_V5::TocEntry) == 0xc, "V5 TocEntry wrong size!");
static_assert(sizeof(PakHeader_V5::TocEntry_SectorAligned) == 0x10, "V5 TocEntry_SectorAligned wrong size!");
} // namespace europa::structs