-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split Stunts format and compression methods to separate files.
- Loading branch information
Showing
12 changed files
with
901 additions
and
698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ | |
#ifndef STPK_STUNPACK_H | ||
#define STPK_STUNPACK_H | ||
|
||
#include <stddef.h> | ||
|
||
#define STPK_VERSION "0.2.0" | ||
#define STPK_NAME "stunpack" | ||
#define STPK_BUGS "[email protected]" | ||
|
@@ -28,29 +30,6 @@ | |
#define STPK_RET_ERR 1 | ||
#define STPK_RET_ERR_DATA_LEFT 2 | ||
|
||
#define STPK_MAX_SIZE 0xFFFFFF | ||
#define STPK_PASSES_MASK 0x7F | ||
#define STPK_PASSES_RECUR 0x80 | ||
|
||
#define STPK_TYPE_RLE 0x01 | ||
#define STPK_TYPE_HUFF 0x02 | ||
|
||
#define STPK_RLE_ESCLEN_MASK 0x7F | ||
#define STPK_RLE_ESCLEN_MAX 0x0A | ||
#define STPK_RLE_ESCLEN_NOSEQ 0x80 | ||
#define STPK_RLE_ESCLOOKUP_LEN 0x100 | ||
#define STPK_RLE_ESCSEQ_POS 0x01 | ||
|
||
#define STPK_HUFF_LEVELS_MASK 0x7F | ||
#define STPK_HUFF_LEVELS_MAX 0x10 | ||
#define STPK_HUFF_LEVELS_DELTA 0x80 | ||
|
||
#define STPK_HUFF_ALPH_LEN 0x100 | ||
#define STPK_HUFF_PREFIX_WIDTH 0x08 | ||
#define STPK_HUFF_PREFIX_LEN (1 << STPK_HUFF_PREFIX_WIDTH) | ||
#define STPK_HUFF_PREFIX_MSB (1 << (STPK_HUFF_PREFIX_WIDTH - 1)) | ||
#define STPK_HUFF_WIDTH_ESC 0x40 | ||
|
||
typedef enum { | ||
// Automatic format detection when decompressing. | ||
STPK_FMT_AUTO, | ||
|
@@ -124,15 +103,6 @@ void stpk_deinit(stpk_Context *ctx); | |
|
||
unsigned int stpk_decompress(stpk_Context *ctx); | ||
|
||
const char *stpk_versionStr(stpk_FmtStuntsVer version); | ||
|
||
unsigned int stpk_decompRLE(stpk_Context *ctx); | ||
unsigned int stpk_rleDecodeSeq(stpk_Context *ctx, unsigned char esc); | ||
unsigned int stpk_rleDecodeOne(stpk_Context *ctx, const unsigned char *escLookup); | ||
|
||
unsigned int stpk_decompHuff(stpk_Context *ctx); | ||
unsigned int stpk_huffGenOffsets(stpk_Context *ctx, unsigned int levels, const unsigned char *leafNodesPerLevel, short *codeOffsets, unsigned short *totalCodes); | ||
void stpk_huffGenPrefix(stpk_Context *ctx, unsigned int levels, const unsigned char *leafNodesPerLevel, const unsigned char *alphabet, unsigned char *symbols, unsigned char *widths); | ||
unsigned int stpk_huffDecode(stpk_Context *ctx, const unsigned char *alphabet, const unsigned char *symbols, const unsigned char *widths, const short *codeOffsets, const unsigned short *totalCodes, int delta); | ||
const char *stpk_fmtStuntsVerStr(stpk_FmtStuntsVer version); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.