Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Featured Replies

  • Replies 671
  • Views 61
  • Created
  • Last Reply

Top Posters In This Topic

  • Author
  • Localization

BCGhost, posted Sun Feb 09, 2020 1:24 pm (53876)


Issue with the "continue" instruction:
Code:
set Flag long 0
set i long 0
set j long 0
for i = 0    print "i = %i%"
   if Flag == 0
      math Flag = 1
      continue
   else
      math Flag = 0
   endif
   print "*** Message before embedded loop ***"
   for j = 0       print "\tj = %j%"
   next j
next i

Image

Of course it's easy to bypass it by placing the code withing an If...EndIf.
  • Author
  • Localization

BCGhost, posted Sun Feb 09, 2020 4:46 pm (53881)


aluigi wrote:
The problem is related to the pre-allocation of the arrays like "putarray 0 totalFileNum 0 # fileID" that indeed adds a new element in the array.
...
If you remove pre-allocation everything is ok...

Usually pre-allocation is not necessary for arrays.

Sorry that I didn't see this in time. It's just that the doc of QuickBMS says "it's highly suggested to pre-allocate the array if you know the max value, example: PutArray 0 FILES 0". I've tested that if you allocate (totalFileNum - 1) elements and adjust the counter afterward it can produce the correct result. So for performance reasons is this routine still necessary?
  • Author
  • Localization

Nameless, posted Fri Feb 14, 2020 3:11 am (53992)


BCGhost wrote:
Issue with the "continue" instruction:
Code:
set Flag long 0
set i long 0
set j long 0
for i = 0 < 3
   print "i = %i%"
   if Flag == 0
      math Flag = 1
      continue
   else
      math Flag = 0
   endif
   print "*** Message before embedded loop ***"
   for j = 0 < 4
      print "\tj = %j%"
   next j
next i

You can use this solution: break to label.
Code:
set Flag long 0
for i = 0 < 3
   print "i = %i%"
   if Flag = 0
      math Flag = 1
      break here
   else
      math Flag = 0
   endif
   print "*** Message before embedded loop ***"
   for j = 0 < 4
      print "\tj = %j%"
   next j
here:
next i

Though labels are also broken in some cases, for example, when you use them in functions then jump backwards doesn't work properly.
  • Author
  • Localization

aluigi, posted Tue Mar 03, 2020 3:14 pm (54395)


@Nameless
"continue" and break to label are some sort of experiment, I know.

Instead regarding the problem you reported about CRC calculation, do you have any script for replicating the problem?
And is it related to NameCRC or to "Encryption crc"?
  • Author
  • Localization

aluigi, posted Tue Mar 03, 2020 3:18 pm (54396)


@GHOST DEAD
MEMORY_FILEs aren't touched in reimport mode because they are usually used for moving data from the original archive to a temporary location.
Reimporting can only work from real file to archive and (experimentally) from some MEMORY_FILEs to archive.
  • Author
  • Localization

Nameless, posted Wed Mar 04, 2020 8:06 pm (54416)


aluigi wrote:
Instead regarding the problem you reported about CRC calculation, do you have any script for replicating the problem?
And is it related to NameCRC or to "Encryption crc"?

It is related to encryption. I didn't check namecrc, so I can't tell whether it is also affected.
And here is the test script you asked. Feed any standard text file to it, you will see that error rate is very high.

heck.7z

  • Author
  • Localization

Daftendirekt, posted Thu Mar 05, 2020 5:00 pm (54435)


An error occurs while trying to unpack the .archive file using https://aluigi.altervista.org/bms/deus_ex_mankind_divided.bms script
Quote:
$ quickbms_4gb_files.exe deus_ex_mankind_divided.bms "C:\Program Files (x86)\Steam\steamapps\common\Deus Ex Mankind Divided\DLC\runtime\DLC02.layer.0.all.archive" outdir

... some time later ...

- error in src\extra\xalloc.c line 703: xdbg_realloc()
Error: memory allocation problem
  • Author
  • Localization

aluigi, posted Tue Mar 10, 2020 10:40 am (54535)


@Daftendirekt
That's game-related, probably the script is not updated or doesn't support that specific archive. Or you are using an old version of quickbms.
In any case you should post in the topic of the game, not here.
  • Author
  • Localization

Shokoniraya, posted Fri Mar 20, 2020 10:35 am (54789)


