Now This is a Strange File...
BioWare's GFF files are simply... uhh... perplexing.
I had... quite an interesting time trying to grasp my head around the ideas.
So this post is kind-of a self-note for me.
So, we have "Structs". Inside a Struct, there's a property "FieldCount"
A Struct can have one "Field", in which case the "DataOrDataOffset" property contains an index to the "Fields Array", pointing directly to the lone field definition of that Struct.
So far so good.
But what's interesting is if a Struct has more than one Fields. In this case, the DataOrDataOffset property points to -- here's the key -- somewhere within the "Field Indices" section of the file. Then you get N elements from the Field Indices starting from the location that DataOrDataOffset pointed to (where N is = FieldCount above).
In other words, the "Field Indices" list is an "unlabeled" set of Fields. It's a looooong list formed from the list of Fields used by Structs.
Illustration:
Let's say Struct 1 uses fields 1, 4, 5. Struct 2 uses fields 1, 2, 5, 6. Struct 3 uses fields 3, 4, 5, 6, 7.
The content of "Field Indices" will be:
WHew. Now, that's not difficult, isn't it?
Now that I can (kinda) grasp the "major structure" and ERD of the GFF file, I should be able to parse dem files...
And with this understanding, I also realize that I have to totally rewrite the logic of the current parser, to make things efficient and to enable a file validity checker.
Huh.
I need some rest.
1 Comment
Recommended Comments