Compiling offzip source?

Doubts, help and support about QuickBMS and other game research tools
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Compiling offzip source?

Post by Acewell »

Hi, what is the easiest way for a non programmer to compile the source for offzip?
I have CodeBlocks installed. What specific dependencies are needed?

I want to add one of these to sign_ext.c so i can extract gr2 models from SWTOR tor archives with the correct extension.

Code: Select all

    {  4, "\x47\x41\x57\x42", "gr2" }, // swtor model files

Code: Select all

    {  4, "GAWB", "gr2" }, // swtor model files


Any help is appreciated! :)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Compiling offzip source?

Post by aluigi »

It's very simple, you need just a gcc installation working on Windows like Mingw or, probably better, tdm-gcc.
Then from the command-line:

Code: Select all

gcc -s -O2 -o offzip.exe offzip.c zopfli\*.c -lz

That's all :)
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Compiling offzip source?

Post by Acewell »

Thanks, but its not quite that simple, this is the first time i've even attempted to compile an exe
I downloaded and installed the package in the first link you posted
the MinGW Installation Manager presented me with a bunch of options for installing various things that i have no idea what they do.
I had to move the source files into the C:\MinGW\bin folder or else gcc could not be found and now i keep getting a zlib.h error that terminates the whole thing.

edit
I can't get a compiler set up so i just hex edited offzip.exe to include my new entry by overwriting an existing one.
i would rather not have to do this though


edit2
I downloaded and installed the package from the second link you posted
moved the source files to C:\TDM-GCC-32
opened the MingGW command prompt and pasted the line you have above
still getting a zlib.h error that terminates the compiling.


edit3
i downloaded zlib-1.2.8 from zlib.net and placed zlib.h and zconf.h in C:\TDM-GCC-32\include
now i'm getting a "cannot find -lz" error and don't know what this means :x


edit4
i think i'm getting closer, i downloaded libz-1.2.7-1-mingw32-dev.tar.lzma from here
http://sourceforge.net/projects/mingw/f ... b-1.2.7-1/
and placed the files in the C:\TDM-GCC-32\include and C:\TDM-GCC-32\lib folders
i can compile the offzip source into an exe but when i run it an error comes up and says
i need libz-1.dll so i download libz-1.2.7-1-mingw32-dll-1.tar.lzma from here
http://sourceforge.net/projects/mingw/f ... b-1.2.7-1/
and now i can run offzip and it works, but it shouldn't need this dll
i know this can't be right but i just don't know exactly what files i need to compile it the way it was meant to :(
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Compiling offzip source?

Post by Acewell »

Alright i finally got everything to compile and work without needing the zlib-1.dll
i just removed the libz.dll.a from the lib folder. :)


This is what i did to compile offzip source
I installed tdm-gcc-5.1.0-3.exe
and added the files to the installation from this zip
libz-1.2.7-1-mingw32-dev.zip

move the files from include folder to include folder and files from lib folder to lib folder in C:\TDM-GCC-32
copy offzip.c, sign_ext.c and the zopfli folder to C:\TDM-GCC-32
then start the MinGW command prompt and paste the line that aluigi posted earlier and run it
voila! Now you have a new offzip.exe with your changes in C:\TDM-GCC-32

:D


i would have deleted this post and used the one above for this but i can't delete this one for some reason.