Users browsing this thread: 1 Guest(s)
Beetle Bug .stg File
#10
OK, managed to update the script so it works for those as well:

Code:
# Beetle Bug .stg
#
# Written by puggsoy
# script for QuickBMS http://quickbms.aluigi.org

idstring "stg2"
getdstring DUMMY 0x0e
get TBLEND long
get FILES long
get DUMMY short

for i = 0 < FILES
    get INFOFF long
    get CHNKNM long
    
    if CHNKNM != 0
        savepos TMP
        goto INFOFF
        
        for j = 0 < CHNKNM
            get NMSZ short #not necessary but whatever
            get DUMMY long
            get ZERO byte
            get SIZE long
            get OFFSET long
            getdstring NAME NMSZ
            
            log NAME OFFSET SIZE
            
            for TEST = 0 == 0
                get TEST byte
            next
            
            savepos POS
            math POS -= 1
            goto POS
            math i += 1
        next j
        
        goto TMP
    endif
next

I did two things here. First of all, I used an offset table at the front of the table to get at the information chunks. The first time round I wasn't aware how it worked but I got it this time. To be perfectly honest it doesn't really help at all and actually makes the script longer than necessary, but it doesn't slow it down and I guess it's more correct (and probably makes it more compatible for reimporting).

The other thing was that I didn't hard-code the name length. This is what screwed it up. I assumed that all names were 0x1D long but the Beetle Bug 2 files have different lengths. Unfortunately there's no way to detect the name length so I had to make a hackish loop that kind of goes through the padding until it reaches something else. It's not as clean as I would like but it's the only way I could think of. At least it doesn't seem to slow it down.

Should work for all archives now. Oh and by the way, Distr.stg does contain 2 tiny files but they're just config stuff that probably isn't really useful.
You may have a fresh start any moment you choose, for this thing that we call "failure" is not the falling down, but the staying down. -Mary Pickford
Reply
Thanked by:


Messages In This Thread
Beetle Bug .stg File - by OS-PRIME - 04-04-2015, 09:34 PM
RE: Beetle Bug .stg File - by puggsoy - 04-04-2015, 10:13 PM
RE: Beetle Bug .stg File - by OS-PRIME - 04-04-2015, 10:30 PM
RE: Beetle Bug .stg File - by puggsoy - 04-05-2015, 12:15 AM
RE: Beetle Bug .stg File - by OS-PRIME - 04-05-2015, 12:34 AM
RE: Beetle Bug .stg File - by puggsoy - 04-05-2015, 01:00 AM
RE: Beetle Bug .stg File - by OS-PRIME - 04-05-2015, 02:08 AM
RE: Beetle Bug .stg File - by puggsoy - 04-05-2015, 05:31 AM
RE: Beetle Bug .stg File - by OS-PRIME - 04-05-2015, 10:08 AM
RE: Beetle Bug .stg File - by puggsoy - 04-05-2015, 10:59 PM
RE: Beetle Bug .stg File - by sutinoer - 04-06-2015, 01:03 PM
RE: Beetle Bug .stg File - by OS-PRIME - 04-06-2015, 01:27 PM
RE: Beetle Bug .stg File - by puggsoy - 04-06-2015, 08:51 PM

Forum Jump: