Hi all,
I know it's an old topic but since I'm working on this directory at the moment I'd like to share what I got so far.
Entries in this directory are related to spells/attacks (including summons, trance, etc.). Spell ID is related to entry index.
DIRECTIRY ENTRIES:typedef struct {
int type //The type of subdirectory this is
file_count //This gives the number of files within the subdirectory.
directory_information_sector //Sector that contains the directory information (IE file sector list).
first_file_sector
} DIR;
This structure can be found here:
http://wiki.qhimm.com/view/FF9/IMGRootDir No when we got this information we can seek to DIR.directory_information_sector (remember that is a sector so to obtain pointer you need to multiply this value by 2048 or shift left by 11 (0xB) ).
Now we got an array of sectors related to DIR.first_file_sector.
short ENTRIES[DIR.file_count];
So if we want to obtain sector to spell data we need to add entry sector to first file sector.
// Example for spell with id 94 (Death):
SPELL_DATA_SECTOR = DIR.first_file_sector + ENTRIES[94]
Keep in mind that not all spells are present on all disks! [EDIT:]Tirlititi is right: 0xFFFF are always at the same positions[/EDIT]
Some entries are equal 0xFFFF and should be omitted.ENTRY STRUCTURE:So far I got this:
Information about file structure is in 1st sector. It's kind of structure but with one exception. More about that bellow.
I will start with example (Death again), it's in little endian:
0100 // chunk count
0000 0400 // chunk index, entires count
00 05 2B00 // id1, id2, size - always textures ?
01 01 0800 // id1, id2, size
02 01 1300 // id1, id2, size - mesh, AKAO ... probably animations as well
0000 // after id1=2 && id2=1 there is always integer value (not always 0, eg. in Madeen it equals 0500)
03 00 1400 // id1, id2, size - this entry (id1=3) always got memory pointer as a first value
As you can see it will be nice structure if not this integer value. But it's always there and you need to remember about it!
Items starts from sector 1 and to obtain start sector of next element you need to remember size of previous one. Here is above example with start, end sectors:
count: 1
chunk: 0 4
item: 0 5 43 [1, 44]
item: 1 1 8 [44, 52]
item: 2 1 19 [52, 71]
unknown: 0
item: 3 0 20 [71, 91]
There's some more information in first sector at offset 0x400. I don't know what is this data yet.
EDIT:
I will post later about how to read textures from item id1=0