.dae.phyre and .phyre in general
Posted: Mon Mar 16, 2020 6:36 am
I've been looking at FFX on PC. There's a common .phyre format used by many files, including .dae (models), .dds (textures), .fx (shaders), and maybe others I haven't seen.
I've got the format mostly figured out. Breaking the file into sections, I can parse and generally understand:
Nearly every file seemed to have pointer fixup data, so I did some basic work to understand the packing format used by reverse engineering the FFX executable. Each unpacked pointer fixup is 28 bytes, consisting of 7 uint32 slots. The general format is a control byte where the low three bits describe the packing format and the other bits describe slot data to read from the stream. There are multiple different packing formats. I have a fair understanding of types 0, 1, 2, 4, 5, and 6. Array packing data is similar, but each unpacked array fixup entry is 4 uint32 slots (16 bytes total), so a little smaller.
Before I go further down this road, has anyone else done this work? I'd like documentation for the format to exist so anyone can write viewers and tools but wasn't able to find any. If some does exist and I can save work here that would be wonderful. If no documentation exists I can start by writing up a more detailed version of the above as a place to start.
I've got the format mostly figured out. Breaking the file into sections, I can parse and generally understand:
- the file/cluster header
- the second section describing the variable types, classes, properties, and string table
- the instance list header and contents
- the user fixup string table and descriptors
- header class instance/child data (I haven't found any files in FFX that have this data, but I haven't looked very hard)
- pointer-array, pointer, and array fixup data in a packed format
- trailing data (I believe this is consumed by the array fixups)
Nearly every file seemed to have pointer fixup data, so I did some basic work to understand the packing format used by reverse engineering the FFX executable. Each unpacked pointer fixup is 28 bytes, consisting of 7 uint32 slots. The general format is a control byte where the low three bits describe the packing format and the other bits describe slot data to read from the stream. There are multiple different packing formats. I have a fair understanding of types 0, 1, 2, 4, 5, and 6. Array packing data is similar, but each unpacked array fixup entry is 4 uint32 slots (16 bytes total), so a little smaller.
Before I go further down this road, has anyone else done this work? I'd like documentation for the format to exist so anyone can write viewers and tools but wasn't able to find any. If some does exist and I can save work here that would be wonderful. If no documentation exists I can start by writing up a more detailed version of the above as a place to start.