Author Topic: FFVIII Guardian Force files (help)  (Read 17592 times)

Softtm17

  • *
  • Posts: 33
    • View Profile
FFVIII Guardian Force files (help)
« on: 2014-03-07 13:37:40 »
Hi to everyone guys. (i'm italian so sorry 4 my bad english)
I'm trying to find and extract the 3d model of GF.
I've made some research...and various model are in battle.fs, inside some Mag*.dat files.

Now...before explain the situation....
I'm a newbie in this sort of things...so i'm trying to find some details/information for anyone who can work on it.

So in this moment there is the new PY plugins for noesis that can extract the "chara.one" in others files containing the npc/items models.
With noesis you can also see some texture of effects and G.F......where? -> Inside Battle.fs
After the enemy/main charachters files there are the Mag*.dat files.
A lot of the are basically just the animation and texture of the magics itself but some of this are the instruction/texture/models of G.F.

I've compared the type of file and here the result:

First 2 files are buel and red bait...
I'm not a genius in hex edit or in the structure of a file, but i've done some stupid work for dissidia and i've resolved some little problem in some gim file replacing a part of the beginning of the file with another one of another (working) file.
I've tried to do the same here but with no result.
As you can see the c0m*dat files are basically the same.
There is the beginning-header part (light blue) - some information inside the blue one, and the ending of the initial structure (green part) after that there are just all the informations about texture/model/bones etc
Looking these, i've tried to hex edit some mag*.dat files....
I've tried to open the mag186_a.dat, *b.dat.......*g.dat....they are splitted in more file (the G.F.)
Some have just a short string (0 to 3) other one have some complete different instrunction inside...except the "b" one....
In noesis if you try to open the Mag186_a.dat you can see the odin texture....if you try to pen the b one...you can't.
If you see the picture it have a very similar structure of the c0m files...(so, i'm thinking, inside there there is the 3d model...) but is more short.
I've tried to replace or add some strings but without results....
Others:
In another one i've found the AKAO header (Mag186_g.dat):

And in the last one (the biggest Mag999_a.dat) you can found another header MNS with the name of Shun moriya inside:


Anyway, if you can do anything, or give some help, will be very appreciated.
Thanks in advance for your support ^^.

Vehek

  • *
  • Posts: 215
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #1 on: 2014-03-08 00:03:05 »
I'm not sure what to advise other than expanding the header and adjusting the offsets to match the types of battle model that Noesis supports.
I do have a list of where some of the GF models are.

"Alternate format" means that the model uses a different header format that lacks a section count, that the model data does not start at the beginning of the file, and that the model's textures are not TIM-format.

battle.fs:
  • mag005_b.05 (Alternate format) - Leviathan
  • mag094_b - Siren
  • mag099_b - Fat Chocobo (ChocoBocle)
  • mag115_h.07 - Quezacotl
  • mag184_e - Shiva
  • mag186_b - Odin
  • mag190_b - Doomtrain
  • mag201_b.12 (alternate format) - Bahamut
  • mag204_b.03 (alternate format) - Brothers?
  • mag217_b - Gilgamesh
  • mag290_h - Pandemona
  • mag324_h - Diablos
  • mag325_b - Odin (death from Seifer?)
  • mag326_e, mag326_g - Gilgamesh

All listed models in magic.fs are the alternate format.
magic.fs:
  • mag200_b.00 - Ifrit
  • mag201_b.00 - Bahamut (head)
  • mag202_b.00 - Cerberus
  • mag203_b.00 - Alexander
  • mag204_b.00 - Brothers?
  • mag205_b.00 - Eden

A bunch of other models are in FF8.exe. One thing that I've found helpful in finding models is that there's usually if not always either the hex string 68 C0 07 08, 70 C0 07 08, or something similiar near the beginning of the model data.

This is a Python script that takes a "normal" GF-model and turns it into a battle model that Noesis can read.
Code: [Select]
import struct

imageCount = 2

name = raw_input('File name:')
model = open(name, 'rb')
model.seek(4)
offsets = struct.unpack("IIII", model.read(16))
model.seek(offsets[0])
modelData = model.read(offsets[3] - offsets[0])

outt = open(name.split('.')[0] + '_mdl.dat', 'wb')
outt.write(struct.pack("IIII", 11, offsets[0] + 0x1C, offsets[1] + 0x1C, offsets[2] + 0x1C))
for i in range(8):
    outt.write(struct.pack("I", offsets[3] + 0x1C))

outt.write(struct.pack("I", offsets[3] + 0x1C + 4 * (imageCount + 2) + imageCount * 0x4220))

outt.write(modelData)
outt.write(struct.pack("I", imageCount))
for i in range(imageCount + 1):
    outt.write(struct.pack("I", i * 0x4220 + 4 * (imageCount + 2)))
#Create placeholder textures
for j in range(2):
    outt.write(struct.pack("IIIHHHH", 0x10, 9, 0x20C, 2, 2, 256, 1))
    for x in range(256):
        outt.write('\x22\x22')

    outt.write(struct.pack("IHHHH", 0x400C, 1, 1, 0x40, 0x80))
    for x in range(0x4000):
        outt.write("\x00")

outt.close()
« Last Edit: 2014-03-08 01:35:34 by Vehek »

Softtm17

  • *
  • Posts: 33
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #2 on: 2014-03-08 07:36:50 »
As i said i don't understand almost nothing about the structure of a file xD
So sorry if i said a lot of "trash"...
However I got an error but is my python version (3.x.x) ^^"...solved with the 2.7.6.
Anyway the output is without texture right? Is just the model.

Thanks again for your kindness.
(Greetings from sicily!)
« Last Edit: 2014-03-08 08:04:52 by Softtm17 »

Vehek

  • *
  • Posts: 215
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #3 on: 2014-03-08 08:31:40 »
Since GF textures are separate from the model, they are not easily merged into the newly created model. It can only directly provide the model.
The script creates placeholder textures for the purpose of being manually replaced or maybe to make textures behave correctly when exported. You can adjust how many placeholders are created by changing the value of imageCount.
« Last Edit: 2014-03-08 09:04:20 by Vehek »

Softtm17

  • *
  • Posts: 33
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #4 on: 2014-03-08 08:59:38 »
Another thing and i've finished.
For example, for leviathan (or for the other alternate model), if i try to convert, and open with noesis, it wants the Battle skeleton.dat......what should i do?
There is no way to extract them?
« Last Edit: 2014-03-08 09:03:38 by Softtm17 »

Vehek

  • *
  • Posts: 215
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #5 on: 2014-03-08 09:27:23 »
I don't know yet if you've gotten the alternate-format models out of the files yet (though I'm assuming you have), but it requires a slightly different script for conversion.

Replace
Code: [Select]
modelData = model.read(totalSize - offsets[0])with
Code: [Select]
modelData = model.read()And replace all occurrences of "0x1C" in the script with "0x18".

Oh, and I slipped up when I was updating my list to post. There's another Leviathan model in mag005_b.02.

Softtm17

  • *
  • Posts: 33
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #6 on: 2014-03-08 09:49:22 »
Give me a sec.
I've replace that string and replaced ALL 0x1C with 0x18.
And i got this:
Code: [Select]
import struct

imageCount = 2

name = raw_input('File name:')
model = open(name, 'rb')
model.seek(4)
offsets = struct.unpack("IIII", model.read(16))
model.seek(offsets[0])
modelData = model.read()

outt = open(name.split('.')[0] + '_mdl.dat', 'wb')
outt.write(struct.pack("IIII", 11, offsets[0] + 0x18, offsets[1] + 0x18, offsets[2] + 0x18))
for i in range(8):
    outt.write(struct.pack("I", offsets[3] + 0x18))

outt.write(struct.pack("I", offsets[3] + 0x18 + 4 * (imageCount + 2) + imageCount * 0x4220))

outt.write(modelData)
outt.write(struct.pack("I", imageCount))
for i in range(imageCount + 1):
    outt.write(struct.pack("I", i * 0x4220 + 4 * (imageCount + 2)))
#Create placeholder textures
for j in range(2):
    outt.write(struct.pack("IIIHHHH", 0x10, 9, 0x20C, 2, 2, 256, 1))
    for x in range(256):
        outt.write('\x22\x22')

    outt.write(struct.pack("IHHHH", 0x400C, 1, 1, 0x40, 0x80))
    for x in range(0x4000):
        outt.write("\x00")

outt.close()

My steps are:
1)Extract all file in Magic.fs with deling
2)Run python with this new script and give him for example ->mag205_b.00
3)Got the new mag205_b_mdl.dat file but after i put it in noesis doesn't work.

