How to add automatic "/x00" to fill a line

Doubts, help and support about QuickBMS and other game research tools
Insoumius
Posts: 6
Joined: Fri Jun 24, 2016 2:28 pm

How to add automatic "/x00" to fill a line

Post by Insoumius »

Hi everyone ive got a doubt. I used a script on QBMS but it generate files, but all got different sizes and finish with different types of lenghts, and i need to all files to get "x---0" size (fill the last line with x00 if necesary)

What lines can i add to the code and where i must add to fill last line?


Example:
Normal with the plugin:
5F C4 F6 FF FF F6 DA FB F6 5B C2 F6 27 9E 80 D9
80 3C 0D B3 80 01 80 EC 00 10 0E EC EC EC D9 3F
EC D9

New 1:
5F C4 F6 FF FF F6 DA FB F6 5B C2 F6 27 9E 80 D9
80 3C 0D B3 80 01 80 EC 00 10 0E EC EC EC D9 3F
EC D9 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Old size: 0x22
New size: 0x30
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: How to add automatic "/x00" to fill a line

Post by aluigi »

If these bytes (padding) already exist in the original stored file (in the archive) then it's enough to align the SIZE by using:
math SIZE x 0x10
log NAME OFFSET SIZE

If these bytes are not available in the archive then try using a mix of comtype COPY + clog:
comtype copy
math XSIZE = SIZE
math XSIZE x 0x10
clog NAME OFFSET SIZE XSIZE
Insoumius
Posts: 6
Joined: Fri Jun 24, 2016 2:28 pm

Re: How to add automatic "/x00" to fill a line

Post by Insoumius »

I'm using this script for byte pair encoding
http://zenhax.com/viewtopic.php?f=13&p=13177#p13195

With a little modifications to not change name and only change file type

Code: Select all

comtype bpe_compress
get SIZE asize
clog MEMORY_FILE2 0 SIZE SIZE
get ZSIZE asize MEMORY_FILE2
log MEMORY_FILE 0 0
put SIZE long MEMORY_FILE
put ZSIZE long MEMORY_FILE
append
log MEMORY_FILE 0 ZSIZE MEMORY_FILE2
append
get SIZE asize MEMORY_FILE
get NAME basename
string NAME + ".FLT"
log NAME 0 SIZE MEMORY_FILE


And generally i use Advanced Renamer to put numbers on the files but that is other thing