i found two problem in QuickBMS

1: -e command will make quickbms slow (not a problem, but i reported it anyway)
2: xmath cant handle x as well, [xmath VAR "15 x 16]
  • Author
  • Localization

saeid0034, posted Sat Mar 21, 2020 2:13 pm (54874)


recently i use a script name assassin_creed_raw.bms for decompress assassin creed odyssey data file (i export data from forge with Ubisoft_Forge_Tool)
script Successfully extracts DATA files and give me 2 DAT file
but when i try to import dat file into data again (with reimport.bat) it failed
Image
. can anyone make a new script (for decompress and compress data file again) for assassin creed odyssey?
A tool already built for this task (Ubisoft_DATA_Tool_By_Delutto) but it cant import file again into data (also it looks like its developer has stopped working on this program)
  • Author
  • Localization

aluigi, posted Thu Mar 26, 2020 8:28 pm (55165)


@saeid0034 and @greenlemonade1:
Off-topic

@sergop
Regarding tar.bms you don't need to use quickbms for that job, it's just the classical tar supported by tons of utilities and obviously tar itself :D

The technical reason behind quickbms refusing to reimport the files is that tar.gz (tgz) is a compressed tar archive, so quickbms must first decompress it in memory and then extract the files.
In reimport mode you need to directly work on the archive on the disk, no MEMORY_FILE, or the changes can't go on the original archive.
  • Author
  • Localization

aluigi, posted Sat Mar 28, 2020 8:42 pm (55313)


@Shokoniraya

1)
the only two things done by the -e command is zeroing the memory of the output buffer and then returning the output size in case of errors.
I suspect that the slowness you are experiencing is caused by zeroing the output memory which may be time consuming with some large files.

2)
'x' can't be directly used in xmath because alphabetic characters may be misinterpreted with variables, that's why exist an alternative way for specifying tons of operators by using the '?' prefix, for example ?add instead of .
What I noticed is that ?align and the other alternative operators don't seem to work correctly for reasons I will investigate.
Thanks for reporting.
  • Author
  • Localization

aluigi, posted Fri Apr 03, 2020 9:12 am (55483)


Nameless wrote:
aluigi wrote:
Instead regarding the problem you reported about CRC calculation, do you have any script for replicating the problem?
And is it related to NameCRC or to "Encryption crc"?

It is related to encryption. I didn't check namecrc, so I can't tell whether it is also affected.
And here is the test script you asked. Feed any standard text file to it, you will see that error rate is very high.

Sorry for the late reply.
What I can say in the meantime is that this issue happens only when using the "e/E" operators of the String command.
Using "log" works perfectly.
Even using "string CHSTR E CHSTR" (VAR1 same as VAR2) produces the correct result, even when calling MYCRC32 before it (just to avoid issues).

