where to Start QuickBMS

Doubts, help and support about QuickBMS and other game research tools
gameside
Posts: 66
Joined: Sun Nov 08, 2020 1:07 pm

where to Start QuickBMS

Post by gameside »

Hi, I'm new in whole game modding scene
from thing I read, QuickBMS is a powerful tool for extract and reimport file to game archives, so I want to start learning it
but I have some question before anything
1. what is best place to learn QuickBMS scripting (I mean any good document?) (I'm a little familiar with c++)
2. I know I can use QuickBMS reimport feature for import exported file back to archive, but if I want to use reimport i have to deal with size limit (my edited file need to be smaller or equal to original file) so I want to know its possible to create a script to import file to archive without size limit? (I mean not using reimport and instead write a separate script to import the files with bigger size to archive)
I'd appreciate it if someone answers my questions.

best regard.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: where to Start QuickBMS

Post by aluigi »

For the documentation about the scripting language:
http://aluigi.org/papers/quickbms.txt

Then it's good to take a look at the many examples available on this forum, just download the samples files provided by the users and the relative script linked in each topic.

There are two topics in the Tutorial section that help a lot:
viewtopic.php?f=4&t=72
viewtopic.php?f=4&t=34

Do you already know how to identify fields in formats?
I mean, do you have practice with hex editor and figuring out structures?
quickbms with the -0 -V options is a huge help for that work.

Regarding the reimporting, use reimport2.bat and everything is ok.
reimport.bat: just injection of the new file without any other change
reimport2.bat: injection/appending of the new file with changing of the offset and size fields.
gameside
Posts: 66
Joined: Sun Nov 08, 2020 1:07 pm

Re: where to Start QuickBMS

Post by gameside »

aluigi wrote:For the documentation about the scripting language:
http://aluigi.org/papers/quickbms.txt

Then it's good to take a look at the many examples available on this forum, just download the samples files provided by the users and the relative script linked in each topic.

There are two topics in the Tutorial section that help a lot:
viewtopic.php?f=4&t=72
viewtopic.php?f=4&t=34

Do you already know how to identify fields in formats?
I mean, do you have practice with hex editor and figuring out structures?
quickbms with the -0 -V options is a huge help for that work.

Regarding the reimporting, use reimport2.bat and everything is ok.
reimport.bat: just injection of the new file without any other change
reimport2.bat: injection/appending of the new file with changing of the offset and size fields.


Thanks for reply and Good information
about knowing hex editing, I used to work with it a little in past but not for reversing files, so I don't have good knowledge about reversing files and figuring out structures.
You know any Good tutorial or Document about it?
and one other thing, there is any tutorial to find out a archive use what type of compression method?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: where to Start QuickBMS

Post by aluigi »

Try taking a look at the Tutorials section.
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: where to Start QuickBMS

Post by Ekey »

Check Mr.Mouse youtube channel with video tutorials and explanations

https://www.youtube.com/watch?v=ysh35jP ... GrVNJ2kS2f
gameside
Posts: 66
Joined: Sun Nov 08, 2020 1:07 pm

Re: where to Start QuickBMS

Post by gameside »

thanks ekay and aluigi
Now i know everything im need for start working with quickBMS
gameside
Posts: 66
Joined: Sun Nov 08, 2020 1:07 pm

Re: where to Start QuickBMS

Post by gameside »

I have another question and I think this topic is right place to ask it (btw sorry for asking to many question)
I have two file, one is my main file and script work with it most of times
other file is just a simple file store size of first file with some other information

what I want to do is first export all files from main archive (I don't have any problem in export)
after that when I try to import them back I need to
open Both first and second file
first (before re-import) get size of original first file and store it in some variable, and then import files back to archive, after all file imported to archive get new file size again
then open other file, search for original file size and replace it with new file size

anyone can give me some script that open 2 file with same name and different ext, and do stuff with it? so I can learn from it
and how can I get size of a file in QuickBMS?


thanks

--edit--
two other thing come into my main
1- there is anyway to know script run with re-import mode? like some kind of Booleans?

Code: Select all

if REIMPORTMODE
   # do stuff when only in re-import mode
endif

its handy when you want to do some stuff only in re-import mode
2- how can I get file name of opened file in script? I want to name exported file based on the original archive name
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: where to Start QuickBMS

Post by aluigi »

open FDDE "extension1"
open FDDE "extension2" 1

get NUM long # from file with extension1
get NUM long 1 # from file with extension 2
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: where to Start QuickBMS

Post by aluigi »

1) there will be a new command in the next version of quickbms but it will be used to used to set the reimport mode.
I can check if I can add some global variables returning the current reimport mode, like QUICKBMS_REIMPORT.

2)
get NAME filename
gameside
Posts: 66
Joined: Sun Nov 08, 2020 1:07 pm

