Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void TheiDump(char *filename)
- {
- u32 npoints;
- int c;
- //get local path for further purposes
- _getcwd(path,500);
- if ((_chdir("Original")))
- {
- printf("Can't access ""Original"" directory. Make sure you know what the fuck you're doing\n");
- return;
- }
- printf("Creating list of file, please wait...\n");
- system("echo off");
- system("del /f /q list.txt");
- system("dir /s /A-D /B *.thei >> list.txt");
- printf("List created\n");
- list=fopen("list.txt","rb");
- CountFileNumber();
- printf("Founded %d files\n",num);
- _chdir("..");
- if (!(_chdir("OriginalDumps")))
- {
- printf("Cleaning up old dumps...it could take a while\n");
- _chdir("..");
- sprintf(command,"rd /s /q OriginalDumps\0",path);
- system(command);
- }
- _mkdir("OriginalDumps");
- _chdir("OriginalDumps");
- printf("Dump in progress. This WILL take a while so be patient\n");
- for (i=0; i<num; i++)
- {
- GString name;
- CBufferFile file;
- printf("\rDumping file %d on %d",i+1,num);
- x=origpoint[i]-ftell(list);
- fread(original,x,1,list);
- original[x]=0;
- name.Set(original,GString::type_ascii);
- file.StoreFile(name);
- u8* b=(u8*)file.GetBuffer();
- TRES_HEADER *h=(TRES_HEADER*)b;
- fseek(list,(long)strlen(path)+0x0A-x,SEEK_CUR);
- MakeDirTree();
- std::vector<u32> pointersoff;
- Disassemble(&b[h->evt],h->text - h->evt,npoints,file.GetSize() - h->text,pointersoff);
- for (c=0; c<(int)pointersoff.size(); c++)
- {
- u32 p=pointersoff[c];
- pointersoff[c]=((buffer[p]&3)<<16)|*((u16*)(&buffer[p+1]));
- }
- for (c=0; c<(int)pointersoff.size(); c++)
- {
- // dump here
- }
- fseek(list,2,SEEK_CUR);
- for (c=0; c<(int)numdir; c++) _chdir("..");
- }
- printf("\nDone. Enjoy it\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment