- — File Parsing Boot Camp — - (Some file structures added)

Started by Xiggah, January 24, 2012, 06:26:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lol TCLL... this is only for helping BJ with PAT0, REFF, the Physics from Havok, and SHP0 data... lol

but since u have data on REFF... sure give us a hand on that smexy data ;)

and welcome aboard 404
https://privateladyescorts.com - Free Local Dating - No Selfie - Anonymous Casual Dating -   Video Chat Private Lady

Homer: ooooooooooohh why can't I share the lime light with Xiggah X(
lol

[spoiler]Quote: Friedslick6
you have been through a lot of hassle. I've watched every topic you posted on this, and most of them seemed to disintegrate gradually.
But the coolest part was that you didn't stop working on it despite that.

Quote: Internet Explorer
you're doing more with your life right now than probably most other people around you. You're a valuable asset to the Smash community. So yeah, you should be proud.

quote: Greg
You do have a gift which I've seen many developers use to their advantage. You can become a great coder, and with all of those ideas I think you can really build something great.

okay, here we goes:

Header:
0x00 (4) PAT0
0x04 (4) String Offset Table
0x08 (4) Version
0x0C (4) Unknown1
0x10 (4) Pipeline offset
0x14 (4) "Texture Reference" (will describe this later)
0x18 (4) Unknown2, one offset that leading to a emtpy space
0x1C (4) Unknown3, often the same as Unknown2
0x20 (4) String Offset Table (Copy)
0x24 (4) Name of animation Offset
0x28 (4) Unknown4
0x2C (2) Frames
0x2E (2) NumEntries/Materials
0x30 (2) How many Textures (String Entries1)
0x32 (2) String Entries 2, often set as "00"
0x34 (4) Unknown5

PipeLine:
0x00 (4) How long PipeLine is
0x04 (4) How many Entries/IDs
0x08-1C IDs thingy
dont exactly know how the ID's working but this is importiant:
0x20 (4) It's name in String Offset (Pipelines offset + this offset = string offset)
0x24 (4) "link" offset (Pipeline offset + this offset = "Link" offset)
and the ID and Stirng/pattern offsets repeat on each entries

"Link" Offset:
0x00 (4) String Offset, linked to Materials name
0x04 (2) What Texture it will using if Flag is set on "7". if the flag is "5" this is set on "00"
0x06 (2) Flag: 5 using Pattern, 7 is Frozen
0x08 (4) Pattern Animation Offset (Link Offset + this = Pattern Offset). this is set on "00" if the Flag is set on "7"

Pattern Animation offset
0x00 (2) Unknown, possibly flag
0x02 (2) Unknown
0x04 (4)  unknown, Possible many flags in "bits"
0x08 (4) unknown, always(?) set on 00
0x0C (2) Which Texture will be shown
0x0E (2) Unknown, always(?) set on 00
0x10 (2) Which frame and possible with a flag with it (if it saying 41B8, the 4 is a flag and 1B8 is frame)

Repeat from 0x0C to 0x10 on how many frames

"Texture refserence" Offset
here is special and hard to explain, the textures here comes in order thanks by the "link" offset and it's the order the Pattern Animation in their "texture"

0x00 (4) Offset to their texture name in String Offset

String Table Offset:
well, all the names are in here, always in the end of the PAT0s

This is my work and I have done this in more than a year :srs:
Stupid Tinypic :C

I'm aboard, though I will mostly help with stage/SSE files.

SCLA:
Sorry but you are not allowed to view spoiler contents.


BLOC:
Sorry but you are not allowed to view spoiler contents.
3DS FC: 5370-0958-4818
Wii U NNID: Doraleus

Holy crap. This thread actually went and happened. Wonderful!

I still need to know how I can help, though.

Edit: Ah. Nevermind. Found the tutorial.


Quote from: Spex130 on January 24, 2012, 04:29:52 PM
Holy crap. This thread actually went and happened. Wonderful!

I still need to know how I can help, though.

Edit: Ah. Nevermind. Found the tutorial.

Don't worry, I'll up and make more tutorials as soon as I find the best way to identify structures myself... gotta find those old posts explaining these things.

Also, I'll try to include brief explanations of each file type so people can easily take an interest to different filetypes.

hmm wat else could i take a good look into.... i guess ill look back into SCN0 data
https://privateladyescorts.com - Free Local Dating - No Selfie - Anonymous Casual Dating -   Video Chat Private Lady

SCN0 data is a good example. We should put together all of the undefined files that have looked into so far. Now where did all those file definitions run off too...

EDIT: Skygrounder, where did you find those file types anyways?

Quote from: Xiggah on January 24, 2012, 09:18:31 PM
SCN0 data is a good example. We should put together all of the undefined files that have looked into so far. Now where did all those file definitions run off too...

