I'm trying to edit character M2/skin files. So far I've successfully written a code that converts M2/skin to SMD files so it's readable in blender and other 3d model editing programs. However trying to code SMD back to M2/skin, I've ran into a bit of trouble:
1) It seems adding vertices (without changing any existing ones) to an M2 file and changing the vert count and all necessary offsets causes the game to crash. However if I copy the entire vertex chunk to the end of the file with added vertices, so that I dont have to change any other offsets other than the offset to verts works. Therefore it appears moving other chunks that appear after the verts chunk will cause the game crash. Why is this?
2) Same thing for skin files. Adding indices to verts and triangles will cause the game to crash UNLESS i copy them to the end of the file so I don't have change anything mid file. Adding vertex properties, on the other hand, will crash the game even if I copy it to the end of the file.
Note: I have been using M2/Cata - WoWDev and M2/WotLK - WoWDev as reference for M2 file description and M2/WotLK/.skin - WoWDev for skin files, and I have been editing the most current (Cata) version of M2/skin files.
Also I have only been testing on live servers using the proper up to date wow.exe patch and scan.dll bypass.