SHARE
TWEET

EA IDX/BIG Extractor

Nicknine Dec 17th, 2018 (edited) 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Electronic Arts - IDX/BIG files, essentially a pack of HDR/DAT compiled into one file
  2.  
  3. open FDDE "IDX" 0
  4. open FDDE "BIG" 1
  5.  
  6. get DUMMY long
  7. endian guess DUMMY
  8. endian save CUR_ENDIAN
  9.  
  10. get SECTIONS long
  11. goto 0x50
  12. get DUMMY long
  13. get SECTIONS long
  14. get BNAME basename
  15.  
  16. for i = 0 < SECTIONS
  17.     get HDR_IDX long
  18.     get HDR_SIZE long
  19.     get HDR_OFFSET long
  20.     get BASE_OFF long
  21.    
  22.     # Get HDR header.
  23.     log MEMORY_FILE HDR_OFFSET HDR_SIZE
  24.     get HASH short MEMORY_FILE
  25.     get SUBID short MEMORY_FILE
  26.     get USERDATA_SIZE byte MEMORY_FILE
  27.     math USERDATA_SIZE & 0x0F
  28.     get FILES byte MEMORY_FILE
  29.     get DUMMY byte MEMORY_FILE
  30.     get OFF_FLAG byte MEMORY_FILE
  31.    
  32.     xmath OFF_MULT "OFF_FLAG * 0x0100 + 0x0100"
  33.     goto 0x0C MEMORY_FILE
  34.    
  35.     if SUBID != 0xFFFF
  36.         string PATH p "%04x/%02d" HASH SUBID
  37.     else
  38.         string PATH p "%04x" HASH
  39.     endif
  40.    
  41.     set NAME PATH
  42.     string NAME + ".hdr"
  43.     log NAME HDR_OFFSET HDR_SIZE
  44.     set TOTAL_SIZE long 0
  45.     endian big
  46.    
  47.     for j = 0 < FILES
  48.         get OFFSET short MEMORY_FILE
  49.         goto USERDATA_SIZE MEMORY_FILE SEEK_CUR
  50.         math OFFSET * OFF_MULT
  51.         math OFFSET + BASE_OFF
  52.         goto OFFSET 1
  53.        
  54.         # Find SCEl block (end marker)
  55.         endian little
  56.         do
  57.             get BLOCKID long 1
  58.             get BLOCKSIZE long 1
  59.             math BLOCKSIZE - 8
  60.             goto BLOCKSIZE 1 SEEK_CUR
  61.         while BLOCKID != 0x6C454353 # SCEl
  62.         endian big
  63.        
  64.         padding OFF_MULT 1 BASE_OFF
  65.         savepos SIZE 1
  66.         math SIZE - OFFSET
  67.         math TOTAL_SIZE + SIZE
  68.     next j
  69.    
  70.     endian set CUR_ENDIAN
  71.    
  72.     set NAME PATH
  73.     string NAME + ".dat"
  74.     log NAME BASE_OFF TOTAL_SIZE 1
  75. next i
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top