ROM Hack adding sound effects

sandwichwater

Active Member
OP
Newcomer
Joined
Apr 13, 2021
Messages
38
Trophies
0
Age
22
XP
338
Country
United States
hello all , im trying to create a hack that adds a single new sound effect to a game which would in turn randomize between two sounds , the one already in the game and the new one , basically so that instead of just one sound playing during combat it would play a randomized two sound effects . if it helps any , the game im trying to hack is kingdom hearts 358/2 days (i know its not a game people typically hack or even know how to) to make the sound effects play more how they do in kingdom hearts recoded , which is running in the same engine with the same file formats . i do know my way around the sdat and everything that works in there , just not how to make games call audio or where the pointers even are , or if that would even do what im trying to achieve

in recoded your combat finisher has a total of two random voice clips that play , meanwhile in 358/2 days the finisher only has one possible voice clip . im trying to figure out how to bring the two random voice clips aspect of recoded into 358/2 days , i figure its more than possible as theyre running in the same engine , and the non finisher sounds already do randomized clips , but im not quite sure where in the rom itself i would change anything to actually make it happen , which is why i figured id ask . ive already tried simply adding another sound into the .sdat but it seems like it doesnt work because its not told to play that extra sound along with the one already in the game , so theres no way it can be randomized or even played through my testing . im thinking its maybe part of the arm7 but im not quite sure how at all id go about editing that either , even in hex

basically , i have no idea where in the world the games call audio from in order to cause random sound effects . whether its something like borrowing code to insert or finding what causes the sounds to play randomly or something tougher than that , id at least like to know if what im trying to do is tough to achieve or not , and if it is any help with it or being pointed towards documents to read or other places would be so appreciated
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Two main approaches I would have thought.

1) Use internal trimming commands and lengthen the existing one. Randomise those. There will be an upper limit on how much you can fit with this but most SWAR/SWAV in most games will be below it.
2) Do it as you say and add in a variable to randomise between two standard calls to audio. Variations on the theme can exist at game level as well -- the undub cheat I did a while back for Castlevania portrait of ruin I noted read a variable every audio call and adjusted accordingly and that could be twiddled with a cheat to essentially be random (easy enough to hardcode a cheat with DSATM to read something that is effectively random and have it twiddle things accordingly), and while this setup I imagine to be on the rarer side (don't know what goes for language settings as for the DS at least it was rare to see multiple dubs in one game).

Anyway my start would probably be to either find a related effect (attacking might well trigger an animation, result in a health drop or something along those lines. Easy enough to find by watching the OAM or health you found with a cheat) or see about the sound effect itself triggering an audio channel (a lot will use the first available channel which can be less reliable than might be ideal, though for a search rather than a hack it might not be so bad).
Others might watch for reads on the relevant part of the ROM (it is a known location after all), whatever constructed the read to it (I doubt the whole SDAT or SWAR is in memory all the time) can then be twiddled either properly using the original API (if one read file 40, if 0 read 39 sort of thing) or something more hackish (if some suitably random location = 0 add so much to the read to get it to the new file location, if 1 use original/don't add anything, will trouble any further hacks that change up locations though) depending upon your desires (layering one more compare and branch/IF ELSE loop is probably not so bad).

It is not the most absolute basic hack as you would technically be adding things but it is still fairly early on in the learning basic assembly hacks path rather than anything too radical.


Possible option the third. Silence the original audio (trim to 0, volume command, replace with silence... it can matter but probably not) and go in for some of the stuff seen when STRM support is not in games and people want to play full audio.
https://gbatemp.net/threads/telling-the-game-to-play-a-strm-instead-of-sseq.340692/#post-4511267
Way overkill for this but an option, even more so if you want to break out of the limitations of sound effects (granted ~10 seconds is achievable in stock SWAV/SWAR and possibly samples so that would want to be something). This would be more radical though, especially if you also have to port the above to a new game.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    OctoAori20 @ OctoAori20: Nice nice-