"Cracking" FFVIII model data

  • Thread starter Thread starter Afrotronics
  • Start date Start date
Status
Not open for further replies.
A

Afrotronics

Guest
Yo er'body.  I was chillin at my computer last night and I was messin' around with the data files from FFVIII, specifically the model files (.mch).  In my programming classes (I got to Eastern Michigan University BTW) I'm learning how to read from different file type and finding algortihms and that good stuff.  So I decided to challenge myself.  I wanted to see if I could figure out the structure of an FFVIII model file.  After tens of minutes of hex editing and consulting with my friend Mo (who is an excellent 3d and AI Programmer BTW) I notice some patterns that may be vertex data.  Looking through the file you'll come across lines that have -D and %D in an obvious pattern.  A majority of the time the -D or %D (it's usually %D) will have six characters before it.  I think these characters may be the x, y, and z coordinates (but where is w?). Before and after each instance of the 6char+%D there is (in hex) 0000 0100.  I think this may be the defining space container for each vertex.  There were some other patterns I found but I can't remember them right now (I'm in the computer lab at school so no FFVIII data is accessable).  But the thing I'm forgetting is pretty important if I recall.  My friend Moe pointed it out to me.  I'll post it when I get home tonight.  I don't know if I'm even remotely on to something ...shoot I could be looking at the wrong files...If I am, I'm definitely going to start writing a file reader for this file type.  But I hope this is useful to y'all.  Off topic--You know how you can hexedit a lot of programs and plain english will turn up in a file?  Am I not seeing any English in these files (except for the .cnf files and the grp file) because the game was programmed in japanese or is there just no human readable data in any of the files? Anyways, I gots to get back to programmin' my stupid/hard e-commerce recommendation system project for my java programming II class.
 
Vertex data and texture (including mappings) can be read through an old editor I once wrote... so those values you've seen is probably the vertex coordinate data, yes. :) I never quite figured out where the skeletal layout/animation is stored however, I think it's in the individual scene files where they're used...
 
Oh yeah....I was also hexediting the FFVIII executable and there are craploads of Direct 3d calls in there.  I have no clue what they all do cuz I don't know directX programming all that good stuff very well.  I'm assuming (not a good idea, eh :wink: ) that somewhere there's a call for getting model data.  

-Just for clarification this ISN'T the pattern that I forgot the details (because this isn't a pattern at all, it's just an observation).  Yo, if you have any extra info and whatnot pllllllleeeeeeeeeeeeaaaaaaaase post!
 
:( :erm: Sorry bout the double post I wasn't quite sure which topic it would go under.  I would've thought that it fits Tech-related more because tech related includes programming and inner-workings,  but I wasn't sure because I saw subjects like mine in the Programming feedback topic.  I hope people follow the link in the other one to get to this one because I think it would be really cool if we could get out hands on that there FFVIII Model data and make it useful :D
 
First Qhimm mentioned he has an old program for doing this

Second yes it would have a lot of Direct 3d calls in it. Of course this must mean you are talking about the PC version.

I'm still in the process of wadding through the PSX version of FF7's data :)

For the PSX version of anything beyond FF7 well Square decided to PACK everything tightly so no one could easily access or read the data (I guess they didn't like people ripping data from there games :) ).

Qhimm-
FF8 PC version does it have higher polygon count models for it?
or is it the same as the PSX in terms of model data?
does it have improved textures?
Do you have the 'prolog' information for the model data on the PC?

Cybie
 
I tried to rip ff8 data apart, but i didnt succeeded yet. I was able to extract only model textures ... no polygon / vertex data yet. I was trying .dat and .c?? files IIRC ... but im not sure about that. I thought that monster polygon / vertex data are stored in those files aswell, because in each there are textures for one monster and lots of other data i dont understand.
 
me not sure about that ... maybe ...
could you guys post info that you found ?
 
From what I've seen, the model data in FF8 PC is identical to the PSX version in terms of quality.
 
Ahh.. ok that means they are have similiar data..

Not that it's terribly informative.

However.. here is what I've found about the PSX models in FF7.
There is ALWAYS a TIM section in them and it's ALWAYS the last section in the file. If FF8 data is stored the same as FF7 then finding one of the characters TIM data location that's stretched on them, will find also there model data.  It's backwards admitedly however I think it has potential to work  better than anything else I have at least (hehehe). Are the background images the same format.. I wonder.  They are all uncompressed too as I understand it. More exploring I guess :)

Cyb
 
yes they are ... i found out that there are usually 11 parts in the file, i think file is like this: (i dont have proper info on this cpu, so its unprecise)
first there is 4bytes(long integer) - number of file parts. Then for each part there is its offset (4bytes). I know that part 11 (and higher) are TIM textures (model texture, i found some buildings textures, so i think that scenes are stored like this aswell) ... i can extract model textures, it is implemented in biturn, but nothing more ... i hasn't been able to decode model info..
i'll post more proper info when i get it.
 
Oh... That's good news.
FF7's file format for models is much more varied and have a lot more parts to the objects.

The only exception in FF7 about the TIM at the end is HICLOUD.LZS this has it as Item 96 of 113.  It's actually a 8 bit texture (instead of the 4 bit ones used on all the other ones).

Normally if the model doesn't use a texture it has a 64 byte TIM that's appears to be TV color bar colors. 16 pixels in all.

I assume all FF7 objects have colored vertices and use Guarad shading save for the few with actual textures?

I'm still working on the PSX model data.. darn hard to figure out.

Cyb
 
I've done some work with the FF7-format. Yes, the last section is always a 4-bit TIM with no pixel data (only palette) when the model has no texture. I know also about the vertex/color data and the offsets that pointing to them. FF7 model files contains also lines and quads. it seems there are also the hierachy and skeleton data in the files but i haven't decoded them 100%.
 
Which section has all the directive information for the file?
Is it section 1 or 2? I haven't pulled my hair out looking for it, but I've thought about it, back to adding my search function to my TV tool. (Originally Tim View. Now it views TIM's LZS compressed TIMs .DAT (partially resolved still needs more work) MIM <DITTO> and dumps BSX files. and of Course Battle Models).

Anyhow I can partially decode MIM files at least to see all the blocks that consist of the actual image.

Is it me or would all the character models be cramed in with each BSX or DAT file? I think that's where all the data for the cutscenes is.

Cyb
 
Yo, I'm thinkin' that none of the model data is actually stored where the textures are.  The mag20383xx... files are just the texture and motion files.  I'm thinkin that all of the model data is stored in the .mch files.  Wouldn't it make sense to keep the model data separate from animation and textures to cut down on size.  If each scene had to store an individual model then the game would be so much larger.  Seeing as that the models themsleves are pretty much static throughout the game you could just keep them in a separate file.  For a model to be the actual model it needs to well, stay as the model that it is.  It would really suck for the programmers to have to reference a different model for each seen instead saying "We have this model that we're going to put in this scene and in this scene the model will be doing this (which is the motion data) and will use this(these) texture(s)".  This is only a guess.  But I'd have no other explaination what the .mch files are in a directory called "model" and everybody is having such a crazy hard time figuring out where exactly the vertex data is in the other file.
 
Well, i guess I was kinda wrong.  I just found that the .mch files contain texture data at the very begining.  it looks like after that though, there is vertex data or mapping data.  It seems as though that the main character each have their own .mch file.
 
Pretty much all of the main characters have their own .mch files which are referenced in the actual field data files (rather than having to include the entire model in each field it's used). Other character models reside in the chara.one files found in the field files. Also, all animation data resides in the chara.one files, even for main character models. The animation data (found in the beginning of each model block in the chara.one files) is pretty much the only part of the model format that still eludes me; I have decoded the vertex data, face data, skeleton data and texture mapping data. Once I've understood the format of the animation data, I might compile a document on it, or write a small program to read the models. (just pleeease don't bug me about it ;) )

Until then, here's a basic layout on the .mch files:

  • Index block, 64 DWORDs. Contains the offsets of each texture in the file, then a 0xFFFFFFFF, then the offset of the model data.
  • Texture data. Standard TIM format.
  • Model data header, 8+8 DWORDs. Contains counts and offsets of different types of model data (skeletal joints, vertices, unknown, faces, unknown, vertex-to-bone links, 3 x unknown).
  • Skeletal joint data. 64-byte blocks of mostly zeros, contains a 1-based parent index and a bone length value. Probably a bunch of skeletal deformation data used in-game, but whose values are initially stored as zeros.
  • Vertices. Blocks of 4 shorts, the first three being x-, y- and z-coordinates and the fourth unused.
  • Faces. Huge blocks containing vertex indices, color data (unused), edge data (I think), texture mapping data and texture ID. Faces can be 3-point or 4-point polygons, decided by the first DWORD (actually it's a PSX GPU command ID).
  • Vertex groups, or "limbs". These decide which vertices are connected to which skeletal node. Groups of 4 shorts, with the index of the first vertex, the number of vertices and the bone ID (1-based) to which they belong.
squall.jpg

Teaser image of a decapitated Squall

Side notes: The animation data somehow stores the internal rotations for the model's skeletal nodes using 4 bytes per node. I'm speculating that the format would be one which a PSX could handle, in line with the lazy programmers theorem. Any ideas?

Also, the battle model format is vastly different from the normal field model format. I haven't even been able to find any vertex data in it, I'm almost suspecting it's compressed or something.
[/list]
 
WooooooHOOOOOOOOOO!!!!!!! Qhimm you so totally rock!  Thank you to everybody that helped in this effort.  I love seeing collections of knowledge be put to work!   Oh yeah, I was checkin' out some of the field data.  I forgot which file it was exactly BUT it looks like the texture and model data for the vattle scences.  The texture for battle scenes are 256x256 and for some reason or another each line of texture is separated by a line of a solid color. Just thought I'd throw in another two cents.
 
in .mch files:

7F 7F 7F 00 7F 7F 7F 00 7F 7F 7F 00 7F 7F 7F 00
<data>
7F 7F 7F 00 7F 7F 7F 00 7F 7F 7F 00 7F 7F 7F 00


is this some sort of container of some sort?
 
Status
Not open for further replies.
Back
Top