Hi, need some help extracting the sounds from the LVL files. There's a file table at the beginning.
GCW.LVL
Thanks in advance.
Star Wars Battlefront 2004 PS2 LVL audio files
-
- Posts: 140
- Joined: Mon Feb 05, 2018 5:45 pm
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Star Wars Battlefront 2004 PS2 LVL audio files
The format is not so easy because there are various chunks ("emo_", "_pad") and the audio data is splitted in an unclear way.
For example 0x9580 at offset 0x7c is the size of the first raw PS adpcm data block.
No idea at the moment and it's time consuming.
I leave what I have done so far for testing:
For example 0x9580 at offset 0x7c is the size of the first raw PS adpcm data block.
No idea at the moment and it's time consuming.
I leave what I have done so far for testing:
Code: Select all
idstring "ucfb" # just like "RIFF"
get LVL_SIZE long
math LVL_SIZE + 8
do
get CHUNK_TYPE long
get SIZE long
savepos LIMIT
math LIMIT + SIZE
set NAME string ""
if CHUNK_TYPE == 0x5f6f6d65 # "emo_"
get DUMMY long
get OFFSET long
savepos BASE_OFF
math OFFSET + BASE_OFF
# I don't know what's the TYPE for the channels
math CHANNELS = 1
for x = 0 < 8
get TYPE long
get VAR long
if TYPE == 0x40fbdebd
math FILES = VAR
endif
next x
for i = 0 < FILES
getdstring DUMMY 0x10
for x = 0 < 4
get TYPE long
get VAR long
if TYPE == 0x2fb31c01
math FREQUENCY = VAR
elif TYPE == 0x23a0d95c
math SIZE = VAR
elif TYPE == 0x1d48feef
math DUMMY = VAR # 0x15000
elif TYPE == 0x809608b6
math DUMMY = VAR
endif
next x
log NAME OFFSET SIZE
math OFFSET + SIZE
next i
goto LIMIT
elif CHUNK_TYPE == 0x5bb97f21
# don't advance, it's probably part of "_pad" and "ucfb"
else # _pad and others
log NAME OFFSET SIZE
goto LIMIT
endif
savepos TMP
while TMP != LVL_SIZE
# you must provide the following values: OFFSET SIZE FREQUENCY and CHANNELS
startfunction DUMP_VAG
log MEMORY_FILE 0 0
put 0x64685353 long MEMORY_FILE
put 0x18 long MEMORY_FILE
put 0x10 long MEMORY_FILE
put FREQUENCY long MEMORY_FILE
put CHANNELS long MEMORY_FILE
xmath TMP "SIZE / CHANNELS"
put TMP long MEMORY_FILE
put 0 long MEMORY_FILE
put 0xffffffff long MEMORY_FILE
put 0x64625353 long MEMORY_FILE
put SIZE long MEMORY_FILE
append
log MEMORY_FILE OFFSET SIZE
append
get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE
endfunction