psp gfx scaling/etc stuff

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@279 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-10-25 19:39:40 +00:00
parent 3aa1e148a2
commit 8ab3e3c1cf
26 changed files with 567 additions and 321 deletions

43
tools/mkbgxx.c Normal file
View file

@ -0,0 +1,43 @@
#include <stdio.h>
#include <zlib.h>
static unsigned char buff[0x10140];
static unsigned char buff2[0x10140];
static void do_file(const char *ifn, const char *ofn)
{
FILE *fi, *fo;
int ret;
unsigned long dlen = sizeof(buff2);
fi = fopen(ifn, "rb");
if (!fi) return;
fseek(fi, 0x10020, SEEK_SET);
fread(buff, 1, 0x10000, fi);
fseek(fi, 0x2000, SEEK_CUR);
fread(buff + 0x10000, 1, 0x80*2, fi);
fseek(fi, 0x221a0, SEEK_SET);
fread(buff + 0x10100, 1, 0x40, fi);
fclose(fi);
ret = compress2(buff2, &dlen, buff, sizeof(buff), Z_BEST_COMPRESSION);
if (ret) { printf("compress2 failed with %i\n", ret); return; }
fo = fopen(ofn, "wb");
if (!fo) return;
fwrite(buff2, 1, dlen, fo);
fclose(fo);
printf("%s: %6i -> %6li\n", ofn, sizeof(buff), dlen);
}
int main(int argc, char *argv[])
{
if (argc != 3) return 1;
do_file(argv[1], "bg40.bin");
do_file(argv[2], "bg32.bin");
return 0;
}