I know this is late, but I went over the gen 5 distribution roms, and I have figured out almost everything, except for what appears to be a single byte. If anyone knows, I would love the help. I'll make a table (or update our wiki later). Thanks to @Bond697 we found out the distribution roms are compiled in such a way where the pointers are static to the data.bin file directly. This is interesting and explains why most of the distro roms have the same file length but different content, sometimes with leftovers or debug data left. Here is the format:
u32 - card count
WCData
- PGF Data
- u16 - game flags
- 506bytes - distro text, terminating with FFFF
- u8 - special download animation
- u8 - language flag, 1 - japanese, 2 - english, 3 - french, 4 - german, 5 - italian, 7 - spanish, 8 - korean
- u16 - unused?
- u16 - CCITT-16
DateRanges - Whether date ranges are needed for each card regardless of card count depends on how the distro rom is compiled.
- u16 - start year
- u8 - start month
- u8 - start day
- u16 - end year
- u8 - end month
- u8 - end day Footer?
- Unknown, all zeroes with a 0x14 in the middle - No reference in the distro rom - Theory is this is used by the templating program for something, possibly maximum card count.
A few things to note. Card count does not have to match the number of cards in the file. If a card fails CRC, let's say it is all zeroes, then it is simply ignored. Not sure if language pertains to the operating system language, or the game language yet. Japanese-only distributions have a IsJapaneseDevice check which checks the OSOwnerInfo (not game language).