FF8/FileFormat magfiles

From Final Fantasy Inside
< FF8
Revision as of 00:40, 29 May 2016 by my_wiki>MaKiPL
Jump to navigation Jump to search

By MaKiPL


There is no unified format for MAG files. Every file has their own naming, even extension. You can't really distinguish them.

Files starting with 10 00 00 00 09 00 00 00 are obviously TIM texture. What we know so far is how to extract GF sequence and GF environment geometry (ifrit ball, Leviathan's rock, Cerberus gate...)

G.F. Sequence

http://forums.qhimm.com/index.php?topic=15056.0

Environment objects

I'm aware it's chaotic, like no tables and etc. but it's up-to-date information and I'll update it after I crack the face indices (triangles/quads) First, recognize file: 1.Header must be 8 bytes null!!

2.Jump to pointer at 0xC [Global]

3.This int indicates pointer count. Example: 10 00 00 00 is 16 pointers

3a. If pointer is 00 00 00 00, just ignore it and move forward

4.After noting all pointers that are not 00 00 00 00 (therefore inspecting Count*4 bytes) just jump to selected one [Relative jump from count int]

5.See third int (8th byte) for UNKNOWN [Relative jump from 03 00 00 00]

6.Read int at 20th byte for VERTICES offset [Relative jump from 03 00 00 00]

7.Read int at 24th byte for VERTICES COUNT [Vertex is 8 bytes! X Z Y W, where W is probably weight byte [as in OBJ specification] and is normally unused (as usual, even in casual OBJ files)]

The polygons are weird? So far I think there are more polygon types. If you work with this dictionary you're going to be fine:

       private Dictionary<UInt16,int> _polygonType = new Dictionary<ushort, int>
       {
           { 0x7, 20},     //BAD?
           { 0x8, 20}, //OK 
           { 0x9, 28}, //OK
           {0x10, 20},     //BAD?
           {0x12, 24}, //OK
           {0x13, 36}, //OK
           {0x18, 0x18}    //24 BAD?
       };

Example: 09 00 9f 01 means there's 9f 01 (415) polygons of type 0x9. Therefore: 28*415=11620 bytes to next polygon type or vertices if FF FF FF FF.