In the first article, I had a glance at the various files that can be found on the disc. That was it. Now it is time to look at them more closely. I figured out that the gcm files could be important, as they basically had the names of all possible vehicle of the game.
I never had any previous experience in reverse engineering a file. So I randomly opened it with xxd.
I do not have a clue of how other people figure out patterns. I do not have any method at all, just random guessing and testing. The strings HEDR, MSH2, SINF … seemed to be present on other files as well. Besides, the four bytes following them seemd to represent (big endian) integers, with small values.
More particulary, the NAME, was followed by the value 20 (in hex), with is exactly the length of the string “lightsaber_anakin…”. I just made the hypothesis that the file was cut in sections defined by char:title int32:section_size. Which I could test with the following python code.
The results were quite consistent:
It seemed, however, that in some cases, a section did not pay attention to the length that is stated before jumping to another section. Therefore, I made the hypothesis that there was some kind of xml/json tree-like structure, where a node could have many elements.
After some trial and errors, some nodes are terminal (they cannot be decomposed into sub-nodes), and other can. The following code parses the files and shows the tree in the console output.
And the result seem to be consistent as the sum over a section is equal to the sum of the sizes of the subsections. Example:
Here is the decomposition of bluelightsaber.gcm according to these hypothesis.
The next step ?
Well, time to look for what these attributes stand for ! NRML could mean “normal”, NAME is obviously the name of a section, MAT. can stand for matrices… Looking for these keyword on the web, I discover this git page : schlechtwetterfront. Basically, this file format is used by the ZeroEngine, which has been reversed engineered (already…) for mods to Star Wars Battlefront… And a plugin already exists to read and write these files with SoftImage… xsizetools.
So, not much to do any more… Vehicles can be modified, and reimported.
Remaining work ?
It seems that I did not manage to import the six leg walker instead of another character in the game. But with these progress, many new things can be changed. What happens if a gcm file is replaced with another ? With this can I rescale a model ? Change the texture, add an add for my blog on the vehicles ? More answers to come…