Advertisement
Kaphotics

X/Y GARC Structure

Aug 30th, 2014
1,250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.53 KB | None | 0 0
  1. Author: Magical
  2.  
  3. Header {
  4. Magic      [4]byte // "CRAG"
  5. HeaderSize uint32  // Size in bytes of this header, always 0x1C
  6. BOM        uint16  // Always 0xFEFF
  7. _          uint16  // Always 0x400
  8. ChunkCount uint32  // Always 4 (wait)
  9. DataOffset uint32  // Offset to start of data inside the FIMG
  10. chunk, relative to start of the GARC
  11. Size       uint32  // Total size in bytes of the GARC
  12. LastSize   uint32  // same as last word in the FATB chunk
  13. }
  14.  
  15. FATO {
  16. Magic       [4]byte // "OTAF"
  17. Size        uint32  // Size in bytes of this chunk
  18. OffsetCount uint16  // Number of records in this chunk
  19. _           uint16  // Padding, always 0xFFFF
  20.  
  21. // Offsets into the FATB, relative to the start of the data
  22. Offsets  [OffsetCount]uint32
  23. }
  24.  
  25. FATB {
  26. Magic       [4]byte // "BTAF"
  27. Size        uint32  // Size in bytes of this chunk
  28. FileCount   uint32  // The total number of File records in this chunk
  29.  
  30. // For each FATO record (OffsetCount)
  31. []struct{
  32. Vec  uint32 // Bit vector
  33. // For each set bit in Vec
  34. Files []struct{
  35.     // Start of the file data, relative to DataOffset and aligned to a four-byte boundary
  36.         Start uint32
  37.         // End of the file data, relative to DataOffset and aligned to a four-byte boundary
  38.         End   uint32
  39.         // Size of the file. This can be smaller than End-Start if the size is not a multiple of four bytes.
  40.         Size  uint32
  41.         }
  42. }
  43. }
  44.  
  45. FIMB {
  46.     Magic      [4]byte // "BMIF"
  47.     HeaderSize uint32  // Always 0xC
  48.     DataSize   uint32  // Size in bytes of the following data
  49.  
  50.     Data []byte // File data. DataOffset points here.
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement