M2 MD21 and triangles menu

User Tag List

Results 1 to 3 of 3
  1. #1
    VesperCore's Avatar Contributor
    Reputation
    127
    Join Date
    Feb 2012
    Posts
    392
    Thanks G/R
    2/17
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    M2 MD21 and triangles

    Hello there,

    in my meshBuilder, I've having an issue currenctly.

    There is those new .M2 files that can contains 8 bytes before the real stuff begin;

    basically:

    MAGIC = MD21
    UNK_INT = XXXXX
    MAGIC = MD20
    .... normal for the rest


    so I just decided to jump 8 bytes in case magic == MD21.

    But, now another story, when magic == MD21, the first triangle at OffsetBoundingTriangles will have wrong values:
    I read if first ushort == ushort.MaxValue (65536)

    then I dump the 4 first bytes:

    Triangle error, 4 bytes extracted: FF FF FF FF from OffsetBoundingTriangles
    Triangle error, 4 bytes extracted: FF FF 2 0 from OffsetBoundingTriangles
    Triangle error, 4 bytes extracted: FF FF FF FF from OffsetBoundingTriangles
    Triangle error, 4 bytes extracted: FF FF 3 0 from OffsetBoundingTriangles
    Triangle error, 4 bytes extracted: FF FF 0 0 from OffsetBoundingTriangles

    Any idea why we would have FF FF instead of the first value, or even FF FF FF FF ?

    It's especially happend on map Troll Raid @ 22_32 for me

    It will cause a OutOfBoundException because there is no vertex at index 65536 and will crash into recast because of unreadable pointer.

    How do you know where the first leggit triangle ushort begin ?


    Here an example of FF FF FF FF + MD21
    World\\Expansion06\\Doodads\\Artifact\\7AF_Artifacthub_AltarMage.m2 ::: TinyUpload.com - best file hosting solution, with no limits, totaly free
    offsettriangle = 194544

    Here an example of FF FF 2 0 + MD21
    World\\Expansion06\\Doodads\\Legion\\7LG_Legion_Spire01.m2

    Here an example of FF FF 3 0 + MD21
    World\\Expansion06\\Doodads\\Legion\\7LG_Legion_Portal02.m2 ::: TinyUpload.com - best file hosting solution, with no limits, totaly free
    offsettriangle = 130608

    Here an example of FF FF 0 0 + MD21
    World\\Expansion06\\Doodads\\Suramar\\7SR_CityWillowTree_B01.m2

    I've uploaded 2 of them if you wanna get an eye over the file with your hex editor or w/e

    Here hexeditor screenshot: https://i.imgur.com/0P1B57u.png

    Should I jump 8 bytes further here too ? If yes, then what is the triangle count ?

    It would make
    00 01 => short
    00 02 => short
    00 01 => short


    and

    00 01 => short
    00 02 => short
    00 02 => short


    Edit:

    When I read header, I do the 8bytes jump, however, when I was reading the other, I did not do the 8 bytes, so the lenght of triangles, read from header is fine, but I must add 8 bytes from the offset too ?

    Can you confirm me this ?
    Last edited by VesperCore; 09-03-2016 at 12:30 PM.

    M2 MD21 and triangles
  2. #2
    VesperCore's Avatar Contributor
    Reputation
    127
    Join Date
    Feb 2012
    Posts
    392
    Thanks G/R
    2/17
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, nevermind, I was thinking for some reasons that the offset would be from the beginning of the .m2 file, when indeed, it's from the beginning of the inner m2 file that start at magic = MD20, so I indeed need to add 8 bytes when reading triangles, bounding, and stuff.

  3. #3
    ioctl's Avatar Active Member
    Reputation
    23
    Join Date
    Jan 2013
    Posts
    35
    Thanks G/R
    2/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by VesperCore View Post
    Hello there,

    in my meshBuilder, I've having an issue currenctly.

    There is those new .M2 files that can contains 8 bytes before the real stuff begin;

    basically:

    MAGIC = MD21
    UNK_INT = XXXXX
    MAGIC = MD20
    .... normal for the rest

    The new model files are chunked with explicit chunk sizes -- similar to ADT's. Your unknown field is the size of the first chunk (the MD21), chunk name and size field not included. The payload of the MD21 chunk is just a plain old MD20 file. So far, all of the m2's I've looked at contain a MD21 wrapper around an MD20 file, followed by a four byte (again, not counting header) SFID chunk.

    It feels like they wanted to add metadata to the MD20 format, so they just wrapped it in their explicit chunking format and tacked it on at the end.

Similar Threads

  1. Above and beyond Orgrimmar
    By Matt in forum World of Warcraft Exploits
    Replies: 3
    Last Post: 12-30-2006, 08:37 PM
  2. Recipes.. and their locations
    By Matt in forum World of Warcraft Guides
    Replies: 4
    Last Post: 12-03-2006, 08:21 AM
  3. Farming Bijous and Coins in ZG
    By Matt in forum World of Warcraft Guides
    Replies: 1
    Last Post: 11-02-2006, 06:48 PM
  4. 8 World of Warcraft Guide Packs (Gold, Profs and Skills)
    By Matt in forum World of Warcraft Guides
    Replies: 17
    Last Post: 09-23-2006, 10:53 AM
  5. WoWGlider and GALB Botting Locations
    By Matt in forum World of Warcraft Bots and Programs
    Replies: 14
    Last Post: 04-11-2006, 08:01 PM
All times are GMT -5. The time now is 07:24 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search