Need help \ Adding 8 bytes to the beginning of the file. (*File size)

Doubts, help and support about QuickBMS and other game research tools
Alex_Abdulov
Posts: 11
Joined: Fri Dec 30, 2016 8:21 pm

Need help \ Adding 8 bytes to the beginning of the file. (*File size)

Post by Alex_Abdulov »

Hi guys.

Need a script that will add the file size to the beginning of this file. (*8 bytes)
--
The first 4 bytes are the file size in hexadecimal format, the remaining 4 bytes just zeros.
*In "Little Endian"
---
Example: D015020000000000
--
These 8 bytes are necessary for the proper work of the game. (*when using "ReImport2" in "QuickBMS")

Image

-
In zip archive 2 file, one without 8 bytes, the other with the addition of these 8 bytes, with the file size.

Thx
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Need help \ Adding 8 bytes to the beginning of the file. (*File size)

Post by spiritovod »

You can use something like this:

Code: Select all

get SIZE asize
append -1
put SIZE longlong

In case of integrating this in other script don't forget to disable append mode if needed and also change position to beginning of the file, because "put" writes to current position.
Alex_Abdulov
Posts: 11
Joined: Fri Dec 30, 2016 8:21 pm

Re: Need help \ Adding 8 bytes to the beginning of the file. (*File size)

Post by Alex_Abdulov »

spiritovod wrote:You can use something like this:

Code: Select all

get SIZE asize
append -1
put SIZE longlong

In case of integrating this in other script don't forget to disable append mode if needed and also change position to beginning of the file, because "put" writes to current position.


ok, it works great.
Thank you very much! ;)