Append 1 Mode?

Doubts, help and support about QuickBMS and other game research tools
zgoro
Posts: 16
Joined: Sat May 02, 2020 12:46 pm

Append 1 Mode?

Post by zgoro »

Hi pals,

I'm trying to understand how to use Append 1 (overwrite mode):

Code: Select all

open fdsE target.bin 99   #Target file

get SIZE asize # Get size of new chunk to import

append 1
goto 0x0c7518 99  # Offset to insert new chunk into Target file
log target.bin 0x0c7518 SIZE
append


This does not work as it expects a smaller file, which is the correct way to do it?

Cheers!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Append 1 Mode?

Post by aluigi »

Reading and writing the same file at the same time?
I'm not surprised it doesn't work.
zgoro
Posts: 16
Joined: Sat May 02, 2020 12:46 pm

Re: Append 1 Mode?

Post by zgoro »

Well yeah, it definitely is wrong! :D
How should I change the script for this to work?

Thanks for you stellar job on QBMS, I love it!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Append 1 Mode?

Post by aluigi »

The best solution is just creating a new file with the portions of the original file you want that I guess it's the following:

Code: Select all

get SIZE asize
log "new.bin" 0 0x0c7518
append
log "new.bin" 0 SIZE
append
zgoro
Posts: 16
Joined: Sat May 02, 2020 12:46 pm

Re: Append 1 Mode?

Post by zgoro »

Gotcha, thanks Aluigi!
zgoro
Posts: 16
Joined: Sat May 02, 2020 12:46 pm

Re: Append 1 Mode?

Post by zgoro »

Just for ref, after abit of experiments overwrite Append 1 worked great on my side like this:

Code: Select all

Open FDSE "Source.bin" 9                   # Open source file you want to overwrite data in, refer as "9"
Get S_SIZE asize 9                         # Get source file total size as S_SIZE
Get I_SIZE asize                           # Get input file total size as I_SIZE 
Log MEMORY_FILE 0 S_SIZE 9                 # Place the whole source file in MEMORY_FILE
                                           
                                                                                   
Goto 0x20 MEMORY_FILE                      # Which offset to store input file
Append 1                                   
Log MEMORY_FILE 0 I_SIZE                   # Input file starting offset & size   
Append                                     
                                             
                                                                       
Log NEW.bin 0 S_SIZE MEMORY_FILE           # Log to new file


Of course, by repeating the "Goto -Append 1 - Log - Append" chunk, you can overwrite to multiple offsets at once.