GRY files [Twisted Metal 2, Jet Moto, and Outwars]

Codecs, formats, encoding/decoding of game audio, video and music
ultradumb
Posts: 7
Joined: Thu Apr 23, 2020 5:57 pm

GRY files [Twisted Metal 2, Jet Moto, and Outwars]

Post by ultradumb »

I am new to bms scripts, but I managed to create a bms script for GRY files that hold sound effects for the old PC games Twisted Metal 2, Jet Moto, and Outwars.

Code: Select all

# Script to extract the sound effects in GRY files from
# the PC games Twisted Metal2, Jet Moto, and Outwars

# Modified from the "WAVE format scanner" script by AlphaTwentyThree
# https://forum.xentax.com/viewtopic.php?f=13&p=74664#p74664

IDString "\x27\x70\x06\x03"

For i = 1
   FindLoc OFFSET binary "\xA0\xB9\xB7\x00" 0
   if OFFSET == ""
      cleanexit
   endif
   GOTO OFFSET

   FindLoc OFFSET2 binary "\x2E\x3E\x9D\x00" 0
   if OFFSET2 == ""
      cleanexit
   endif
   GOTO OFFSET2

   get NAME basename
   string NAME += "_"
   if i < 10
      string NAME += 0
      string NAME += i
   else
      string NAME += i
   endif
   string NAME += "_"
   string NAME += OFFSET
   string NAME += ".vgmstream"

   get DUMMY long
   get STREAMSIZE long

   SAVEPOS MYOFF

   set HEADERSIZE MYOFF
   math HEADERSIZE -= OFFSET
   set SIZE HEADERSIZE
   math SIZE += STREAMSIZE

   log NAME OFFSET SIZE

   set SEARCH OFFSET
   math SEARCH += SIZE
   if SEARCH == FSIZE
      cleanexit
   endif
   GOTO SEARCH
Next i


Then you can play the extracted files with Foobar2000 and vgmstream with the following .txth files.

Code: Select all

# PC Twisted Metal 2 and Jet Moto

id_value = 0xA0B9B700
id_offset = @0x00:BE

codec = PCM16LE

channels = @0x06$1
sample_rate = @0x08

start_offset = 0x1c
data_size = @0x18
num_samples = data_size


Not too sure if the ADPCM plays correctly, because they play in mono, but interleave has to be set.

Code: Select all

# Outwars ADPCM - all except O5

id_value = 0xA0B9B700
id_offset = @0x00:BE

codec = MSADPCM
interleave = @0x14$2

channels = @0x0a$1
sample_rate = @0x0c

start_offset = 0x4e
data_size = @0x4a
num_samples = data_size


Code: Select all

# Outwars PCM from O5

id_value = 0xA0B9B700
id_offset = @0x00:BE

codec = PCM16LE

channels = @0x0a$1
sample_rate = @0x0c

start_offset = 0x20
data_size = @0x1c
num_samples = data_size