ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Sat Sep 22, 2018 12:04 am

All times are UTC




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Apr 13, 2018 11:14 am 

Joined: Thu Apr 05, 2018 7:08 am
Posts: 12
not related to this other format.
also, not sure if this should be in the audio section. feel free to move it there if so.

anyway, i couldn't really figure out much. there's 3 files for each "sound collection":

  • v*.wad: concatenated xbox adpcm audio.
  • p*.wad: contains some names at 0x8b7c, but i don't think there's any offsets/sizes related to the v*.wad file. not sure.
  • h*.wad: no idea. maybe the offsets/sizes are here and p*.wad points here instead?

inside p*.wad there's some sort of group structure there, with each one having a name, then some bytes followed by more names (more like IDs, really). in the bytes right after the group name there's a byte that gives the amount of the sounds that will appear. it could be more than just a byte, but i don't see how a 32-bit integer would fit in there, and i haven't seen any groups with more than 255 IDs anyway.

about the audio files, there's usually a lot of duplicates across different collections, which is odd. also, some of them are stored outside of the concatenated audio file.

there is one other kind of file (s*.wad), but i also couldn't really quite understand it. it contains the same "group names" as the p*.wad files, but instead of the IDs it has the actual names. there's only a few of those, but they're larger.

inside the attachment there's a small sound collection with all three files.


Attachments:
etmsample.zip [35.53 KiB]
Downloaded 27 times
Top
   
PostPosted: Sat May 05, 2018 4:28 am 

Joined: Thu Apr 05, 2018 7:08 am
Posts: 12
i kept looking at p*.wad a lot for some reason, when h*.wad was the one with offsets/sizes. the following quickbms script splits up all the v*.wad files correctly:

Code:
get INPUT_FILENAME filename
strlen INPUT_FILENAME_SIZE INPUT_FILENAME

log MEMORY_FILE 0 0
putdstring INPUT_FILENAME INPUT_FILENAME_SIZE MEMORY_FILE
goto 1 MEMORY_FILE
math INPUT_FILENAME_SIZE - 1
getdstring PREFIXLESS_FILENAME INPUT_FILENAME_SIZE MEMORY_FILE

string H_FILENAME = "h"
string H_FILENAME + PREFIXLESS_FILENAME

string V_FILENAME = "v"
string V_FILENAME + PREFIXLESS_FILENAME

open FDSE H_FILENAME 0
open FDSE V_FILENAME 1

get DUMMY long
get DUMMY long
get NUMBER_OF_SOUNDS long
get DUMMY long

for I = 0 < NUMBER_OF_SOUNDS
    get SIZE long
    get DUMMY long
    get OFFSET long
    get DUMMY long
    get DUMMY long
    get DUMMY long
    get DUMMY long
    get DUMMY long

    string SOUND_FILENAME p= "%s.adp" I
    log SOUND_FILENAME OFFSET SIZE 1
next I


as always, the resulting files can be played back using vgmstream (using this txth), or one of aluigi's xbox tools.

i'd still like to know if anyone has any ideas on how to grab the proper IDs for the sounds out of the p*.wad file.


Top
   
PostPosted: Wed May 09, 2018 11:56 pm 

Joined: Thu Apr 05, 2018 7:08 am
Posts: 12
figured it out

Code:
get INPUT_FILENAME filename
strlen INPUT_FILENAME_SIZE INPUT_FILENAME

log MEMORY_FILE 0 0
putdstring INPUT_FILENAME INPUT_FILENAME_SIZE MEMORY_FILE
goto 1 MEMORY_FILE
math INPUT_FILENAME_SIZE - 1
getdstring PREFIXLESS_FILENAME INPUT_FILENAME_SIZE MEMORY_FILE

string H_FILENAME = "h"
string H_FILENAME + PREFIXLESS_FILENAME

string V_FILENAME = "v"
string V_FILENAME + PREFIXLESS_FILENAME

string P_FILENAME = "p"
string P_FILENAME + PREFIXLESS_FILENAME

open FDSE H_FILENAME 0
open FDSE V_FILENAME 1
open FDSE P_FILENAME 2

get P_FILE_SIZE asize 2

# TODO: is there a reason for this offset to ALWAYS be where the groups start?
goto 0x8b7c 2
for
    # TODO: find group count in p*.wad so we can avoid this
    savepos P_FILE_OFFSET 2
    if P_FILE_OFFSET >= P_FILE_SIZE
        break
    endif

    getdstring GROUP_NAME 17 2
    get DUMMY byte 2
    get DUMMY byte 2
    get DUMMY byte 2
    get DUMMY byte 2
    get NUMBER_OF_SOUNDS byte 2
    get DUMMY byte 2
    get DUMMY byte 2

    for I = 0 < NUMBER_OF_SOUNDS
        getdstring SOUND_ID 8 2
        get DUMMY long 2
        get DUMMY long 2
        get DUMMY long 2
        get DUMMY long 2
        get DUMMY long 2
        get DUMMY long 2
        get INDEX short 2
        get DUMMY short 2
        get DUMMY long 2
        get DUMMY long 2 # this seems to be always increasing
        get DUMMY long 2 # sample rate?

        set ACTUAL_INDEX INDEX
        math ACTUAL_INDEX - 4096
        if ACTUAL_INDEX >= 0
            # sound is inside v*.wad
            set SOUND_INFO_OFFSET 32 # 8 longs
            math SOUND_INFO_OFFSET * ACTUAL_INDEX
            math SOUND_INFO_OFFSET + 16 # skip first four longs

            goto SOUND_INFO_OFFSET 0

            get SIZE long 0
            get DUMMY long 0 # this seems to be the same as INDEX
            get OFFSET long 0

            # TODO: this will show the prompt about overwriting/appending/etc,
            # which i think shouldn't really happen.
            # in the meantime, calling quickbms with -k does what i want.
            string SOUND_FILENAME p "%s.adp" SOUND_ID
            log SOUND_FILENAME OFFSET SIZE 1
        endif
    next I
next


(the game has a file called soundDB.h which maps IDs to filenames, should you want that)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited