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
/.c
files (zlib.h
,inflate.c
, etc) from zlib directory intobuffer_zlib
directory of the repository. - Open
buffer_zlib.sln
in 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
PATH
environment variable location.
- Copy all
.h
/.c
files (zlib.h
,inflate.c
, etc) from zlib directory intobuffer_zlib.java\jni
directory of the repository. - Run
_javaclass
BAT to compile java class fromBufferZlib.java
.BufferZlib.class
shall appear in thebuffer_zlib.java\bin\com\gamemaker\bufferzlib
directory. - Run
_jniheader
BAT. It should producecom_gamemaker_bufferzlib_BufferZlib.h
header based on the java class. You need to place this file intobuffer_zlib.java\jni
. - Header is the link between
.java
and.cpp
sources. Methods inbuffer_zlib.cpp
should match the methods fromcom_gamemaker_bufferzlib_BufferZlib.h
which are generated based on the methods fromBufferZlib.java
. - Run
_libs.bat
to build NDK Shared Library. If all was done correctly, you will see two newly created directories,obj
andlibs
. Copylibs
folder and name itlib
. - Go to
lib
directory and delete all architectures not supported by GameMaker. Currently supported architecures are:armeabi
,armeabi-v7a
,mips
andx86
, 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
lib
directory to a zip file. Path of directory should be saved, so it shall belib.zip\lib\*
. - Rename
lib.zip
intolib.jar
and copy it intoAndroidSource\libs
directory of GameMaker extension. - Copy
BufferZlib.java
andBufferZlibExt.java
intoAndroidSource\Java
directory of GameMaker extension.BufferZlibExt.java
is 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.