The gist is simple, I'm planing to rip sprites from a game called Beetle Bug/Junior/Ju and all of the games assets are contained in a stg file. Looking in the file with Notepad Plus and Notepad show the names of some assets and random text. If you have any idea how to extract them i'd like to know.
(04-04-2015, 10:13 PM)puggsoy Wrote: If you upload the file then I can take a look. Judging from your screenshot though, the file format doesn't look to complex.
04-05-2015, 12:15 AM (This post was last modified: 04-05-2015, 12:16 AM by puggsoy.)
Well it's not simple per-se, but I mean compared to a lot of other formats I've seen
Anyway, turns out it was. Here's a QuickBMS script:
Code:
# Beetle Bug .stg
#
# Written by puggsoy
# script for QuickBMS http://quickbms.aluigi.org
idstring "stg2"
getdstring DUMMY 0x0e
get INFSTART long
get FILES long
goto INFSTART
for i = 0 < FILES
get NMSZ short #not necessary but whatever
get DUMMY long
get ZERO byte
get SIZE long
get OFFSET long
getdstring NAME 0x1D
log NAME OFFSET SIZE
next i
The things you want should be ready to use in .png, .jpg, and .ogg format. Things like .lvl, .fnt, .spr, .dmo, and .sav probably aren't useful unless you want to try modding the game. There's also strings.bin which appears to hold all the text, again it isn't really useful if you're just extracting resources.
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
04-05-2015, 12:34 AM (This post was last modified: 04-05-2015, 12:35 AM by OS-PRIME.)
(04-05-2015, 12:15 AM)puggsoy Wrote: Well it's not simple per-se, but I mean compared to a lot of other formats I've seen
Anyway, turns out it was. Here's a QuickBMS script:
Code:
# Beetle Bug .stg
#
# Written by puggsoy
# script for QuickBMS http://quickbms.aluigi.org
idstring "stg2"
getdstring DUMMY 0x0e
get INFSTART long
get FILES long
goto INFSTART
for i = 0 < FILES
get NMSZ short #not necessary but whatever
get DUMMY long
get ZERO byte
get SIZE long
get OFFSET long
getdstring NAME 0x1D
log NAME OFFSET SIZE
next i
The things you want should be ready to use in .png, .jpg, and .ogg format. Things like .lvl, .fnt, .spr, .dmo, and .sav probably aren't useful unless you want to try modding the game. There's also strings.bin which appears to hold all the text, again it isn't really useful if you're just extracting resources.
Actually that is simple!
Anyway, i can't thank you enough for this. Is it okay if i add you as a submitter when i submit the sprites to the Spriters Resource?
(04-05-2015, 05:31 AM)puggsoy Wrote: If you upload the one that doesn't work I can maybe make something for it. With luck it shouldn't be drastically different.
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
I'd guess that .spr files would be used for loading and animating the sprites. Besides, all of the monster sprites were in the extracted folder as a .PNG
Yeah, a lot of files use the .spr extension but aren't necessarily the same. For these they just look like animation files or something, like OS-PRIME said.
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