#include #include "rtv.h" u16 rtv_to_u16(unsigned char ** pp) { unsigned char * p; u16 r; p = *pp; r = *p++; r <<= 8; r |= *p++; *pp = p; return r; } u32 rtv_to_u32(unsigned char ** pp) { unsigned char * p; u32 r; p = *pp; r = rtv_to_u16(&p); r <<= 16; r |= rtv_to_u16(&p); *pp = p; return r; } char * typestr(u32 type) { static char buf[32]; switch(type) { case 0x10808: strcpy(buf, "BMP"); break; case 0x80820: strcpy(buf, "JPG"); break; case 0x200820: strcpy(buf, "BMX"); break; default: sprintf(buf, "Unknown %lx", type); break; } return buf; } int main(int argc, char ** argv) { FILE * fp; unsigned char buf[4096]; unsigned char * p; int i = 0; int numrecs, recsize; fp = fopen(argv[1], "r"); fread(buf, 4096, 1, fp); p = buf+8; numrecs = rtv_to_u32(&p); recsize = rtv_to_u32(&p); while (i < numrecs) { u32 start, length, width, height, type, unk2; must_be_0 = rtv_to_u32(&p); start = rtv_to_u32(&p); length = rtv_to_u32(&p); width = rtv_to_u32(&p); height = rtv_to_u32(&p); type = rtv_to_u32(&p); printf("%d\t%lx\t%4dx%4d\tfs=%5ld\ttype=%s\tunk2=%lx\n", i, start, width, height, length, typestr(type), must_be_0); i++; if (4096 - (p - buf) < recsize) { fread(buf, 4096, 1, fp); p = buf; } } }