diff --git a/templates/EsperALR.bt b/templates/EsperALR.bt index 8d34f9b..fd6e829 100644 --- a/templates/EsperALR.bt +++ b/templates/EsperALR.bt @@ -34,16 +34,21 @@ struct File_ALR int Magic; int Size; int InfoSectionsCount; - struct InfoSection2 - { - int Flags2; // (?) Example from pc00a.alr: 0x01 00 04 00 - int DataSec_Start; - int Unk; - int Unk; - int UnkZ; - int StaticID; - int Unk; - } Subsection[InfoSectionsCount]; + + // Prevents warnings if the array size will be 0. + if (InfoSectionsCount != 0) + { + struct InfoSection2 + { + int Flags2; // (?) Example from pc00a.alr: 0x01 00 04 00 + int DataSec_Start; + int Unk; + int Unk; + int UnkZ; + int StaticID; + int Unk; + } Subsection[InfoSectionsCount]; + } } Subfile; } @@ -84,33 +89,24 @@ struct File_ALR { struct Block0xD { - int Magic; // 0D 00 00 00 - int SectorSize; - int Pad; + int Magic; // 0D 00 00 00 + int SectorSize; + int Pad; } Subfile; } - if (ReadByte() == 3 || ReadByte() == 5) + if (ReadByte() == 0xA) { - struct Block0x3 - { - int Magic; // 03 00 00 00 - int Size; - int Unk1; // Seems to always be 00 00 20 42 - int Flags; // (?) Example from pc00a.alr: 06 00 08 00 - int Unk2; - int Unk3; // UNK2 and UNK3 sometimes match each other in value. When they don't, UNK3 is always 0 - int UnkZero1; - int Flags; // Example from pc00a.alr: 00 02 0C 00 - - // 0x[SIZE-0x24] DATA - // 0x24 = 36 - local int DataSize = Size - 32; - char DataSector[DataSize]; - } Subfile; - } + struct Block0xA + { + int Magic; // 0A 00 00 00 + int SectorSize; + char Unknown[28]; + char pad[12]; + } Subfile; + } - if (ReadByte() == 0x10) + if (ReadByte() == 0x10) { struct Block0x10 { @@ -135,6 +131,53 @@ struct File_ALR } TGA[TGA_Num]; } Subfile; } + + // These blocks are only found in st##cam.alr files + // in the Map folder. They control the camera animation + // for stage intros. + if (ReadByte() == 0x7) + { + struct Block0x7 + { + int Magic; // 07 00 00 00 + int SectorSize; + int Unknown[3]; + int unk; + double pad; + struct AnimFrames + { + float FrameNum; + float CoordinateX; + float CoordinateY; + float CoordinateZ; + } animation[(SectorSize - 32)/16]; + } Subfile; + } + + if (ReadByte() == 3 || ReadByte() == 5) + { + struct Block0x3 + { + int Magic; // 03 00 00 00 + int Size; + int Unk1; // Seems to always be 00 00 20 42 + int Flags; // (?) Example from pc00a.alr: 06 00 08 00 + int Unk2; + int Unk3; // UNK2 and UNK3 sometimes match each other in value. When they don't, UNK3 is always 0 + int UnkZero1; + int Flags; // Example from pc00a.alr: 00 02 0C 00 + + // 0x[SIZE-0x24] DATA + // 0x24 = 36 + local int VertCount = 0; + while (VertCount < (Size - 32)/8) + { + float UnkNum; + float Float; + VertCount++; + }; + } Subfile; + } if (ReadByte() == 2) { @@ -193,11 +236,22 @@ struct File_ALR } } Subfile; } + + if (FEof() == 1) + { + // Checks if we're at the end of the file + break; + } - if (ReadByte() != 0x00 && ReadByte() != 0x01 && ReadByte() != 0x02 && ReadByte() != 0x03 && ReadByte() !=0x05 && ReadByte() != 0x0D && ReadByte() && ReadByte() != 0x0D && ReadByte() != 0x10 && ReadByte() != 0x13 && ReadByte() != 0x14 && ReadByte() != 0x15 && ReadByte() != 0x16) + if (ReadByte() != 0x00 && ReadByte() != 0x01 && ReadByte() != 0x02 && ReadByte() != 0x03 && ReadByte() !=0x05 && ReadByte() != 0x7 && ReadByte() != 0x0A && ReadByte() && ReadByte() != 0x0D && ReadByte() != 0x10 && ReadByte() != 0x13 && ReadByte() != 0x14 && ReadByte() != 0x15 && ReadByte() != 0x16) { break; } } - char Whitespace[header.WhitespaceEndAddress - (FTell())]; + + if (FEof() != 1) + { + // Checks if we're at the end of the file + char Whitespace[header.WhitespaceEndAddress - (FTell())]; + } } file; \ No newline at end of file