diff options
author | Iru Cai <mytbk920423@gmail.com> | 2018-10-01 10:40:39 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2018-10-01 10:44:15 +0800 |
commit | be9144f843df829fd2529c7ebf518749856eab90 (patch) | |
tree | 9ed567eb22ebb03a3169dd0f86f4d7aaf9e7f484 /csrc/mkf | |
parent | e3411dcbf0f8cfee057011ea29ce87654d74a3c1 (diff) | |
download | rich4-be9144f843df829fd2529c7ebf518749856eab90.tar.xz |
move mkf source to mkf/
Diffstat (limited to 'csrc/mkf')
-rw-r--r-- | csrc/mkf/Makefile | 5 | ||||
-rw-r--r-- | csrc/mkf/mkf.c | 180 | ||||
-rw-r--r-- | csrc/mkf/mkf.h | 22 | ||||
-rw-r--r-- | csrc/mkf/mkf_decompress.c | 502 | ||||
-rw-r--r-- | csrc/mkf/test/Data.mkf.sha1 | 1 | ||||
-rw-r--r-- | csrc/mkf/test/dump_data.c | 42 | ||||
-rw-r--r-- | csrc/mkf/test/mkfdata.sha1 | 303 | ||||
-rw-r--r-- | csrc/mkf/test/parse_mkf.c | 36 | ||||
-rwxr-xr-x | csrc/mkf/test/runtest.sh | 15 |
9 files changed, 1106 insertions, 0 deletions
diff --git a/csrc/mkf/Makefile b/csrc/mkf/Makefile new file mode 100644 index 0000000..c33b580 --- /dev/null +++ b/csrc/mkf/Makefile @@ -0,0 +1,5 @@ +CFLAGS=-m32 -g -Wall +MKFOBJ=mkf.o mkf_decompress.o + +libmkf.a: $(MKFOBJ) + ar r libmkf.a $(MKFOBJ) diff --git a/csrc/mkf/mkf.c b/csrc/mkf/mkf.c new file mode 100644 index 0000000..63e7e2d --- /dev/null +++ b/csrc/mkf/mkf.c @@ -0,0 +1,180 @@ +/* + * Copyright (C) 2018 Iru Cai <mytbk920423@gmail.com> + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "mkf.h" + +#define NULL_HND ((FILE*)(-1)) + +void mkf_decompress(void *arg1, void *arg2); + +struct mkf +{ + FILE *handle; + void *data; +}; +struct mkf mkf_stdata[16] = { { NULL_HND, NULL } }; // 0x4762f4 + +#ifdef MKF_INFO +static int mkfc[16]; + +int mkf_nchunks(int i) +{ + return mkfc[i]; +} +#endif + +int load_mkf(const char *fn) +{ + int i; + int32_t x; + + if (mkf_stdata[0].handle == NULL_HND) + memset(mkf_stdata, 0, sizeof(mkf_stdata)); + + FILE *fp = fopen(fn, "rb"); + if (fp == NULL) + return -1; + + for (i = 0; mkf_stdata[i].handle != 0; i++) + ; + + mkf_stdata[i].handle = fp; + fread(&x, 4, 1, fp); + fseek(fp, -1, SEEK_END); + long filesz = ftell(fp) + 1; + size_t t = filesz - x; + fseek(fp, x, SEEK_SET); + mkf_stdata[i].data = malloc(t); + fread(mkf_stdata[i].data, 1, t, fp); +#ifdef MKF_INFO + mkfc[i] = t / 4; +#endif + return i; +} + +void unload_mkf(int mkf_idx) +{ + struct mkf *m = &mkf_stdata[mkf_idx]; + if (m->handle == NULL) { + return; + } + fclose(m->handle); + free(m->data); + m->handle = NULL; + m->data = NULL; +} + +static void update_spr_smp_ptr(void *s) +{ + struct spr_smp *sst = (struct spr_smp*)s; + int lastsz; + + if (strcmp(sst->sig, "SPR") == 0) { + lastsz = sst->chunk_tab[0].chunk_sz; + sst->chunk_tab[0].chunk_sz = (int32_t)s + sst->start_offset + 0x200; + + for (int i = 1; i < sst->nchunk; i++) { + int t = sst->chunk_tab[i].chunk_sz; + sst->chunk_tab[i].chunk_sz = lastsz + sst->chunk_tab[i-1].chunk_sz; + lastsz = t; + } + } + + if (strcmp(sst->sig, "SMP") == 0) { + lastsz = sst->chunk_tab[0].chunk_sz; + sst->chunk_tab[0].chunk_sz = (int32_t)s + sst->start_offset; + + for (int i = 1; i < sst->nchunk; i++) { + int t = sst->chunk_tab[i].chunk_sz; + sst->chunk_tab[i].chunk_sz = lastsz + sst->chunk_tab[i-1].chunk_sz; + lastsz = t; + } + } +} + +int pixel_fmt; + +static void update_pixels(uint16_t *a, int nbytes) +{ + int nw = nbytes >> 1; + + switch (pixel_fmt) { + case 1: + for (int i = 0; i < nw; i++) { + uint16_t t = a[i]; + uint16_t t2 = t * 2; + t &= 0x001f; /* t[0:4] */ + t2 &= 0xffc0; /* t2[6:15] = t[5:14] */ + a[i] = t | t2; /* t[0:4],0,t[5:14] */ + } + return; + case 2: + for (int i = 0; i < nw; i++) { + uint16_t t = a[i]; + uint16_t v1 = (t & 0x7c00) >> 10; /* v1[0:4] = t[10:14] */ + uint16_t v2 = (t & 0x03e0) << 1; /* v2[6:10] = t[5:9] */ + uint16_t v3 = (t & 0x001f) << 11; /* v3[11:15] = t[0:4] */ + a[i] = v1 | v2 | v3; /* t[10:14],0,t[5:9],t[0:4] */ + } + return; + case 3: + for (int i = 0; i < nw; i++) { + uint16_t t = a[i]; + uint16_t v1 = (t & 0x7800) >> 3; /* v1[8:11] = t[11:14] */ + uint16_t v2 = (t & 0x03c0) >> 2; /* v2[4:7] = t[6:9] */ + uint16_t v3 = (t & 0x001e) >> 1; /* v3[0:3] = t[1:4] */ + a[i] = v1 | v2 | v3; /* t[1:4],t[6:9],t[11:14] */ + } + return; + default: + return; + } +} + +char * read_mkf(int mkf_idx, int a1, char *buf, int *bufsize) +{ + /* 4-dword mkf info: + * [0]: real data size + * [1]: original size in file + * [2]: graphics data offset + * [3]: graphics data size in bytes + */ + uint32_t data[4]; + + FILE * hdl = mkf_stdata[mkf_idx].handle; + if (hdl == 0) + return 0; + + fseek(hdl, ((uint32_t*)(mkf_stdata[mkf_idx].data))[a1], SEEK_SET); + fread(data, 4, 4, hdl); + + if (buf == NULL) { + buf = malloc(data[0]); + } + + int bufsz = data[0]; + if (data[1] == bufsz) { + fread(buf, 1, bufsz, hdl); + } else { + void *tmpbuf = malloc(data[1]); + fread(tmpbuf, 1, data[1], hdl); + mkf_decompress(buf, tmpbuf); + free(tmpbuf); + } + if (data[3] != 0) { + update_pixels((uint16_t*)(buf + data[2]), data[3]); + } + if (bufsize != NULL) { + *bufsize = data[0]; + } + if (strncmp(buf, "SPR", 3) == 0 + || strncmp(buf, "SMP", 3) == 0) { + update_spr_smp_ptr(buf); + } + return buf; +} diff --git a/csrc/mkf/mkf.h b/csrc/mkf/mkf.h new file mode 100644 index 0000000..ef1fa38 --- /dev/null +++ b/csrc/mkf/mkf.h @@ -0,0 +1,22 @@ +#include <stdint.h> + +int load_mkf(const char *fn); +void unload_mkf(int mkf_idx); +char * read_mkf(int mkf_idx, int a1, char *buf, int *bufsize); + +extern int pixel_fmt; + +struct spr_smp +{ + char sig[4]; /* "SPR" or "SMP" */ + int32_t nchunk; + int32_t start_offset; + int32_t t3, t4; /* unused? */ + struct { + /* in the file, it's the chunk size, + * after read_mkf(), it becomes the start address */ + int32_t chunk_sz; + int32_t v2, v3; /* unused? */ + } chunk_tab[0]; +}; + diff --git a/csrc/mkf/mkf_decompress.c b/csrc/mkf/mkf_decompress.c new file mode 100644 index 0000000..432b30d --- /dev/null +++ b/csrc/mkf/mkf_decompress.c @@ -0,0 +1,502 @@ +#include <stdint.h> +#include <stdlib.h> +#include <string.h> + +const uint8_t table_483430[256] = { + 0x3f, 0x0b, 0x17, 0x03, 0x2f, 0x0a, 0x16, 0x00, 0x2e, 0x09, + 0x15, 0x02, 0x2d, 0x01, 0x08, 0x00, 0x3e, 0x07, 0x14, 0x03, + 0x2c, 0x06, 0x13, 0x00, 0x2b, 0x05, 0x12, 0x02, 0x2a, 0x01, + 0x04, 0x00, 0x3d, 0x0b, 0x11, 0x03, 0x29, 0x0a, 0x10, 0x00, + 0x28, 0x09, 0x0f, 0x02, 0x27, 0x01, 0x08, 0x00, 0x3c, 0x07, + 0x0e, 0x03, 0x26, 0x06, 0x0d, 0x00, 0x25, 0x05, 0x0c, 0x02, + 0x24, 0x01, 0x04, 0x00, 0x3b, 0x0b, 0x17, 0x03, 0x23, 0x0a, + 0x16, 0x00, 0x22, 0x09, 0x15, 0x02, 0x21, 0x01, 0x08, 0x00, + 0x3a, 0x07, 0x14, 0x03, 0x20, 0x06, 0x13, 0x00, 0x1f, 0x05, + 0x12, 0x02, 0x1e, 0x01, 0x04, 0x00, 0x39, 0x0b, 0x11, 0x03, + 0x1d, 0x0a, 0x10, 0x00, 0x1c, 0x09, 0x0f, 0x02, 0x1b, 0x01, + 0x08, 0x00, 0x38, 0x07, 0x0e, 0x03, 0x1a, 0x06, 0x0d, 0x00, + 0x19, 0x05, 0x0c, 0x02, 0x18, 0x01, 0x04, 0x00, 0x37, 0x0b, + 0x17, 0x03, 0x2f, 0x0a, 0x16, 0x00, 0x2e, 0x09, 0x15, 0x02, + 0x2d, 0x01, 0x08, 0x00, 0x36, 0x07, 0x14, 0x03, 0x2c, 0x06, + 0x13, 0x00, 0x2b, 0x05, 0x12, 0x02, 0x2a, 0x01, 0x04, 0x00, + 0x35, 0x0b, 0x11, 0x03, 0x29, 0x0a, 0x10, 0x00, 0x28, 0x09, + 0x0f, 0x02, 0x27, 0x01, 0x08, 0x00, 0x34, 0x07, 0x0e, 0x03, + 0x26, 0x06, 0x0d, 0x00, 0x25, 0x05, 0x0c, 0x02, 0x24, 0x01, + 0x04, 0x00, 0x33, 0x0b, 0x17, 0x03, 0x23, 0x0a, 0x16, 0x00, + 0x22, 0x09, 0x15, 0x02, 0x21, 0x01, 0x08, 0x00, 0x32, 0x07, + 0x14, 0x03, 0x20, 0x06, 0x13, 0x00, 0x1f, 0x05, 0x12, 0x02, + 0x1e, 0x01, 0x04, 0x00, 0x31, 0x0b, 0x11, 0x03, 0x1d, 0x0a, + 0x10, 0x00, 0x1c, 0x09, 0x0f, 0x02, 0x1b, 0x01, 0x08, 0x00, + 0x30, 0x07, 0x0e, 0x03, 0x1a, 0x06, 0x0d, 0x00, 0x19, 0x05, + 0x0c, 0x02, 0x18, 0x01, 0x04, 0x00 +}; + +const uint8_t table_483530[256] = { + 0x08, 0x05, 0x06, 0x04, 0x07, 0x05, 0x06, 0x03, 0x07, 0x05, + 0x06, 0x04, 0x07, 0x04, 0x05, 0x03, 0x08, 0x05, 0x06, 0x04, + 0x07, 0x05, 0x06, 0x03, 0x07, 0x05, 0x06, 0x04, 0x07, 0x04, + 0x05, 0x03, 0x08, 0x05, 0x06, 0x04, 0x07, 0x05, 0x06, 0x03, + 0x07, 0x05, 0x06, 0x04, 0x07, 0x04, 0x05, 0x03, 0x08, 0x05, + 0x06, 0x04, 0x07, 0x05, 0x06, 0x03, 0x07, 0x05, 0x06, 0x04, + 0x07, 0x04, 0x05, 0x03, 0x08, 0x05, 0x06, 0x04, 0x07, 0x05, + 0x06, 0x03, 0x07, 0x05, 0x06, 0x04, 0x07, 0x04, 0x05, 0x03, + 0x08, 0x05, 0x06, 0x04, 0x07, 0x05, 0x06, 0x03, 0x07, 0x05, + 0x06, 0x04, 0x07, 0x04, 0x05, 0x03, 0x08, 0x05, 0x06, 0x04, + 0x07, 0x05, 0x06, 0x03, 0x07, 0x05, 0x06, 0x04, 0x07, 0x04, + 0x05, 0x03, 0x08, 0x05, 0x06, 0x04, 0x07, 0x05, 0x06, 0x03, + 0x07, 0x05, 0x06, 0x04, 0x07, 0x04, 0x05, 0x03, 0x08, 0x05, + 0x06, 0x04, 0x07, 0x05, 0x06, 0x03, 0x07, 0x05, 0x06, 0x04, + 0x07, 0x04, 0x05, 0x03, 0x08, 0x05, 0x06, 0x04, 0x07, 0x05, + 0x06, 0x03, 0x07, 0x05, 0x06, 0x04, 0x07, 0x04, 0x05, 0x03, + 0x08, 0x05, 0x06, 0x04, 0x07, 0x05, 0x06, 0x03, 0x07, 0x05, + 0x06, 0x04, 0x07, 0x04, 0x05, 0x03, 0x08, 0x05, 0x06, 0x04, + 0x07, 0x05, 0x06, 0x03, 0x07, 0x05, 0x06, 0x04, 0x07, 0x04, + 0x05, 0x03, 0x08, 0x05, 0x06, 0x04, 0x07, 0x05, 0x06, 0x03, + 0x07, 0x05, 0x06, 0x04, 0x07, 0x04, 0x05, 0x03, 0x08, 0x05, + 0x06, 0x04, 0x07, 0x05, 0x06, 0x03, 0x07, 0x05, 0x06, 0x04, + 0x07, 0x04, 0x05, 0x03, 0x08, 0x05, 0x06, 0x04, 0x07, 0x05, + 0x06, 0x03, 0x07, 0x05, 0x06, 0x04, 0x07, 0x04, 0x05, 0x03, + 0x08, 0x05, 0x06, 0x04, 0x07, 0x05, 0x06, 0x03, 0x07, 0x05, + 0x06, 0x04, 0x07, 0x04, 0x05, 0x03 +}; + +typedef struct { + uint16_t tab1[642]; /* 0x4847bc, from 0x483630 */ + uint16_t tab2[641]; /* 0x484cc0, from 0x483b34 */ + uint16_t tab3[641]; /* 0x4851c2, from 0x484036 */ + uint16_t tab4[322]; /* 0x4856c4, from 0x484538 */ +} ctabs; + +ctabs ctab_orig = { + { + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0003, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0005, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, + 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, + 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, + 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, + 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, + 0x0008, 0x0009, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, + 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, + 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0011, 0x0020, 0x0020, + 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0021, + 0x0040, 0x0040, 0x0040, 0x0040, 0x0041, 0x0080, 0x0080, 0x00c1, + 0x0141, 0xffff + }, + { + 0x0502, 0x0504, 0x0506, 0x0508, 0x050a, 0x050c, 0x050e, 0x0510, + 0x0512, 0x0514, 0x0516, 0x0518, 0x051a, 0x051c, 0x051e, 0x0520, + 0x0522, 0x0524, 0x0526, 0x0528, 0x052a, 0x052c, 0x052e, 0x0530, + 0x0532, 0x0534, 0x0536, 0x0538, 0x053a, 0x053c, 0x053e, 0x0540, + 0x0542, 0x0544, 0x0546, 0x0548, 0x054a, 0x054c, 0x054e, 0x0550, + 0x0552, 0x0554, 0x0556, 0x0558, 0x055a, 0x055c, 0x055e, 0x0560, + 0x0562, 0x0564, 0x0566, 0x0568, 0x056a, 0x056c, 0x056e, 0x0570, + 0x0572, 0x0574, 0x0576, 0x0578, 0x057a, 0x057c, 0x057e, 0x0580, + 0x0582, 0x0584, 0x0586, 0x0588, 0x058a, 0x058c, 0x058e, 0x0590, + 0x0592, 0x0594, 0x0596, 0x0598, 0x059a, 0x059c, 0x059e, 0x05a0, + 0x05a2, 0x05a4, 0x05a6, 0x05a8, 0x05aa, 0x05ac, 0x05ae, 0x05b0, + 0x05b2, 0x05b4, 0x05b6, 0x05b8, 0x05ba, 0x05bc, 0x05be, 0x05c0, + 0x05c2, 0x05c4, 0x05c6, 0x05c8, 0x05ca, 0x05cc, 0x05ce, 0x05d0, + 0x05d2, 0x05d4, 0x05d6, 0x05d8, 0x05da, 0x05dc, 0x05de, 0x05e0, + 0x05e2, 0x05e4, 0x05e6, 0x05e8, 0x05ea, 0x05ec, 0x05ee, 0x05f0, + 0x05f2, 0x05f4, 0x05f6, 0x05f8, 0x05fa, 0x05fc, 0x05fe, 0x0600, + 0x0602, 0x0604, 0x0606, 0x0608, 0x060a, 0x060c, 0x060e, 0x0610, + 0x0612, 0x0614, 0x0616, 0x0618, 0x061a, 0x061c, 0x061e, 0x0620, + 0x0622, 0x0624, 0x0626, 0x0628, 0x062a, 0x062c, 0x062e, 0x0630, + 0x0632, 0x0634, 0x0636, 0x0638, 0x063a, 0x063c, 0x063e, 0x0640, + 0x0642, 0x0644, 0x0646, 0x0648, 0x064a, 0x064c, 0x064e, 0x0650, + 0x0652, 0x0654, 0x0656, 0x0658, 0x065a, 0x065c, 0x065e, 0x0660, + 0x0662, 0x0664, 0x0666, 0x0668, 0x066a, 0x066c, 0x066e, 0x0670, + 0x0672, 0x0674, 0x0676, 0x0678, 0x067a, 0x067c, 0x067e, 0x0680, + 0x0682, 0x0684, 0x0686, 0x0688, 0x068a, 0x068c, 0x068e, 0x0690, + 0x0692, 0x0694, 0x0696, 0x0698, 0x069a, 0x069c, 0x069e, 0x06a0, + 0x06a2, 0x06a4, 0x06a6, 0x06a8, 0x06aa, 0x06ac, 0x06ae, 0x06b0, + 0x06b2, 0x06b4, 0x06b6, 0x06b8, 0x06ba, 0x06bc, 0x06be, 0x06c0, + 0x06c2, 0x06c4, 0x06c6, 0x06c8, 0x06ca, 0x06cc, 0x06ce, 0x06d0, + 0x06d2, 0x06d4, 0x06d6, 0x06d8, 0x06da, 0x06dc, 0x06de, 0x06e0, + 0x06e2, 0x06e4, 0x06e6, 0x06e8, 0x06ea, 0x06ec, 0x06ee, 0x06f0, + 0x06f2, 0x06f4, 0x06f6, 0x06f8, 0x06fa, 0x06fc, 0x06fe, 0x0700, + 0x0702, 0x0704, 0x0706, 0x0708, 0x070a, 0x070c, 0x070e, 0x0710, + 0x0712, 0x0714, 0x0716, 0x0718, 0x071a, 0x071c, 0x071e, 0x0720, + 0x0722, 0x0724, 0x0726, 0x0728, 0x072a, 0x072c, 0x072e, 0x0730, + 0x0732, 0x0734, 0x0736, 0x0738, 0x073a, 0x073c, 0x073e, 0x0740, + 0x0742, 0x0744, 0x0746, 0x0748, 0x074a, 0x074c, 0x074e, 0x0750, + 0x0752, 0x0754, 0x0756, 0x0758, 0x075a, 0x075c, 0x075e, 0x0760, + 0x0762, 0x0764, 0x0766, 0x0768, 0x076a, 0x076c, 0x076e, 0x0770, + 0x0772, 0x0774, 0x0776, 0x0778, 0x077a, 0x077c, 0x077e, 0x0780, + 0x0782, 0x0000, 0x0004, 0x0008, 0x000c, 0x0010, 0x0014, 0x0018, + 0x001c, 0x0020, 0x0024, 0x0028, 0x002c, 0x0030, 0x0034, 0x0038, + 0x003c, 0x0040, 0x0044, 0x0048, 0x004c, 0x0050, 0x0054, 0x0058, + 0x005c, 0x0060, 0x0064, 0x0068, 0x006c, 0x0070, 0x0074, 0x0078, + 0x007c, 0x0080, 0x0084, 0x0088, 0x008c, 0x0090, 0x0094, 0x0098, + 0x009c, 0x00a0, 0x00a4, 0x00a8, 0x00ac, 0x00b0, 0x00b4, 0x00b8, + 0x00bc, 0x00c0, 0x00c4, 0x00c8, 0x00cc, 0x00d0, 0x00d4, 0x00d8, + 0x00dc, 0x00e0, 0x00e4, 0x00e8, 0x00ec, 0x00f0, 0x00f4, 0x00f8, + 0x00fc, 0x0100, 0x0104, 0x0108, 0x010c, 0x0110, 0x0114, 0x0118, + 0x011c, 0x0120, 0x0124, 0x0128, 0x012c, 0x0130, 0x0134, 0x0138, + 0x013c, 0x0140, 0x0144, 0x0148, 0x014c, 0x0150, 0x0154, 0x0158, + 0x015c, 0x0160, 0x0164, 0x0168, 0x016c, 0x0170, 0x0174, 0x0178, + 0x017c, 0x0180, 0x0184, 0x0188, 0x018c, 0x0190, 0x0194, 0x0198, + 0x019c, 0x01a0, 0x01a4, 0x01a8, 0x01ac, 0x01b0, 0x01b4, 0x01b8, + 0x01bc, 0x01c0, 0x01c4, 0x01c8, 0x01cc, 0x01d0, 0x01d4, 0x01d8, + 0x01dc, 0x01e0, 0x01e4, 0x01e8, 0x01ec, 0x01f0, 0x01f4, 0x01f8, + 0x01fc, 0x0200, 0x0204, 0x0208, 0x020c, 0x0210, 0x0214, 0x0218, + 0x021c, 0x0220, 0x0224, 0x0228, 0x022c, 0x0230, 0x0234, 0x0238, + 0x023c, 0x0240, 0x0244, 0x0248, 0x024c, 0x0250, 0x0254, 0x0258, + 0x025c, 0x0260, 0x0264, 0x0268, 0x026c, 0x0270, 0x0274, 0x0278, + 0x027c, 0x0280, 0x0284, 0x0288, 0x028c, 0x0290, 0x0294, 0x0298, + 0x029c, 0x02a0, 0x02a4, 0x02a8, 0x02ac, 0x02b0, 0x02b4, 0x02b8, + 0x02bc, 0x02c0, 0x02c4, 0x02c8, 0x02cc, 0x02d0, 0x02d4, 0x02d8, + 0x02dc, 0x02e0, 0x02e4, 0x02e8, 0x02ec, 0x02f0, 0x02f4, 0x02f8, + 0x02fc, 0x0300, 0x0304, 0x0308, 0x030c, 0x0310, 0x0314, 0x0318, + 0x031c, 0x0320, 0x0324, 0x0328, 0x032c, 0x0330, 0x0334, 0x0338, + 0x033c, 0x0340, 0x0344, 0x0348, 0x034c, 0x0350, 0x0354, 0x0358, + 0x035c, 0x0360, 0x0364, 0x0368, 0x036c, 0x0370, 0x0374, 0x0378, + 0x037c, 0x0380, 0x0384, 0x0388, 0x038c, 0x0390, 0x0394, 0x0398, + 0x039c, 0x03a0, 0x03a4, 0x03a8, 0x03ac, 0x03b0, 0x03b4, 0x03b8, + 0x03bc, 0x03c0, 0x03c4, 0x03c8, 0x03cc, 0x03d0, 0x03d4, 0x03d8, + 0x03dc, 0x03e0, 0x03e4, 0x03e8, 0x03ec, 0x03f0, 0x03f4, 0x03f8, + 0x03fc, 0x0400, 0x0404, 0x0408, 0x040c, 0x0410, 0x0414, 0x0418, + 0x041c, 0x0420, 0x0424, 0x0428, 0x042c, 0x0430, 0x0434, 0x0438, + 0x043c, 0x0440, 0x0444, 0x0448, 0x044c, 0x0450, 0x0454, 0x0458, + 0x045c, 0x0460, 0x0464, 0x0468, 0x046c, 0x0470, 0x0474, 0x0478, + 0x047c, 0x0480, 0x0484, 0x0488, 0x048c, 0x0490, 0x0494, 0x0498, + 0x049c, 0x04a0, 0x04a4, 0x04a8, 0x04ac, 0x04b0, 0x04b4, 0x04b8, + 0x04bc, 0x04c0, 0x04c4, 0x04c8, 0x04cc, 0x04d0, 0x04d4, 0x04d8, + 0x04dc, 0x04e0, 0x04e4, 0x04e8, 0x04ec, 0x04f0, 0x04f4, 0x04f8, + 0x04fc + }, + { + 0x0282, 0x0282, 0x0284, 0x0284, 0x0286, 0x0286, 0x0288, 0x0288, + 0x028a, 0x028a, 0x028c, 0x028c, 0x028e, 0x028e, 0x0290, 0x0290, + 0x0292, 0x0292, 0x0294, 0x0294, 0x0296, 0x0296, 0x0298, 0x0298, + 0x029a, 0x029a, 0x029c, 0x029c, 0x029e, 0x029e, 0x02a0, 0x02a0, + 0x02a2, 0x02a2, 0x02a4, 0x02a4, 0x02a6, 0x02a6, 0x02a8, 0x02a8, + 0x02aa, 0x02aa, 0x02ac, 0x02ac, 0x02ae, 0x02ae, 0x02b0, 0x02b0, + 0x02b2, 0x02b2, 0x02b4, 0x02b4, 0x02b6, 0x02b6, 0x02b8, 0x02b8, + 0x02ba, 0x02ba, 0x02bc, 0x02bc, 0x02be, 0x02be, 0x02c0, 0x02c0, + 0x02c2, 0x02c2, 0x02c4, 0x02c4, 0x02c6, 0x02c6, 0x02c8, 0x02c8, + 0x02ca, 0x02ca, 0x02cc, 0x02cc, 0x02ce, 0x02ce, 0x02d0, 0x02d0, + 0x02d2, 0x02d2, 0x02d4, 0x02d4, 0x02d6, 0x02d6, 0x02d8, 0x02d8, + 0x02da, 0x02da, 0x02dc, 0x02dc, 0x02de, 0x02de, 0x02e0, 0x02e0, + 0x02e2, 0x02e2, 0x02e4, 0x02e4, 0x02e6, 0x02e6, 0x02e8, 0x02e8, + 0x02ea, 0x02ea, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x02f0, 0x02f0, + 0x02f2, 0x02f2, 0x02f4, 0x02f4, 0x02f6, 0x02f6, 0x02f8, 0x02f8, + 0x02fa, 0x02fa, 0x02fc, 0x02fc, 0x02fe, 0x02fe, 0x0300, 0x0300, + 0x0302, 0x0302, 0x0304, 0x0304, 0x0306, 0x0306, 0x0308, 0x0308, + 0x030a, 0x030a, 0x030c, 0x030c, 0x030e, 0x030e, 0x0310, 0x0310, + 0x0312, 0x0312, 0x0314, 0x0314, 0x0316, 0x0316, 0x0318, 0x0318, + 0x031a, 0x031a, 0x031c, 0x031c, 0x031e, 0x031e, 0x0320, 0x0320, + 0x0322, 0x0322, 0x0324, 0x0324, 0x0326, 0x0326, 0x0328, 0x0328, + 0x032a, 0x032a, 0x032c, 0x032c, 0x032e, 0x032e, 0x0330, 0x0330, + 0x0332, 0x0332, 0x0334, 0x0334, 0x0336, 0x0336, 0x0338, 0x0338, + 0x033a, 0x033a, 0x033c, 0x033c, 0x033e, 0x033e, 0x0340, 0x0340, + 0x0342, 0x0342, 0x0344, 0x0344, 0x0346, 0x0346, 0x0348, 0x0348, + 0x034a, 0x034a, 0x034c, 0x034c, 0x034e, 0x034e, 0x0350, 0x0350, + 0x0352, 0x0352, 0x0354, 0x0354, 0x0356, 0x0356, 0x0358, 0x0358, + 0x035a, 0x035a, 0x035c, 0x035c, 0x035e, 0x035e, 0x0360, 0x0360, + 0x0362, 0x0362, 0x0364, 0x0364, 0x0366, 0x0366, 0x0368, 0x0368, + 0x036a, 0x036a, 0x036c, 0x036c, 0x036e, 0x036e, 0x0370, 0x0370, + 0x0372, 0x0372, 0x0374, 0x0374, 0x0376, 0x0376, 0x0378, 0x0378, + 0x037a, 0x037a, 0x037c, 0x037c, 0x037e, 0x037e, 0x0380, 0x0380, + 0x0382, 0x0382, 0x0384, 0x0384, 0x0386, 0x0386, 0x0388, 0x0388, + 0x038a, 0x038a, 0x038c, 0x038c, 0x038e, 0x038e, 0x0390, 0x0390, + 0x0392, 0x0392, 0x0394, 0x0394, 0x0396, 0x0396, 0x0398, 0x0398, + 0x039a, 0x039a, 0x039c, 0x039c, 0x039e, 0x039e, 0x03a0, 0x03a0, + 0x03a2, 0x03a2, 0x03a4, 0x03a4, 0x03a6, 0x03a6, 0x03a8, 0x03a8, + 0x03aa, 0x03aa, 0x03ac, 0x03ac, 0x03ae, 0x03ae, 0x03b0, 0x03b0, + 0x03b2, 0x03b2, 0x03b4, 0x03b4, 0x03b6, 0x03b6, 0x03b8, 0x03b8, + 0x03ba, 0x03ba, 0x03bc, 0x03bc, 0x03be, 0x03be, 0x03c0, 0x03c0, + 0x03c2, 0x03c2, 0x03c4, 0x03c4, 0x03c6, 0x03c6, 0x03c8, 0x03c8, + 0x03ca, 0x03ca, 0x03cc, 0x03cc, 0x03ce, 0x03ce, 0x03d0, 0x03d0, + 0x03d2, 0x03d2, 0x03d4, 0x03d4, 0x03d6, 0x03d6, 0x03d8, 0x03d8, + 0x03da, 0x03da, 0x03dc, 0x03dc, 0x03de, 0x03de, 0x03e0, 0x03e0, + 0x03e2, 0x03e2, 0x03e4, 0x03e4, 0x03e6, 0x03e6, 0x03e8, 0x03e8, + 0x03ea, 0x03ea, 0x03ec, 0x03ec, 0x03ee, 0x03ee, 0x03f0, 0x03f0, + 0x03f2, 0x03f2, 0x03f4, 0x03f4, 0x03f6, 0x03f6, 0x03f8, 0x03f8, + 0x03fa, 0x03fa, 0x03fc, 0x03fc, 0x03fe, 0x03fe, 0x0400, 0x0400, + 0x0402, 0x0402, 0x0404, 0x0404, 0x0406, 0x0406, 0x0408, 0x0408, + 0x040a, 0x040a, 0x040c, 0x040c, 0x040e, 0x040e, 0x0410, 0x0410, + 0x0412, 0x0412, 0x0414, 0x0414, 0x0416, 0x0416, 0x0418, 0x0418, + 0x041a, 0x041a, 0x041c, 0x041c, 0x041e, 0x041e, 0x0420, 0x0420, + 0x0422, 0x0422, 0x0424, 0x0424, 0x0426, 0x0426, 0x0428, 0x0428, + 0x042a, 0x042a, 0x042c, 0x042c, 0x042e, 0x042e, 0x0430, 0x0430, + 0x0432, 0x0432, 0x0434, 0x0434, 0x0436, 0x0436, 0x0438, 0x0438, + 0x043a, 0x043a, 0x043c, 0x043c, 0x043e, 0x043e, 0x0440, 0x0440, + 0x0442, 0x0442, 0x0444, 0x0444, 0x0446, 0x0446, 0x0448, 0x0448, + 0x044a, 0x044a, 0x044c, 0x044c, 0x044e, 0x044e, 0x0450, 0x0450, + 0x0452, 0x0452, 0x0454, 0x0454, 0x0456, 0x0456, 0x0458, 0x0458, + 0x045a, 0x045a, 0x045c, 0x045c, 0x045e, 0x045e, 0x0460, 0x0460, + 0x0462, 0x0462, 0x0464, 0x0464, 0x0466, 0x0466, 0x0468, 0x0468, + 0x046a, 0x046a, 0x046c, 0x046c, 0x046e, 0x046e, 0x0470, 0x0470, + 0x0472, 0x0472, 0x0474, 0x0474, 0x0476, 0x0476, 0x0478, 0x0478, + 0x047a, 0x047a, 0x047c, 0x047c, 0x047e, 0x047e, 0x0480, 0x0480, + 0x0482, 0x0482, 0x0484, 0x0484, 0x0486, 0x0486, 0x0488, 0x0488, + 0x048a, 0x048a, 0x048c, 0x048c, 0x048e, 0x048e, 0x0490, 0x0490, + 0x0492, 0x0492, 0x0494, 0x0494, 0x0496, 0x0496, 0x0498, 0x0498, + 0x049a, 0x049a, 0x049c, 0x049c, 0x049e, 0x049e, 0x04a0, 0x04a0, + 0x04a2, 0x04a2, 0x04a4, 0x04a4, 0x04a6, 0x04a6, 0x04a8, 0x04a8, + 0x04aa, 0x04aa, 0x04ac, 0x04ac, 0x04ae, 0x04ae, 0x04b0, 0x04b0, + 0x04b2, 0x04b2, 0x04b4, 0x04b4, 0x04b6, 0x04b6, 0x04b8, 0x04b8, + 0x04ba, 0x04ba, 0x04bc, 0x04bc, 0x04be, 0x04be, 0x04c0, 0x04c0, + 0x04c2, 0x04c2, 0x04c4, 0x04c4, 0x04c6, 0x04c6, 0x04c8, 0x04c8, + 0x04ca, 0x04ca, 0x04cc, 0x04cc, 0x04ce, 0x04ce, 0x04d0, 0x04d0, + 0x04d2, 0x04d2, 0x04d4, 0x04d4, 0x04d6, 0x04d6, 0x04d8, 0x04d8, + 0x04da, 0x04da, 0x04dc, 0x04dc, 0x04de, 0x04de, 0x04e0, 0x04e0, + 0x04e2, 0x04e2, 0x04e4, 0x04e4, 0x04e6, 0x04e6, 0x04e8, 0x04e8, + 0x04ea, 0x04ea, 0x04ec, 0x04ec, 0x04ee, 0x04ee, 0x04f0, 0x04f0, + 0x04f2, 0x04f2, 0x04f4, 0x04f4, 0x04f6, 0x04f6, 0x04f8, 0x04f8, + 0x04fa, 0x04fa, 0x04fc, 0x04fc, 0x04fe, 0x04fe, 0x0500, 0x0500, + 0x0000 + }, + { + 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000a, 0x000c, 0x000e, + 0x0010, 0x0012, 0x0014, 0x0016, 0x0018, 0x001a, 0x001c, 0x001e, + 0x0020, 0x0022, 0x0024, 0x0026, 0x0028, 0x002a, 0x002c, 0x002e, + 0x0030, 0x0032, 0x0034, 0x0036, 0x0038, 0x003a, 0x003c, 0x003e, + 0x0040, 0x0042, 0x0044, 0x0046, 0x0048, 0x004a, 0x004c, 0x004e, + 0x0050, 0x0052, 0x0054, 0x0056, 0x0058, 0x005a, 0x005c, 0x005e, + 0x0060, 0x0062, 0x0064, 0x0066, 0x0068, 0x006a, 0x006c, 0x006e, + 0x0070, 0x0072, 0x0074, 0x0076, 0x0078, 0x007a, 0x007c, 0x007e, + 0x0080, 0x0082, 0x0084, 0x0086, 0x0088, 0x008a, 0x008c, 0x008e, + 0x0090, 0x0092, 0x0094, 0x0096, 0x0098, 0x009a, 0x009c, 0x009e, + 0x00a0, 0x00a2, 0x00a4, 0x00a6, 0x00a8, 0x00aa, 0x00ac, 0x00ae, + 0x00b0, 0x00b2, 0x00b4, 0x00b6, 0x00b8, 0x00ba, 0x00bc, 0x00be, + 0x00c0, 0x00c2, 0x00c4, 0x00c6, 0x00c8, 0x00ca, 0x00cc, 0x00ce, + 0x00d0, 0x00d2, 0x00d4, 0x00d6, 0x00d8, 0x00da, 0x00dc, 0x00de, + 0x00e0, 0x00e2, 0x00e4, 0x00e6, 0x00e8, 0x00ea, 0x00ec, 0x00ee, + 0x00f0, 0x00f2, 0x00f4, 0x00f6, 0x00f8, 0x00fa, 0x00fc, 0x00fe, + 0x0100, 0x0102, 0x0104, 0x0106, 0x0108, 0x010a, 0x010c, 0x010e, + 0x0110, 0x0112, 0x0114, 0x0116, 0x0118, 0x011a, 0x011c, 0x011e, + 0x0120, 0x0122, 0x0124, 0x0126, 0x0128, 0x012a, 0x012c, 0x012e, + 0x0130, 0x0132, 0x0134, 0x0136, 0x0138, 0x013a, 0x013c, 0x013e, + 0x0140, 0x0142, 0x0144, 0x0146, 0x0148, 0x014a, 0x014c, 0x014e, + 0x0150, 0x0152, 0x0154, 0x0156, 0x0158, 0x015a, 0x015c, 0x015e, + 0x0160, 0x0162, 0x0164, 0x0166, 0x0168, 0x016a, 0x016c, 0x016e, + 0x0170, 0x0172, 0x0174, 0x0176, 0x0178, 0x017a, 0x017c, 0x017e, + 0x0180, 0x0182, 0x0184, 0x0186, 0x0188, 0x018a, 0x018c, 0x018e, + 0x0190, 0x0192, 0x0194, 0x0196, 0x0198, 0x019a, 0x019c, 0x019e, + 0x01a0, 0x01a2, 0x01a4, 0x01a6, 0x01a8, 0x01aa, 0x01ac, 0x01ae, + 0x01b0, 0x01b2, 0x01b4, 0x01b6, 0x01b8, 0x01ba, 0x01bc, 0x01be, + 0x01c0, 0x01c2, 0x01c4, 0x01c6, 0x01c8, 0x01ca, 0x01cc, 0x01ce, + 0x01d0, 0x01d2, 0x01d4, 0x01d6, 0x01d8, 0x01da, 0x01dc, 0x01de, + 0x01e0, 0x01e2, 0x01e4, 0x01e6, 0x01e8, 0x01ea, 0x01ec, 0x01ee, + 0x01f0, 0x01f2, 0x01f4, 0x01f6, 0x01f8, 0x01fa, 0x01fc, 0x01fe, + 0x0200, 0x0202, 0x0204, 0x0206, 0x0208, 0x020a, 0x020c, 0x020e, + 0x0210, 0x0212, 0x0214, 0x0216, 0x0218, 0x021a, 0x021c, 0x021e, + 0x0220, 0x0222, 0x0224, 0x0226, 0x0228, 0x022a, 0x022c, 0x022e, + 0x0230, 0x0232, 0x0234, 0x0236, 0x0238, 0x023a, 0x023c, 0x023e, + 0x0240, 0x0242, 0x0244, 0x0246, 0x0248, 0x024a, 0x024c, 0x024e, + 0x0250, 0x0252, 0x0254, 0x0256, 0x0258, 0x025a, 0x025c, 0x025e, + 0x0260, 0x0262, 0x0264, 0x0266, 0x0268, 0x026a, 0x026c, 0x026e, + 0x0270, 0x0272, 0x0274, 0x0276, 0x0278, 0x027a, 0x027c, 0x027e, + 0x0280, 0x0000 + } +}; + +ctabs gtables; + +static void cfcn_45511b(size_t i) +{ + uint16_t ax, cx, tmp; + uint16_t ebx = gtables.tab4[i]; + do { + gtables.tab1[ebx / 2]++; + ax = gtables.tab1[ebx / 2]; + if (ax <= gtables.tab1[ebx / 2 + 1]) { + ebx = gtables.tab3[ebx / 2]; + if (ebx) + continue; + else + break; + } + + uint16_t *edi = >ables.tab1[ebx / 2 + 1]; + + uint16_t t = ax - 1; + for (int i = 0; i < 642; i++) { + if (*edi != t) + break; + edi++; + } + + size_t _edi = (void*)edi - (void*)>ables.tab1[1]; + + tmp = ax; + ax = gtables.tab1[_edi / 2]; + gtables.tab1[_edi / 2] = tmp; + gtables.tab1[ebx / 2] = ax; + + ax = gtables.tab2[ebx / 2]; + cx = gtables.tab2[_edi / 2]; + gtables.tab3[cx / 2] = ebx; + if (cx < 0x502) { + gtables.tab3[cx / 2 + 1] = ebx; + } + + gtables.tab3[ax / 2] = _edi; + if (ax < 0x502) { + gtables.tab3[ax / 2 + 1] = _edi; + } + gtables.tab2[ebx / 2] = cx; + gtables.tab2[_edi / 2] = ax; + ebx = gtables.tab3[_edi / 2]; + } while (ebx); +} + +static void cfcn_004550cc() +{ + for (size_t i = 0; i < 321; i++) { + uint16_t cx = gtables.tab4[i]; + if (gtables.tab1[cx/2] & 1) { + cfcn_45511b(i); + } + } + + for (size_t i = 0; i < 641; i++) + gtables.tab1[i] >>= 1; +} + +static void cfcn_00455109(size_t i) +{ + if (gtables.tab1[640] == 0x8000) { + cfcn_004550cc(); + } + cfcn_45511b(i); +} + +static void cfcn_004551bb(const void *s, uint32_t *ecx, uint32_t *ebx) +{ + uint16_t bx = 640; + uint32_t _c = *ecx; + + while (1) { + bx = gtables.tab2[bx] / 2; + + if (bx >= 641) + break; + + if (((const char*)s)[_c / 8] & (1 << (_c % 8))) + bx++; + _c++; + } + *ecx = _c; + + bx -= 641; + cfcn_00455109(bx); + *ebx = bx; +} + +void mkf_decompress(void *arg1, const void *src) +{ + uint32_t bx; + uint32_t eax, ecx; + + memcpy(>ables, &ctab_orig, sizeof(gtables)); + ecx = 0; + char *edi = arg1; + + while (1) { + cfcn_004551bb(src, &ecx, &bx); + if ((bx & 0xff00) == 0) { + *edi = bx & 0xff; + edi++; + continue; + } + eax = ecx; + uint32_t old_ecx = ecx; + eax >>= 3; + ecx &= 7; + eax = *(uint32_t*)(src + eax); + eax >>= ecx; + size_t ebp = eax & 0xff; + uint8_t cl = table_483530[ebp]; + uint8_t dh = table_483430[ebp]; + eax >>= cl; + uint8_t dl = eax << 2; + uint16_t dx = (((uint16_t)dh << 8) | dl) >> 2; + cl += 6; + eax = cl; + ecx = old_ecx + eax; + if (dx == 0xfff) + return; + + bx -= 0xfd; + + char *s = edi - 1 - dx; + /* note that it's not memcpy/memmove!! */ + for (size_t i = 0; i < bx; i++) { + *edi = *s; + edi++; + s++; + } + } +} diff --git a/csrc/mkf/test/Data.mkf.sha1 b/csrc/mkf/test/Data.mkf.sha1 new file mode 100644 index 0000000..33fb946 --- /dev/null +++ b/csrc/mkf/test/Data.mkf.sha1 @@ -0,0 +1 @@ +639dab8f896ea1d18bfda5309a4c7e0d7a990254 Data.mkf diff --git a/csrc/mkf/test/dump_data.c b/csrc/mkf/test/dump_data.c new file mode 100644 index 0000000..2f19dd8 --- /dev/null +++ b/csrc/mkf/test/dump_data.c @@ -0,0 +1,42 @@ +/* gcc -m32 -DMKF_INFO=1 -I.. dump_data.c ../mkf.c ../mkf_decompress.c -o dump_data */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "mkf.h" + +struct mkf +{ + FILE *handle; + void *data; +}; +int pixel_fmt = 1; +extern struct mkf mkf_stdata[]; +int mkf_nchunks(int idx); + +int main(int argc, char *argv[]) +{ + int mkf = load_mkf("Data.mkf"); + FILE *fp = mkf_stdata[mkf].handle; + int nchunks = mkf_nchunks(mkf); + int dump_smp = 1; + if (argc >= 2 && strcmp(argv[1], "--no-smp-spr") == 0) + dump_smp = 0; + + for (int i = 0; i < nchunks; i++) { + int sz; + char *data = read_mkf(mkf, i, NULL, &sz); + if ((strcmp(data, "SMP") == 0 || strcmp(data, "SPR") == 0) + && !dump_smp) { + free(data); + continue; + } + char fn[16]; + sprintf(fn, "%03d.data", i); + FILE *fp = fopen(fn, "wb"); + fwrite(data, 1, sz, fp); + fclose(fp); + free(data); + } + unload_mkf(mkf); +} diff --git a/csrc/mkf/test/mkfdata.sha1 b/csrc/mkf/test/mkfdata.sha1 new file mode 100644 index 0000000..39cb212 --- /dev/null +++ b/csrc/mkf/test/mkfdata.sha1 @@ -0,0 +1,303 @@ +c35c61899a891853ebb6c0b4879b129fff61655b 004.data +25dd6d1b0ec6d83a20ea5115ddeca4842e0ee608 005.data +267642401fc295a91f292d46608815fc857f1133 006.data +4a7cbfd681dbb43c10f33c36d594b171113f2f0d 007.data +36cc033d8c04bb896c0818adb51dee568929f2d1 008.data +ccc85ccbd3ed03421de6f9b648026ada4573e7d2 009.data +69429c6bd3806a1197540a2250ccb430e3ad53ab 010.data +76f81f7c64d0ec1fd09af279a9edb0a3d388c2b9 011.data +6fccc68ff6e520c303515364c120d5cc83a91512 012.data +e61cc655dbfbb5afb2fa4c4e6c61dd1ac94b2612 013.data +4857dd7256a843ed7a1cb750de9f0ea2e15a6656 014.data +fdecf73c040b54c6cd56dbd23ad1843cac39108a 015.data +5770d5c1a14276dca544a9cabbf5e852545c7fac 016.data +847e8a250e317658093bb546eaa4c97478e64c93 017.data +eb0c03f7cde4c94669e2a49e105d2ea558f434f4 018.data +493b57f1c1e9b0ab4787bb7c770c6a13ff73628e 019.data +6a6ffc48a344fb7cd36f6d8dcd4b8198d60c5764 020.data +8345c9830063c146914223f923a13c1d35e9ba14 021.data +8627e02a0149d3898164d6de9a712f8963bcd545 022.data +ffbc613bfdcc4a6ea41c730518a5d533bc8acbb4 023.data +19c1adaf4bd4e1db7f551d6e068b88fe1a051112 024.data +0f97034f7d9912f31d113094e9fed3cbc0268061 025.data +fcd8d7e1467015a948ac80c29837e822efb1d406 026.data +b2dd2fdb70298b0ee27d44563b61f538be32b931 027.data +c35c61899a891853ebb6c0b4879b129fff61655b 028.data +25dd6d1b0ec6d83a20ea5115ddeca4842e0ee608 029.data +8edc0589ba4b022375cfc1582bfae4f29f73d23b 030.data +ccc85ccbd3ed03421de6f9b648026ada4573e7d2 031.data +267642401fc295a91f292d46608815fc857f1133 032.data +c3af10f84e140b43eead49d1a7303f66caf2bb5a 033.data +ac631919fa7764df01b104a2ab9a37456e1f1a00 034.data +3851990d49268b03c4145511c68638d3093f6440 035.data +d5ee0d7dd7c76b0a1f84160a39cb59b0b71f89ab 036.data +2349b217088db8adeeae9f793226ecd355948034 037.data +493b57f1c1e9b0ab4787bb7c770c6a13ff73628e 038.data +6a6ffc48a344fb7cd36f6d8dcd4b8198d60c5764 039.data +8345c9830063c146914223f923a13c1d35e9ba14 040.data +8627e02a0149d3898164d6de9a712f8963bcd545 041.data +ffbc613bfdcc4a6ea41c730518a5d533bc8acbb4 042.data +19c1adaf4bd4e1db7f551d6e068b88fe1a051112 043.data +df466aa5632639f5a37fe2b329acdb5022703788 044.data +fcd8d7e1467015a948ac80c29837e822efb1d406 045.data +2422ff83f5441298f0acfaa407ae35d058569592 046.data +4b4ad990bad016d65a4a54dfb5ffbff69214fc72 047.data +8d46388faa1881eab52e97f80f722408a9b6af0a 048.data +6377fea28c27dbbc7b4f7ca321dcfbb0e610f0a0 049.data +0b2771b946e575d5647909e498b689f863ddcd85 050.data +1f318f27eeb843455a4816f5e1d1b966d29692ca 051.data +25dd6d1b0ec6d83a20ea5115ddeca4842e0ee608 052.data +3930b9d692a8ab0f149f734ebcb71509e615b76d 053.data +344636df9c5de093258d68866206c8b9edcb92eb 054.data +cba0f73cb516e900da7518f19547b161bcecb04f 055.data +80149619bdec4dcab4b8385e3743a02c268a08cd 056.data +3d6de0e4955d91cd76cb513ef44aa7cd6f94e4eb 057.data +8582d03787649e65aecc815921db8162d4a6e2e2 058.data +feaa0cfde2060d6ed65aae77b81531b36b61d7b6 059.data +cc8a8650da63eeab15bb45374aacba44d7cfd0e7 060.data +84e4b45ae15c08807331f6f388e55e4588626b66 061.data +9ab5dfd87bf133f1bb66fb2db66da7c3acaab6c0 062.data +2cb7c98757df01d8c28859c5a8694f204b9106b3 063.data +0d116c379820b4ccf5805af69a938c810effba98 064.data +cb81a695e8d59217227b0079bd9062bbc3f37828 065.data +a19a943ea75926cf316853f7321baa2def056633 066.data +0795e54fa61ecedf04db42cd3a401bf3f3e39c2d 067.data +869eb60fa0ec7d4c1b419b6b218a2be93adfe751 068.data +fe575e06b11406245c97ea3ac41283888450cf96 069.data +5d51c238554f7e97b03645218e7d42c4d0f12beb 070.data +dd2a249d92edfdf4d87f5bef2512a86479e9ec68 071.data +20c3f8eb002923995e084299ca434d59a9e1564a 072.data +1b6c5fc41c873a841b209c6072d8bcd09071347d 073.data +aae08f938e4b8325261fd6cf236d28321408424c 074.data +966cdced2039b7933095833282718f73ae256309 075.data +1daa8f3f2e69cbef090022849016106c2f4fabe5 076.data +8aac705fa6a30fc83536387d992e8874c8c7d811 077.data +ab5e3b68ac761cae784dab64a134fb430847be5a 078.data +e5a4fbf12a9bce7e91b8fcbc2e3d0d60d9d7de9a 079.data +5f69a608efbfcd95d7046f2fa3c5b3c93917c90e 080.data +1a6bb0ee2475cdc49f29fbb12673d8d5dc9c3e0b 081.data +9ab6b3c52bb2af37c594ae9e9d6207e520119d4c 082.data +a3bdbc0e9f462685461918e320a6ae5587f2e0eb 083.data +33ca51ead6cba7eebabde103cc30ead6b5cf6be5 084.data +258bb12b5cd12e51ec8de61d9730391024c80553 085.data +67bb53190a0b798e23ad0a8739cf0d675b84109e 086.data +539f170703e0691af77520db5675362a1d18e06c 087.data +d5950791b3b1c86afd57868142a15a7ab3da299c 088.data +16cc09e3510d1acb822d36c471032e392fd18756 089.data +386bd7364f8b7534af4c7ea8ebe6c6db091361a3 090.data +cb95226bd4d4892289f86fcdca9d075726ae87cc 091.data +04ea899855fa223721d9a0bc142339b5db64f267 092.data +b4dbff100f6948a87889a7642c29825c437bf7a4 093.data +8aa050c5ffc699bd164602ffb80b57e4426ce967 094.data +0a505e7e34293e0027a7360dff1ba53899153b1c 095.data +a990622958441649e021c87be2cfc9ef993a64a0 096.data +2f18e8b2455fbfbb2b9979ae5e1924389fe271a5 097.data +8d642c413db004a8aa4551f28e8db4c3aaaafaa3 098.data +8d642c413db004a8aa4551f28e8db4c3aaaafaa3 099.data +8d642c413db004a8aa4551f28e8db4c3aaaafaa3 100.data +8d642c413db004a8aa4551f28e8db4c3aaaafaa3 101.data +8d642c413db004a8aa4551f28e8db4c3aaaafaa3 102.data +8d642c413db004a8aa4551f28e8db4c3aaaafaa3 103.data +8d642c413db004a8aa4551f28e8db4c3aaaafaa3 104.data +9f868b92077ba48899d7407232c5495b0abeb492 105.data +b04dabef93698befaff753ec13ae943f78223c84 106.data +eb7e85ad62fc6210d9db56d72277a62e0281c330 107.data +8e063764b5205c8cbeb01d2bc528625180e66b02 108.data +734cf802bb212946b4243db6c32d1a7d1768c1c5 109.data +ea93de577476188d533058223eb652caedd2814d 110.data +78016f24ac59374e0544feaef65d209bef7c3501 111.data +fb6e5a4f42cea6fc6561516dfc0f85c011f83783 112.data +63da7d7f98af5f895493780077862f5fd4fa19fe 113.data +0821cfd004b955f14f1bb649dc69abb275df2174 114.data +6f176b82bfdc8818d91d7006c765e39c5ff1a051 115.data +cc13ab589a081b92674e1fdcb65230054c45ae25 116.data +0396b341e60ccb6b37a0808813eeec1354459aa6 117.data +0795e54fa61ecedf04db42cd3a401bf3f3e39c2d 118.data +a047ad4e167808fc22978b798d3f4bdf3536b50e 119.data +b4442ba7619a79161df2a71b93d81de4b0b79076 120.data +aae08f938e4b8325261fd6cf236d28321408424c 121.data +69b00983eec76cc9c52ffdf16ae55a9c868cfae9 122.data +f3a90a6f95aa231145d16e75747b94af334f335a 123.data +d5d801531d52017040b29dc49d1a10569703d04a 124.data +b7bd6eb6a7090eb19a79eef2f8f47ff27c7a16af 125.data +ed3f5c32c56209387c1dc2daf515b344eeb2e1ec 126.data +5d6fd09e4e83846c2ef0401e6dd66de08decf59e 127.data +8e96755fe06898b8006e32828590d1c85c3bfbb5 416.data +9458ba3184dc433d35b332a66a1b9fede8aad8ee 417.data +cd051cc112da67886e0a57a0c4bed6ab4c68b9ac 418.data +cb0d9691c888a718b2717142952fb5be6f1c031d 419.data +d0b13c5e92dabb9728a09788d50c596a684decb4 420.data +44048a1857328aa0e49a6a5ec3014ff21adda307 421.data +afb67823fb8b53c032f3baa5e50d66ea5e3c93e1 422.data +9efc2dfb3a8ba5d8c442906dc163daad903ed64c 423.data +12a95e23383fc765d3964d300dff497a4f760bdb 424.data +def85b3231e3cf6da8bace2c119b13e16a813f44 425.data +1ae30dbf751349800567a8d3abd41a9009a13cd5 426.data +0a0c9b863272551ddee0dd97350c79fe46e34401 427.data +94c349c8a2a4c9ffe8a13cf2b26088264b8a15bd 428.data +c37d96cc91120ff50540d5161b39ae718e975970 429.data +ad61109819a7017a4710a7478f4a013f8196202c 430.data +535045739a10a63385b390a4f381be76f85194ab 431.data +67fb15d37a011db6ba980dab69f84194b0c4564c 432.data +51ad07b31da132d512327789fb79121f1c0b6190 433.data +e579b04a1e223ab6bc9f64ab05e365935c3caf2c 434.data +f639428846d0434fe25ca310166f69a405f0d605 435.data +5ca244058f6fed742e595fbf5aa5108527b187f6 436.data +3245daba4c0bcdfd0c75ab4b33a26ffb04200e2a 437.data +d1fa044e9910efa3797145e6d54ebc9a6c2e777b 438.data +c191f4851cdc6ebef48daf5dc7f02a90d133efb8 439.data +15073cccea27e27baf1787f45fb9d75753e218de 441.data +ed2814aeb35dd39538dee546c0aba81a1eebfbfc 442.data +7dbedfc9fb950a37a471d28673edc71f36edf6c7 443.data +026defb436396a7b094f88af20b293bbbbd87165 444.data +bfe8f8973ca17485e6c7bb7d6f75c6766e7c445b 445.data +2e913f2894ff712c2573432538d3aa2284e4a6d0 446.data +69e62129540c6fb8953fa2514d6e86219905cc8a 447.data +52f5476a577807a82e9d821466ca37b34565ba5e 448.data +8aaadd084c787310898cafa9de99f68830dfd94d 449.data +46f2172753416b142dff1b6e021e58ea664e18e8 450.data +e94fb8e2b2ced2b3e49dfe775d3460f08c56ed1d 451.data +662ba7c3cef541f80a8be1702a1bc138e2d7ca4f 452.data +13d0c437e937340c3d8166faaace02c90b991348 453.data +d59293f36b19432e12e6127f84300e85efb288ae 454.data +e9bf2616597f77d291c42ee62451212531b6ad14 455.data +918ec7a78492060cc87c2bd748ccae301303f64a 456.data +3100d2093e2f58d271c3edb6128825595768191a 457.data +59e7edae0e0f4ba46c5bf1b0589eddc670892193 458.data +f8839fc7062c4ee0f2ec81012c7df901119d020a 459.data +4378f633244a149c985c9404ed289dd5de3e48af 460.data +d63b6f813c8517066e4ad6c44bf2ec661264b861 461.data +b712a3be6c01a3e761013ded365bcefa213fac54 462.data +8d959cbc5c469e22daa21ef362ea8cd23671a405 463.data +18534405062b25ccc5d407b954ce5e68e8305b92 464.data +55cebf6aa06b56c0ed3490d62a84f287bf45d9ba 465.data +86d1a65a1049271e75bc6dd1ef94afc30140b173 466.data +f51d7b53601e7b3b7c6caa1f556c96a8052da98d 467.data +f51d7b53601e7b3b7c6caa1f556c96a8052da98d 468.data +38cf0bda7c29a199e9fcbd4c8dcd72d06696bcec 469.data +eb87a7149a0a1fe4c20519b2ddc42ddb20e93226 470.data +cd8dc28dc275ac771a32f044ad8665200fe1b669 471.data +c63c6f76c1502fbc9c5f773b422b6c772a33e491 472.data +28a0d658a2094ee8d2c9d6208e85a7a7a00d870f 473.data +e0bd42c36f23d98c5d62e04b6cb94c3955dbf623 474.data +5b65bdc19c2b20803aedb7b81319d92689cc5fae 475.data +a59fb35797052405b2f12a41d8389a52f60c74f3 476.data +683464fd60913153b2cc1755ab772ad8245dbeff 477.data +2de33350155277a28041452ba681665d1fd9328f 478.data +d16d77f1d388052a98a1f32fbf602571e2ae56fe 479.data +265ba5a158e95b6a1ef11f5cc08e2bb450fa7b10 480.data +0de35c3658357a871e0afc81012206a3a4da2bba 481.data +e7b4236bfa1669c87687810708db7bfe8184dd75 482.data +3c81e3d6a5cfea35ebc36e39d6398daf835d5f5a 483.data +965140a23a0d8920e2283a4f08650702af267969 484.data +6aa0f197716319dd1da981884bf4392c5840d43b 485.data +db29a06e69459ffb0dcb118a93c4763de292ef19 486.data +2b5cacac56baaa597f397b82be972b1ca10d400e 487.data +68a3e49db47842ee0b383951c48ce667e570507b 488.data +58a3dd47af4e13ec3377f5adc4b7e82b195b9778 489.data +72c8e746b61a35aa3764172ba731c1871ff91055 490.data +4657165cc3cc10849e48b8a0a926a8049fbc8311 491.data +b149b9cd2dde7d4a4301fb1e47ad23ca3167aaa7 492.data +b64372bdbef14568e4dc80dd306c4038444fe811 493.data +2a46d6fa3c8a358c82a5b4413280bcf5c5ae61aa 494.data +c7a87c1b3f67153db26d2a35e0d07fb965d1cee4 495.data +4f49992f5c893bd596dd8ecab6625a5c416b1f7c 496.data +1e4b027c9488754f71ee2154b6be6f7c552200f7 497.data +5009931d736d29e45f9bd0dcdd098fd31c29f31b 498.data +6d16fd9a8305db5e2ace7088a79e0b18e7829345 499.data +6c18ddecd99f53577fa55f46d6b4617b863667fa 500.data +29ff3cd3b02b724c792c9cfbd898c1c43e4c9ee2 501.data +e141923a31e7a7aa513d1c201330002362721e30 502.data +c95678b548356ff15abe76189bc48850737ce1f2 503.data +7818a94716c82914965f192ab26b4faff4853687 504.data +ee3f623338f0402fb9468ecf78b4f5d4380cf1be 505.data +8cc7a03e59018013b618005f98a92bd153cc2299 506.data +bdabce9b1096016e67a956b4e3d0468ea92ab58d 507.data +a1d5f17de7d18cfb5192c7c71d3b58e386971fcf 508.data +2c3db8b1c27e06300cc7c76caf9638195adb996d 509.data +836c11ebc296de65eee4381e72c9b24c4d0d8a6d 510.data +20cb6d5c0224de7ebe4d8ed4387a0462e717a02d 511.data +7e214a1f197695827f2023a8448bb659c662c978 512.data +a1351ad8ba6d3e27e4b0bcbf3d65d77ec19587da 513.data +97ddc183c7c898f9ea547c3b39016921ca4c4093 514.data +04c51de123522f307abb9b21e9fc7c765386b924 515.data +8ece5a0601a97dc44bdc899ab1fa9357c0d3f52b 516.data +a656d23722af37b3f23770c8217939d1d7280e74 523.data +5eace6573d947d05bec3259a273b21974d0bead3 524.data +274f4450bd27f0bc69d8509c202d31463f253e7f 525.data +f4bf86489d531345ffc41d94592f507817bbe999 526.data +e15b687f252d0664220be773cb8767315849c21f 527.data +314f0c095d12759649c702d8142c7c77dd391445 528.data +4ed1ee8500b0681d392e76e6ca1f929d927385cc 529.data +7a7ebe70e5e96e04271db753b1723110c0860c99 530.data +ffb17ffa026dfc0778e933700e5c8ecdcf7c8815 531.data +d2444f59f38658630d851c4029fab189f7ae5a9a 532.data +8b5797d11d6b0f7d6f80cac859243d90f657e351 533.data +5c8b2b29ef020e188bed632d91b66f9566a26c6b 534.data +8ed4f99d49edaa5adc2419c6c62b430004cb5409 535.data +d3a11a43fe8fe299fd9148b8c3947e63c7641778 536.data +87433826647283eacf209170fae61edc46dc520b 537.data +7b4ebc63b201b37714ea9a203d2fce362cb08f20 538.data +bb017738fe0bec6039e9eae563e441da00013cd9 539.data +5f47e30d36c300f4c8d9e579dda7c620b2c58782 540.data +53f6da1309aa500496e21cbbfb845ed40121ee39 541.data +b15eb0142565e6fa224fbc9d1b832d5ff48b6a6c 542.data +2f098024fe3ef68e259e094c76272ac16040db3b 543.data +3e2a313f4a056249f5ec05e5f28374eb568327b4 544.data +c5d6d3f773e77ef9d5f9247694cc60e758618431 545.data +5dfc09ef2be4764f4e66d57f26a38293c851202d 546.data +dccfb1b053a1181940f2f91e30ad7f9e53fed5a2 547.data +8f2466b3f16816a4849ab30a2829c487da358755 548.data +db6fae4677a93f05583acfdef99ee62905712a76 549.data +ce47134a1d9fe42a7ab6d92c04f2284b6f191177 550.data +58b3661a88424496463d1fcaf71b796d3e47fe87 551.data +9eb2a9f3afecc891b3faacf68e0cde3420b61013 552.data +ed35c2de37af93462111d9b1ec75ca255436e0a5 553.data +6a80d7b5c6b87b43b5ccffdcf81841440c34e3e6 554.data +938237c8f1b7f0efa7b88bb02c40e67ac85c6fb8 555.data +30a515a913e499abdf3f1de6898298f44748bb30 556.data +a4495270591aeaaa509c9ab24f556be2b64e2662 557.data +bd80597a7be6cd33ab04c25fffcd200b4e2bf135 558.data +230a87d54cd16d0f7fbc08aceb15742b4aa50f5c 559.data +6d57460206ecc859bedb5538aeb0471116946692 560.data +6afcbcc696216829786e4cf84ca3e07216d1e717 561.data +0e84132f11a9d496591639e75c9da769702d2f3e 562.data +e09d0eae94ddc4e479cb3eddf4149c5e8783c4b3 563.data +14250afb90b6d182a048793524766e14c9c53662 564.data +17b0eb5386ee7c6b29e54e740204c182ca394394 565.data +3adfcadef8471c28ddaa67303aa05f90a0d299ce 566.data +231f108d5e0961d9a9efdf370a3795bcb16d9e50 567.data +40b1d9f5c267923b3a1abeea98f9bd95eb35befe 568.data +a3c784610d43e24b9f282ad11846a718cbe83a1f 569.data +e6d951406323f5d62c27b08b91ddaef7eb11e52e 570.data +b4a2b2d3220ce627b856d950d108ea746395dabc 571.data +d575946de6105fecc8f654766fb87269e38241e1 572.data +29c41531af52ed44e7d146276f485848949326c3 573.data +45d1815bd0814735e5af0b7acea5be1d2dedfa17 574.data +04d2d96c0bcf22a6711a9d3ff5bb3ad516abaaeb 575.data +5e58fa6523195fb11cd115950a2f39573d61933c 576.data +f275b98d35a81b11e7af9575036b1ddf437954be 577.data +dc4ade073439b02eb1e84ca15a212f6415031d15 578.data +f58258ac7aee50feda17d3c6e91103b8da7ab3d0 579.data +3c167f302b14e2600ed2b10bf1c315bd6b378400 580.data +6b004a88d07953599b83a656b1ea4dc6138de0b0 581.data +cd8446c07369371c0f48493b2ed2f8980f7f127b 582.data +29f5952f39098148e6fd867d5ba544615579b6f7 583.data +9305f38f8797c30d143dd0dc2037a8449b9f588c 584.data +348bad2c5aa072a3b20f4ff6d8f22bad10befdb0 585.data +1af88c57724a21481150fbfb2651b45c6497ab14 586.data +15a9e87f279aeac0aa5d504dcee8300e3629550b 587.data +cc866bc6a841dcbc9e21b612b7dfb2f474863945 588.data +1e470ab63c3c849f4474ea0c1606805be64fd67e 589.data +208bfe50ab4aa40bed335d0096efc228ec7ed561 590.data +27d0d7388d1c99b4222d940f3efc87bed2d5bdc9 591.data +6739eba9a0fa91f23cb89dd7eea13f8bcb0021fb 592.data +9c488b0654ab1db294c3546320d4d43a0f0f3ef0 593.data +c9088652f20fd495b47b2abe07578b36dcd501d1 594.data +92ecac7a79ef2cf22b393f23bfc35ef8c82af990 595.data +f1c78e211d540da12dffe281f9a0980d6c4bf1b4 596.data +1ec1d23e01150f52c4ef06ae2bd1dfdc1cca66e3 597.data +187f7ee1a3418282f7670cef0b510da4fdf33cdd 598.data +175bd011f9d18a30c7b270f75a75861c8ca66865 599.data +5f817c2d273b4f8ac1ea017515e70ef2f6abc7bb 600.data +c6d07561ef3975832c527183adf63cc829bbadc7 601.data diff --git a/csrc/mkf/test/parse_mkf.c b/csrc/mkf/test/parse_mkf.c new file mode 100644 index 0000000..1ff8130 --- /dev/null +++ b/csrc/mkf/test/parse_mkf.c @@ -0,0 +1,36 @@ +/* gcc -m32 -I.. -DMKF_INFO=1 parse_mkf.c ../mkf.c ../mkf_00455040.c -o parse_mkf */ + +#include <stdio.h> +#include <stdint.h> +#include "mkf.h" + +struct mkf +{ + FILE *handle; + void *data; +}; +int pixel_fmt = 1; +extern struct mkf mkf_stdata[]; +int mkf_nchunks(int idx); + +int main(int argc, char *argv[]) +{ + if (argc < 2) + return 1; + + int mkf = load_mkf(argv[1]); + FILE *fp = mkf_stdata[mkf].handle; + int nchunks = mkf_nchunks(mkf); + uint32_t *data = mkf_stdata[mkf].data; + + for (int i = 0; i < nchunks; i++) { + printf("chunk %d: offset = 0x%08x\n", i, data[i]); + fseek(fp, data[i], SEEK_SET); + uint32_t meta[4]; + fread(meta, 4, 4, fp); + printf("real size = %d, original size = %d, gdata offset = 0x%08x, gsize = %d\n", + meta[0], meta[1], meta[2], meta[3]); + } + + unload_mkf(mkf); +} diff --git a/csrc/mkf/test/runtest.sh b/csrc/mkf/test/runtest.sh new file mode 100755 index 0000000..a4252a8 --- /dev/null +++ b/csrc/mkf/test/runtest.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +TESTDIR=/tmp/rich4.test +mkdir -p ${TESTDIR} + +gcc -m32 -DMKF_INFO=1 -I.. dump_data.c ../mkf.c ../mkf_decompress.c -o dump_data + +if sha1sum -c Data.mkf.sha1 +then + cp Data.mkf dump_data mkfdata.sha1 ${TESTDIR} + cd ${TESTDIR} + ./dump_data --no-smp-spr + sha1sum -c mkfdata.sha1 +fi |