4 static unsigned char buff[0x10140];
5 static unsigned char buff2[0x10140];
7 static void do_file(const char *ifn, const char *ofn)
11 unsigned long dlen = sizeof(buff2);
13 fi = fopen(ifn, "rb");
15 fseek(fi, 0x10020, SEEK_SET);
16 fread(buff, 1, 0x10000, fi);
17 fseek(fi, 0x2000, SEEK_CUR);
18 fread(buff + 0x10000, 1, 0x80*2, fi);
19 fseek(fi, 0x221a0, SEEK_SET);
20 fread(buff + 0x10100, 1, 0x40, fi);
23 ret = compress2(buff2, &dlen, buff, sizeof(buff), Z_BEST_COMPRESSION);
24 if (ret) { printf("compress2 failed with %i\n", ret); return; }
26 fo = fopen(ofn, "wb");
28 fwrite(buff2, 1, dlen, fo);
31 printf("%s: %6i -> %6li\n", ofn, sizeof(buff), dlen);
34 int main(int argc, char *argv[])
36 if (argc != 3) return 1;
38 do_file(argv[1], "bg40.bin");
39 do_file(argv[2], "bg32.bin");