View Single Post
Old 10-10-11, 08:43 PM   #58
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

started recoding the app so as to not use the granny2.dll. It can currently read the fileheader, infoheader, sections, and art tool info. It can also successfully write them back to the file along with all the pointers needed for them (major accomplishment). I just started decoding how the skeleton(s), bone(s), and model(s) sections are laid out in the GR2 files. I figured out all the pointers and how they work for those items now I just have to code it.
All in all the GR2 file is not overly difficult to 'read'. If you remember that everything is laid out in sections and pointers are used to access those sections (and more pointers are used for items in the section) then you can successfully 'read' it. It just gets very confusing when you have a pointer referencing another pointer that can possibly reference another pointer.
~95% of the pointers are located at the end of the file.

Those pointers have the following configuration (from what I've seen so far):
first 4 bytes: offset in section (from start of section). This usually points to a value, a place for a pointer to go, or start of something (bone, model, skeleton, etc.)
second 4 bytes: seems to be some kind of description/identifier/accessor. Usually this value is 0x0. Have seen it be 0x6 but don't know what that value means
third 4 bytes: offset in section (from start of section). This usually points to text (Strings). Can point to start of something (bone, model, skeleton, etc.)

If you use privateer's template file for 010 editor you can get the start of the pointers from SectionInfo[0] Long Another_Pointer (has comment of 'Will explain at a later date').

If you don't use the 010 editor then the pointer address (start of the pointers) can be found at 0x84 in almost all of SH5's GR2 files.

I recommend using the 1X1_version01.GR2 file located in \data\Library\Patch_1x1 for investigating/mapping out the GR2 format. It's a 'simple' GR2 file to read. If you use that file then the start of the pointers is at 0x2EC0.

I was updating the GR2 template file for 010 editor with this information but it became too complicated to do. Even if I were to successfully update the template file I would have to turn around and take that 'code' and recode it for C#. In the end it was easier to just write everything in C#.
TheDarkWraith is offline   Reply With Quote