| 1 |
#ifndef LIBCHDR_CODEC_LZMA_H |
| 2 |
#define LIBCHDR_CODEC_LZMA_H |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
|
| 6 |
#include "../deps/lzma-25.01/include/LzmaDec.h" |
| 7 |
|
| 8 |
#include "../include/libchdr/chd.h" |
| 9 |
|
| 10 |
|
| 11 |
#define MAX_LZMA_ALLOCS 64 |
| 12 |
|
| 13 |
typedef struct _lzma_allocator lzma_allocator; |
| 14 |
struct _lzma_allocator |
| 15 |
{ |
| 16 |
ISzAlloc base; |
| 17 |
uint32_t* allocptr[MAX_LZMA_ALLOCS]; |
| 18 |
uint32_t* allocptr2[MAX_LZMA_ALLOCS]; |
| 19 |
}; |
| 20 |
|
| 21 |
typedef struct _lzma_codec_data lzma_codec_data; |
| 22 |
struct _lzma_codec_data |
| 23 |
{ |
| 24 |
CLzmaDec decoder; |
| 25 |
lzma_allocator allocator; |
| 26 |
}; |
| 27 |
|
| 28 |
|
| 29 |
chd_error lzma_codec_init(void *codec, uint32_t hunkbytes); |
| 30 |
void lzma_codec_free(void *codec); |
| 31 |
chd_error lzma_codec_decompress(void *codec, const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen); |
| 32 |
|
| 33 |
#endif |