Luigi Auriemma

aluigi.org (ARCHIVE-ONLY FORUM!)
It is currently 19 Jul 2012 13:40

All times are UTC [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 37 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: some quickBMS questions
PostPosted: 19 Sep 2010 13:20 

Joined: 09 Mar 2010 23:13
Posts: 40
Hey there Luigi. Sometimes in my work I need to batch edit many files (insert hex and dec text). And much of them are with plain text. So my question is about using a MEMORY_FILE var type. For example I have a file contains "1 2 3 7 8 9" text. My MEMORY_FILE should be " 4 5 6 ". (and my output file should be like "1 2 3 4 5 6 7 8 9"). But how I can to insert them after "1 2 3" string, how to "program" that ? And sometimes I need to insert string like this in the start/end of file (like header/footer). Is it possible to code that ?

And my second question about CoD4 (and some games with q3 engine). Well, console have input bar (with pressing "~" key (or /toggleconsole command)) and output window with info (which are drawing with Shift+~ pressing). Some guys asking me about possibility to launch console output window with some hidden command (cvar/may be dvar). I didn't find something and I think it's impossible. Any ideas ? Guys needs to bind this like /bind <key> <"cvar command, if exist">


Top
 Profile  
 
 
 Post subject: Re: some quickBMS questions
PostPosted: 19 Sep 2010 14:11 

Joined: 24 Jun 2010 10:04
Posts: 70
Location: aluigi not @ home
with quickbms you can use the Append command that allows you to build a file (or a memory file) piece by piece.
so taking your example you should do something like:
Code:
set MEMORY_FILE binary "1 2 3 7 8 9"
set MEMORY_FILE3 binary " 4 5 6 "
log MEMORY_FILE2 0 0  # needed if MEMORY_FILE2 has been already used and you want to reset it
append
log MEMORY_FILE2 0 5 MEMORY_FILE
log MEMORY_FILE2 0 7 MEMORY_FILE3
log MEMORY_FILE2 6 5 MEMORY_FILE
append
get SIZE asize MEMORY_FILE2
log "output.txt" 0 SIZE MEMORY_FILE2
don't worry, seems complex but it's perfectly logical :)

the following are 2 other examples:
Code:
log MEMORY_FILE2 0 0  # needed to create/reset it
putdstring "1 2 3" 5 MEMORY_FILE2
putdstring " 4 5 6 " 7 MEMORY_FILE2
putdstring "7 8 9" 5 MEMORY_FILE2
get SIZE asize MEMORY_FILE2
log "output2.txt" 0 SIZE MEMORY_FILE2
Code:
log MEMORY_FILE2 0 0  # needed to create/reset it
put "1 2 3" string MEMORY_FILE2
put " 4 5 6 " string MEMORY_FILE2
put "7 8 9" string MEMORY_FILE2
get SIZE asize MEMORY_FILE2
log "output2.txt" 0 SIZE MEMORY_FILE2


about cod4 I have not fully understood anyway I'm sure someone else could help you


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 20 Sep 2010 19:31 

Joined: 09 Mar 2010 23:13
Posts: 40
thanks, now I'm partially understood this var type. But for most conception can u post full version of .bms script. From start to end, for my example. If my input file is 123.txt and my output.txt file with contain "1 2 3 4 5 6 7 8 9" string. If it's not so hard, sure


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 21 Sep 2010 14:01 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
substituite "set MEMORY_FILE binary "1 2 3 7 8 9"" with:
get SIZE asize
log MEMORY_FILE 0 SIZE

alternatively you can also avoid to use MEMORY_FILE and using directly the input one, so delete any reference about MEMORY_FILE (so that will be used the default file number 0, the input file)


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 22 Sep 2010 20:36 

Joined: 09 Mar 2010 23:13
Posts: 40
thanks, but I mean working script, not the part. script

Code:
get SIZE asize
set MEMORY_FILE binary "1 2 3 7 8 9"
log MEMORY_FILE 0 SIZE


