• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

[Modset4.2] Open BrawlBox/Lib Development Thread [PW's SSS support(PAT0 editing)]

guzzleboy478

Smash Rookie
Joined
Nov 25, 2009
Messages
22
I think this is a problem from the original BrawlBox. When I try to export the "ind" under the clr sequence i get that error. Was hoping it could be fixed.
http://tinypic.com/view.php?pic=2zs4aoj&s=6

EDIT--- Oh, and if you need the error details here they are(I apologize for the wall of text but i dunno how to make it smaller or anything.):
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileLoadException: The volume for a file has been externally altered so that the opened file is no longer valid. (Exception from HRESULT: 0x800703EE)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at System.Win32.SafeHandle.ErrorCheck()
at BrawlLib.IO.wFileMap..ctor(VoidPtr hFile, FileMapProtect protect, Int64 offset, UInt32 length)
at BrawlLib.IO.FileMap.FromStream(FileStream stream, FileMapProtect prot, Int32 offset, Int32 length)
at BrawlLib.IO.FileMap.FromStream(FileStream stream)
at BrawlLib.SSBB.ResourceNodes.ResourceNode.Export(FileStream outStream)
at BrawlLib.SSBB.ResourceNodes.ResourceNode.Export(String outPath)
at BrawlBox.GenericWrapper.OnExport(String outPath, Int32 filterIndex)
at BrawlBox.GenericWrapper.Export()
at BrawlBox.GenericWrapper.ExportAction(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3603 (GDR.050727-3600)
CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
BrawlBox
Assembly Version: 0.63.3834.25755
Win32 Version: 0.63.3.0
CodeBase: file:///C:/Documents%20and%20Settings/(MyNameHere)/Desktop/BrawlBox%20Modset2/BrawlBox.exe
----------------------------------------
BrawlLib
Assembly Version: 0.10.3834.25755
Win32 Version: 0.10.3.0
CodeBase: file:///C:/Documents%20and%20Settings/(MyNameHere)/Desktop/BrawlBox%20Modset2/BrawlLib.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3614 (GDR.050727-3600)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Design
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Design/2.0.0.0__b03f5f7f11d50a3a/System.Design.dll
----------------------------------------
Accessibility
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
It is not a bug but an unfinished part.
I don't know so much about clr that I can't make BrawlBox export it. Sorry.
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
After a long six months, it's good to see the code being put to use. Best of luck to you my friends :)

By the way, who's commenting the code in Japanese?
 

Mr.Chuy

Chuy
Joined
Dec 29, 2009
Messages
1,817
Location
Somewhere in Texas
After a long six months, it's good to see the code being put to use. Best of luck to you my friends :)

By the way, who's commenting the code in Japanese?
*tips hat* Evening
I believe that would be Bero since he's the only one that speaks japanese
 

pokelover980

Smash Ace
Joined
Oct 4, 2007
Messages
905
After a long six months, it's good to see the code being put to use. Best of luck to you my friends :)

By the way, who's commenting the code in Japanese?
Like Chuy said, it would be Bero, he's the only one who's worked on the modset so far and he is the only one of us that is from Japan.
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
ベロさん、僕の制作はよろしくお願いします。
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
"Bero, please take care of my creation."
Google translate isn't perfect ;)
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
WAIT.
WHY KRYAL IS HERE?
I can't code as well as you at all. And there are many part in your code that I haven't understood yet. So I still want your help
Would you write comment in your code?

I'm ashamed if you have read my codes.
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
Haha, I would have to write quite a bit. I really should have release a technology document on the formats and how to work with them, but I never had the time.

Most of the data formats are pretty straightforward, and I tried keeping field names sensible. Most of what I was doing was discovery and experimentation, so I avoided comments in case I was wrong. But then, never went back to document things.

If you want to know how something works just ask. I could probably offer a better explanation in the end.
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
So, I can ask you question if I want?
Well, how did you discover meaning of variables in each files?
Did you use USB Gecko? I have that, but I'm trying to understand variables without that.
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
So, I can ask you question if I want?
Well, how did you discover meaning of variables in each files?
Did you use USB Gecko? I have that, but I'm trying to understand variables without that.
Most of it was just analyzing the formats in a hex editor.

  • First, find lengths and offsets. Then you can determine the size/parts of each data block.
  • Write out the data blocks in your code and understand how they link.
  • Determine the data type and length of each field. This part is usually easy, just keep an eye out for patterns and take note of similarities/differences between each record.
  • Use logic to determine field meanings. If the function of your data is understood this should be fairly easy.
  • Anything left can be manually hexed for SD/Gecko. With BBox you can even begin editing these fields without hexing (just build the wrapper).

You can get at least 50% of your data formats complete without hexing a single value. When I was working on this, I was using the SD/Gecko method to test field changes. I believe Dolphin Emu works with Brawl, which may be faster/easier.

When reverse engineering, there are three rules:
1. Patterns
2. Patterns
3. Cake! Wait... Patterns!
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
I'll quote your advice to OP.

I'm analyzing AIPD file. I found offsets for each entries. Each entries had variables.
I could understand one of them which means argument count. But I can't understand other variables.
Do I have to experiment randomly?
 

Stoney

Smash Apprentice
Joined
Nov 24, 2009
Messages
156
Location
[loh-kay-shuhn] n. The act or process of locating
Haha, I would have to write quite a bit. I really should have release a technology document on the formats and how to work with them, but I never had the time.

Most of the data formats are pretty straightforward, and I tried keeping field names sensible. Most of what I was doing was discovery and experimentation, so I avoided comments in case I was wrong. But then, never went back to document things.

If you want to know how something works just ask. I could probably offer a better explanation in the end.
First of all, good to see you again. You probably don't remember me since I posted in the BrawlBox thread all of two or three times, but I followed it pretty closely and greatly enjoy your programs.

Second of all, is your offer of wisdom open to anyone, or just Bero? Because from what I gathered in the BrawlBox thread, the one format everyone seemed most interested in was MDL0, and how to continue the work you began with the version .64 beta. RandomTBush did some experimentation with the beta and it seemed to import models fine from Maya 2011, only problem being that the shader commands don't get set up, which prevents the BrawlBox beta from saving or exporting the files.

Basically I'd like to know what you know regarding MDL0 shaders, and how to fix their implementation. If this is asking too much, please don't hesitate to give me an internet smack upside the head. I'm simply an anxious fan who saw this:

Seeing that the newest BrawlBox has the potential to import new models (but can't because it won't save or even export MDL0s properly) makes me :(.


Well, thanks for all your hard work, anyway, Kryal. I eagerly wait for your return. In the mean time, I'm gonna fiddle around with this beta BrawlBox.
...And has been yearning for that last step to be completed ever since.
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
First of all, good to see you again. You probably don't remember me since I posted in the BrawlBox thread all of two or three times, but I followed it pretty closely and greatly enjoy your programs.

Second of all, is your offer of wisdom open to anyone, or just Bero? Because from what I gathered in the BrawlBox thread, the one format everyone seemed most interested in was MDL0, and how to continue the work you began with the version .64 beta. RandomTBush did some experimentation with the beta and it seemed to import models fine from Maya 2011, only problem being that the shader commands don't get set up, which prevents the BrawlBox beta from saving or exporting the files.

Basically I'd like to know what you know regarding MDL0 shaders, and how to fix their implementation. If this is asking too much, please don't hesitate to give me an internet smack upside the head. I'm simply an anxious fan who saw this:

...And has been yearning for that last step to be completed ever since.
Just because I got models into the program doesn't mean I could save them. Look here: http://code.google.com/p/brawltools/source/browse/#svn/trunk/BrawlLib/SSBB/ResourceNodes/MDL0

Bero, this one's on me. Took 1.5 hours to complete so it's not too fancy. There are no logical definitions, just a basic layout. The size of the lists will change, which is most likely dependent on one of the three Def blocks. Many fields are flags.

This is just an example of what I meant in my previous post, about the reverse engineering process. Right now I have lengths, offsets and data types (most of them), but nothing else. I only used a hex editor (010 Editor, free trial) to build the template. Open an AIPD file in 010 Editor, and use this template. It will give you a graphical representation as well as values.

Code:
//--------------------------------------
//--- 010 Editor v3.0.6 Binary Template
//--------------------------------------

typedef struct AIPDHeader
{
    char Tag[4];
    uint DataOffset; //Version? Always 0xC
    uint Unknown1; //0
    uint Unknown2; //0
};

typedef struct DefBlock
{
    float _float1;
    float _float2;
    ushort _short1 <format=hex>;
    ushort _short2 <format=hex>;
    ushort _short3 <format=hex>;
    ushort _short4 <format=hex>;
    float _float3;
    float _float4;
    ushort _short5 <format=hex>;
    ushort _short6 <format=hex>;
    ushort _short7 <format=hex>;
    ushort _short8 <format=hex>;
    float _float5;
    ushort _short9 <format=hex>;
    ushort _short10 <format=hex>;
    float _float6;
    ushort _short11 <format=hex>;
    ushort _short12 <format=hex>;
    float _float7;
    float _float8;
    float _float9;
    float _float10;
    uint _int1 <format=hex>;
    uint _int2 <format=hex>;
    uint _int3 <format=hex>;
    uint _int4 <format=hex>;
    uint _int5 <format=hex>;
    uint _int6 <format=hex>;
    uint _int7 <format=hex>;
    char _char1 <format=hex>;
    char _char2 <format=hex>;
    char _char3 <format=hex>;
    char _char4 <format=hex>;
};

typedef struct SubBlock
{
    ushort _short1 <format=hex>;
    ushort _short2 <format=hex>;
    ushort _short3 <format=hex>;
    ushort _short4 <format=hex>;
    float _float1;
    float _float2;
    ushort _short5 <format=hex>;
    ushort _short6 <format=hex>;
    ushort _short7 <format=hex>;
    ushort _short8 <format=hex>;
    ushort _short9 <format=hex>;
    ushort _short10 <format=hex>;
    char _char1 <format=hex>;
    char _char2 <format=hex>;
    char _char3 <format=hex>;
    char _char4 <format=hex>;
    ushort _short11 <format=hex>;
    ushort _short12 <format=hex>;
    uint _int1 <format=hex>;
    uint _int2 <format=hex>;
    uint _int3 <format=hex>;
};

typedef struct UnkBlock
{
    char Padding[64];
};

typedef struct Type1Entry
{
    byte command <format=hex>;
    if(command != 0)
    {
        byte control1 <format=hex>;
        byte control2 <format=hex>;
    }
};

typedef struct Type1
{
    Type1Entry Entry;
    while(Entry.command != 0)
        Type1Entry Entry;
};

typedef struct Type2Entry
{
    char char1 <format=hex>;
    char char2 <format=hex>;
    char char3 <format=hex>;
    char char4 <format=hex>;
    char char5 <format=hex>;
    char char6 <format=hex>;
};

typedef struct Type2
{
    ushort _id;
    byte _flag;
    byte _numEntries;

    local int i;
    for(i = 0 ; i < _numEntries ; i++)
        Type2Entry Entry;
};

typedef struct Type1List
{
    uint Offsets1[28];

    local long offset = FTell();
    local int i;
    for(i = 0 ; i < 28 ; i++)
    {
        if(Offsets1[i] == 0)
            byte NULL;
        else
        {
            FSeek(Offsets1[i]);
            Type1 Entry;
        }
    }
    FSeek(offset);
};

typedef struct Type2List
{
    uint Offsets1[33];

    local long offset = FTell();
    local int i;
    for(i = 0 ; i < 33 ; i++)
    {
        if(Offsets1[i] == 0)
            byte NULL;
        else
        {
            FSeek(Offsets1[i]);
            Type2 Entry;
        }
    }
    FSeek(offset);
};

AIPDHeader Header;
DefBlock Def1;
DefBlock Def2;
SubBlock Sub1;
SubBlock Sub2;
UnkBlock Unk;

//Offsets are relative to beginning of file
Type1List List1;
Type2List List2;
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
Smacked it is, then. I guess I deserved that. Oh well, thanks for replying, I appreciate it all the same.

Your code is fascinating to read, BTW.
Sorry. I just get a lot of questions like that. Quite frankly, everything you need to know is available to you. There's a certain level of understanding that is necessary in order to manipulate this data.

My explanation on how these things work exists in the code. If you can't understand the code, you need to learn how. For example, to understand shaders and materials you need to know how the GPU processes display lists and registers. There ARE structures in my code that define this as well as how they are organized, just look and you'll find it. You can also get this information from the SDK and Dolphin Emu SVN.

I'm not trying to be mean here, but if it was something I could easily explain then I would have been able to implement these things rather easily.

All I can really say is that shaders are a collection of display lists. For the most part they are fixed so editing shouldn't be that hard. If you look up the MDL0Shader structure in my code you will see how the header is organized somewhat. The flags determine which display lists are included in the data. Each display list is a fixed block of data that performs operations on certain GPU registers. The way the model files are put together, these blocks are all the same except in how they are ordered and which ones are included. Keep in mind that there are 8 texture layers, which adds to the complexity. Determining how the flags function and how the lists are included/ordered is pretty much where I left off.

Textures, materials and shaders go hand-in-hand. Change one, and you need to change them all. This is because they are pre-compiled.
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
Thank you for completing AIPD!
I can't analyze as fast as you.

Anyway, thank you for coming this thread.
I will be grad if you come here in your freetime.:)
 

pikazz

Smash Lord
Joined
Dec 6, 2009
Messages
1,868
Location
Sweden, Umeå (Currently in Seattle)
NNID
pikamaxi
wow, welcome back Kryal :D
long time no see. (feels like I miss all stuff then I am asleep D: )

if you have problem with model import to brawlbox, you maybe would ask chadderz, creator of SZS modifier.
he has done obj importing program to mario kart wii and since MKWii and SSBB has almost the same mld0, you maybe get help from him :3

see my "how to import obj into brawl" thread for more information
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
I've pretty much given up on MDL0, just too stressful. OBJ files do not work with skins, which is why I never bothered.

Since people are trying to get model manipulation working here are some suggestions:
  • If you want to support blender, use the .blend file format. All of the plugins are too old and broken for anything else to work properly.
  • For everything else, use Collada AND FBX. Both have text formats.
  • If you want OBJ support, use it for static meshes only.
 

pikazz

Smash Lord
Joined
Dec 6, 2009
Messages
1,868
Location
Sweden, Umeå (Currently in Seattle)
NNID
pikamaxi
I've pretty much given up on MDL0, just too stressful. OBJ files do not work with skins, which is why I never bothered.

Since people are trying to get model manipulation working here are some suggestions:
  • If you want to support blender, use the .blend file format. All of the plugins are too old and broken for anything else to work properly.
  • For everything else, use Collada AND FBX. Both have text formats.
  • If you want OBJ support, use it for static meshes only.
oh, too bad you nearly gave up on MLD0 but I am glad you took your time to visit us :3

nice tips about the model format :3
 

pokelover980

Smash Ace
Joined
Oct 4, 2007
Messages
905
Well, now I'm bored, so I'm going to try and document the MDL0 format, and then see if I can take a file exported by AiS/BrawlBox 0.64 and manually convert it back into MDL0, since from what I've seen from the MDL0 format is that it isn't too complicated. I'll just do something simple to convert back, like a Pokeball or something with not too many polygons/vertices.
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
I have been worked on AI, but how many people that are interested in AI are there?
I will finish AIPD and make editor for AI files.
But most people here seem to be interested in model importing.
 

Eternal Yoshi

I've covered ban wars, you know
Joined
Mar 3, 2007
Messages
5,450
Location
Playing different games
NNID
EternalYoshi
3DS FC
3394-4459-7089
I'm interested in examining the REFF and RE3D files so that we can add articles in a legit way which would help those making characters.

Edit: O_O Metaknight's sword slashes and tornado counts as external graphic effects.
i can tell by the fact that the EFLS files have null ID's that match the shword slashes and Tornado.
 

Fl@me

Smash Cadet
Joined
Jan 24, 2010
Messages
48
AI meaning like computer level? if so then how do u make them really hard
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
@Eternal Yoshi
If you tell me more detail, I will add support for that.

@Fl@me
By BrawlBox.
 

Eternal Yoshi

I've covered ban wars, you know
Joined
Mar 3, 2007
Messages
5,450
Location
Playing different games
NNID
EternalYoshi
3DS FC
3394-4459-7089
This thread has a bit more info on EFLS.
http://www.smashboards.com/showthread.php?p=9729718

It seems that efls is a look up table for the reff file.

MiscData[1] is the reff file.
offset 0x08 - 0x0c is the file size.
offset 0x14 - 0x17 always points to the hex value that is 18 hex units before the end of the file.
offset 0x25 always contains the # of letters in a character's name plus one.
offset 0x28 is where the character's name begins.

MiscData[2] is the REFT files.
0x08-0x0c is the file size.
0x14 - 0x17 always points to the hex value that is 18 hex units before the end of the file.
offset 0x25 always contains the # of letters in a character's name plus one.
offset 0x28 is where the character's name begins.
offset 0x68 is the start of the filenames.
There seem to be multiple bytes in between the names, many of which are null.

0ffset 0x6a is the start of the name of the archived files.


Both of these seem to be a type of archive for multiple files.
 

pokelover980

Smash Ace
Joined
Oct 4, 2007
Messages
905
Well, I have a small, inaccurate, basic understanding of MDL0. I have some notes, but some of it isn't accurate. It's all based off of studying and comparing the MDL0 files of Lucario, Link, Ganon, Captain Falcon, Samus, Zero Suit Samus and Mario. I went to study item MDL0 files and they're slightly different from character MDL0, so not all of this applies with items. Anyways, here are the notes:
Code:
--HEADER NOTES--

first 4 bytes always 4D 44 4C 30 or MDL0 in ASCII
offset 4 always 00
bytes 08 through 0F always 00 00 00 09 FF FF FF 80
bytes 10 thourgh 12 always 00 00 05
byte 13 always 90
bytes 14 through 16 always 00 00 05
bytes 18 through 1A always 00 00 0A
bytes 1C through 1D always 00 00
bytes 20 through 21 always 00 00
bytes 24 through 25 always 00 00
bytes 28 through 29 always 00 00
bytes 2C through 2D always 00 00
bytes 30 through 31 always 00 00
bytes 34 through 35 always 00 00
bytes 38 through 3C always 00 00 00 00 00
bytes 40 through 4F always 00 00 00 40 FF FF FF C0 00 00 00 00 00 00 00 00
bytes 50 through 53 is number of vertices in hex
bytes 54 through 57 is number of faces in hex
bytes 58 through 5B always 00 00 00 00
bytes 5C through 5F is number of nodes in hex
bytse 60 through 67 always 01 01 00 00 00 00 00 40
bytes 82 through 83 is number of nodes in hex
bytes 84 through 86 always 00 00 00
bytes 88 through 8A always 00 00 00
bytes 8C through 8C always 00 00 00
bytes 90 through 92 always 00 00 00
bytes 94 through 96 always 00 00 00

--BONE NOTES--
bones are D0 bytes big
first 6 bytes always 00 00 00 D0 FF FF
44 bytes after start of bone is BoneMin
50 bytes after start of bone is BoneMax
20 bytes after start of bone is Scale
2C bytes after start of bone is Rotation
38 bytes after start of bone is Translation
10 bytes after start of bone is NodeID
14 bytes after start of bone is Flags

--VERTICES NOTES--
first 4 bytes are TotalLen, or how big the vertices file is
8 bytes after start is DataOffset
C bytes after start is StringOffset
1E bytes after start is number of vertices

--NORMALS NOTES--

--COLORS NOTES--

--UV POINTS NOTES--

--MATERIALS1 NOTES--

--MATERIALS2 NOTES--

--POLYGONS NOTES--


--TEXTURES1 NOTES--
When it says always, it really isn't always, it's almost always. There are those few MDL0 files that break away from the norm and don't follow them.
 

RandomTBush

Smash Ace
Joined
Aug 10, 2009
Messages
889
Location
Donut Plains
Here's some of my notes. I didn't fill in anything for Vertex, Normals, etc. yet, but I'll do so later. And I think I might've listed the wrong values for a few things.

Code:
MDL0 HEADER

Offset		Name
0x00		MDL0 Identifier
0x04		MDL0 Size
0x08		Sections
0x0C		Model Nodes Offset
0x10		Definitions List
0x14		Bones List
0x18		Vertices List
0x1C		Normals List
0x20		Colors List
0x24		UV Points List
0x28		Materials 1 List
0x2C		Materials 2 List
0x30		Polygons List
0x34		Textures 1 List
0x38		Textures 2 List
0x3C		Model Name Offset
0x40		Header Length
0x44		Header Offset
0x48		Unknown 1
0x4C		Unknown 2
0x50		# of Vertices
0x54		# of Faces
0x58		Unknown 3
0x5C		# of Nodes
0x60		Version
0x62		Unknown 4
0x64		Unknown 5
0x68		Box Min. X
0x6C		Box Min. Y
0x70		Box Min. Z
0x74		Box Max. X
0x78		Box Max. Y
0x7C		Box Max. Z
0x80		# of Nodes (Copy?)

BONE HEADER

0x00		Header Length
0x04		MDL0 Offset
0x08		String Offset
0x0C		Bone Index
0x10		Node ID
0x14		Flags
0x18		Pad 1 (?)
0x1C		Pad 2 (?)
0x20		Scale X
0x24		Scale Y
0x28		Scale Z
0x2C		Rotation X
0x30		Rotation Y
0x34		Rotation Z
0x38		Translation X
0x3C		Translation Y
0x40		Translation Z
0x44		Box Min. X
0x48		Box Min. Y
0x4C		Box Min. Z
0x50		Box Max. X
0x54		Box Max. Y
0x58		Box Max. Z
0x5C		Parent Offset
0x60		First Child Offset
0x64		Next Offset
0x68		Previous Offset
0x6C		Bone Strings/Properties Offset
0x70		FrameMatrix Set 1 Float 1
0x74		FrameMatrix Set 2 Float 1
0x78		FrameMatrix Set 3 Float 1
0x7C		FrameMatrix Set 4 Float 1
0x80		FrameMatrix Set 1 Float 2
0x84		FrameMatrix Set 2 Float 2
0x88		FrameMatrix Set 3 Float 2
0x8C		FrameMatrix Set 4 Float 2
0x90		FrameMatrix Set 1 Float 3
0x94		FrameMatrix Set 2 Float 3
0x98		FrameMatrix Set 3 Float 3
0x9C		FrameMatrix Set 4 Float 3
0xA0		InverseBindMatrix Set 1 Float 1
0xA4		InverseBindMatrix Set 2 Float 1
0xA8		InverseBindMatrix Set 3 Float 1
0xAC		InverseBindMatrix Set 4 Float 1
0xB0		InverseBindMatrix Set 1 Float 2
0xB4		InverseBindMatrix Set 2 Float 2
0xB8		InverseBindMatrix Set 3 Float 2
0xBC		InverseBindMatrix Set 4 Float 2
0xC0		InverseBindMatrix Set 1 Float 3
0xC4		InverseBindMatrix Set 2 Float 3
0xC8		InverseBindMatrix Set 3 Float 3
0xCC		InverseBindMatrix Set 4 Float 3

POLYGONS HEADER

0x00		Total Length
0x04		MDL0 Offset
0x08		Node ID
0x0C		Flags 1
0x10		Flags 2
0x14		Unknown 1
0x18		Def. Size
0x1C		Def. Flags
0x20		Def. Offset
0x24		Data Length
0x28		Data Length (Copy?)
0x2C		Data Offset
0x30		Unknown 2
0x34		Unknown 3
0x38		String Offset
0x40		(Undocumented for now)

POLYGON TYPES

0x20		Bone Def 1
0x28		Bone Def 2
0x30		Bone Def 3
0x80 		Quads
0x90		Triangles
0x98		Triangle Strip
0xA0		Triangle Fan
0xA8		Lines
0xB0 		Line Strip
0xB8		Points

TEXTURES 1 HEADER

0x00	# of entries
0x04	Materials 1 Offset
0x08	Materials 2 Offset

TEXTURES 2 HEADER

0x00	# of entries
0x04	Materials 1 Offset
0x08	Materials 2 Offset
And I don't have the values used for the lists yet, because I'm not even sure what half of the values are for. (I know one set's for the offset, and one's for the string, but I'm not sure about the other two.)
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
Good job, both of you.

I think it isn't too hard to write code, but it is a little too busy for me if I have to do it alone.
...Anybody?
 

pokelover980

Smash Ace
Joined
Oct 4, 2007
Messages
905
Here's some of my notes. I didn't fill in anything for Vertex, Normals, etc. yet, but I'll do so later. And I think I might've listed the wrong values for a few things.

Code:
MDL0 HEADER

Offset		Name
0x00		MDL0 Identifier
0x04		MDL0 Size
0x08		Sections
0x0C		Model Nodes Offset
0x10		Definitions List
0x14		Bones List
0x18		Vertices List
0x1C		Normals List
0x20		Colors List
0x24		UV Points List
0x28		Materials 1 List
0x2C		Materials 2 List
0x30		Polygons List
0x34		Textures 1 List
0x38		Textures 2 List
0x3C		Model Name Offset
0x40		Header Length
0x44		Header Offset
0x48		Unknown 1
0x4C		Unknown 2
0x50		# of Vertices
0x54		# of Faces
0x58		Unknown 3
0x5C		# of Nodes
0x60		Version
0x62		Unknown 4
0x64		Unknown 5
0x68		Box Min. X
0x6C		Box Min. Y
0x70		Box Min. Z
0x74		Box Max. X
0x78		Box Max. Y
0x7C		Box Max. Z
0x80		# of Nodes (Copy?)

BONE HEADER

0x00		Header Length
0x04		MDL0 Offset
0x08		String Offset
0x0C		Bone Index
0x10		Node ID
0x14		Flags
0x18		Pad 1 (?)
0x1C		Pad 2 (?)
0x20		Scale X
0x24		Scale Y
0x28		Scale Z
0x2C		Rotation X
0x30		Rotation Y
0x34		Rotation Z
0x38		Translation X
0x3C		Translation Y
0x40		Translation Z
0x44		Box Min. X
0x48		Box Min. Y
0x4C		Box Min. Z
0x50		Box Max. X
0x54		Box Max. Y
0x58		Box Max. Z
0x5C		Parent Offset
0x60		First Child Offset
0x64		Next Offset
0x68		Previous Offset
0x6C		Bone Strings/Properties Offset
0x70		FrameMatrix Set 1 Float 1
0x74		FrameMatrix Set 2 Float 1
0x78		FrameMatrix Set 3 Float 1
0x7C		FrameMatrix Set 4 Float 1
0x80		FrameMatrix Set 1 Float 2
0x84		FrameMatrix Set 2 Float 2
0x88		FrameMatrix Set 3 Float 2
0x8C		FrameMatrix Set 4 Float 2
0x90		FrameMatrix Set 1 Float 3
0x94		FrameMatrix Set 2 Float 3
0x98		FrameMatrix Set 3 Float 3
0x9C		FrameMatrix Set 4 Float 3
0xA0		InverseBindMatrix Set 1 Float 1
0xA4		InverseBindMatrix Set 2 Float 1
0xA8		InverseBindMatrix Set 3 Float 1
0xAC		InverseBindMatrix Set 4 Float 1
0xB0		InverseBindMatrix Set 1 Float 2
0xB4		InverseBindMatrix Set 2 Float 2
0xB8		InverseBindMatrix Set 3 Float 2
0xBC		InverseBindMatrix Set 4 Float 2
0xC0		InverseBindMatrix Set 1 Float 3
0xC4		InverseBindMatrix Set 2 Float 3
0xC8		InverseBindMatrix Set 3 Float 3
0xCC		InverseBindMatrix Set 4 Float 3

POLYGONS HEADER

0x00		Total Length
0x04		MDL0 Offset
0x08		Node ID
0x0C		Flags 1
0x10		Flags 2
0x14		Unknown 1
0x18		Def. Size
0x1C		Def. Flags
0x20		Def. Offset
0x24		Data Length
0x28		Data Length (Copy?)
0x2C		Data Offset
0x30		Unknown 2
0x34		Unknown 3
0x38		String Offset
0x40		(Undocumented for now)

POLYGON TYPES

0x20		Bone Def 1
0x28		Bone Def 2
0x30		Bone Def 3
0x80 		Quads
0x90		Triangles
0x98		Triangle Strip
0xA0		Triangle Fan
0xA8		Lines
0xB0 		Line Strip
0xB8		Points

TEXTURES 1 HEADER

0x00	# of entries
0x04	Materials 1 Offset
0x08	Materials 2 Offset

TEXTURES 2 HEADER

0x00	# of entries
0x04	Materials 1 Offset
0x08	Materials 2 Offset
And I don't have the values used for the lists yet, because I'm not even sure what half of the values are for. (I know one set's for the offset, and one's for the string, but I'm not sure about the other two.)
I've started to document after 0x40 on polygon's, for another 8 or so bytes it's more header IIRC, and then it's polygons positions in hexadecimal, which you can convert to float. The same goes for vertices after their header. I actually learned that when trying to find how AiS converted to .dae from MDL0, and found that when you convert the float numbers in it to hexadecimal you'll find the polygons and vertex groups in the MDL0 if you search for that number in the MDL0 file. I'm also starting to test adding more vertices to a model, using the traditional vertex hacking method (not DDVB) and then editing some values throughout the file. It might not seem helpful now, but it could eventually XD

And don't worry Bero, I'm still trying to learn. It's not that hard, now that I look at it. Just a few added things from C++ (and more object oriented), and it seems very close to Java.
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
If you want a spec written up just say so. These formats are cryptic, but I know them like the back of my hand. :urg:
 

RandomTBush

Smash Ace
Joined
Aug 10, 2009
Messages
889
Location
Donut Plains
Top Bottom