Cracking W3D
#1
Posted 08 May 2007 - 08:25 PM
So far I have found out this:
- the first 4 bytes contain the filetype. for a mesh, this is 0
- then comes the size of the mesh data, again 4 bytes
- after that come the chunks which make up the mesh
Repeat:
-- 4 bytes: chunk type (e.g. 31 = header, 2 = vertices, 3 = vertex normals)
-- 4 bytes: chunk size
-- <chunk size> bytes: the data in this chunk
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."
#2
Posted 08 May 2007 - 11:31 PM
I really don't do requests and my Arnor Soldier is not fit for BFME. Don't ask me for either.
#3
Posted 08 May 2007 - 11:54 PM
// C}{riZ
"Do not come between the Nazgûl and his mod!"
----------------------------------------------------------------------------------------------------
>>>>>>>>>>>>>>>>>>>>>>> I S.E.E. YOU! <<<<<<<<<<<<<<<<<<<<<<<
----------------------------------------------------------------------------------------------------
#4
Posted 09 May 2007 - 08:30 PM
WE NEED YOU!!
Show EA (AND ESPECIALLY ADAM MCCARTHY, one of the EA animators, WHO PISSED ME OFF ABOUT THE BFME2 W3Ds) that you can break their ******* protocols!!!
Edited by GSV, 09 May 2007 - 08:33 PM.
#5
Posted 09 May 2007 - 09:42 PM
We (T3A and us modders) are here to make the bfme games better and make our own mods for them, not to show up EA.
/offtopic
Back on topic, I agree with Nazgul, this is a great idea. Good luck with it
-GothmogtheOrc
Click on my Sig to go to my BFME Modding site where you can download my mods.
Kings of the West Mod Leader
*Retired. PM me if you need to get a hold of me as I'll get an email notification and should reply within a day or so*
#6
Posted 10 May 2007 - 01:08 AM
Attached are my notes...
2play, do you mind telling us how you managed to tell what that is by looking at the raw code, or do you use something I don't?
I will look more into it giving both my patterns, and your stated things consideration...
EDIT: Just so you know, when I first joined, I had not dreamed that I would be examining the raw code of some of the files within a few months...
Attached Files
Edited by JEV3, 10 May 2007 - 01:09 AM.
"There is some good in this world, and its worth fighting for!"
J.M.J.
#7
Posted 10 May 2007 - 03:20 AM
GitHub - https://github.com/ClickerMonkey
YouTube - http://www.youtube.c...r/ClickerMonkey
#8
Posted 10 May 2007 - 01:39 PM
Aragorn's BFME2 style 'atnd' animation
EDIT: Are you sure '31' designates a header? and when you say four bytes I am assuming you mean one hexadecimal "slot" (that's what I call them)
Edited by JEV3, 10 May 2007 - 01:44 PM.
"There is some good in this world, and its worth fighting for!"
J.M.J.
#9
Posted 10 May 2007 - 09:41 PM
also, i didn't figure it out by reading raw code (seriously, nobody can do that), i read the source of coolfile's w3d importer
sorry, but that kind of stuff is just too obvious/random, won't ever workIn my look at it, it appears that the first 64 bytes seem to have patterns across all animations, BFME1 and BFME2... Also similar anims in BFME2 share patterns in the next 64 bytes... also changing the first sixty-four bytes of the BFME2 header to be like the BFME header does not make it work, and likewise it doesn't make the BFME1 anims not work...
here's the start of a reader I made (Java)
import java.io.*;public class W3DReader { public static void main(String[] args) throws Exception { FileInputStream stream = new FileInputStream(args[0]); byte[] buf4 = new byte[4]; // read filetype long fileType = readLong(stream); if(fileType != 0) { out("File is not a mesh (type is " + fileType + ")"); System.exit(1); } // read filesize long fileDataSize = readLong(stream) & 0x7FFFFFFF; out("Mesh chunk size: " + fileDataSize); while(true) { long chunkType = readLong(stream); out("Mesh subchunk type: " + chunkType + "(" + meshChunkType(chunkType) + ")"); if(chunkType == 0) System.exit(0); long chunkDataSize = readLong(stream) & 0x7FFFFFFF; out("Mesh subchunk size: " + chunkDataSize); byte[] chunkBuf = new byte[(int)chunkDataSize]; stream.read(chunkBuf); out(new String(chunkBuf)); } } /** * Converts a 4 byte array of unsigned bytes to an long * @param b an array of 4 unsigned bytes * @return a long representing the unsigned int */ public static final long unsignedIntToLong(byte[] b) { long l = 0; l |= b[3] & 0xFF; l <<= 8; l |= b[2] & 0xFF; l <<= 8; l |= b[1] & 0xFF; l <<= 8; l |= b[0] & 0xFF; return l; } public static final long readLong(InputStream s) throws Exception { byte[] buf = new byte[4]; s.read(buf); return unsignedIntToLong(buf); } /** * Converts a two byte array to an integer * @param b a byte array of length 2 * @return an int representing the unsigned short */ public static final int unsignedShortToInt(byte[] b) { int i = 0; i |= b[1] & 0xFF; i <<= 8; i |= b[0] & 0xFF; return i; } public static void out(String msg) { System.out.println(msg); } public static void out_(String msg) { System.out.print(msg); } public static void reportRead(InputStream s, byte[] buf) throws Exception { out_(" Read bytes:"); String bytesDec = ""; String bytesHex = ""; for(int i = 0; i < buf.length; i++) { int b = s.read(); bytesDec += " " + b; bytesHex += " " + Integer.toHexString(b).toUpperCase(); buf[i] = (byte) b; } out(bytesDec + " - " + bytesHex); } public static String meshChunkType(long type) { if(type == 31) return "W3D_CHUNK_MESH_HEADER3"; if(type == 2) return "W3D_CHUNK_VERTICES"; if(type == 3) return "W3D_CHUNK_VERTEX_NORMALS"; else return "?"; } public static String bytesToString(byte[] in) { StringBuffer result = new StringBuffer(); for(int i = 0; i < in.length; i++) { result.append(" " + Integer.toHexString(in[i])); } return result.toString(); }}
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."
#10
Posted 10 May 2007 - 09:47 PM
GitHub - https://github.com/ClickerMonkey
YouTube - http://www.youtube.c...r/ClickerMonkey
#11
Posted 10 May 2007 - 09:51 PM
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."
#12
Posted 10 May 2007 - 10:46 PM
GitHub - https://github.com/ClickerMonkey
YouTube - http://www.youtube.c...r/ClickerMonkey
#14 Guest_booto_*
Posted 01 June 2007 - 09:04 AM
#15 Guest_Guest_*
Posted 01 June 2007 - 09:05 AM
#16
Posted 07 December 2011 - 08:58 PM
Dome Basic Informations:
Splittet in Chunks:
-Hierarchy
-Mesh
-Animation
-Compressed Animation
-AABox
#17
Posted 08 December 2011 - 12:07 AM
#18
Posted 08 December 2011 - 04:49 PM
#19
Posted 09 December 2011 - 10:06 AM
#20
Posted 09 December 2011 - 01:46 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users