Need update to *.tor bms script

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Need update to *.tor bms script

Post by Acewell »

Chrrox posted this script on Xentax years ago to extract the files from the beta SWTOR tor archives but it errors out on line 16 with current tor files.
http://forum.xentax.com/viewtopic.php?p=57937#p57937

local copy of script

Code: Select all

goto 0xC
get ftable long
goto 0x18
get files long
goto ftable
for i = 0 < files
   get unk01 long
   get unk02 long
   get unk03 long
   get offset long
   get null01 long
   get null02 long
   get zsize long
   get size long
   get unk04 short
   clog "" offset zsize size
next i


here is a small tor sample to test the script
swtor_main_zed_1.zip


EasyMYP is what we normally use to extract the files from tor archives but some people aren't able to extract the gr2 model files with it any more for some reason and this is the only other solution to getting those files extracted.

Any help is appreciated! :D


edit
ok since chrrox says tor files are zlib compressed i figured offzip will work and i was able to extract 229 files from the sample like this
offzip.exe -a swtor_main_zed_1.tor C:\offzip\extracted_files 0

i'd still like to see that script work though :(
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Need update to *.tor bms script

Post by aluigi »

Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

SWTOR (*.tor)

Post by Acewell »

updated script based on a newer sample i have :)

Code: Select all

# Star Wars - The Old Republic MYP
# script for QuickBMS http://quickbms.aluigi.org

idstring "MYP\0"
get VERSION long
get UNK long
get TABLE_OFFSET longlong
get MAX_FILES_PER_TABLE long
get TOTAL_FILES long
goto TABLE_OFFSET
do
   get FILES long
   if FILES == 0
      break
   endif
   get NEXT_TABLE_OFF longlong
   for i = 0 < FILES
      get OFFSET longlong
      if OFFSET == 0
         break
      endif
      get HEADER_SZ long
      get ZSIZE long
      get SIZE long
      get NAME_HASH long
      get NAME_HASH2 long
      get DATA_HASH long
      get COMP_TYPE short
      savepos TMP
      goto OFFSET
      get DATA_TYPE short
      get DATA_OFF short
      goto DATA_OFF 0 SEEK_CUR
      savepos OFFSET
      string NAME p "%08x_%08x%08x.dat" DATA_HASH NAME_HASH2 NAME_HASH
      if COMP_TYPE == 0
         log NAME OFFSET SIZE
      else
         clog NAME OFFSET ZSIZE SIZE
      endif
      goto TMP
   next i
   goto NEXT_TABLE_OFF
while NEXT_TABLE_OFF != 0
Last edited by Acewell on Fri Feb 02, 2018 6:57 pm, edited 2 times in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Need update to *.tor bms script

Post by aluigi »

Cool
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Need update to *.tor bms script

Post by AlphaTwentyThree »

And here it is with a type identifier and subfolder integrated (needed script attached):

Code: Select all

include "func_getTYPE.bms"
get BNAME basename
idstring "MYP\0"
get VERSION long
get UNK long
get TABLE_OFFSET longlong
get MAX_FILES_PER_TABLE long
get TOTAL_FILES long
goto TABLE_OFFSET
do
   get FILES long
   if FILES == 0
      break
   endif
   get NEXT_TABLE_OFF longlong
   for i = 0 < FILES
      get OFFSET longlong
      if OFFSET == 0
         break
      endif
      get HEADER_SZ long
      get ZSIZE long
      get SIZE long
      get NAME_HASH long
      get NAME_HASH2 long
      get DATA_HASH long
      get COMP_TYPE short
      savepos TMP
      goto OFFSET
      get DATA_TYPE short
      get DATA_OFF short
      goto DATA_OFF 0 SEEK_CUR
      savepos OFFSET
      string NAME p "%s\%08x_%08x%08x" BNAME DATA_HASH NAME_HASH2 NAME_HASH
     putVarChr MEMORY_FILE SIZE 0
     log MEMORY_FILE 0 0
      if COMP_TYPE == 0
         log MEMORY_FILE OFFSET SIZE
      else
         clog MEMORY_FILE OFFSET ZSIZE SIZE
      endif
     callfunction getTYPE 1
     get SIZE asize MEMORY_FILE
     log NAME 0 SIZE MEMORY_FILE
      goto TMP
   next i
   goto NEXT_TABLE_OFF
while NEXT_TABLE_OFF != 0


Edit 10:17: more formats added to func_getTYPE.bms
Last edited by AlphaTwentyThree on Mon Jan 10, 2022 10:02 am, edited 2 times in total.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Need update to *.tor bms script

Post by AlphaTwentyThree »

I actually might be able to write a script for retrieving the original file names: inside the swtor_main_gamedata_1.tor there are tons of plain text files with the GUID and corresponding file name.
For example:

Code: Select all

<Appearance fqn="epp.daily_area.oricon.shared.the_towers_core.boss.strike_2.tick_3" GUID="3298414624243712" assetVersion="3" CreationTimeStamp="2013-06-24 15:26:07Z" Id="epp.daily_area.oricon.shared.the_towers_core.boss.strike_2.tick_3">

So I just need to extract

Code: Select all

3298414624243712
epp.daily_area.oricon.shared.the_towers_core.boss.strike_2.tick_3

No idea when I'll get to it but it seems possible.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Need update to *.tor bms script

Post by AlphaTwentyThree »

Found another kind of archive inside the level TOR files:

Code: Select all

get FILES long
get ZERO long
for i = 0 < FILES
   get NAME string
   get SIZE longlong
   get OFFSET longlong
   log NAME OFFSET SIZE
next i
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Need update to *.tor bms script

Post by AlphaTwentyThree »

Added latest func_getTYPE.bms with more specific format, e.g. nodes and particles.
Searched for names high and low - looks like the is a lack of file names in those text files, so scrap that for now.