Rizin
unix-like reverse engineering framework and cli tools
|
#include <system.h>
#include <kwaj.h>
#include <mszip.h>
#include <readbits.h>
#include <readhuff.h>
Go to the source code of this file.
Macros | |
#define | BITS_TYPE struct kwajd_stream |
#define | BITS_VAR lzh |
#define | BITS_ORDER_MSB |
#define | BITS_NO_READ_INPUT |
#define | READ_BYTES |
#define | TABLEBITS(tbl) KWAJ_TABLEBITS |
#define | MAXSYMBOLS(tbl) KWAJ_##tbl##_SYMS |
#define | HUFF_TABLE(tbl, idx) lzh->tbl##_table[idx] |
#define | HUFF_LEN(tbl, idx) lzh->tbl##_len[idx] |
#define | HUFF_ERROR return MSPACK_ERR_DATAFORMAT |
#define | READ_BITS_SAFE(val, n) |
#define | READ_HUFFSYM_SAFE(tbl, val) |
#define | BUILD_TREE(tbl, type) |
#define | WRITE_BYTE |
#define BITS_TYPE struct kwajd_stream |
#define BUILD_TREE | ( | tbl, | |
type | |||
) |
#define HUFF_ERROR return MSPACK_ERR_DATAFORMAT |
#define READ_BYTES |
#define READ_HUFFSYM_SAFE | ( | tbl, | |
val | |||
) |
#define TABLEBITS | ( | tbl | ) | KWAJ_TABLEBITS |
#define WRITE_BYTE |
|
static |
Definition at line 129 of file kwajd.c.
References mskwaj_decompressor_p::base, mskwajd_header_p::fh, and MSPACK_ERR_OK.
Referenced by kwajd_decompress(), and mspack_create_kwaj_decompressor().
|
static |
Definition at line 331 of file kwajd.c.
References mskwaj_decompressor_p::base, error(), input(), kwajd_close(), kwajd_extract(), kwajd_open(), MSPACK_ERR_ARGS, and output.
Referenced by mspack_create_kwaj_decompressor().
|
static |
Definition at line 351 of file kwajd.c.
References mskwaj_decompressor_p::base, and MSPACK_ERR_ARGS.
Referenced by mspack_create_kwaj_decompressor().
|
static |
Definition at line 253 of file kwajd.c.
References mspack_system::alloc, mskwaj_decompressor_p::base, mspack_system::close, mskwajd_header::comp_type, mskwajd_header::data_offset, fh, mspack_system::free, i, KWAJ_INPUT_SIZE, lzh_decompress(), lzh_free(), lzh_init(), lzss_decompress(), LZSS_MODE_EXPAND, MSKWAJ_COMP_LZH, MSKWAJ_COMP_MSZIP, MSKWAJ_COMP_NONE, MSKWAJ_COMP_SZDD, MSKWAJ_COMP_XOR, MSPACK_ERR_ARGS, MSPACK_ERR_DATAFORMAT, MSPACK_ERR_NOMEMORY, MSPACK_ERR_OK, MSPACK_ERR_OPEN, MSPACK_ERR_READ, MSPACK_ERR_SEEK, MSPACK_ERR_WRITE, MSPACK_SYS_OPEN_WRITE, MSPACK_SYS_SEEK_START, mszipd_decompress_kwaj(), mszipd_free(), mszipd_init(), mspack_system::open, read(), mspack_system::read, mspack_system::seek, mszipd_stream::sys, kwajd_stream::sys, and mspack_system::write.
Referenced by kwajd_decompress(), and mspack_create_kwaj_decompressor().
|
static |
Definition at line 93 of file kwajd.c.
References mspack_system::alloc, mskwaj_decompressor_p::base, mspack_system::close, fh, mspack_system::free, kwajd_read_headers(), MSPACK_ERR_NOMEMORY, MSPACK_ERR_OPEN, MSPACK_SYS_OPEN_READ, NULL, and mspack_system::open.
Referenced by kwajd_decompress(), and mspack_create_kwaj_decompressor().
|
static |
Definition at line 151 of file kwajd.c.
References mspack_system::alloc, mskwajd_header::comp_type, mskwajd_header::data_offset, EndGetI16, EndGetI32, mskwajd_header::extra, mskwajd_header::extra_length, fh, mskwajd_header::filename, fn, mskwajd_header::headers, i, kwajh_CompMethod, kwajh_DataOffset, kwajh_Flags, kwajh_Signature1, kwajh_Signature2, kwajh_SIZEOF, len, mskwajd_header::length, MSKWAJ_HDR_HASEXTRATEXT, MSKWAJ_HDR_HASFILEEXT, MSKWAJ_HDR_HASFILENAME, MSKWAJ_HDR_HASLENGTH, MSKWAJ_HDR_HASUNKNOWN1, MSKWAJ_HDR_HASUNKNOWN2, MSPACK_ERR_DATAFORMAT, MSPACK_ERR_NOMEMORY, MSPACK_ERR_OK, MSPACK_ERR_READ, MSPACK_ERR_SEEK, MSPACK_ERR_SIGNATURE, MSPACK_SYS_SEEK_CUR, NULL, mspack_system::read, and mspack_system::seek.
Referenced by kwajd_open().
|
static |
Definition at line 436 of file kwajd.c.
References kwajd_stream::bit_buffer, kwajd_stream::bits_left, BUILD_TREE, err, i, kwajd_stream::i_end, kwajd_stream::i_ptr, INIT_BITS, kwajd_stream::input_end, len, LZSS_WINDOW_FILL, LZSS_WINDOW_SIZE, memset(), MSPACK_ERR_OK, OFFSET, pos, READ_BITS_SAFE, READ_HUFFSYM_SAFE, RESTORE_BITS, types, kwajd_stream::window, and WRITE_BYTE.
Referenced by kwajd_extract().
|
static |
Definition at line 492 of file kwajd.c.
References mspack_system::free, and kwajd_stream::sys.
Referenced by kwajd_extract().
|
static |
Definition at line 422 of file kwajd.c.
References mspack_system::alloc, in, kwajd_stream::input, NULL, out, kwajd_stream::output, and kwajd_stream::sys.
Referenced by kwajd_extract().
|
static |
Definition at line 545 of file kwajd.c.
References kwajd_stream::i_end, kwajd_stream::i_ptr, kwajd_stream::inbuf, kwajd_stream::input, kwajd_stream::input_end, KWAJ_INPUT_SIZE, MSPACK_ERR_OK, MSPACK_ERR_READ, read(), mspack_system::read, and kwajd_stream::sys.
|
static |
Definition at line 500 of file kwajd.c.
References c, err, i, MSPACK_ERR_OK, READ_BITS_SAFE, RESTORE_BITS, sel(), STORE_BITS, and type.
struct mskwaj_decompressor* mspack_create_kwaj_decompressor | ( | struct mspack_system * | sys | ) |
Creates a new KWAJ decompressor.
sys | a custom mspack_system structure, or NULL to use the default |
Definition at line 55 of file kwajd.c.
References mspack_system::alloc, kwajd_close(), kwajd_decompress(), kwajd_error(), kwajd_extract(), kwajd_open(), mspack_default_system, MSPACK_ERR_OK, mspack_valid_system(), and NULL.
Referenced by main().
void mspack_destroy_kwaj_decompressor | ( | struct mskwaj_decompressor * | self | ) |
Destroys an existing KWAJ decompressor.
self | the mskwaj_decompressor to destroy |
Definition at line 79 of file kwajd.c.
References mskwaj_decompressor_p::base, and mspack_system::free.
Referenced by main().