Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update properties.

git-svn-id: svn+ssh://jay/var/svn/wolf/trunk@63 32837ae5-38f0-4cfd-8401-3ff76d8497c4
  • Loading branch information...
commit 3a5fb71342f0cef08373856db611a247603b47d1 1 parent 07599d1
paul authored
Showing with 70 additions and 0 deletions.
  1. +70 −0 build_pictable.c
View
70 build_pictable.c
@@ -0,0 +1,70 @@
+#include "wl_def.h"
+
+#include "huffman.h"
+
+void CAL_HuffExpand(const byte *source, byte *dest, long length,
+ const huffnode *htable)
+{
+ const huffnode *headptr;
+ const huffnode *nodeon;
+ byte mask = 0x01;
+ word path;
+ byte *endoff = dest + length;
+
+ nodeon = headptr = htable + 254;
+
+ do {
+ if (*source & mask)
+ path = 1;
+ else
+ path = 0;
+ mask <<= 1;
+ if (mask == 0x00) {
+ mask = 0x01;
+ source++;
+ }
+ if (path ? nodeon->flag1 : nodeon->flag0) {
+ nodeon = (htable + nodeon->val[path]);
+ } else {
+ *dest = nodeon->val[path];
+ dest++;
+ nodeon = headptr;
+ }
+ } while (dest != endoff);
+}
+
+int main()
+{
+ byte *source;
+ byte *p;
+ int start;
+ int end;
+ int i;
+ int size;
+ int compressed;
+ FILE *f = fopen("vgagraph.wl6", "rb");
+ if (!f)
+ return 1;
+
+ start = grstarts[STRUCTPIC];
+ compressed = grstarts[STRUCTPIC + 1] - start;
+ source = malloc(compressed);
+ fread(source, 1, compressed, f);
+ fclose(f);
+
+ size = source[0]|(source[1]<<8)|(source[2]<<16)|(source[3]<<24);
+ source += 4;
+
+ p = malloc(size);
+ CAL_HuffExpand(source, p, size, grhuffman);
+
+ printf("#include \"wl_def.h\"\n");
+ printf("const pictabletype pictable[%d] = {\n", size / 4);
+ for (i = 0; i < size / 4; i++)
+ {
+ printf("{%d,%d},\n", p[0] | (p[1] << 8), p[2] | (p[3] << 8));
+ p += 4;
+ }
+ printf("};\n");
+ return 0;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.