So...any solution?

Vehek

  • *
  • Posts: 215
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #7 on: 2014-03-08 09:58:18 »
The alternate-format models are not at the beginning of the file, which is why the script fails. Unfortunately, I don't know enough to automatically locate where they are in the file. I used a hex editor to find the alternate-format models and to copy their data out into new files. That isn't an optimal solution.

For example, open up mag005_b.05 in a hex editor and copy out the data from 0xD4-C643 into a new file.
In its file, Eden is at 0x5A54-134FF.
« Last Edit: 2014-03-08 10:02:24 by Vehek »

Softtm17

  • *
  • Posts: 33
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #8 on: 2014-03-08 10:09:45 »
Yeah now it's working...
Manually how can i individuate the beginning (and this i can easily find it) and the "End" of the file.
There is any way to calculate it?

Vehek

  • *
  • Posts: 215
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #9 on: 2014-03-08 10:25:42 »
If you've located the beginning of the model, then it should be simple. The first 4 bytes of the alternate header are the length of the model, in little-endian (take the bytes and reverse the order to get the value).

Good night.
« Last Edit: 2014-03-08 10:28:42 by Vehek »

Softtm17

  • *
  • Posts: 33
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #10 on: 2014-03-08 10:30:38 »
Thanks for all!!

kaspar01

  • *
  • Posts: 118
  • FFVIII Fan & Collector , 3D Artist , FF8RP-WIP
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #11 on: 2014-03-08 12:11:02 »
Vehek you made my day!

