ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Mon Jun 21, 2021 12:38 am

All times are UTC




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Append 1 Mode?
PostPosted: Tue May 11, 2021 8:18 am 

Joined: Sat May 02, 2020 12:46 pm
Posts: 10
Hi pals,

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

Code:
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!


Top
   
 Post subject: Re: Append 1 Mode?
PostPosted: Tue May 11, 2021 9:51 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12296
Reading and writing the same file at the same time?
I'm not surprised it doesn't work.


Top
   
 Post subject: Re: Append 1 Mode?
PostPosted: Tue May 11, 2021 10:17 am 

Joined: Sat May 02, 2020 12:46 pm
Posts: 10
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!


Top
   
 Post subject: Re: Append 1 Mode?
PostPosted: Tue May 11, 2021 10:35 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12296
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:
get SIZE asize
log "new.bin" 0 0x0c7518
append
log "new.bin" 0 SIZE
append


Top
   
 Post subject: Re: Append 1 Mode?
PostPosted: Tue May 11, 2021 10:38 am 

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


Top
   
 Post subject: Re: Append 1 Mode?
PostPosted: Wed May 12, 2021 8:52 am 

Joined: Sat May 02, 2020 12:46 pm
Posts: 10
Just for ref, after abit of experiments overwrite Append 1 worked great on my side like this:

Code:
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.


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