not working. I'm still don't understand, where is "append" var need to be set =(


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 22 Sep 2010 20:50 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
append must be used before the log operation for "enabling" the append mode (anything you write in the output file will be concatenated to the existing data) and a secondary time for disabling it.
so it's not a "var", it's an instruction switch.


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 30 Sep 2010 21:06 

Joined: 09 Mar 2010 23:13
Posts: 40
was busy last week, sorry for waitings

ok, back to BMS =)

I have .txt file with "1 2 3" strings text. File with output info must be .txt too with "1 2 3 4 5 6 7 8 9" string text

my BMS

Code:
get SIZE asize
set MEMORY_FILE binary "4 5 6 7 8 9"
append
log MEMORY_FILE 0 SIZE
append


and when QuickBMS allow to enter file output name i'v got an "error" like :0 files found in 0 seconds

where I was "wrong" ?


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 01 Oct 2010 09:03 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
first you need to set MEMORY_FILE to " 4 5 6 7 8 9", note the space before "4" otherwise the result will be "1 2 34 5"
then if you make the append on MEMORY_FILE the result will be "4 5 6 7 8 91 2 3" and in any case you forgot to write the file on the disk, so the correct one is:
Code:
set MEMORY_FILE2 binary "4 5 6 7 8 9"
append
get SIZE asize
log MEMORY_FILE 0 SIZE
get SIZE asize MEMORY_FILE2
log MEMORY_FILE 0 SIZE MEMORY_FILE2
append
get SIZE asize MEMORY_FILE
log "dump.txt" 0 SIZE MEMORY_FILE


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 03 Oct 2010 20:31 

Joined: 09 Mar 2010 23:13
Posts: 40
Thank you. All works fine. I'm combine it with "get NAME basename" and "string NAME ..." and one of my tasks decided now. But another stupid issue. I'm tryed to reverse script for result like " 4 5 6 7 8 9 1 2 3" and quickbms returns with error =( My script:

Code:
get NAME basename
set MEMORY_FILE2 binary "4 5 6 7 8 9 "
append
get SIZE asize
log MEMORY_FILE 0 SIZE
get SIZE asize MEMORY_FILE2
log MEMORY_FILE2 0 SIZE MEMORY_FILE
append
get SIZE asize MEMORY_FILE
string NAME += "_1.wor"
log NAME 0 SIZE MEMORY_FILE


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 03 Oct 2010 21:12 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
the error is caused by a mistake you did in the following:
Code:
log MEMORY_FILE2 0 SIZE MEMORY_FILE
where you exchanged the two MEMORY_FILEs, so the correct one is:
Code:
log MEMORY_FILE 0 SIZE MEMORY_FILE2


the only other thing to change for having the desired "reverse" job is simply exchanging the file->MEMORY_FILE and MEMORY_FILE2->MEMORY_FILE, so the order in which you "log" them in the new file:
Code:
get NAME basename
set MEMORY_FILE2 binary "4 5 6 7 8 9 "
append
get SIZE asize MEMORY_FILE2         # I go for
log MEMORY_FILE 0 SIZE MEMORY_FILE2 # first
get SIZE asize                      # I go for
log MEMORY_FILE 0 SIZE              # second
append
get SIZE asize MEMORY_FILE
string NAME += "_1.wor"
log NAME 0 SIZE MEMORY_FILE


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 03 Oct 2010 21:34 

Joined: 09 Mar 2010 23:13
Posts: 40
Thanks so much for answers and your patience. I'm hope understand principle now ! =)


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 26 Oct 2010 22:27 

Joined: 09 Mar 2010 23:13
Posts: 40
Hey there Luigi. Some another stupid questions. If I want to make some math operations (sum, for example) I need a math function. I'v tryed a simple operation but no luck

Code:
get NAME basename 0
Set MEMORY_FILE2 binary "12345678"
Set MEMORY_FILE3 binary "12345678"


append
get SIZE asize MEMORY_FILE2
get SIZE2 asize MEMORY_FILE3
math SIZE += SIZE2
append

log NAME 0 SIZE


without append it's not working too. Where's I was wrong ?


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 27 Oct 2010 08:26 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
because there are no file operations there.
you have used append but there are no log operations there so the math operation works correctly but when you use "log" you ask quickbms to put in the file NAME the content of the first 8+8 bytes of the same file :)

