ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Mon Dec 10, 2018 4:41 am

All times are UTC




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
 Post subject: BMS Script - Help
PostPosted: Thu Oct 11, 2018 11:37 am 

Joined: Wed Jun 01, 2016 5:53 pm
Posts: 22
Hi there i need your help. I have edited aluigi's script to unpack files. But i need to unpack files to the folders specified by file_type with their original names specified by file_ID.
Here is script. Thanks in advance!
Code:
idstring YBIG
get DUMMY long
get DUMMY long
get DUMMY long
get OFFSET long
goto OFFSET
get DUMMY short
get DUMMY short
get FILES long
getdstring DUMMY 0x51
getdstring MAINFOLDER 0x4
#get MAINFOLDER long
getdstring DUMMY 0x23

savepos TMP
math BASE_OFF = FILES
math BASE_OFF *= 10
math BASE_OFF += TMP
math BASE_OFF x= 8

for i = 0 < FILES

    get OFFSET long
    get file_ID long   
    get file_type byte
    get bComplex byte   
   
    math OFFSET *= 8
    math OFFSET += BASE_OFF
    savepos TMP   
   goto OFFSET   

   if file_type < 126   
      get SIZE long
      savepos OFFSET
      log file_ID OFFSET SIZE
   endif   
   
   if file_type == 126
      getdstring DUMMY 0xE
      get COMCHAR byte
      if COMCHAR == 0
         goto OFFSET
         get SIZE long
         savepos OFFSET
         log file_ID OFFSET SIZE
      else
         goto OFFSET
         math OFFSET += 22
         get ZSIZE long
         math ZSIZE -= 18      
         get DUMMY0 long
         get DUMMY1 long
         get DUMMY2 long
         get SIZE long
         get TEXCOUNT short
         clog file_ID OFFSET ZSIZE SIZE
      endif
   endif
   
   if file_type > 126
      goto OFFSET   
      get SIZE long
      savepos OFFSET
      log file_ID OFFSET SIZE
   endif   
    goto TMP
next i


Top
   
 Post subject: Re: BMS Script - Help
PostPosted: Thu Oct 11, 2018 4:28 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 9414
I guess you want to use this code:
Code:
string NAME p "%d/%d.dat" file_type file_id

Put it under "get bComplex byte" and replace all the file_ID in the *log operations with NAME


Top
   
 Post subject: Re: BMS Script - Help
PostPosted: Thu Oct 11, 2018 4:55 pm 

Joined: Wed Jun 01, 2016 5:53 pm
Posts: 22
Hell yes! Thanks aluigi.
BTW i must only change "%d/%d.dat" to "%d/%u.dat" because some values of file_ID was negative.


Top
   
 Post subject: Re: BMS Script - Help
PostPosted: Thu Oct 11, 2018 5:49 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 9414
:D


Top
   
 Post subject: Re: BMS Script - Help
PostPosted: Thu Nov 15, 2018 1:42 pm 

Joined: Wed Jun 01, 2016 5:53 pm
Posts: 22
Hi aluigi, I have another question regarding string. I need to search specific strings and return long value before string. How to do that? Thanks!
The long value should be SIZE. String name is "NodsNoHe"

Tried this but no luck...

For
FindLoc OFFSET string "\x4E\x6F\x64\x73\x4E\x6F\x48\x65" 0 ""
if OFFSET == ""
savepos OFFSET
goto OFFSET-4
Get SIZE long
goto OFFSET
log NAME OFFSET SIZE
endif
Next


Top
   
 Post subject: Re: BMS Script - Help
PostPosted: Thu Nov 15, 2018 2:40 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 9414
I would use something like:
Code:
findloc TMP string "NodsNoHe"
math TMP - 4
goto TMP
get SIZE long
By default findloc terminated quickbms if it doesn't find the string.
This is the alternative that doesn't terminate:
Code:
findloc TMP string "NodsNoHe" 0 ""
if TMP != ""
    math TMP - 4
    goto TMP
    get SIZE long
endif


Top
   
 Post subject: Re: BMS Script - Help
PostPosted: Thu Nov 15, 2018 3:21 pm 

Joined: Wed Jun 01, 2016 5:53 pm
Posts: 22
Thanks! It works but only for one occurrence. There are more then one occurrences of that string.


Top
   
 Post subject: Re: BMS Script - Help
PostPosted: Thu Nov 15, 2018 10:54 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 9414
just close that code between a for cycle, for example:
Code:
for
findloc TMP string "NodsNoHe"
math TMP - 4
goto TMP
get SIZE long
getdstring SKIP SIZE # or findloc will find the same string again
next


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited