This is a boring, but how necessary, part of game modding. Here is the story. Some tools were developed on Windows machines for game modding. Most of my machines are Linux. And I do not like to execute .exe files from the internet randomly. So I do my best to find the sources of the files and compile them.
I am not an expert in compiling C stuff, the details that matters when compiling 32 or 64 bits programs, or fluent with the C language. So, it may seem really simple for someone with a vast experience in that field, but it was quite instructive to me ;)
tgctogcm plays quite an important role for finding hiddent elements in multi game disc, as we may see in future posts. Fortunately, it is available with the source. I did not write it, all the credit goes to Plootid (the source is at the end of the article).
If you want to have a working version of the tool and do not care about my errings with compilers, C and whatnot, just jump to the last section.
I first tried :
It did not work.
So, the trouble comes from the small functions ntohl, htonl… What they are supposed to do is to modify the machine representation of integers.
They are available on Linux and Windows, but the way to import them are different. You can add the following line to import it.
Not, it compiles. And it works. Almost. If you use the executable, it will turn a tgc to a gcm file. But the gcm file will be corrupted. The issue was that the program has to be compiled in 32 bits. Once done, this works. The way to figure this out was to have a look at the .exe file. You can infer the compilation looking at some printable characters, and the following answer was quite useful : SuperUser
In a nutshell.
So you will have a 32 bits executable file, that will reproduce the behavior of the windows file exe :)