from that code I don't understand if you want to:
- append MEMORY_FILE2 and 3 to the current file
- create a new file named NAME containing MEMORY_FILE2 and 3

so take a look at the following script if it does what you mean:
Code:
get NAME basename 0
Set MEMORY_FILE2 binary "12345678"
Set MEMORY_FILE3 binary "12345678"

append
get SIZE asize MEMORY_FILE2
log MEMORY_FILE 0 SIZE MEMORY_FILE2
get SIZE asize MEMORY_FILE3
log MEMORY_FILE 0 SIZE MEMORY_FILE3
append

get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE
I have used MEMORY_FILE only to avoid the "do you want to overwrite it" question


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 27 Oct 2010 10:40 

Joined: 09 Mar 2010 23:13
Posts: 40
thx, but that was my previous question, where I'm trying to insert first text part after second text part. And before it. I'm understood this already

Now I need any math operation with MEMORY_FILE's. I mean if I set MEMORY_FILE2 with value "12345678" and MEMORY_FILE3 with same value and need to log another MEMORY_FILE with sum of this values. I mean my final MEMORY_FILE log must be with value "24691356"

That's my question

And I didn't know about "append" here. Does it needed or not ?


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 27 Oct 2010 19:27 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
ah, so the sum of 2 numbers inside the files. now it's clear :)

Code:
get NAME basename 0
Set MEMORY_FILE2 binary "12345678"
Set MEMORY_FILE3 binary "12345678"

get NUM string MEMORY_FILE2
get NUM2 string MEMORY_FILE3
math NUM += NUM2

put NUM string MEMORY_FILE
get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE
the syntax is probably not much clear because this is a type of operation enough unusual, after all quickbms is an extractor


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 27 Oct 2010 22:43 

Joined: 09 Mar 2010 23:13
Posts: 40
thx, it's working. But result value contain one null byte... Like 24691356\x00

How I can fix this ?


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 27 Oct 2010 22:51 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
...
get SIZE asize MEMORY_FILE
math SIZE -= 1 # remove the final NULL
log NAME 0 SIZE MEMORY_FILE


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 28 Oct 2010 06:17 

Joined: 09 Mar 2010 23:13
Posts: 40
hm, too easy =) Thx so much again !


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 05 Nov 2010 21:33 

Joined: 29 Oct 2010 09:43
Posts: 2
Hi ,aluigi!
I don't want to create new topic,so ask here.
I'm trying to extract audio from (PS3)Darksiders[streams.osps3(size 17gb)] with FSBscanner script by AlphaTwentyThree.
Can U add support for files bigger th??n 4gb in quickBMS?


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 07 Nov 2010 16:39 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
it's in the list of things to do for the next version.
I will work on it when I will have some free time so not now


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 07 Nov 2010 20:56 

Joined: 29 Oct 2010 09:43
Posts: 2
thx,aluigi!
I'l waiting a new version with impatience:)


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 09 Jan 2011 14:40 

Joined: 09 Mar 2010 23:13
Posts: 40
Hey there Luigi. I'm analysed most of the functions/operators and almost is clearing for me. But some questions are still inaccessibly for me =)

1) Questions about "Get <variable> string". For example:

Image

my code:

Code:
Get NULL short # take first two NULL bytes
Get TEXT string # takes 4 bytes of string text or not ?
Get SIZE long # decompressed file size
Get CSIZE long # compressed file size
Savepos POS # Offset where is zlib starting
Clog ....


But I'v got an error with result. How much bytes the "get string" is taken ? What characters is it taken ? Because if I'm replacing "Get TEXT string" with "GetDString TEXT 0x04" or "IDString TEXT "test"" - all works fine

2) The same satuation. My code:

Code:
Get NULL short # take first two NULL bytes
GetCT TEXT string 0x3F # Must takes four bytes (0x02-0x06) until delimiter byte

My code....


So I'v got an error again. What's I'm doing wrong ? Why GetCT didn't takes four bytes and don't staying on offset 0x06 ?

3) if i have a file and I need so simply remove 5 (for example) first bytes. How can I done it ? Because something like
Code:
Get FSIZE asize
math FSIZE -= 5


