Simple test of compressing and storing datafiles inside executable or a loadable binary blob.
- Packs datafiles directly into executable or a binary blob.
- Compression using zlib.
- Allows users to override files (must be explicitly enabled.)
- API to access files in-memory (entire file is loaded into memory.)
- Supports FILE* for reading/writing (data is streamed).
- Load files either using a hardcoded handle from a header or using filename.
- Create ando/or edit datafiles
-
datapacker NAME:FILENAME..
to generate c-file. - Build your app as usual and include generated c-file.
- Use
unpack
orunpack_filename
to load the data into memory.unpack
uses structure directly.unpack_filename
uses a virtual filename to locate the struct.
- ./configure
- make
- make install
For apt-based distributions you can generate a .deb
for easier installation:
- ./configure
- sudo make deb
- sudo dpkg -i datapack_*.deb
See Makefile.am for real example.
files.c: datapacker Makefile
$(AM_V_GEN)./datapacker -f ${top_srcdir}/datafiles -s ${top_srcdir} -d $(DEPDIR)/files.data -o files.c -e files.h
-include ./$(DEPDIR)/files.data
where datafiles
is a list of files to pack.