1 /* license:BSD-3-Clause
2 * copyright-holders:Aaron Giles
3 ***************************************************************************
7 Zlib compression wrappers
9 ***************************************************************************/
13 #ifndef __LIBCHDR_ZLIB_H__
14 #define __LIBCHDR_ZLIB_H__
19 #include "coretypes.h"
22 #define MAX_ZLIB_ALLOCS 64
24 /* codec-private data for the ZLIB codec */
26 typedef struct _zlib_allocator zlib_allocator;
27 struct _zlib_allocator
29 UINT32 * allocptr[MAX_ZLIB_ALLOCS];
30 UINT32 * allocptr2[MAX_ZLIB_ALLOCS];
33 typedef struct _zlib_codec_data zlib_codec_data;
34 struct _zlib_codec_data
37 zlib_allocator allocator;
40 /* codec-private data for the CDZL codec */
41 typedef struct _cdzl_codec_data cdzl_codec_data;
42 struct _cdzl_codec_data {
44 zlib_codec_data base_decompressor;
46 zlib_codec_data subcode_decompressor;
51 /* zlib compression codec */
52 chd_error zlib_codec_init(void *codec, uint32_t hunkbytes);
54 void zlib_codec_free(void *codec);
56 chd_error zlib_codec_decompress(void *codec, const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen);
58 voidpf zlib_fast_alloc(voidpf opaque, uInt items, uInt size);
60 void zlib_fast_free(voidpf opaque, voidpf address);
62 /* cdzl compression codec */
63 chd_error cdzl_codec_init(void* codec, uint32_t hunkbytes);
65 void cdzl_codec_free(void* codec);
67 chd_error cdzl_codec_decompress(void *codec, const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen);
69 #endif /* __LIBCHDR_ZLIB_H__ */