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 ?