Skip to content

Commit

Permalink
Import QuickBMS scripts from Gist
Browse files Browse the repository at this point in the history
  • Loading branch information
ccawley2011 committed Oct 7, 2020
1 parent c050523 commit 6a45f72
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 0 deletions.
38 changes: 38 additions & 0 deletions QuickBMS/scripts/4Mation.bms
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 4Mation archive unpacker
# By Cameron Cawley

IDString "BIIK-DJC"
get ARCHIVE_SIZE asize
goto 20
get FILEINDEX long
goto FILEINDEX
get TEMP long
get INDEXSIZE long
get HEADERSIZE long
getct INDEXNAME string 0
padding 4
math FILEINDEX += HEADERSIZE
do
get ENTRYSIZE long
get OFFSET long
getct NAME string 0
padding 4
math FILEINDEX += ENTRYSIZE
goto OFFSET
get TYPE long
get SIZE long
get HEADSIZE long
math SIZE -= HEADSIZE
math OFFSET += HEADSIZE
getct NAME string 0
padding 4
if TYPE == 11
string NAME += ",aff"
elif TYPE == 2
string NAME += ",cb6"
else
string NAME += ",ffd")
endif
log NAME OFFSET SIZE
goto FILEINDEX
while FILEINDEX < ARCHIVE_SIZE
24 changes: 24 additions & 0 deletions QuickBMS/scripts/SADX.bms
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Sonic Adventure DX .dat unpacker
# By Cameron Cawley
# Based on information from https://info.sonicretro.org/SCHG:Sonic_Adventure_DX:_PC/Sound_Editing/Sound_Effects#Format

getdstring IDSTR 16
set ID04 binary "archive V2.2\0\0\0"
set ID10 binary = "archive V2.DMZ\0"
if IDSTR == ID04
elif IDSTR == ID10
else
cleanexit
endif
get COUNT long
set POSITION long 20
for i = 0 < COUNT
get NAMEPTR long
get OFFSET long
get SIZE long
savepos POSITION
goto NAMEPTR
getct NAME string 0
goto POSITION
log NAME OFFSET SIZE
next i
43 changes: 43 additions & 0 deletions QuickBMS/scripts/SCCmods.bms
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Sonic Classic Collection .mods unpacker
# By Cameron Cawley

get COUNT long
set POSITION long 4
for i = 0 < COUNT
get FIRSTPTR long
math POSITION += 4
get NEXTPTR long
if FIRSTPTR != NEXTPTR
set MEMORY_FILE binary "\x53\x57\x41\x56\xff\xfe\x00\x01\x00\x00\x00\x00\x10\x00\x01\x00\x44\x41\x54\x41\x00\x00\x00\x00\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
goto FIRSTPTR
get SIZE long
math SIZE -= 16
get LOOP long
get SAMPLERATE short
get TEMP1 long
get TEMP2 short
string NAME = "Track"
string NAME + i
string NAME + ".swav"
savepos OFFSET

set SIZEMINUSLOOP SIZE
math SIZEMINUSLOOP -= LOOP
set DATASIZE SIZE
math DATASIZE += 16
set FILESIZE SIZE
math FILESIZE += 16

putvarchr MEMORY_FILE 8 FILESIZE long
putvarchr MEMORY_FILE 20 DATASIZE long
putvarchr MEMORY_FILE 26 SAMPLERATE short
putvarchr MEMORY_FILE 28 SIZE short
putvarchr MEMORY_FILE 30 LOOP short
putvarchr MEMORY_FILE 32 SIZEMINUSLOOP long
log NAME 0 36 MEMORY_FILE
append
log NAME OFFSET SIZE
append
endif
goto POSITION
next i
27 changes: 27 additions & 0 deletions QuickBMS/scripts/SCDsounds.bms
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Sonic CD (PC 1996) pcm8.cmp unpacker
# By Cameron Cawley
# Based on information from https://info.sonicretro.org/SCHG:Sonic_CD_(PC)#Sound_Effects

IDString "OTHE"
get EOF long
get COUNT long
get OFFSET long

for i = 0 < COUNT
get SIZE long
set MEMORY_FILE binary "\x52\x49\x46\x46\x00\x00\x00\x00\x57\x41\x56\x45\x66\x6D\x74\x20\x10\x00\x00\x00\x01\x00\x01\x00\x11\x2B\x00\x00\x11\x2B\x00\x00\x01\x00\x08\x00\x64\x61\x74\x61\x00\x00\x00\x00"
string NAME = "Sound"
string NAME + i
string NAME + ".wav"

set FILESIZE SIZE
math FILESIZE += 40
putvarchr MEMORY_FILE 4 FILESIZE long
putvarchr MEMORY_FILE 40 SIZE long

log NAME 0 44 MEMORY_FILE
append
log NAME OFFSET SIZE
append
math OFFSET += SIZE
next i
20 changes: 20 additions & 0 deletions QuickBMS/scripts/Sim2000.bms
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Sim City 2000 SC2000.DAT unpacker
# By Cameron Cawley

getdstring NAME 12
get OFFSET long
math COUNT = OFFSET
math COUNT /= 16

for i = 1 <= COUNT
getdstring NEXTNAME 12
get NEXTOFFSET long
if i = COUNT
get NEXTOFFSET asize
endif
math SIZE = NEXTOFFSET
math SIZE -= OFFSET
log NAME OFFSET SIZE
set NAME = NEXTNAME
set OFFSET = NEXTOFFSET
next i
38 changes: 38 additions & 0 deletions QuickBMS/scripts/dgamer.bms
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# DGamer .fun unpacker
# By Cameron Cawley

get NAMES long
math NAMES += 24
get NAMESLEN long
get POINTERS long
get POINTERSLEN long

do
goto NAMES
get NAME_LENGTH byte
math NAMES += 1
math FOLDER = NAME_LENGTH
math FOLDER >> 7
if NAME_LENGTH == 0
cleanexit
elif FOLDER == 1
math NAME_LENGTH & 127
getdstring FOLDER_NAME NAME_LENGTH
math NAMES += NAME_LENGTH
math NAMES += 3
else
getdstring FILE_NAME NAME_LENGTH
math NAMES += NAME_LENGTH

goto POINTERS
get START_OFFSET long
get END_OFFSET long
math END_OFFSET -= START_OFFSET
math POINTERS += 8

string NAME = FOLDER_NAME
string NAME += /
string NAME += FILE_NAME
log NAME START_OFFSET END_OFFSET
endif
while NAME_LENGTH > 0
17 changes: 17 additions & 0 deletions QuickBMS/scripts/gsp_run.bms
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# gsp_run.dat unpacker
# By Cameron Cawley

get ARCHIVE_SIZE asize
math ARCHIVE_SIZE += 1
math OFFSET = 0

do
goto OFFSET
get NAME_LENGTH long
getdstring NAME NAME_LENGTH
get SIZE long
math OFFSET += 8
math OFFSET += NAME_LENGTH
log NAME OFFSET SIZE
math OFFSET += SIZE
while OFFSET < ARCHIVE_SIZE

0 comments on commit 6a45f72

Please sign in to comment.