Re: where to Start QuickBMS

Post by gameside »

aluigi wrote:open FDDE "extension1"
open FDDE "extension2" 1

get NUM long # from file with extension1
get NUM long 1 # from file with extension 2


thanks, I also get file size with ASIZE (I don't know why I don't check document before asking)
aluigi wrote:1) there will be a new command in the next version of quickbms but it will be used to used to set the reimport mode.
I can check if I can add some global variables returning the current reimport mode, like QUICKBMS_REIMPORT.

its will be handy to have global variables to return what mode script running on
gameside
Posts: 66
Joined: Sun Nov 08, 2020 1:07 pm

Re: where to Start QuickBMS

Post by gameside »

Hi, I have some other question
I want to first get 3 byte with

Code: Select all

GET CHAR THREEBYTE

for example its give me this value
08 00 00 -to little-endian-> 00 00 08
two values ​​are stored in this HEX in 1.5 bytes (000008 -> 000 , 008)
how can I get these 1.5 byte value? so I can have 0 and 8
(sorry if I cant explain it right)

-- edit --
I read document and find out about GetBits, so i try it with

Code: Select all

GetBits CHAR_1 12
GetBits CHAR_2 12

for get two 1.5 byte, but problem is its not little endian
I need to first Get 3 byte with

Code: Select all

GET CHAR THREEBYTE

convert it to little endian (80 90 70 -> 70 90 80) and then put it back
so I think it good to use MEMORY_FILE for this job, but I don't know how can I actually do it, anyone can help me?

Code: Select all

SAVEPOS CHARACTER_POSITION
log MEMORY_FILE CHARACTER_POSITION 3
GetBits CHARACTER_POSITION_1 12 MEMORY_FILE
GetBits CHARACTER_POSITION_2 12 MEMORY_FILE
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: where to Start QuickBMS

Post by aluigi »

getbits is perfecft for that job and the endianess you get is correct (tested and confirmed for decades).
Here I see no problems but it depends by the results you were expecting:

Code: Select all

. 00000000 getbits VAR1       0x00000008 12
. 00000002 getbits VAR2       0x00000000 12
...
. 00000003 getbits VAR1       0x00000080 12
. 00000005 getbits VAR2       0x00000709 12

But if you want to change the endianess just specify it before getbits:

Code: Select all

endian big
getbits VAR1 12
getbits VAR2 12
endian little
gameside
Posts: 66
Joined: Sun Nov 08, 2020 1:07 pm

Re: where to Start QuickBMS

Post by gameside »

aluigi wrote:getbits is perfecft for that job and the endianess you get is correct (tested and confirmed for decades).
Here I see no problems but it depends by the results you were expecting:

Code: Select all

. 00000000 getbits VAR1       0x00000008 12
. 00000002 getbits VAR2       0x00000000 12
...
. 00000003 getbits VAR1       0x00000080 12
. 00000005 getbits VAR2       0x00000709 12

But if you want to change the endianess just specify it before getbits:

Code: Select all

endian big
getbits VAR1 12
getbits VAR2 12
endian little

thank you for reply, but I still have a problem
as I said, I need to first get 3 byte and convert it to little endian and save it somewhere, and after that get 12 bite from converted 3 byte...
[12 34 56] -> [56 34 12] -> [563],[412]
but I don't know how can I actually do it
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: where to Start QuickBMS

Post by aluigi »

Ah ok, so you just need a very simple math operation:

Code: Select all

get VAR threebyte
xmath VAR1 "(VAR >> 12) & ((1 << 12) - 1)"
xmath VAR2 " VAR        & ((1 << 12) - 1)"

print "%VAR1|x% %VAR2|x%"

The AND mask is a lot more easy than how it looks and can be quickly adapted for future operations.