Page 9 of 10

Re: Files extractors scripting

Posted: Tue Oct 20, 2009 5:14 pm
by brienj
aluigi, thanks for adding the BPE decoding support, however I am still having some troubles making it work. Perhaps the Smackdown games are using some sort of variation on BPE. Could you PLEASE look at these two sample bpe files and see if you can get them to extract properly? I have tried every setting I can think of. The compressed size of the data is the LONG or SHORT at 0x008, with the data starting at 0x010, but the value at 0x00C, either LONG or SHORT, is not the uncompressed value, and that value is the same in both files too, so not sure if it would be pertaining to the size anyway. The closest I can come is if I say the uncompressed size of the first file is 1000000, then it extracts, but it has repeating data at the end for a long time, and doesn't really decompress properly. I have had a hard time getting anything to work even close on the second file. Thanks for any help you can give, and if it helps, I can give you the PAC files that these two file were taken from, just didn't want to give a big file, unless necessary.

Re: Files extractors scripting

Posted: Tue Oct 20, 2009 5:18 pm
by brienj
I will just go ahead and post the PAC file that they came from, it isn't much bigger than those two files by themseleves. Thank you, if you can help, I appreciate it. :)

Re: Files extractors scripting

Posted: Tue Oct 20, 2009 5:55 pm
by aluigi
I have tried to test all the algorithms supported by quickbms but nothing.
that's the max I can do

Re: Files extractors scripting

Posted: Thu Oct 29, 2009 4:11 am
by chrrox
Dragon Age Origins.

Code: Select all

goto 0x10
get FILES long
get UNK1 long
get UNK2 long
get UNK3 long
for i = 0 < FILES
getdstring UNAME 0x40
set NAME unicode UNAME
get OFFSET long
get SIZE long
log NAME OFFSET SIZE
next i

this extracts all the main data types from this game the audio is fsb which is supported with http://hcs64.com/vgm_ripping.html
except the gui sounds they seem to be a newer version

Re: Files extractors scripting

Posted: Thu Oct 29, 2009 7:04 pm
by aluigi
if needed I have other examples of bms scripts that I created the other day in some minutes:
Gorky17
Razor Shadow Unit
games developed by Rebellion with the Asura Engine (ASR,PC)
games of 49games
RFA files used in the DICE's Refractor2 engine (like the Battlefield series)
ShellShock NAM67
Red Faction
Massive Assault Network
Sacrifice
SĂ–LDNER - Secret Wars (simplified folders tree)
Soldier of Fortune 1
Panzer Elite Action
MAS files of ANY game that uses the ISI Gmotor2 engine (cool)

what I did was simply searching some of the bigger files in my hard-disk and I found these games and so I decided to see how much time was needed to make the work.
it was mainly a test to see how simple and fast was to create the scripts.

if someone has some requests about non-recent games or games for which already exist extractors (so for seeing the difference with a bms script) please let me know.

Re: Files extractors scripting

Posted: Thu Oct 29, 2009 8:05 pm
by interloko
hi aluigi!
i don't know if .dat mk trilogy psx files are a valid request :lol:
if it is then i posted a sample file and some info here: viewtopic.php?f=18&t=3811

thanx in advance

Re: Files extractors scripting

Posted: Thu Oct 29, 2009 8:26 pm
by aluigi
rapidshare is impossible to use as usual, but judging the size of that file it's to be excluded that it's an archive.
so not stuff for me

Re: Files extractors scripting

Posted: Thu Oct 29, 2009 8:31 pm
by interloko
the file is a .dat from a stage of mkt containing graphics.
characters are stored in the same kind of files.
so, now luck, right?

thanx anyway.

Re: Files extractors scripting

Posted: Tue Nov 10, 2009 2:50 pm
by aluigi
I have implemented a feature in quickbms 0.3.8 that I guess could be useful to some advanced users.

as many of you know, the main problem when handling a compressed file is figuring the algorithm used for compressing it.
in some cases it's simple like for the zlib data which starts with 0x78 or with the deflate algorithm in general where it's enough to use tools like offzip to recognize it, in other cases is less easy but still possible like the lzma data which has a 5 bytes header with some zeroes in it or with lzss that is used often and the plain-text data in it is enough visible or with xmemdecompress that seems used in many x360 games but usually it's hard or not possible to figure them on the fly.

so recently after an obsession (really!) in the searching of various algorithms to implement in quickbms I thought that wouldn't be bad to use this vast collection of algorithms in sequence for knowing if and what algorithm was used or at least having an idea of what of them has a result closer to the original uncompressed file.

the following is a simple example of quickbms script for doing this "scan job":
http://aluigi.org/papers/bms/comtype_scan.bms

it's job is very simple, it reads the input file and performs a decompression using any of the available algorithms and each output will be placed in an output file named with a sequential number which is the same one used internally by quickbms to index the algorithm.
the number associated to the algorithm is visible in the source code of quickbms.c where I have numbered them in steps of 5 like:

Code: Select all

    ...
    COMP_LZO1,
    COMP_LZO1A,
    COMP_LZO1B,     // scan 5
    COMP_LZO1C,
    COMP_LZO1F,
    COMP_LZO1X,
    COMP_LZO1Y,
    COMP_LZO1Z,     // scan 10
    COMP_LZO2A,
    ...
so it's clear that the input file must be the direct raw compressed data block without headers and other useless stuff, or in any case it must have the format supported by quickbms (this is valid only for those algorithms that don't have a standard like quad, balz, paq6, ppmd and so on).

unfortunately, although I have tried to fix some of them a bit, the algorithms implemented come from third parties and so are not written correctly for supporting invalid data, the consequence is that a file compressed with zlib will cause the crash of quickbms when the script is scanning the XMemDecompress algorithm and the same will happen with other non-well-written algorithms.

so IN ANY CASE is needed the hand of the user (you) for removing the crashed algorithms from the bms script.
that means that in the case of the previous example we need to substituite

Code: Select all

    #elif i == 22    # XmemDecompress
with

Code: Select all

    elif i == 22    # XmemDecompress
for skipping that algorithm which causes the crash and continuing with the others and doing the same (uncommenting or adding them) with any other crashed algorithm.

and now a practical example:
a couple of days ago chrrox had a doubt about the algorithm used in that Rumble Rose game so I dumped the compresse data from the files he provided (you can see it some bytes after the "BPE" signature) and I launched quickbms -o comtype_scan.bms data.dat z:\ and I noticed that the generated file with name "55" (the bpe algorithm) had a perfectly comprehensible data in it.
ok then I noticed that only the first 0x400 compressed bytes gave this perfect result but that scan of some seconds was enough to guess the correct algorithm without having that game or without spending time to do the manual check on each algorithm.

well I hope it helps and let me know any doubt or idea.
oh and as I have said before this stuff is intended only for advanced users!

Re: Files extractors scripting

Posted: Wed Nov 11, 2009 9:51 am
by shekofte
:erm: i am not advanced
i discoverd if we set a random value larger than real value in (uncompressed size variable) used in CLOG command has no issue !
just remaind the offset and zsize , but if we set them incorrect QBMS will crash by error !
please if it is possible gift an ability to QBMS that can sweep in a defined range for offset or zsize without
error prompt untill it dump the file !
excuse me for greed ! because i accustomed to QBMS :drunken:
acclaim , Luigi Auriemma :bravo:

Re: Files extractors scripting

Posted: Wed Nov 11, 2009 12:41 pm
by aluigi
scanning both offset and zsize is not a problem (although doing it for zsize is useless, use the whole zsize and you are ok) but remains ever the problem of the bad algorithms that crash with invalid data.

for example in zlib and deflate there is absolutely no problem, the result will be exactly like offzip but I guess that lzo could start to give some troubles with some types of data and the same happens to almost all the others.

oh, the offset scanning can be implemented directly in the bms script, so nothing to add to quickbms.

Re: Files extractors scripting

Posted: Mon Jan 25, 2010 7:22 pm
by aluigi
regarding the guessing of the compression algorithms I have released another version of comtype_scan that now avoids the need of editing it everytime one of the supported algorithms crashes.

needed files:
http://aluigi.org/papers/bms/comtype_scan2.bat
http://aluigi.org/papers/bms/comtype_scan2.bms

the bat file launches quickbms 200 times in sequence so that if an algorithm crashes it's enough to close the Windows dialog message that reports the error and if an algorithm doesn't terminate just press CTRL-C and type 'n' for continuing with the next algorithm.

example:
comtype_scan2.bat c:\comtype_scan2.bms c:\dump.dat c:\output_folder

if the needed 3 arguments are missing then the bat will show a runtime help.
note that is necessary QuickBMS 0.3.13

now there are no excuses for having doubts about an unknown algorithm :)
and obviously if you are aware of other algorithms that you would like to see implemented in quickbms, just tell me

Re: Files extractors scripting

Posted: Fri Apr 23, 2010 6:41 pm
by aluigi
oh well it's already passed one year from the first idea of QuickBMS (read the first posts of this thread) and within 2 days there will be the first "birthday" from the date of the public version ih ih ih :)

so I have decided to retake this thread only to show some of the recent updates, indeed today I have released another version: 0.4.1
  • support for the WCX packer plugins of Total commander
    so now GAUP and any other TC plugin can be used directly from QuickBMS
  • automatic extensions if you use an empty filename in your scrypts like: log "" OFFSET SIZE
  • abnourmous number of new encryptions and compressions that can be applied even to the variables (String command)
  • various hash and crc (fully customizable) through the Encryption command
  • improved the CallDll command like support for dlls inside the scripts and any known x86 calling convention
  • lot of bugfixes and enhancements
the downside of all this stuff is that now the size of the executable is over 2 megabytes, wow the first version was about 200 kilobytes :)

as usual let me know if you have new ideas or bug reports for QuickBMS or the scripts created by me.

for example I have already thought to the idea of adding support for other external plugins (I mean plugins written for other programs) but except Total Commander I have seen no other software that has a so good "park of plugins" and it's easy to implement to deserve the support in QuickBMS.

Re: Files extractors scripting

Posted: Sat Apr 24, 2010 8:39 pm
by Rick
I have not look at a recent release, but would it be possible for a number to string conversion function be added? Eg, instead of always treating as signed number, you could do unsigned (%u), or in hex (%X/%08X), etc.

I didn't see anything for this in the documentation I looked at, but this was a week or two ago when I last looked.

Re: Files extractors scripting

Posted: Sat Apr 24, 2010 9:00 pm
by aluigi
for the visualization with the Print command you could use the -x option of quickbms that shows the numbers in hex mode so "print %123%" will show 0x7b instead of 123
while for the unsigned thing no, there is no way.

personally I use a lot -x when I debug a format with the usage of the Print instruction just for this reason (offsets and sizes).
while if I need to know the unsigned version of a number (99% not needed because if it's so big it's probably only a crc) I convert it with my calculator simply copying and pasting the number in the console.