SC1 unpacking tools

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2767 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2007-06-01 14:01:14 +00:00
parent c9095d9793
commit 325a882c5d
13 changed files with 1653 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
// Reverse engineered from the Star Control executable.
#ifndef _HUFF_H
#define _HUFF_H
typedef struct Huff_Code Huff_Code;
typedef struct Huff_Context Huff_Context;
#include "dostypes.h"
#include "../../shared/cbytesex.h"
struct Huff_Code {
WORD field_0;
BYTE value;
BYTE len;
};
struct Huff_Context {
Huff_Code codes[0x100];
WORD codeCount;
WORD maxCodeLen;
bool (*lookupCodeFunc)(Huff_Context *ctx, DWORD *result);
BitStreamContext *bsc;
union {
BYTE topCodeIndexLen;
// Number of bits in the index of the top code.
BYTE codeIndices[16];
// Index into 'codes' to the first code with some length.
} u;
};
Huff_Context *Huff_new(BitStreamContext *bsc, WORD codeCount);
void Huff_delete(Huff_Context *ctx);
static inline bool
Huff_getCode(Huff_Context *ctx, DWORD *result) {
return ctx->lookupCodeFunc(ctx, result);
}
#endif /* _HUFF_H */