Gemini

Untitled

Aug 8th, 2011
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.71 KB | None | 0 0
  1. void TheiDump(char *filename)
  2. {
  3.     u32 npoints;
  4.     int c;
  5.     //get local path for further purposes
  6.     _getcwd(path,500);
  7.  
  8.     if ((_chdir("Original")))
  9.     {
  10.         printf("Can't access ""Original"" directory. Make sure you know what the fuck you're doing\n");
  11.         return;
  12.     }
  13.  
  14.     printf("Creating list of file, please wait...\n");
  15.     system("echo off");
  16.     system("del /f /q list.txt");
  17.     system("dir /s /A-D /B *.thei >> list.txt");
  18.     printf("List created\n");
  19.     list=fopen("list.txt","rb");
  20.  
  21.     CountFileNumber();
  22.  
  23.     printf("Founded %d files\n",num);
  24.     _chdir("..");
  25.     if (!(_chdir("OriginalDumps")))
  26.     {
  27.         printf("Cleaning up old dumps...it could take a while\n");
  28.         _chdir("..");    
  29.         sprintf(command,"rd /s /q OriginalDumps\0",path);
  30.         system(command);
  31.     }
  32.  
  33.     _mkdir("OriginalDumps");
  34.     _chdir("OriginalDumps");
  35.     printf("Dump in progress. This WILL take a while so be patient\n");
  36.  
  37.     for (i=0; i<num; i++)
  38.     {
  39.         GString name;
  40.         CBufferFile file;
  41.  
  42.         printf("\rDumping file %d on %d",i+1,num);    
  43.         x=origpoint[i]-ftell(list);    
  44.         fread(original,x,1,list);
  45.         original[x]=0;
  46.         name.Set(original,GString::type_ascii);
  47.         file.StoreFile(name);
  48.         u8* b=(u8*)file.GetBuffer();
  49.         TRES_HEADER *h=(TRES_HEADER*)b;
  50.  
  51.         fseek(list,(long)strlen(path)+0x0A-x,SEEK_CUR);
  52.         MakeDirTree();
  53.  
  54.         std::vector<u32> pointersoff;
  55.         Disassemble(&b[h->evt],h->text - h->evt,npoints,file.GetSize() - h->text,pointersoff);
  56.  
  57.         for (c=0; c<(int)pointersoff.size(); c++)
  58.         {
  59.             u32 p=pointersoff[c];
  60.             pointersoff[c]=((buffer[p]&3)<<16)|*((u16*)(&buffer[p+1]));
  61.         }
  62.  
  63.         for (c=0; c<(int)pointersoff.size(); c++)
  64.         {
  65.             // dump here
  66.         }
  67.         fseek(list,2,SEEK_CUR);
  68.  
  69.         for (c=0; c<(int)numdir; c++) _chdir("..");  
  70.     }
  71.     printf("\nDone. Enjoy it\n");
  72. }
Advertisement
Add Comment
Please, Sign In to add comment