removes last 5 bytes

4) Is it possible to create simple replace operation script ? I mean "find text1" and if found then "PutVarChr string" ?


Last edited by Gagarin on 09 Jan 2011 18:37, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 09 Jan 2011 18:21 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
1)
the type "string" takes all the bytes till a 0x00, so if you have "61 61 61 00" then it will take 4 bytes.
in the dump you posted the short is 0x0000 which means that it doesn't contain the size of the string and so I guess the string has a fixed size of 4 bytes, except if not specified in other places.
so use: getdstring TEXT 4

2)
"getct" must be used only in particular conditions and this is not the case because 0x3f is part of the SIZE field

3)
get SIZE asize
math SIZE -= 5
log "newfile.dat" 5 SIZE

4)
uhmm I guess you mean something like:
Code:
for
    findloc OFFSET string "oldtext"
    goto OFFSET
    putdstring "newtext" 7
next
remember that you must use the -w option from command-line if you want to write on the same input file (for security reasons!), otherwise use the following:
Code:
get SIZE asize
log MEMORY_FILE 0 SIZE
for
    findloc OFFSET string "oldtext" MEMORY_FILE -1
    if OFFSET < 0
        break
    endif
    goto OFFSET MEMORY_FILE
    putdstring "newtext" 7 MEMORY_FILE
next
log "newfile.txt" 0 SIZE MEMORY_FILE
I know that some of these commands could sound "weird" but it's enough normal because you are trying to do with quickbms something that is not in its "extractor" nature :)


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 09 Jan 2011 23:09 

Joined: 09 Mar 2010 23:13
Posts: 40
1) Thx ! I'm insert a null byte after my word "test" and "get string" works fine !

2) With which kind of variables/functions/strings/numbers GetCT worked then ? I thought I was going in right way =)

3) Thx, now it's all clear for me !

4) Works like a charm. Thank you !


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 10 Jan 2011 10:06 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
1)
why you must edit the archive you want to extract?
isn't getdstring ok?

2)
getct VARIABLE DELIMITER
in your case it's not applicable because 0x3f is not the delimiter, it's the low 8bit part of the SIZE field so it changes everytime


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 10 Jan 2011 13:28 

Joined: 09 Mar 2010 23:13
Posts: 40
1) because default file was easy. It's contains 4 bytes for compressed size, 4 for uncompressed and offset (and clog functions surely). I'm insert some null bytes and "test" string only for testing functions and there functionality. That's why I'm firstly testing "IDString", "GetDString" and now "get string"

2) hmmm, if I understood right, I need to use GetCT only with MEMORY_FILEs like in some of your scripts ?


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 10 Jan 2011 17:39 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
getct works with any file.
for example "getct TEXT 0x00" is exactly like "get TEXT string" because it reads the data till the reaching of the byte 0x00.


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 10 Jan 2011 20:32 

Joined: 09 Mar 2010 23:13
Posts: 40
ahhhh, understood now how is working. Thank you !


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 20 Jan 2011 18:37 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
new version 0.4.8 released:

http://aluigi.org/quickbms

it contains the quickbms64_test.exe file that should work with files and archives bigger than 4 gigabytes.

quickbms64_test.exe is a 32bit application so works with any Windows but consider that it's experimental, so use it ONLY with files over 4 gigabytes


Top
 Profile  
 
 Post subject: Re: some quickBMS questions
PostPosted: 13 Feb 2011 17:07 

Joined: 09 Mar 2010 23:13
Posts: 40
More questions is comes =)

Now I'm interesting about using your BMS scrpt calls "comtype_scan" ver. 2 (comtype_scan2 + batch file). It says this script can define compression archive type. So I'm using it for my file:

http://rapidshare.com/files/447728968/zork1.z3

With this:

Code:
comtype_scan2 comtype_scan2.bms  zork1.z3 c:\


And it's extracted for me about 200 .dmp files with nothing of nothing (break code). I'm try another file (simple .ff file in call of duty, which compressed with zlib) and I'v got same result - 200 .dmp files with nothing. What I'm doing wrong, how exactly it's working ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 37 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: