sscanf support in quickbms

Doubts, help and support about QuickBMS and other game research tools
barti
Posts: 34
Joined: Sun Nov 09, 2014 2:40 pm

sscanf support in quickbms

Post by barti »

Aluigi, do you have any plans to fix sscanf in quickbms? Recently I stumbled upon a format that would benefit from it, as the entire file table is stored in text form:

Code: Select all

294 80 24576
        0     15202  100       0    0 mq_AlexKidd.ia                           
    16384     15624  100       0    0 mq_AlteredB.ia                           
    32768     15233  100       0    0 mq_BonanzaB.ia                           
    49152     14824  100       0    0 mq_Columns.ia                           
    65536     15126  100       0    0 mq_ComixZon.ia                           
    81920     13884  100       0    0 mq_Decap.ia                             
    96256     13745  100       0    0 mq_Ecco.ia                               


I used the string "s" operator to extract the numeric values, but I had to use a crappy workaround (shift_left first 38 characters) to get the file name. A solution with working %s operator would be much cleaner.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: sscanf support in quickbms

Post by aluigi »

The limit of the sscanf 's' implementation in quickbms is the support for numeric-only fields, that's made mainly for security but also because sscanf is not ideal for strings.
I highly suggest you to opt for the 'S' operator that works great:

Code: Select all

String ELEMENTS S YOUR_STRING OUT_VAR1 OUT_VAR2 OUT_VAR3 OUT_VARN
where:
ELEMENTS is the output variable containing the number of variables that have been filled with values
YOUR_STRING is just your input string, for example: hello1, "hello 2 " 'hello3'
OUT_VAR will get the values read from the input string.
That's good also for the numeric fields because they are read as string and will be interpreted as numbers in the math operations.
barti
Posts: 34
Joined: Sun Nov 09, 2014 2:40 pm

Re: sscanf support in quickbms

Post by barti »

The 'S' operator is a much better solution and works correctly, thanks for helping.