Files not being named correctly

Doubts, help and support about QuickBMS and other game research tools
DPersonalized
Posts: 3
Joined: Thu Nov 03, 2016 9:05 pm

Files not being named correctly

Post by DPersonalized »

My first bms script extracts each texture file from Burnout 3's .TXD files. Here it is:

Code: Select all

get null longlong
get texCount long
get ten long

for i = 0 < texCount
   savepos REMEMBER
   get fileNo long
   get null0 long
   get fileOff long
   get null1 long
   
   goto fileOff
   
   get null2 long
   get twoFiddy long
   get fileLength long
   math tempVar = fileOff
   math tempVar += 0x9D
   
   goto tempVar
   
   getCT NAME string 0x0
   
   log NAME fileOff fileLength
   
   math REMEMBER += 0x10
   goto REMEMBER
next i

The files are extracted, alright, but they don't get given the names I want them to be given. Instead, they're just given the automatically generated names. I can't post FRONTEND.TXD or GLOBAL.TXD here due to copyright issues, but if anyone else has Burnout 3, I'd be delighted if I could receive some help with this.

And I know, the script is awful, but it's not too bad for my first one IIDSSM ;) ;) ;).
DPersonalized
Posts: 3
Joined: Thu Nov 03, 2016 9:05 pm

Re: Files not being named correctly

Post by DPersonalized »

Code: Select all

get null longlong
get texCount long
get ten long

for i = 0 < texCount
   savepos REMEMBER
   get fileNo long
   get null0 long
   get fileOff long
   get null1 long
   
   goto fileOff
   
   get null2 long
   
   get something long
   
   get fileLength long
   
   math tempVar = fileOff
   math tempVar += 0xA8
   
   goto tempVar
   
   getdstring NAME 0x18
   string NAME + ".txd"   //Don't know what the actual extension is.
   
   log NAME fileOff fileLength
   
   math REMEMBER += 0x10
   goto REMEMBER
next i


I managed to fix the issue, although I would like to be able to use getCT string so I don't read any more data than I need to.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Files not being named correctly

Post by aluigi »

If the names have a fixed size then you have to use getdstring NAME FIXED_SIZE.
Post a sample in case you still have problems.
DPersonalized
Posts: 3
Joined: Thu Nov 03, 2016 9:05 pm

Re: Files not being named correctly

Post by DPersonalized »

aluigi wrote:If the names have a fixed size then you have to use getdstring NAME FIXED_SIZE.
Post a sample in case you still have problems.


The names are of various sizes. Here's FRONTEND.txd from Burnout 3:
https://drive.google.com/open?id=0B3AFe ... 3hZWHlPLUE

The script works perfectly fine, but I'd like to be able to use getCT in the future.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Files not being named correctly

Post by aluigi »

Why getct?
get NAME string
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Files not being named correctly

Post by Acewell »

i'm seeing a problem with your filelength, some extracted files are zero bytes, the
long integer before the string name looks like the correct size and works with all but

Volumebar
B3Logo
finish
EATrax
coronaglow

where the size exceeds the data by 64 bytes, there must be a flag or something that signals this :|

Code: Select all

goto 0x8
get FILES long
get SKIP long
for i = 0 < FILES
    get SKIP long
    get SKIP long
    get OFFSET long
    get SKIP long
    savepos TMP
    goto OFFSET
    savepos TMP2
    math TMP2 + 164
    goto TMP2
    get SIZE long
    get NAME string
    string NAME + ".tex"
    log NAME OFFSET SIZE
    goto TMP
next i