Advertisement
cr88192

Quick/dirty WAD4 format idea.

Oct 15th, 2020
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. Header {
  2. FOURCC magic; //00: 'WAD4'
  3. U32 numlumps; //04: Number of lumps in the directory.
  4. U32 diroffs; //08: Offset of Directory
  5. U32 hashoffs; //0C: Offset of Directory Hash.
  6. U32 bmpoffs; //10: Offset of Allocation Bitmap.
  7. U32 resv3; //14: Reserved
  8. U32 resv4; //18: Reserved
  9. U32 resv5; //1C: Reserved
  10. //...
  11. }
  12.  
  13. An allocation bitmap may be present to allow basic Read/Write access.
  14. This format will focus primarily on a read-only use-case though.
  15.  
  16.  
  17. DirEntW4 {
  18. U32 offs; //00: offset of lump data
  19. U32 csize; //04: compressed size of lump
  20. U32 dsize; //08: uncompressed size of lump
  21. BYTE ety; //0C: entry type
  22. BYTE cmp; //0D: compression method
  23. U16 chain; //0E: lump chain (hash)
  24. U16 dirid; //10: Directory ID (Parent Directory)
  25. U16 dirnext; //12: Next in Directory
  26. U16 uid; //14: UID
  27. U16 gid; //16: GID
  28. U16 mode; //18: Mode Flags (---Srwxrwxrwx)
  29. U16 hibits; //1A: Some extra bits
  30. U32 mtime; //1C: File timestamp
  31. BYTE name[32]; //20: name
  32. }
  33.  
  34. Offsets will be scaled by 64 bytes.
  35. Thus, the maximum theoretical WAD4 image size will be 256GB.
  36.  
  37. ety:
  38. * 0: Normal File / Unused Dirent
  39. * 1: Directory
  40. * 2: Symlink
  41.  
  42. cmp:
  43. * 0: Uncompressed
  44. * 1: Fragmented File (Large File)
  45. * 2: Merged / Packed File (Small File)
  46. * 3: RP2 Compressed
  47. * 4: LZ4 Compressed
  48.  
  49. hibits:
  50. * ( 3:0): chain-hi
  51. * ( 7:4): dirnext-hi
  52. * (11:8): mtime-hi
  53. ** Extend timestamp to 3062.
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement