Page 1 of 1

.dae.phyre and .phyre in general

Posted: Mon Mar 16, 2020 6:36 am
by norved
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:
  • 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
These sections are followed in order by a few more sections that I understand less:
  • 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)
I'm interested in understanding the file contents as completely as possible. With the above knowledge, it's possible to write a texture extractor, and I've found examples of that. With a better understanding, we can write better tools across a larger set of content, including other games.

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.

Re: .dae.phyre and .phyre in general

Posted: Mon Mar 16, 2020 8:51 am
by Darkhowlings
norved wrote: 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:
  • 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
These sections are followed in order by a few more sections that I understand less:
  • 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)
I'm interested in understanding the file contents as completely as possible. With the above knowledge, it's possible to write a texture extractor, and I've found examples of that. With a better understanding, we can write better tools across a larger set of content, including other games.

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.
Actually, they are tools for extract textures from FFX, even models with bones.
Same for reverse and pack the textures, sadly, only with one tool one can reverse pack on FFX and if you don't have a buy one, you cannot used it.

What they is nothing is a reverse tool for import custom models.

But, for the rest is all have done.