Possible next features of QuickBMS

Doubts, help and support about QuickBMS and other game research tools
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: Possible next features of QuickBMS

Post by Shokoniraya »

QuickBMS re-set variables that contain asize? but i don't think so (those variables that have a real block like byte short long can resize always, problem is those variables that created by hand with math and xmath, like math OFFSET = 208 or xmath SIZE "NEXT_OFFSET - OFFSET")

and about asize problem, maybe you can add a function to log that resize all of savepos variables that are >= than log offset variable
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Possible next features of QuickBMS

Post by aluigi »

In the tests I did when I implemented the reverse math operations in reimporting, they worked.
asize is something that I don't want to touch because when I touched it few weeks ago it introduced a bug.
So it's better for me to keep everything as-is ;)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Possible next features of QuickBMS

Post by aluigi »

New beta, I mainly fixed some bugs introduced in the previous beta.
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: Possible next features of QuickBMS

Post by Shokoniraya »

asize works fine
you right sir aluigi, savepos will be a real mess if touched, must be adjust in script with more coding


but xmath SIZE "NEXT_OFFSET - OFFSET" and math still has problem
and let's say it's not a problem at all! becuase it can be fixed
xmath and math working good
thank you

Code: Select all

xmath SIZE "NEXT_OFFSET - OFFSET"

get BEFORE_REIMPORT_ASIZE asize
log NAME OFFSET SIZE
get AFTER_REIMPORT_ASIZE asize #input file size will be changed in reimporting

xmath ASIZE_CHANGING "AFTER_REIMPORT_ASIZE  - BEFORE_REIMPORT_ASIZE"
math SIZE + ASIZE_CHANGING #ASIZE_CHANGING can be negative or positive


we can do same job for savepos OFFSET too
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Possible next features of QuickBMS

Post by aluigi »

Honestly I don't think I can do much on that, it seems a mess and as far as I know reimporting of math/xtmath works perfectly with normal archives, I suppose the problem there is just with sequential files.

I just uploaded a new beta.
The main feature is the -e option that when used in reimport2 allows to disable the compression of the imported file.

For example if you want to reimport the Neptunia Rebirth files, you can't because there is no algorithm for recompressing the originally compressed data.
While now it works if the reimport2 mode is used with the -e option (also available in quickbmsver in the script).
(Neptunia is only an example because there are rebuilders as far as I know)
shekofte
Posts: 42
Joined: Sun Aug 10, 2014 9:22 am

Re: Possible next features of QuickBMS

Post by shekofte »

2020 keep me away from programming .
Also All pcs turned into 64 bits that are so expensive in fully equipped configuration !
Just looking for good Omen in new year ...
69 days countdown to year 2021

Also Best Wishes for You Luigi Auriemma !
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Possible next features of QuickBMS

Post by aluigi »

Not really a feature but I'm finally making an example for the operators of the String command:

Code: Select all

+   append
      MyStringExampleString!STRING
      MyStringExampleString!3
      MyStringExampleString!-3
-   remove, truncate
      MyExample!
      MyStringExampleStri
      MyS
^   xor
      -=<.=31/*#87:5::5h
      ~J`GAZ]TvKR^C_V`GAZ]T
      `J~G_ZCThKL^]_H`YAD]J
<   strrstr + var2 (before)
      MyStringExampleString
      tringExampleString!
      ng!
*   replicate
      MyString
      MyStringExampleString!MyStringExampleString!MyStringExampleString!
      MyStringExampleString!MyS
%   strstr (before), truncate, mod
      My
      M
      MyStringExampleString
&   strstr
      StringExampleString!
      MyStringExampleString!
      MyStringExampleString!
|   strstr + var2
      ExampleString!
      MyStringExampleString!
      MyStringExampleString!
$   strrstr
      String!
      MyStringExampleString!
      MyStringExampleString!
!   strrstr + var2
      !
      MyStringExampleString!
      MyStringExampleString!
>   strrstr (before)
      MyStringExample
      MyStringExampleStri
      MyStringExampleString!

The examples are based on the following variables:

Code: Select all

VAR1 is MyStringExampleString!
VAR1 is 22 bytes
VAR2 is STRING
NUM  is 3
NEG  is -3

The operators + ^ | $ ! don't support numeric VAR2.
The 3 examples provided for each operator are just the results with a VAR2 string, positive number and negative number.

Currently the only problem is with VAR2 being a string starting with a number like "3x" because it will be handled as a number causing wrong results:
string VAR - "3" = ok because "3" is handled as a constant
set VAR2 string "3" ; string VAR - VAR2 = fail

I'm still working on it since the numeric "%" is confusing and useless (when are we going to use it?) so I was thinking about leaving it as string only.

Open to suggestions.
saeid0034
Posts: 40
Joined: Sat Mar 14, 2020 7:17 pm

Re: Possible next features of QuickBMS

Post by saeid0034 »

Hi, I don't know here is right place to tell or not
I think QuickBMS can really use some color in commend line output (in error message and etc.), for example when some one try to print a text when a error happened it can simply lost among other outputs, but if we have something like
print "error %error_code%" [red/green]
its make it easier to find the error
I know its not a important thing, but its help in read the output
Last edited by saeid0034 on Sat Jun 19, 2021 12:32 pm, edited 1 time in total.
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: Possible next features of QuickBMS

Post by Shokoniraya »

you can make it like this

Code: Select all

print "\n\n\nERROR!!\nerror: %error_code%\n\n\n"
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Possible next features of QuickBMS

Post by aluigi »

I like the idea of using colors, the usual problems are the escapes and the format.
Let's say I use [red] and [/red] to go back, it sounds good to me.
And also [b] for higher intensity.
I can also change the background color but I don't know what may be the good tag to use.

We need a simple tag to change (and mix) them

This is the method currently used in a function of quickbms for setting the colors:

Code: Select all

'o': color |= original
'0': color |= original

'r': color |= FOREGROUND_RED
'g': color |= FOREGROUND_GREEN
'b': color |= FOREGROUND_BLUE
'i': color |= FOREGROUND_INTENSITY

'R': color |= BACKGROUND_RED
'G': color |= BACKGROUND_GREEN
'B': color |= BACKGROUND_BLUE
'I': color |= BACKGROUND_INTENSITY

'x': original (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
So it's easy for me to build all the combos but it may not be easy for people, [rgb] [ri] and so on.
saeid0034
Posts: 40
Joined: Sat Mar 14, 2020 7:17 pm

Re: Possible next features of QuickBMS

Post by saeid0034 »

aluigi wrote:I like the idea of using colors, the usual problems are the escapes and the format.
Let's say I use [red] and [/red] to go back, it sounds good to me.
And also [b] for higher intensity.
I can also change the background color but I don't know what may be the good tag to use.

We need a simple tag to change (and mix) them

This is the method currently used in a function of quickbms for setting the colors:

Code: Select all

'o': color |= original
'0': color |= original

'r': color |= FOREGROUND_RED
'g': color |= FOREGROUND_GREEN
'b': color |= FOREGROUND_BLUE
'i': color |= FOREGROUND_INTENSITY

'R': color |= BACKGROUND_RED
'G': color |= BACKGROUND_GREEN
'B': color |= BACKGROUND_BLUE
'I': color |= BACKGROUND_INTENSITY

'x': original (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
So it's easy for me to build all the combos but it may not be easy for people, [rgb] [ri] and so on.


what about mixing both foreground and background in a hexadecimal digits like how cecho do it?
or simply use {red on blue} for make it easer

Image
cecho source
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Possible next features of QuickBMS

Post by aluigi »

I'm going to release the beta quickbms.exe with the new feature in about 10 minutes:
https://aluigi.altervista.org/beta/quickbms_exe.zip

Example:

Code: Select all

print "Hello, [bi]how are you?[]\n[RGBIri]Fine![] ... [I]also this [g]closing[/g] works"


The only doubt is about [] when used for non-color purposes.
Let's say I want to write "The variable VAR[] is invalid", it will just write VAR instead of VAR[], same for VAR[i].
It's very rare but some people may use that text in their print messages.

My solution was increasing the range of escaped characters for supporting other languages, therefore [] are now supported in all the cstring notation ;)

@saeid0034
it's the first time I see that notation and it looks a bit complicated rather than just RGB
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Possible next features of QuickBMS

Post by aluigi »

Another beta is out.
I even addded (experimental) regex support for findloc.
saeid0034
Posts: 40
Joined: Sat Mar 14, 2020 7:17 pm

Re: Possible next features of QuickBMS

Post by saeid0034 »

aluigi wrote:@saeid0034
it's the first time I see that notation and it looks a bit complicated rather than just RGB

thank you for update, I tested new beta and its work well, but still I think this notation maybe is a little complicated, but it's better to manage and work with

Code: Select all

"Hello {09}how are you?{\n}{FC}Fine!{#} ... {8F}also this{02} closing{default} works"

I think its much cleaner then use RGB format
Because each color has its own code, in RGB format you need to use [RGBIri] to get red color in white, but in this format you only use [FC]
Image
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Possible next features of QuickBMS

Post by aluigi »

I like the { escape instead of [ since the latter is used for other ANSI escapes.
I also like the idea of one-char color code.

But I don't like the numbers assigned by cecho, I prefer those of the ANSI standard so I'm going to add support for them.
https://en.wikipedia.org/wiki/ANSI_escape_code#Colors

In short they are just 0-7 for normal colors and 8-15 for brighter, example {11} for red text and background.
Basically I can parse any color even by name so I will try putting some code in place for the next beta.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Possible next features of QuickBMS

Post by aluigi »

quickbms_exe.zip updated with the new colors
saeid0034
Posts: 40
Joined: Sat Mar 14, 2020 7:17 pm

Re: Possible next features of QuickBMS

Post by saeid0034 »

aluigi wrote:quickbms_exe.zip updated with the new colors

thanks, it's way better and easier to use
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Possible next features of QuickBMS

Post by aluigi »

Ah please check if the beta you got is "Nov 29 2020 - 20:42:27" since the one I released when I made the post had a bug in the loops (described in the other "Errors" topic) and I fixed it about one hour after.

The message is visible when you run quickbms:

Code: Select all

QuickBMS generic files extractor and reimporter 0.11.0
by Luigi Auriemma
e-mail: me@aluigi.org
web:    aluigi.org
        (Nov 29 2020 - 20:42:27)
saeid0034
Posts: 40
Joined: Sat Mar 14, 2020 7:17 pm

Re: Possible next features of QuickBMS

Post by saeid0034 »

aluigi wrote:Ah please check if the beta you got is "Nov 29 2020 - 20:42:27" since the one I released when I made the post had a bug in the loops (described in the other "Errors" topic) and I fixed it about one hour after.

The message is visible when you run quickbms:

Code: Select all

QuickBMS generic files extractor and reimporter 0.11.0
by Luigi Auriemma
e-mail: me@aluigi.org
web:    aluigi.org
        (Nov 29 2020 - 20:42:27)

yes I had this version, Thanks for letting me know, I downloaded new version.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Possible next features of QuickBMS

Post by aluigi »

To anyone interested in the filexor command.

There is this particular format in this topic (viewtopic.php?f=9&t=11577) where the entry is encrypted with xor, the content of the file follows the entry and the position of the key is kept the same since the last byte of the previous entry.
In short it's like if the entries are a contiguous stream of bytes during decryption (the content of the files is NOT encrypted).

It was very difficult to handle it with quickbms because the position of the key depends by the offset of the file.
After some tentatives I found the solution ("CHECK HERE" comments) and I want to share it with anyone who will have the same situation in the future:

Code: Select all

# Resident Evil 4 Mobile H2Z

comtype deflate
idstring "H2Z\0"
get SOME_CRC long
get SIZE long

idstring "HIZ\0"
get FILES long
get SIZE long

math ENTRY_SIZE = 0
for i = 0 < FILES

    # CHECK HERE
    savepos OFFSET
    math OFFSET - ENTRY_SIZE
    filexor "bio4" OFFSET
    #

    get TYPE short
    get ZSIZE long
    get SIZE long
    get NAMESZ short
    getdstring NAME NAMESZ

    # CHECK HERE
    filexor ""
    savepos ENTRY_SIZE
    math ENTRY_SIZE - OFFSET
    savepos OFFSET
    #

    if TYPE == 0
        log NAME OFFSET SIZE
    else    # 8 for deflate
        clog NAME OFFSET ZSIZE SIZE
    endif
    goto ZSIZE 0 SEEK_CUR
next i


Ah, I also finally added support for the FILENUM argument of filexor, filerot and filecrypt.
By default everything works as before: filexor applied to all the files using the offset of file 0 as position when the command is invoked
If you use FILENUM then filexor will work only with that specific file.
It's already available in the beta I just uploaded (both exe and source code).