ZenHAX

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

All times are UTC




Post new topic  Reply to topic  [ 11 posts ] 
Author Message
 Post subject: divided by a number
PostPosted: Thu Nov 22, 2018 6:47 am 
User avatar

Joined: Sat Sep 15, 2018 5:22 am
Posts: 72
i need a little help with a script


get FILE-SIZE asize
get CRC long
math CRC += 1024
get OFFSET longlong

How can i do that: (If FILE-SIZE not was divided by 16, then do that: math OFFSET += 12)

divided by 16: like 16, 32, 48, 64, 80, 96, 112, 128, 144...


Top
   
 Post subject: Re: divided by a number
PostPosted: Thu Nov 22, 2018 7:32 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 9431
math OFFSET x 16

It performs an automatic alignment to 16.


Top
   
 Post subject: Re: divided by a number
PostPosted: Thu Nov 22, 2018 8:28 am 
User avatar

Joined: Sat Sep 15, 2018 5:22 am
Posts: 72
in LIS_BNK_Import.bms, Line 53

i need to set alignment all of files as (divided by 16), just like original, or if i dont, then game cant read files, if i do it with hex, game can read files


Attachments:
BNK_FILE.zip [82.84 KiB]
Downloaded 6 times
Top
   
 Post subject: Re: divided by a number
PostPosted: Thu Nov 22, 2018 8:55 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 9431
That's a bit different than the original simpler question of how to align an offset :)
Basically you should first calculate the aligned offset, then use "append 1" that allows to move on any desired offset of MEMORY_FILE, then fix that OFFLEN... not exactly a one-line fix.

I did some edit on the fly, try it:
Code:
open FDDE header_bnk 0
open FDDE footer_bnk 1
open FDDE bnk 2
get NAME basename
string BNK_NAME p "%s%s.bnk" NAME "_NEW"


get HEADER_SIZE asize 0
get FSB_SIZE asize 1
log MEMORY_FILE 0 HEADER_SIZE 0


get MEM_SIZE asize MEMORY_FILE



goto 0x0 0
findloc DATA binary "\x44\x41\x54\x41" 0
goto DATA 0
get DATA long 0
get CHUNK long #all extracted size 0
math ALL_SIZE = CHUNK 0
savepos SSSSA 0
math E_HEADING = DATA 0
goto 0x0 0
findloc HEADER_TWO_SCOUND binary "\x44\x49\x44\x58" 0
goto HEADER_TWO_SCOUND 0
get DIDX_HEADER long 0
get HEADER_TWO long 0
math HEADER_COUNT = HEADER_TWO 0
math HEADER_TWO /= 12 #12, (CRC, OFFSET, SIZE long) 0

math DUMMY_ADDER = 24 0
math HEADER_HEADING + HEADER_ONE 0
math HEADER_HEADING + DUMMY_ADDER 0


get MAHPE asize 0
for i = 0 < HEADER_TWO 0

get CRC long 0
savepos OFFSET_OFF 0
get OFFSET long 0
savepos SIZE_OFF 0
get SIZE long 0
math OFFSET == 0 0
math OFFSET + HEADER_HEADING 0
string CRC p "%s.wem" CRC 0

open FDSE CRC 4
get WEM_SIZE asize 4
savepos OFFLEN MEMORY_FILE
math OFFLEN x 16
append 1
goto OFFLEN MEMORY_FILE
log MEMORY_FILE 0 WEM_SIZE 4
append




putvarchr MEMORY_FILE OFFSET_OFF OFFLEN long
putvarchr MEMORY_FILE SIZE_OFF WEM_SIZE long



next i





append
log MEMORY_FILE 0 FSB_SIZE 1
append



get MEM_SIZE asize MEMORY_FILE
log BNK_NAME 0 MEM_SIZE MEMORY_FILE


Top
   
 Post subject: Re: divided by a number
PostPosted: Fri Nov 23, 2018 3:41 am 
User avatar

Joined: Sat Sep 15, 2018 5:22 am
Posts: 72
Sorry, nut BKHD Header cant add!
alignment is works fine! but when you change (append) to (append 1), then header cant add on top of file!

math OFFLEN x 16
append 1


i upload a better sample


Attachments:
BNK_Sample.zip [83.23 KiB]
Downloaded 4 times
Top
   
 Post subject: Re: divided by a number
PostPosted: Fri Nov 23, 2018 7:03 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 9431
You can use both, I mean "append 1" for moving to the aligned position, followed by "append" (for closing the previous mode) and another "append" for opening the classical append mode.

Otherwise just go directly to the end of the file in "append 1":
Code:
get TMP asize MEMORY_FILE
goto TMP MEMORY_FILE
log MEMORY_FILE OFFSET SIZE

Many choices :)


Top
   
 Post subject: Re: divided by a number
PostPosted: Fri Nov 23, 2018 8:14 am 
User avatar

Joined: Sat Sep 15, 2018 5:22 am
Posts: 72
aluigi wrote:
You can use both, I mean "append 1" for moving to the aligned position, followed by "append" (for closing the previous mode) and another "append" for opening the classical append mode.

Otherwise just go directly to the end of the file in "append 1":
Code:
get TMP asize MEMORY_FILE
goto TMP MEMORY_FILE
log MEMORY_FILE OFFSET SIZE

Many choices :)


infact, i cant understand why cant add header! because i did it before!

can you fix script? to make NEW .bnk Just like original?


Top
   
 Post subject: Re: divided by a number
PostPosted: Sun Nov 25, 2018 7:55 am 
User avatar

Joined: Sat Sep 15, 2018 5:22 am
Posts: 72
Shokoniraya wrote:
aluigi wrote:
You can use both, I mean "append 1" for moving to the aligned position, followed by "append" (for closing the previous mode) and another "append" for opening the classical append mode.

Otherwise just go directly to the end of the file in "append 1":
Code:
get TMP asize MEMORY_FILE
goto TMP MEMORY_FILE
log MEMORY_FILE OFFSET SIZE

Many choices :)


infact, i cant understand why cant add header! because i did it before!

can you fix script? to make NEW .bnk Just like original?


aluigi, i dont unrestand why (append 1) will disable header log?
can you fix it yourself for test?


Top
   
 Post subject: Re: divided by a number
PostPosted: Sun Nov 25, 2018 9:26 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 9431
Sorry, currently I can't.


Top
   
 Post subject: Re: divided by a number
PostPosted: Thu Nov 29, 2018 6:54 am 
User avatar

Joined: Wed Jul 19, 2017 5:04 am
Posts: 151
aluigi wrote:
Sorry, currently I can't.

hmmm... adding another append not working
do you think QuickBMS need a Update? because i think so

_________________
Be Good, Even in distressing or defamation and chill, Even Everyone's Called You a Bad Guy Or Lier and Mad


Top
   
 Post subject: Re: divided by a number
PostPosted: Thu Nov 29, 2018 8:01 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 9431
No, everything works perfectly.
It's just that I can't spend time understanding what the script is meant to do and then fixing or rewriting it from scratch.
Sorry.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 11 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