Thanks so much man..really  :)

Anyway I'm having a little problem whith Quetzacoatl model about the uv info..it's like it is incomplete..I mean that Quetzacoatl model uses 3 material/maps but the info of the third one is missing and ther is no unwrap for that part of the model.

Anyway I don't remember if there was a way to unpack the ff8.exe files.. I remember that some models were hidden in it..for example the Grim reaper (the one from the Death magic cast) ..and maybe Carbuncle too..I should check  ;D

[Edit]

I made a "manual" fix for the Quetzacoatl missing UV and now it looks better even if maybe not perfect :)



« Last Edit: 2014-03-08 18:31:54 by kaspar01 »

kaspar01

  • *
  • Posts: 118
  • FFVIII Fan & Collector , 3D Artist , FF8RP-WIP
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #12 on: 2014-03-09 08:48:43 »
I found 2 more summons but I've not been able to extract them:

-Phoenix should be located in mag139 files
-MiniMog should be located in mag095 files

Hope this can be useful :)

Vehek

  • *
  • Posts: 215
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #13 on: 2014-03-09 09:02:42 »
While their textures are in the archives, those summons' models are in FF8.exe.
For the English 1.2, both non-Geforce and Geforce:
  • Phoenix: 0xDB537C
  • MiniMog: 0x112BC04
  • Carbuncle: 0xCB6F94
  • Tonberry: 0x1147514
These are "normal" GF models.

I mean that Quetzacoatl model uses 3 material/maps but the info of the third one is missing and ther is no unwrap for that part of the model.
You may need to increase imageCount in the script in order to have all the UVs preserved.
« Last Edit: 2014-03-09 09:07:37 by Vehek »

kaspar01

  • *
  • Posts: 118
  • FFVIII Fan & Collector , 3D Artist , FF8RP-WIP
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #14 on: 2014-03-09 09:27:56 »
Thanks!

I'll try to increase the imagecount then  :D

do you know anything about the Grim Reaper?

I'm quite sure he's in the ff8.exe too (or at least the texture is there)

It's one of the summon models I'd like to find most  :-)

Thanks a lot again anyway!

