[request] In-game music

08/16/2011 11:51 viper4513#1
Hey guys, i was wondering if anyone knew a way of setting the in-game music to your own custom music.

I know where the sound files are, and how to add my own files into the game, i also "think" that each different song that plays is triggered by the named areas in maps.

What i was wondering was, is there a way to set for example. Apulune square to play the goddess01.wav, as Apulune Square (in my game files) has no linked song.

And if anyone does know, what are the music triggers? or a way to find them out for myself (other than running around each map, until a song plays and writing it down, as i have been doing)

thanks in advance if anyone has any info for me :)
08/16/2011 11:56 RebeccaBlack#2
I can't say I know how they're triggered. I'm PRETTY sure (not 100% sure but yar) that any music files, triggers and such, would be handled in the .wld files of the map. You could open them up in a hex editor, and see if you can find any relation, but as far as I know, the triggers are unknown. n.n
08/16/2011 12:13 viper4513#3
Aww, i was hoping you wouldn't say something like that :P
I noticed that songs play and change when you reach named areas... but not all named areas actually play songs.... guess i'll keep looking then :P

Wanna find a way to make a whole map have 1 song, and another map another song, maybe on loop, or just edited to be like 10-15 mins long maybe. Thanks for your reply tho :)

1st, sorry for double post..
You were 100% correct there RB :)
just opened up a wld (47 for jungle) did a search of 1 of the songs i knew was in the map, and it found it instantly.

offset 00363EE0 (dunno if that would help anyone here for other maps)
offset 00363FE0 (the 2nd song file for that map)

still not sure on the triggers, but atleast that should make it possible to completely add new music and change the maps songs :)
08/17/2011 02:25 ShaiyaOmega#4
Using the search is Good Look [Only registered and activated users can see links. Click Here To Register...]

That allows you to change the music that is InGame as far as triggers i am not sure about that.
08/17/2011 18:03 viper4513#5
Reading what i wrote in my first post also helps :)

I already said i know how to find the sound files, how to extract, and import my own sound files, what i was asking was specifically about triggers, not how to "import" sounds into my data file... but thanks for the link for anyone else looking at this post wondering how to do it.
08/18/2011 02:24 castor4878#6
the background music of a .wld / FLD format are defined in a block consisting of:

- an array of .wav file names, the array starts with the number of items as a long (4 bytes), then N strings of 256 characters, zero terminated, w/o length-prefix and with lot of garbage. (these files are read from Sound/back).

- an array of coords of area where the music is played , the array also starts with the nbr of records and then some 9 * 4 bytes records.

these records are structured as:
- top-left coords of rectangle: 3 float values (x1, y1,z1)
- bottom-right coords of rectangle: 3 float values (x2, y2, z2)
- a long id (set to 0 in lot of cases)
- the music file identifier (long), it's the index of the .wav in the previous list (not all files are necessary present, ie have their list of coords).
- another long id (set to 0 in lot of cases).

before this block, the file contains a list of ""modules"" (a rock, a river, a forest, ...) that can contains the name of a sound file (from Sound directory) together with the texture filename (a .tga which is a .dds since episo 4.?); just forget that block and all the stuff before, do manual edition after finding the previous "background music" block.
08/18/2011 10:50 viper4513#7
Thank you Castor, once again proving that you know your shizz :P

I shall have a look into that, i kinda gave up hope after seeing all the stuff in Hex when i viewed the wld files.... but i shall give it another go looking at what you posted. Thanks again :)
08/18/2011 21:50 castor4878#8
Quote:
Originally Posted by viper4513 View Post
i shall give it another go looking at what you posted.
the boring thing is the map-height at beginning of the file...

a .wld file is as follows:

- format identifier ('FLD\0' or 'DUN\0')

for FLD format only:

- map size (long), all map are square, this is the length of a side
- the map-height, ... a mess (so far), if the map size is 1024 (Apu & others) this block is 789507 long, so skip that length

- textures-waves array, a number of records as long and then record defined as:
- texture name (256 char)
- ident (long)
- wave name (256 chars)

then for FLD & DUN:

- name of ground file (256 chars)
- buildings (Element)
- shapes (Element)
- trees (Element)
- grass (Element)
- VANI (Element)
- VANI(2) (Element)
- more (Element)
- MANI (Element) (coords have a additional long ident)
- name of effects file (char 256)
- vertices (array of locations: counter + N * 40 bytes)
- 3 longs always null (maybe linked to the vertices just before)
- Objects (Element)
- Sound/Music items
- Sound/Back items
- trailing data


[Only registered and activated users can see links. Click Here To Register...]
(for sound areas (x,y,z) is the first point, (r,s,t) is the second - the columns u,v,w are used by Element coordinates only)

an 'Element' is:
- an array of names, ie nb of string as long, N string as char256
- an array of locations, ie nb of records, N records of 40 bytes (44 for MANI records)

a Sound array is:
- an array of file names, ie nb of string as long, N string as char256
- an array of locations, ie nb of records and N records of 36 bytes (as listed in previous post)

with this info you can write a Q&D piece of code to read/write a .wld and modify on the fly the Sound arrays - the only constraint is to copy the full map-height block as well as the trailing data, and to comply with structures of each Element & Sound array, you will simply adjust the number of records according the added / removed filenames and/or locations.

Also note that "Environnement Sound" (Sound/Back) areas are usually larger (of course) and they don't stop to play while a "Background Music" (Sound/Music) is played when the toon enters its area.
(quoted name are those of the game sound control panel).
08/18/2011 22:16 viper4513#9
Oh... well thanks alot for that explanation, explained so much more than i expected :P
Thanks for that, makes the whole wld and music thing alot more simple for me....

on another little note.. what is that program you use to view your wld's?

I've tried in your tool, but it doesnt seem to load anything (thats me probably doing something wrong) :P thanks again for your amazing help Castor :)
08/18/2011 23:03 castor4878#10
Quote:
Originally Posted by viper4513 View Post
another little note.. what is that program you use to view your wld's?
shStudio ... release 0.7.5 which is not released so far.

btw, I'm not sure that the published version will contain editors, maybe only viewers.
08/19/2011 11:20 viper4513#11
Damn, it looks so shiny, i wants it :P

Guess i'll have to do it the "hard" way and actually work for it eh? :P