ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Tue Apr 24, 2018 4:57 am

All times are UTC




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
 Post subject: bms to pseudo code?
PostPosted: Sun Mar 25, 2018 7:41 pm 

Joined: Sun Mar 25, 2018 7:24 pm
Posts: 3
What would be the equivalent pseudo code for this?

Code:
# script for QuickBMS http://quickbms.aluigi.org

quickbmsver "0.7.1"
comtype zlibx

getdstring DUMMY 260
getdstring SIGN 32
math PKG_OLD = -1
get FULLSIZE asize
do
    get INDEX long
    get OFFSET long
    get SECSTART long
    get ZSIZE long
    get SOME_32BIT_CRC longlong
    get FLAGS longlong
    get CREATED longlong
    get ACCESSED longlong
    get MODIFIED longlong
    get SIZE long
    getdstring FILENAME 260
    getdstring PATH 260
    get DUMMY long
    get PKG long
    get DUMMY long
    if PKG != PKG_OLD
        string PKG_NAME p= "pkg%03d.pkg" PKG
        open FDSE PKG_NAME 1 EXISTS # just for working even if packages are missing...
        math PKG_OLD = PKG
    endif
    string NAME = PATH
    string NAME += FILENAME

    if EXISTS != 0
        if ZSIZE == SIZE
            log NAME OFFSET SIZE 1
        else
            clog NAME OFFSET ZSIZE SIZE 1
        endif
    endif
    savepos CURR
while CURR < FULLSIZE


I mean I get its reading the idx file but I don't see how its extracting or what it should use to extract the file from the above, what would be an actual pseudo code of the whole process?


Top
   
 Post subject: Re: bms to pseudo code?
PostPosted: Wed Mar 28, 2018 3:54 pm 

Joined: Sun Mar 25, 2018 7:24 pm
Posts: 3
OK, so I figured it out but, ini files seem to be either encrypted/xor'ed or are not compressed like the rest of the files.

What quickbms does with the list of files the script get? Does it run each file against some sort of encryption or packing test and then tries to break it or what?


Top
   
 Post subject: Re: bms to pseudo code?
PostPosted: Thu Mar 29, 2018 2:51 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 7925
there is no encryption, the files are compressed with a modified version of zlib/deflate that is available only in quickbms


Top
   
 Post subject: Re: bms to pseudo code?
PostPosted: Fri Mar 30, 2018 4:06 pm 

Joined: Sun Mar 25, 2018 7:24 pm
Posts: 3
aluigi wrote:
there is no encryption, the files are compressed with a modified version of zlib/deflate that is available only in quickbms

I see, thanks for the information, do you know which file should I look into quickbms source to study?

Thanks again.


Top
   
 Post subject: Re: bms to pseudo code?
PostPosted: Mon Apr 02, 2018 11:54 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 7925
src/compression/tinf.h
src/compression/tinflatex.c
(my modifications are those tagged with ALUIGI)

How the code is used in quickbms, t32 is just a normal 32bit integer:
Code:
            t32 = size;
            size = -1;
            tinf_init();
            if(tinf_uncompress(out, &t32, in + 2, zsize - 2) == TINF_OK) size = t32;


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC


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:
Powered by phpBB® Forum Software © phpBB Limited