EDIT: Skygrounder, where did you find those file types anyways?
The SCLA file is found within every stage file, it's just never been talked about. (I don't know what purpose it serves though.)
As for the BLOC, it's found within SSE stages, and contain formats such as the ones I listed in the previous post (which might have something to do with auto-movement, doors, itemboxes, hitboxes, etc.
3DS FC: 5370-0958-4818
Wii U NNID: Doraleus

I guess you could say I'm a part of this by default.
I'm just gonna post my stuff in C# code... no point reformatting it.

Btw, please don't call the Resource Group "Pipelines" >.>
Really, "relocation table" or "resource group" is a much better name for it...
We have to use like terms.

PAT0 parsing and rebuilding is done.
The only thing that needs to be fully figured out is the secondary flags. :srs:
I need to update Bero's code so it works better.

Anway, SHP0:
unsafe struct SHP0
   {
       public BRESCommonHeader _header;
       public bint _dataOffset;
       public bint _stringListOffset; //List of vertex node strings
       public bint _stringOffset;
       public bint _unk1; //0
       public bshort _numFrames;
       public bshort _numEntries;
       public bint _unk2; //0x00, 0x01

unsafe struct SHP0Entry
   {
       public bint _numEntries; //entries + 1 index part
       public bint _stringOffset;
       public bint _numIndices;
       public bint _unk;
       public bint _indiciesOffset;

I'm pretty sure the keyframes are I12 Keyframe Entries except with no frame scale.

   public unsafe struct I12Header
   {
       public bushort _numFrames;
       public bushort _unk;
       public bfloat _frameScale; //This is the value that isn't present in SHP0

public unsafe struct I12Entry
   {
       public bfloat _index;
       public bfloat _value;
       public bfloat _tangent;

Also, REFF definitely controls REFT images. It's not SRT0 but REFF that makes some of the images go together like a GIF. (like animated fire or a spinning coin)

Havok Physics:
public unsafe struct PhysicsHeader
   {
       public const uint Tag1 = 0x57E0E057;
       public const uint Tag2 = 0x10C0C010;

       public uint _tag1; //0x57E0E057
       public uint _tag2; //0x10C0C010
       public bint _unk2; //0
       public bint _unk3; //4

       public byte _unk4; //4
       public bshort _unk5; //1
       public byte _unk6; //1
       public bint _unk7; //3
       public bint _unk8; //1
       public bint _unk9; //0

       public bint _unk10; //0
       public buint _unk11; //Size/Offset

       //Three sections of offsets:
       //__classnames__
       //__data__
       //__types__

       public OffsetSection ClassNames;
       public OffsetSection Data;
       public OffsetSection Types;

       public String Name { get { return new String((sbyte*)Address + 0x28); } }
       
       public VoidPtr ClassNamesData { get { return Address + *(buint*)(Address + 0x54); } }
       public VoidPtr DataData { get { return Address + *(buint*)(Address + 0x84); } }
       public VoidPtr TypesData { get { return Address + *(buint*)(Address + 0xB4); } }
}

public unsafe struct OffsetSection
   {
       public fixed byte name[0x10];

       public bint _unk0; //-1
       public buint _dataOffset; //Main header is the base
       
       //Offsets to indices struct. _dataOffset is the base for everything.
       public buint _dataOffset1;
       public buint _dataOffset2;
       public buint _dataOffset3;
       public buint _dataOffset4;
       public buint _dataOffset5;
       public buint _dataOffset6;

       //When offsets begin to repeat, stop reading
       //Indices count is ((next data offset) - (current data offset)) / 2
       //Indices are padded to 0x10 with 0xFF

       public String Name { get { return new String((sbyte*)Address); } }
   }

public unsafe struct IndexGroup
   {
       //Base is the offset sections's _dataOffset
       //Still not sure exactly how these are used, but they're definitely a datalength or offset
       
       public buint _dataOffset; //Not necessarily...
       public buint _stringOffset; //Not necessarily...

Also, SCN0 is almost rebuildable. I finished STPM too.
SCN0 definitely needs more research, especially since it has a frame count. :srs:

While we're talking about SCN0 + frames, I tried to port a SSE stage to final destination some time ago, and the result of the SceneData was that it kept shifting between light and dark.
I *think* this was the file:
http://www.mediafire.com/?6e0nwrebfid5hv2
3DS FC: 5370-0958-4818
Wii U NNID: Doraleus

Does that animation count have anything to do with the lighting system on Battlefield?


Quote from: Spex130 on January 24, 2012, 11:18:56 PM
Does that animation count have anything to do with the lighting system on Battlefield?
yes it does... battlefields lighting has a framecount of 10800
https://privateladyescorts.com - Free Local Dating - No Selfie - Anonymous Casual Dating -   Video Chat Private Lady

Quote from: Nymph on January 24, 2012, 11:23:01 PM
yes it does... battlefields lighting has a framecount of 10800
Framecount of 10800, going off of memory here isn't that the same framecount for Battlefields stage animation? Seems like a typical light animation to me.

Anyways, I'll be adding the file structs to the first post.

I will keep an eye on this...
Quotes:
Sorry but you are not allowed to view spoiler contents.