New version bug

Doubts, help and support about QuickBMS and other game research tools
Mygoshi
Posts: 654
Joined: Mon Oct 27, 2014 1:49 pm

New version bug

Post by Mygoshi »

Hi. I just want to warn about a bug I encountered while using a specific script with quickbms.

THIS (https://mega.nz/#!GtcT3QyT!pRdku1cInuNj ... jtiKI79a1o) particular script, written by Alpha23 in order to add XBOX ADPCM header to a file, was producing LWAV output files that were readable or convertable with vgmstream/towav, but it no longer works. It does produce LWAVs but they are unplayable (the header is wrong) (sample: https://mega.nz/#!z9Vn1IyJ!RYueZNgtw56u ... 2G-CtjzqUI)
Using the older version of quickbms from 25 September 2014, it works correctly. (here is a sample: https://mega.nz/#!yhNjBQyA!8AOwHaq2O2hE ... fyIrgrfgX8)
So, it is a problem with the last version of quickbms (and maybe other versions after 25 September 2014)

Audio streams from Spongebob Movie Game XBOX are in .WAV.SNDS format. They are headerless XBOX ADPCM. I have to add a GENH header with codec Xbox 4-Bit IMA ADPCM, offset 0x0, interleave 0x10, channels 2, frequency 44100. After this, I add Xbox ADPCM header to the GENH files with offset 0x1000, freq 44100, testv 0, channels 2. I convert the resulting LWAV into WAV with towav in order to remove artifact noises that occurs with vgmstream.

SNDS file: https://mega.nz/#!G1EikTJB!t07N87bSlJ6y ... YzmrcTcjr4
GENH file: https://mega.nz/#!K0cUDT7S!mYL7vnaXtlzs ... 4YLKcoMI4I

Thanks in advance if the bug can be solved
Last edited by Mygoshi on Wed Feb 17, 2021 5:53 pm, edited 2 times in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: New version bug

Post by aluigi »

Well done, it's a good catch.
In Quickbms 0.8.0 the behaviour of the putvarchr command has been improved to allow to store also the address of the variable instead of just its content, that's necessary for calling some external dll where you have to fill a struct with data and pointers to data, quite rare but it may happens.

In quickbms the function that decides if the data to store is a number or a string (pointer to a string) is get_var_ptr_cmd that in fact checks if the variable is a string and returns its address.
The script made by alpha23 sets the variable in this way "set VAR 0x123" which is interpreted by quickbms like a way to store the number as a string, so "0x123" and not 0x123.

I will for sure fix the bug in the next version of quickbms because putvarchr must use the address only when you use '&' or '*' before the variable.

In the meantime it's enough to replace the "set VAR number" instructions in the main script with one of the following:
math VAR = number
set VAR long number
Mygoshi
Posts: 654
Joined: Mon Oct 27, 2014 1:49 pm

Re: New version bug

Post by Mygoshi »

Thank you for the explanation.
Last edited by Mygoshi on Sat Mar 24, 2018 7:46 pm, edited 1 time in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: New version bug

Post by aluigi »

Ah right I forgot it, obviously the other alternative is using quickbms 0.7.7 which is the latest version not affected by the bug:
http://aluigi.org/papers/quickbms_0.7.7.zip