Difference between revisions of "Talk:MDL0 (File Format)"

From Custom Mario Kart
Jump to navigation Jump to search
 
(16 intermediate revisions by 5 users not shown)
Line 77: Line 77:
 
It seems that there are 2 different sizes plus a little padding.
 
It seems that there are 2 different sizes plus a little padding.
 
: [[User:Wiimm|Wiimm]] 18:16, 6 May 2011 (CEST)
 
: [[User:Wiimm|Wiimm]] 18:16, 6 May 2011 (CEST)
 +
:: This was a failure of my. It apperars if the layer count is 0 and the layer offset points to the beginning of section 8. Then I detect the name of the base structure.
 +
:: [[User:Wiimm|Wiimm]] 13:43, 11 May 2011 (CEST)<br>
 +
<br>
 +
I hex edited a model so the X and Y texture settings were 02 (mirror) but showed no difference (Layers section, addresses 0x18 and 0x1c. I checked with another model, a mach bike model, and it has 00000002 there on both). I'm too lazy to edit my uv maps in 3dsmax (I'm trying to make a character but the textures are weird). I took a quick look through the page but didn't see anything else that would change this setting. Any help?<br>
 +
[[User:Guilmon|Guilmon35249vr]] 03:16, 16 September 2011 (CEST)
 +
<br><br>Also, has anyone ever tried adding a texture link to a map_model? --[[User:Guilmon|Guilmon35249vr]] 23:39, 25 September 2011 (CEST)
 +
 +
== Adding polygons to pre-existing models? ==
 +
 +
There are people trying to get Paratroopa into Mario Kart Wii. After taking a look through Koopa Troopa's files, I noticed he already has EVERYTHING needed to make Paratroopa work.. except a wing model. He even has bones for the wings already!<br> http://i349.photobucket.com/albums/q364/MikeYoshi/koopatroopawings.png <br>And he has textures for them too. I would assume that.. since the bones are there, they're also animated (Recycled animations happen in MKW already.. Yoshi/Birdo share some animations. This would make me thing that Koopa Troopa and Paratroopa would share animations too).
 +
Has anyone found a way to hex edit in a new polygon?<br>--[[User:Guilmon|Guilmon35249vr]] 01:23, 9 November 2011 (CET)
 +
:So with nothing more then hex editing this is possible?
 +
:I haven't seen any animated character yet.
 +
:[[User:KHacker35000vr|kHacker35000vr]] 07:21, 9 November 2011 (CET)
 +
 +
== Is the MDL0 page correct? ==
 +
 +
At the moment I try to understand MDL0. But I can't follow the the descriptions.
 +
 +
;Example "section 1 - bones": The page says, that the basic structure is 0xd0 (=208) byte long, but if analyzing Nintendo Moonview Highway, it contains 26 MDL0 files and section 1 is always smaller than 0xd0, the size is most 0x28.
 +
I can find such things also for some other sections. Either the page info is wrong or I don't understand the section concept of BRESS sub files.
 +
: Not sure what the problem is here; the page seems to be correct. I suppose calling it section 1 is a little ambiguous; it's the section 1 entry's format. The pointer at the begining is to a [[BRRES Index Group]] which then in turn points to the data described.
 +
:[[User:Chadderz|Chadderz]] 12:07, 8 January 2012 (CET)
 +
 +
