Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 21st, 2010 | Syntax: None | Size: 1.02 KB | Hits: 69 | Expires: Never
Copy text to clipboard
  1. #include <idc.idc>
  2. static main(void) {
  3.  
  4. auto i,j,x,s,index,path;
  5. auto addr,dref,section,action,file;
  6.  
  7. i = 0;
  8. addr = 0x94B8A;
  9. action=1;
  10.  
  11. file = fopen("splitmaps.txt","w");
  12.  
  13. while(addr!=0x94CC6&&action==1){
  14.         Jump(addr);
  15.        
  16.         dref = Dfirst(addr);
  17.        
  18.         Jump(dref);
  19.        
  20.         index = ltoa(i,10);
  21.         if(strlen(index)==1)index=form("0%s",index);
  22.        
  23.         MakeNameEx(dref,form("Map%s",index),0);
  24.         writestr(file,form("#dir\tmaps/map%s\n",index));
  25.         for(s=0;s!=10;s++){
  26.        
  27.                 section = Dfirst(dref+6+4*s);
  28.                 x = section+1;
  29.                 Message(form("\nsection%s, x%s ",ltoa(section,16),ltoa(x,16)));
  30.                 while(DfirstB(x)==-1){
  31.                         x++;
  32.                         //Message(form("x%s;",ltoa(x,16)));
  33.                 }
  34.                 MakeData(section,FF_BYTE,x-section,1);
  35.                 MakeNameEx(section,form("Map%sSection%d",index,s),0);
  36.                 SetManualInsn   (section, form("incbin \"maps/map%s/section%d.bin\"",index,s));
  37.                 writestr(file,form("#split\t0x%s,0x%s,maps/map%s/section%d.bin\n",ltoa(section,16),ltoa(x,16),index,s));
  38.                
  39.         }
  40.                
  41.         addr=addr+4;
  42.         i++;
  43.        
  44.         action = AskYN(1,"Ok ?");
  45. }
  46.  
  47. fclose(file);
  48.  
  49. }