Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <inttypes.h>
- struct fileheader
- {
- char ident[7];
- uint32_t offset1;
- uint32_t files;
- uint32_t unk;
- } __attribute__((packed));
- int main(int argc, char **argv)
- {
- FILE *fil = fopen(argv[1],"rb");
- fseek(fil,0,SEEK_END);
- uint32_t size = ftell(fil);
- fseek(fil,0,SEEK_SET);
- fileheader hed;
- fread(&hed,sizeof(fileheader),1,fil);
- int32_t tab_ptrs = size - hed.offset1;
- fseek(fil,tab_ptrs,SEEK_SET);
- int32_t ptrs_size;
- fread(&ptrs_size,4,1,fil);
- int32_t ptrs_count = (ptrs_size/4) - 1;
- int32_t *ptrstart = (int32_t *)malloc(ptrs_count * 4);
- int32_t *ptrsize = (int32_t *)malloc(ptrs_count * 4);
- fread(ptrsize,ptrs_count*4,1,fil);
- int32_t ptr_ = ptrs_size;
- for (int j=0;j<ptrs_count;j++)
- {
- ptrstart[j] = ptr_;
- ptr_ = ptrsize[j];
- ptrsize[j] -= ptrstart[j];
- }
- void *out=malloc(0x8000);
- for (int i=0; i<ptrs_count;i++)
- {
- fseek(fil,ptrstart[i],SEEK_SET);
- void *filbuf = malloc(ptrsize[i]);
- fread(filbuf,ptrsize[i],1,fil);
- //decode(filbuf,out); //decode block to 0x8000
- free(filbuf);
- }
- fclose(fil);
- return 0;
- }
Add Comment
Please, Sign In to add comment