The index group points to the different sub files (MDL0, TEX0, PAT0,...). But the MDL0 has also sections as described [[BRRES_Sub_Files_%28File_Format%29#Common_Format|here]]. A hexdump of a typical MDL0:
 +
<pre>
 +
MDL0 file header (equal structure for all BRRES sub files)
 +
    0: 4d 44 4c 30  00 00 31 60  00 00 00 0b  00 00 00 00  :MDL0..1`........:
 +
14 section offsets (is this my misunderstanding?)
 +
    10: 00 00 00 9c  00 00 00 e4  00 00 01 2c  00 00 01 64  :...........,...d:
 +
    20: 00 00 01 8c  00 00 01 c4  00 00 00 00  00 00 00 00  :................:
 +
    30: 00 00 01 fc  00 00 02 34  00 00 02 6c  00 00 02 a4  :.......4...l....:
 +
    40: 00 00 00 00  00 00 00 00
 +
string pointer
 +
    40:                          00 00 31 98
 +
beginning of MDL0 header
 +
    40:                                        00 00 00 40  :..........1....@:
 +
    50: ff ff ff b4  00 00 00 00  00 00 00 00  00 00 02 32  :...............2:
 +
...
 +
</pre>
 +
Interpreting the offset table, section 01 starts a 0xe4 and ends at 0x12c (length 0x48).
 +
<br/>[[User:Wiimm|Wiimm]] 12:23, 8 January 2012 (CET)
 +
:: Yes; if you look carefully that 0x48 data structure is a [[BRRES Index Group]] structure. It then points to the section 1 bones. It's another level of indirection to allow multiple bones, ploygones, etc.
 +
:: [[User:Chadderz|Chadderz]] 07:15, 9 January 2012 (CET)
 +
: Click!! [[User:Wiimm|Wiimm]] 09:06, 9 January 2012 (CET)
 +
Thanx! It works now! And here is an example output of <tt>"wszst memory K_car_b.mdl"</tt>
 +
<pre>
 +
* memory dump of MDL:K_car_b.mdl
 +
 +
type    unused  begin ..    end  size  file name
 +
--------------------------------------------------------------------------------
 +
MDL        -      0 ..    4c    4c  .BRSUB.header.MDL0-v11.n14.bin
 +
?          -      4c ..    8c    40  MDL0.header.bin
 +
?          -      8c ..    9c    10  MDL0.bone-table.bin
 +
?          -      9c ..    e4    48  .MDL0.s00.draw-list.header.n3.bin
 +
?          -      e4 ..    12c    48  .MDL0.s01.bones.header.n3.bin
 +
?          -    12c ..    164    38  .MDL0.s02.verticies.header.n2.bin
 +
?          -    164 ..    18c    28  .MDL0.s03.normals.header.n1.bin
 +
?          -    18c ..    1c4    38  .MDL0.s04.colors.header.n2.bin
 +
?          -    1c4 ..    1fc    38  .MDL0.s05.t-coord.header.n2.bin
 +
?          -    1fc ..    234    38  .MDL0.s08.materials.header.n2.bin
 +
?          -    234 ..    26c    38  .MDL0.s09.mat-nodes.header.n2.bin
 +
?          -    26c ..    2a4    38  .MDL0.s10.objects.header.n2.bin
 +
?          -    2a4 ..    2dc    38  .MDL0.s11.t-links.header.n2.bin
 +
?          -    2dc ..    2e8      c  MDL0.s11_0.t-links.K_car_2.bin
 +
?          -    2e8 ..    2f4      c  MDL0.s11_1.t-links.TW_spot_c_1031.bin
 +
?          -    2f4 ..    304    10  MDL0.s00_0.draw-list.NodeTree.bin
 +
?          -    304 ..    30d      9  MDL0.s00_1.draw-list.DrawOpa.bin
 +
?          -    30d ..    318      b  MDL0.s00_2.draw-list.DrawXlu.bin
 +
?          -    318 ..    3e8    d0  MDL0.s01_0.bones.K_car_b.bin
 +
?          -    3e8 ..    4b8    d0  MDL0.s01_1.bones.polySurface178.bin
 +
?          -    4b8 ..    588    d0  MDL0.s01_2.bones.polySurface179.bin
 +
?          -    588 ..    b60    5d8  MDL0.s08_0.materials.TW_spot.bin
 +
?          -    b60 ..  1140    5e0  MDL0.s08_1.materials.car_b.bin
 +
?          -    1140 ..  1340    200  MDL0.s09_0.mat-nodes.TW_spot.bin
 +
?        200-  1140 ..  1340    200  MDL0.s09_1.mat-nodes.car_b.bin
 +
?          -    1340 ..  1d00    9c0  MDL0.s10_0.objects.polygon0.bin
 +
?          -    1d00 ..  1fa0    2a0  MDL0.s10_1.objects.polygon1.bin
 +
?          -    1fa0 ..  2880    8e0  MDL0.s02_0.verticies.polySurface178__car_b.bin
 +
?          -    2880 ..  2a40    1c0  MDL0.s02_1.verticies.polySurface179__TW_spot.bin
 +
?          -    2a40 ..  2d60    320  MDL0.s03_0.normals.polySurface178__car_b.bin
 +
?          -    2d60 ..  2da0    40  MDL0.s04_0.colors.polySurface178__car_b.bin
 +
?          -    2da0 ..  2de0    40  MDL0.s04_1.colors.polySurface179__TW_spot.bin
 +
?          -    2de0 ..  30a0    2c0  MDL0.s05_0.t-coord.#0.bin
 +
?          -    30a0 ..  3160    c0  MDL0.s05_1.t-coord.#1.bin
 +
?          -    3160 ..  325c    fc  .MDL0.string-pool.bin
 +
</pre>
 +
It was not clear for me, that multiple entries of a section exist. And that is the reason that my string relocation fails sometimes.
 +
<br/>[[User:Wiimm|Wiimm]] 21:27, 9 January 2012 (CET)
 +
: Damn!! I have already implemented this for the string relocation, long time ago ... and forgotten.
 +
: [[User:Wiimm|Wiimm]] 22:56, 9 January 2012 (CET)
 +
:: Yes, I thought you must have, I was a little confused what you were asking at first. We all make mistakes!
 +
:: [[User:Chadderz|Chadderz]] 07:12, 10 January 2012 (CET)
 +
 +
== Section 0 - Draw Lists, Code 0x03 ==
 +
The page says for code 03:
 +
<pre>
 +
  1 byte:  0x03
 +
  2 bytes: weight ID
 +
  1 byte:  N := weight count
 +
  2 bytes: Table ID
 +
N*4 bytes: data
 +
</pre>
 +
After scanning all MDL0 files I'm sure that following is correct:
 +
<pre>
 +
  1 byte:  0x03
 +
  2 bytes: weight ID
 +
  1 byte:  N := weight count
 +
N*6 bytes: data
 +
</pre>
 +
[[User:Wiimm|Wiimm]] 08:41, 1 February 2012 (CET)
 +
 +
== MDL0 Page Updates ==
 +
 +
just figured I'd notify about a bunch of updates made to the page.
 +
These updates correct a few things with the vector info and bone-links, make note about the resource lists, as well as identify the fur vectors and fur-shell-layer vectors.
 +
 +
It's been a few years now and there's definately tonz more knowledge to be noted...
 +
Though what I've done could be restructured and cleaned up a bit more.
 +
 +
Also, my grammar is more based on logic, so my english wording kinda sucks... heh
 +
if anyone can think of a better way to state something than me, please do correct it. :)
 +
 +
[[User:Tcll|Tcll]] ([[User talk:Tcll|talk]]) 15:13, 9 April 2014 (UTC)

Latest revision as of 15:14, 9 April 2014

MDL, section 8

I have found string behind the last layer at offset 8. Overall I found 1885 valid string references, but also 13929 NULL and 18 other values. Because the most string contains a variation of "shadow" I believe that there is at least a conditional string. Here is a summary of all found strings (using 218 different offsets):

   1647  mat_shadow
     68  lambert1
     24  mat_shadow1
     20  shb_mat_shadow
     17  shadow
     10  map01
     10  lambert3
      9  shadow1
      4  map1
      4  map
      4  lambert318
      4  lambert239
      4  lambert233
      4  beginner_course_m
      2  nami_tx_v_x
      2  lambert9
      2  lambert42
      2  lambert404
      2  lambert400
      2  lambert351
      2  lambert326
      2  lambert321
      2  lambert313
      2  lambert282
      2  lambert264
      2  lambert242
      2  lambert238
      2  lambert19
      2  lambert11
      2  hikari1
      2  ex_lambert193
      2  ex_lambert186
      2  col_ROAD
      2  cactusColor_m
      2  c_road_m
      2  TR_sky
      2  ROAD_c
      2  ROAD_ami
      2  Map
      2  MAP_m
      1  wing1
      1  m_ef_bkBoard
      1  glow
      1  body2
I'm not aware of this. Can you give me some examples of which BRRESs have this in.
Chadderz 17:38, 6 May 2011 (CEST)
Race/Common.szs -> banana_s.brres
Race/Kart/ldf_bike_blue-la_mii_f_4.szs -> kart_model.brres
Race/Course/old_donkey_gc_d.szs -> DKrockGC.brres
Race/Course/boardcross_course.szs -> itembox.brres

And these are the sizes of the appended data areas:

   6596 * 0x180
   1884 * 0x184
   1459 * 0x188
   3128 * 0x18c
    759 * 0x190
   3698 * 0x194
   1432 * 0x198
   1569 * 0x19c = 0x180 + 0x1c

      2 * 0x598
     12 * 0x59c
      9 * 0x5a0
   1756 * 0x5a4
      4 * 0x5a8
     12 * 0x5ac
     88 * 0x5b0
      2 * 0x5b4 = 0x598 + 0x1c

It seems that there are 2 different sizes plus a little padding.

Wiimm 18:16, 6 May 2011 (CEST)
This was a failure of my. It apperars if the layer count is 0 and the layer offset points to the beginning of section 8. Then I detect the name of the base structure.
Wiimm 13:43, 11 May 2011 (CEST)


I hex edited a model so the X and Y texture settings were 02 (mirror) but showed no difference (Layers section, addresses 0x18 and 0x1c. I checked with another model, a mach bike model, and it has 00000002 there on both). I'm too lazy to edit my uv maps in 3dsmax (I'm trying to make a character but the textures are weird). I took a quick look through the page but didn't see anything else that would change this setting. Any help?
Guilmon35249vr 03:16, 16 September 2011 (CEST)

Also, has anyone ever tried adding a texture link to a map_model? --Guilmon35249vr 23:39, 25 September 2011 (CEST)

Adding polygons to pre-existing models?

There are people trying to get Paratroopa into Mario Kart Wii. After taking a look through Koopa Troopa's files, I noticed he already has EVERYTHING needed to make Paratroopa work.. except a wing model. He even has bones for the wings already!
http://i349.photobucket.com/albums/q364/MikeYoshi/koopatroopawings.png
And he has textures for them too. I would assume that.. since the bones are there, they're also animated (Recycled animations happen in MKW already.. Yoshi/Birdo share some animations. This would make me thing that Koopa Troopa and Paratroopa would share animations too). Has anyone found a way to hex edit in a new polygon?
--Guilmon35249vr 01:23, 9 November 2011 (CET)

So with nothing more then hex editing this is possible?
I haven't seen any animated character yet.
kHacker35000vr 07:21, 9 November 2011 (CET)

Is the MDL0 page correct?

At the moment I try to understand MDL0. But I can't follow the the descriptions.

Example "section 1 - bones"
The page says, that the basic structure is 0xd0 (=208) byte long, but if analyzing Nintendo Moonview Highway, it contains 26 MDL0 files and section 1 is always smaller than 0xd0, the size is most 0x28.

I can find such things also for some other sections. Either the page info is wrong or I don't understand the section concept of BRESS sub files.

Not sure what the problem is here; the page seems to be correct. I suppose calling it section 1 is a little ambiguous; it's the section 1 entry's format. The pointer at the begining is to a BRRES Index Group which then in turn points to the data described.
Chadderz 12:07, 8 January 2012 (CET)

The index group points to the different sub files (MDL0, TEX0, PAT0,...). But the MDL0 has also sections as described here. A hexdump of a typical MDL0:

MDL0 file header (equal structure for all BRRES sub files)
     0: 4d 44 4c 30  00 00 31 60  00 00 00 0b  00 00 00 00  :MDL0..1`........:
14 section offsets (is this my misunderstanding?)
    10: 00 00 00 9c  00 00 00 e4  00 00 01 2c  00 00 01 64  :...........,...d:
    20: 00 00 01 8c  00 00 01 c4  00 00 00 00  00 00 00 00  :................:
    30: 00 00 01 fc  00 00 02 34  00 00 02 6c  00 00 02 a4  :.......4...l....:
    40: 00 00 00 00  00 00 00 00
string pointer
    40:                           00 00 31 98
beginning of MDL0 header
    40:                                        00 00 00 40  :..........1....@:
    50: ff ff ff b4  00 00 00 00  00 00 00 00  00 00 02 32  :...............2:
...

Interpreting the offset table, section 01 starts a 0xe4 and ends at 0x12c (length 0x48).
Wiimm 12:23, 8 January 2012 (CET)

Yes; if you look carefully that 0x48 data structure is a BRRES Index Group structure. It then points to the section 1 bones. It's another level of indirection to allow multiple bones, ploygones, etc.
Chadderz 07:15, 9 January 2012 (CET)
Click!! Wiimm 09:06, 9 January 2012 (CET)

Thanx! It works now! And here is an example output of "wszst memory K_car_b.mdl"

* memory dump of MDL:K_car_b.mdl

type    unused  begin ..    end   size  file name
--------------------------------------------------------------------------------
MDL         -       0 ..     4c     4c  .BRSUB.header.MDL0-v11.n14.bin
?           -      4c ..     8c     40  MDL0.header.bin
?           -      8c ..     9c     10  MDL0.bone-table.bin
?           -      9c ..     e4     48  .MDL0.s00.draw-list.header.n3.bin
?           -      e4 ..    12c     48  .MDL0.s01.bones.header.n3.bin
?           -     12c ..    164     38  .MDL0.s02.verticies.header.n2.bin
?           -     164 ..    18c     28  .MDL0.s03.normals.header.n1.bin
?           -     18c ..    1c4     38  .MDL0.s04.colors.header.n2.bin
?           -     1c4 ..    1fc     38  .MDL0.s05.t-coord.header.n2.bin
?           -     1fc ..    234     38  .MDL0.s08.materials.header.n2.bin
?           -     234 ..    26c     38  .MDL0.s09.mat-nodes.header.n2.bin
?           -     26c ..    2a4     38  .MDL0.s10.objects.header.n2.bin
?           -     2a4 ..    2dc     38  .MDL0.s11.t-links.header.n2.bin
?           -     2dc ..    2e8      c  MDL0.s11_0.t-links.K_car_2.bin
?           -     2e8 ..    2f4      c  MDL0.s11_1.t-links.TW_spot_c_1031.bin
?           -     2f4 ..    304     10  MDL0.s00_0.draw-list.NodeTree.bin
?           -     304 ..    30d      9  MDL0.s00_1.draw-list.DrawOpa.bin
?           -     30d ..    318      b  MDL0.s00_2.draw-list.DrawXlu.bin
?           -     318 ..    3e8     d0  MDL0.s01_0.bones.K_car_b.bin
?           -     3e8 ..    4b8     d0  MDL0.s01_1.bones.polySurface178.bin
?           -     4b8 ..    588     d0  MDL0.s01_2.bones.polySurface179.bin
?           -     588 ..    b60    5d8  MDL0.s08_0.materials.TW_spot.bin
?           -     b60 ..   1140    5e0  MDL0.s08_1.materials.car_b.bin
?           -    1140 ..   1340    200  MDL0.s09_0.mat-nodes.TW_spot.bin
?         200-   1140 ..   1340    200  MDL0.s09_1.mat-nodes.car_b.bin
?           -    1340 ..   1d00    9c0  MDL0.s10_0.objects.polygon0.bin
?           -    1d00 ..   1fa0    2a0  MDL0.s10_1.objects.polygon1.bin
?           -    1fa0 ..   2880    8e0  MDL0.s02_0.verticies.polySurface178__car_b.bin
?           -    2880 ..   2a40    1c0  MDL0.s02_1.verticies.polySurface179__TW_spot.bin
?           -    2a40 ..   2d60    320  MDL0.s03_0.normals.polySurface178__car_b.bin
?           -    2d60 ..   2da0     40  MDL0.s04_0.colors.polySurface178__car_b.bin
?           -    2da0 ..   2de0     40  MDL0.s04_1.colors.polySurface179__TW_spot.bin
?           -    2de0 ..   30a0    2c0  MDL0.s05_0.t-coord.#0.bin
?           -    30a0 ..   3160     c0  MDL0.s05_1.t-coord.#1.bin
?           -    3160 ..   325c     fc  .MDL0.string-pool.bin

It was not clear for me, that multiple entries of a section exist. And that is the reason that my string relocation fails sometimes.
Wiimm 21:27, 9 January 2012 (CET)

Damn!! I have already implemented this for the string relocation, long time ago ... and forgotten.
Wiimm 22:56, 9 January 2012 (CET)
Yes, I thought you must have, I was a little confused what you were asking at first. We all make mistakes!
Chadderz 07:12, 10 January 2012 (CET)

Section 0 - Draw Lists, Code 0x03

The page says for code 03:

  1 byte:  0x03
  2 bytes: weight ID
  1 byte:  N := weight count 
  2 bytes: Table ID
N*4 bytes: data

After scanning all MDL0 files I'm sure that following is correct:

  1 byte:  0x03
  2 bytes: weight ID
  1 byte:  N := weight count 
N*6 bytes: data

Wiimm 08:41, 1 February 2012 (CET)

MDL0 Page Updates

just figured I'd notify about a bunch of updates made to the page. These updates correct a few things with the vector info and bone-links, make note about the resource lists, as well as identify the fur vectors and fur-shell-layer vectors.

It's been a few years now and there's definately tonz more knowledge to be noted... Though what I've done could be restructured and cleaned up a bit more.

Also, my grammar is more based on logic, so my english wording kinda sucks... heh if anyone can think of a better way to state something than me, please do correct it. :)

Tcll (talk) 15:13, 9 April 2014 (UTC)