This small extension wraps zlib to add several functions for data compression/decompression to GameMaker: Studio (1, 2).
Since the extension is freeware and I'm not particularly familiar with zlib, this repository is intended as a "do it yourself" kind of thing for anyone desiring additional features/platforms. Feel free to send back a pull request if you do something nice.
- Clone/download the repository.
- Download zlib. I've been using v1.2.11 as of writing this.
- Copy all
.h/.cfiles (zlib.h,inflate.c, etc) from zlib directory intobuffer_zlibdirectory of the repository. - Open
buffer_zlib.slnin Visual Studio. I've been using Community Edition 2015 as of writing this. - If all was done correctly, the project should now produce a valid DLL when in x86 release mode.
- If you want the extension function list to be automatically updated post-compile, download gmxgen and tuck it's executable files at some
PATHenvironment variable location.
- Copy all
.h/.cfiles (zlib.h,inflate.c, etc) from zlib directory intobuffer_zlib.java\jnidirectory of the repository. - Run
_javaclassBAT to compile java class fromBufferZlib.java.BufferZlib.classshall appear in thebuffer_zlib.java\bin\com\gamemaker\bufferzlibdirectory. - Run
_jniheaderBAT. It should producecom_gamemaker_bufferzlib_BufferZlib.hheader based on the java class. You need to place this file intobuffer_zlib.java\jni. - Header is the link between
.javaand.cppsources. Methods inbuffer_zlib.cppshould match the methods fromcom_gamemaker_bufferzlib_BufferZlib.hwhich are generated based on the methods fromBufferZlib.java. - Run
_libs.batto build NDK Shared Library. If all was done correctly, you will see two newly created directories,objandlibs. Copylibsfolder and name itlib. - Go to
libdirectory and delete all architectures not supported by GameMaker. Currently supported architecures are:armeabi,armeabi-v7a,mipsandx86, which should stay. If you build your games without supporting some of architecures (see Android Settings of your project) you can delete it too. - Add
libdirectory to a zip file. Path of directory should be saved, so it shall belib.zip\lib\*. - Rename
lib.zipintolib.jarand copy it intoAndroidSource\libsdirectory of GameMaker extension. - Copy
BufferZlib.javaandBufferZlibExt.javaintoAndroidSource\Javadirectory of GameMaker extension.BufferZlibExt.javais the main file, so Class Name in Android extension settings should beBufferZlibExt. - Tested SDKs: jdk/jre
1.8.0, Target SDK25, Min SDK9, Compile SDK25, Build Tools26, Support Lib25.3.1, NDKr14b.
See zlib license.