I will better investigate when I will work on the next version but it's clearly a bug in the length used for performing the encryption since it uses the length of the first variable instead of the second one:
Code:
            case 'E': {
                if(len1 < len2) {
                    len1 = len2;
                    ...
                }
                memcpy(var1, var2, len1);
                fixed_len = perform_encryption(var1, len1);
  • Author
  • Localization

Nameless, posted Sun Apr 05, 2020 6:19 am (55550)


aluigi wrote:
Even using "string CHSTR E CHSTR" (VAR1 same as VAR2) produces the correct result, even when calling MYCRC32 before it (just to avoid issues).

Interesting... Good to know. Too bad that readme doesn't specify it, I always thought that VAR2 will be destroyed in such case.
  • Author
  • Localization

aluigi, posted Sun Apr 05, 2020 10:08 am (55553)


Nameless wrote:
Interesting... Good to know. Too bad that readme doesn't specify it, I always thought that VAR2 will be destroyed in such case.

Because it's a bug :D
The plan was to copy the encrypted content of VAR2 in VAR1 but the bug took the lenght of VAR1 instead of VAR2
  • Author
  • Localization

Nameless, posted Sun Apr 05, 2020 10:47 am (55554)


Glad that it will be fixed.
  • Author
  • Localization

Shokoniraya, posted Tue Jun 02, 2020 10:26 pm (57018)


when i want to run a exe with a none-standard cstring name like ( or ) that should used " in beging and end of name, in execute command in bms script, command not working fine

"zlib(v2.4).exe -c #INPUT# #OUTPUT#"
or even this one: "\"zlib(v2.4).exe\" -c #INPUT# #OUTPUT#"
or this: ""zlib(v2.4).exe" -c #INPUT# #OUTPUT#"
  • Author
  • Localization

Shokoniraya, posted Thu Jun 04, 2020 11:19 pm (57048)


sir aluigi

there is a problem in QuickBMS that always making some problem in text importing
there is some string like \n or \f or \e
but can you skip none cstring error? like \:

Error: cstring() failure, your input string has some wrong escape sequences or
it's not a valid escaped string


i know i should use \\:
but \: not used in cstring, right? becuase there is not any \: or \k too, so error and stop the process can't helping, then simply ignore unavailable escapes

and i know if i export that text again, it will turned to \\:
but there is no problem with that, so can you please ignore wrong escapes in next version?

thank you
  • Author
  • Localization

Shokoniraya, posted Fri Jun 05, 2020 2:12 pm (57059)


sir aluigi, about cstring errors, i know there is some problems for that if you ignore it as default, but it's better to make a command option to ignore incorrect \* cstring

and about unicode converting that skips at zero, normaly if we want to read a 64 bytes that stored a name in it, it will stop at zero (null). so there must be a option to ignore zero bytes too
because of such cases
Code:
63 6F 6D 6D 6F 6E 5C 00 00 00 00 00 75 69 5C 00 common\.....ui\.
00 00 00 00 00 00 00 74 65 78 74 00 00 00 75 72 .......text...ur
00 00 65 00 00 00 5C 00 00 00 66 6E 74 5F 00 00 ..e...\...fnt_..
00 00 00 30 2E 00 00 00 00 00 66 6E 74 00 00 00 ...0......fnt...
  • Author
  • Localization

Shokoniraya, posted Tue Jun 09, 2020 4:11 pm (57120)


another problem, but i don't know that if it's a QuickBMS feature or not

append -1 not working as well, i think it should add binary to start of file but has problem

please test it on a 40 byte file (you can see it better in a small file)
Code:
get SIZER asize

for i = 0 < 5
append -1
log FILE_APPEND 0 SIZER
append -1
next i
  • Author
  • Localization

spiritovod, posted Tue Jun 09, 2020 8:37 pm (57124)


@Shokoniraya: This script doesn't make much sense to me. Usual construction will look like this (aside from that you're trying to add the same file to itself or something):
append -1
for ...
log ...
next i
append

Also, consider using MEMORY_FILE or TEMPORARY_FILE before writing actual file if possible. Otherwise you may be stuck with core logic of how quickbms is working with files. You may take a look at existing scripts using "append" for better understanding.
Anyway, proper example script and expected results would be nice.
  • Author
  • Localization

Shokoniraya, posted Tue Jun 09, 2020 8:54 pm (57125)


append - 1 should add binary to strat of file but it has problem

and i can't dump a huge file in memory file (my system is low end), however, test it with a small file (40-byte) and you will see that binary will overwrite (not overwrite actually, a kind of problem in file enlarging)
  • Author
  • Localization

spiritovod, posted Wed Jun 10, 2020 11:24 am (57132)


Now I see what you mean, "append -1" only works for a single iteration, because it's allocating additional memory only once - on the 2nd iteration and the rest it stop allocating and start to rewrite file (like in "append 1" mode). Not sure, but it may be actually related to position checks for memfile. If you allocate required memory manually, it works fine though.

I hope aluigi will take a look at that when he has time. Also, some basic example would be appreciated, since I'm also confused with how "append 1" works - in documentation it's stated that you can choose position where to write stuff in rewrite mode with goto, but you expect that goto will work on current file. You may expect that you should open result file as 1, then something like "goto OFFSET 1" and then "log ..." into that file from memfile, but that doesn't work as expected.
  • Author
  • Localization

Shokoniraya, posted Fri Jun 19, 2020 5:17 pm (57271)


there is two problem that i've found

1) codepage problem
when codepage used in a script, some empty folders will be create with none-codepaged names, but it just a junk folder and codepage works correctly

2) unicode names for input file
it's clear that cmd can't support unicode as well, but for %%x can be used in any file, no matter file names has space character or unicode names and quickbms can't support unicode in input name

problems.zip

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.