After  summons files the only thing still missing is (at least among the ones I'm looking for) the terrain/city models..I'm not sure about the world map characters/vehicles ones since I've seen something like a re-texturing but didn't understood how that guy extracted the models.

kaspar01

  • *
  • Posts: 118
  • FFVIII Fan & Collector , 3D Artist , FF8RP-WIP
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #15 on: 2014-03-09 11:28:42 »
I changed it to 3 for siren and it still return only 2 materials/textures..
The imageCount alone didn't help but I figured out why.
It's because the range is fixed and so I put the imagecount variable again there too in the code :)

Softtm17

  • *
  • Posts: 33
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #16 on: 2014-03-09 15:28:53 »
mmh...i got a problem....
I've succesful extracted, Ifrit,Bahamut,Cerberus...works like a charms.
For alexander i cannot find the beginning of file...Brothers too...can you give me any help?
« Last Edit: 2014-03-09 16:00:34 by Softtm17 »

kaspar01

  • *
  • Posts: 118
  • FFVIII Fan & Collector , 3D Artist , FF8RP-WIP
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #17 on: 2014-03-09 21:30:09 »
Same here..still stuck whith Alexander and Brothers  :'(

And same thing from the Doom/Death summon model file(Grim Reaper)..can't find it even if I'm 75% sure it's in ff8.exe file..
Anyway the texture for that summon animation effects are in mag007 and mag008 files but I've not been able to find it there neither.. :(

I'll keep search  :-D

Vehek

  • *
  • Posts: 215
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #18 on: 2014-03-09 23:40:19 »
    Alexander: At 0x8138 in mag203_b.01 (Sorry, didn't have it listed correctly in my big list.)
    Brothers: 0x31E0 in mag204_b.00, and 0xE0 in mag204_b.03.

    Grim Reaper:
    According to the models I manually extracted a while ago, there are multiple copies.
    One can be found at 0x122C95C.

    There were so many models that I don't think I got them all, but in FF8.exe, I've found:
    • Gilgamesh's swords (multiple copies, I think)
    • Various Angelo models, and Angelo's bone
    • Rinoa's wings?
    • A cherub (angel)? 0x11786D4
    • Boko models, Cactuar, and Moomba
« Last Edit: 2014-03-10 00:46:21 by Vehek »

kaspar01

  • *
  • Posts: 118
  • FFVIII Fan & Collector , 3D Artist , FF8RP-WIP
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #19 on: 2014-03-10 08:32:01 »
Thanks!

I'll try whith them too as soon as possible (not at my place now :( )

The Gilgamesh swords are supposed to be at least 4 (1 for each attack he can cast)..I see the textures for it yesterday and they're 32x128 instead of the classic 128x128 (i don't remember the name of the file right now but I can easily find it again if you could need)..anyway 2 of them have the same model whith different texture but they probably use a

About angelo there is probably 1 model for each Rinoa Limit .

The wings are the one from the other rinoa limit (Angel Wings?)

The cherub/angel you saw is the one who appear when someone dies during the final battle vs Ultimecia.


Softtm17

  • *
  • Posts: 33
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #20 on: 2014-03-10 08:35:58 »
Alredy Extracted ALL.
I've found a particular strings of Hex...so i use this string to find any models.
In 10 minutes i've extracted 16 models from the exe..
4 different angelo
rinoa's wing
momba
Kyactus
reaper
gilgamesh's swords
also the biscuit for angelo xD

Thanks for all Vehek!

Softtm17

  • *
  • Posts: 33
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #21 on: 2014-03-10 10:20:47 »
OFF topic and LAST question i promise ^^"

For the terrain model?
Like ragnarock or "mini squall"?
You know where they are? (And off course the way for exctract)

Zervox

  • *
  • Posts: 55
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #22 on: 2014-04-29 01:36:29 »
Not sure if this might help others(not even sure how these files are supposed to be written)
I also note that its been awhile that someone posted in this thread.

Basically just convert folder of files instead of singular entered file.

Python 3.
This code is based on what Vehek posted.
Code: [Select]
import struct
import os
import sys

path = './Unconv/'
pathd = './Conv/'

imageCount = 2

for file in os.listdir(path):
    current = os.path.join(path, file)
    if os.path.isfile(current):
        try:
            model = open(current, 'rb')
            model.seek(4)
            offsets = struct.unpack("IIII", model.read(16))
            model.seek(offsets[0])
           
            modelData = model.read(offsets[3] - offsets[0])
           
            outt = open(pathd+os.path.basename(current)+ '_mdl.dat', 'wb')
            outt.write(struct.pack("IIII", 11, offsets[0] + 0x1C, offsets[1] + 0x1C, offsets[2] + 0x1C))
            for i in range(8):
                outt.write(struct.pack("I", offsets[3] + 0x1C))

            outt.write(struct.pack("I", offsets[3] + 0x1C + 4 * (imageCount + 2) + imageCount * 0x4220))

            outt.write(modelData)
            outt.write(struct.pack("I", imageCount))
            for i in range(imageCount + 1):
                outt.write(struct.pack("I", i * 0x4220 + 4 * (imageCount + 2)))
            #Create placeholder textures
            for j in range(2):
                outt.write(struct.pack("IIIHHHH", 0x10, 9, 0x20C, 2, 2, 256, 1))
                for x in range(256):
                    outt.write(bytes("\x22\x22", 'UTF-8'))

                outt.write(struct.pack("IHHHH", 0x400C, 1, 1, 0x40, 0x80))
                for x in range(0x4000):
                    outt.write(bytes("\x00", 'UTF-8'))

            outt.close()
        except Exception:
            pass

This is the altered code.
Code: [Select]
import struct
import os
import sys

path = './Unconv/'
pathd = './Conv/'

imageCount = 2

for file in os.listdir(path):
    current = os.path.join(path, file)
    if os.path.isfile(current):
        try:
            model = open(current, 'rb')
            model.seek(4)
            offsets = struct.unpack("IIII", model.read(16))
            model.seek(offsets[0])
           
            modelData = model.read(offsets[3] - offsets[0])
           
            outt = open(pathd+os.path.basename(current)+ '_mdl.dat', 'wb')
            outt.write(struct.pack("IIII", 11, offsets[0] + 0x1C, offsets[1] + 0x1C, offsets[2] + 0x1C))
            for i in range(8):
                outt.write(struct.pack("I", offsets[3] + 0x1C))

            outt.write(struct.pack("I", offsets[3] + 0x1C + 4 * (imageCount + 2) + imageCount * 0x4220))

            outt.write(modelData)
            outt.write(struct.pack("I", imageCount))
            for i in range(imageCount + 1):
                outt.write(struct.pack("I", i * 0x4220 + 4 * (imageCount + 2)))
            #Create placeholder textures
            for j in range(2):
                outt.write(struct.pack("IIIHHHH", 0x10, 9, 0x20C, 2, 2, 256, 1))
                for x in range(256):
                    outt.write(bytes("\x22\x22", 'UTF-8'))

                outt.write(struct.pack("IHHHH", 0x400C, 1, 1, 0x40, 0x80))
                for x in range(0x4000):
                    outt.write(bytes("\x00", 'UTF-8'))

            outt.close()
        except Exception:
            pass
« Last Edit: 2014-04-29 01:39:47 by Zervox »

Lubdar

  • *
  • Posts: 6
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #23 on: 2014-06-17 03:52:09 »
First off I would  like to thank all of the hard work that people have put into this endeavor!!!

  Sorry that I'm getting into this a little bit late, but I was wondering if anyone has had any success with extracting these models from the steam files.  So far I've been able to pull out most all of the "Standard" and "Alternative" GFs using the scripts provided above.  However I'm a little unclear on how to determine the lengths of models and or where to start looking for them.

Mainly when looking at ff8.exe,
While their textures are in the archives, those summons' models are in FF8.exe.
For the English 1.2, both non-Geforce and Geforce:
  • Phoenix: 0xDB537C
  • MiniMog: 0x112BC04
  • Carbuncle: 0xCB6F94
  • Tonberry: 0x1147514
These are "normal" GF models.
You may need to increase imageCount in the script in order to have all the UVs preserved.

I can locate them, but I don't know how to identify how much data to copy out to run the python script for.

Any help would be greatly appreciated...
« Last Edit: 2014-06-17 17:29:40 by Lubdar »

Lubdar

  • *
  • Posts: 6
    • View Profile
Re: FFVIII Guardian Force files (help)
« Reply #24 on: 2014-06-21 05:51:45 »
Ahhh things should be good, I was able to figure out where the files were located...Does anybody know if this approach works for FF9 summons?