Sfx Editor - 3rd Pass (#1873)

* First pass on SFX Editor

* Fix crash at night in Colossus (and probably other undocumented issues)

The SFX editor was swapping out the bytes corresponding to the sequence
to be played regardless of the audio command being issued. This fix
ensures the swap will only happen on commands which actually treat those
bytes as a sequence identifier.

* enabling a few more songs/fanfares

* Removing a few broken bgms, fixing the preview button returning to the wrong bgm

* Fixes restoration from miniboss music to previous one

* add timed minigame into the sounds pool

* A few small tweaks

* More cleanup and add instruments

* adjust usage of getReverseReplacementSeq

* Changes from feedback and prefix external methods with SfxEditor

Co-authored-by: RaelCappra <rael.cappra@gmail.com>
This commit is contained in:
Garrett Cox 2022-11-02 11:27:05 -05:00 committed by GitHub
parent fab52d323b
commit 897e70b6fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 415 additions and 0 deletions

View file

@ -1698,6 +1698,12 @@ void Audio_OcaSetInstrument(u8 arg0) {
return;
}
u16 sfxEditorId = arg0 + 0x81;
u16 newArg0 = SfxEditor_GetReplacementSeq(sfxEditorId);
if (newArg0 != sfxEditorId) {
arg0 = newArg0 - 0x81;
}
Audio_SeqCmd8(SEQ_PLAYER_SFX, 1, SFX_PLAYER_CHANNEL_OCARINA, arg0);
D_80130F10 = arg0;
if (arg0 == 0) {
@ -4580,6 +4586,7 @@ s32 func_800F5A58(u8 arg0) {
*/
void func_800F5ACC(u16 seqId) {
u16 curSeqId = func_800FA0B4(SEQ_PLAYER_BGM_MAIN);
curSeqId = SfxEditor_GetReverseReplacementSeq(curSeqId);
if ((curSeqId & 0xFF) != NA_BGM_GANON_TOWER && (curSeqId & 0xFF) != NA_BGM_ESCAPE && curSeqId != seqId) {
Audio_SetSequenceMode(SEQ_MODE_IGNORE);

View file

@ -221,6 +221,7 @@ void Audio_ProcessSoundRequest(void)
if (req->sfxId == 0) {
return;
}
req->sfxId = SfxEditor_GetReplacementSeq(req->sfxId);
bankId = SFX_BANK(req->sfxId);
if ((1 << bankId) & D_801333F0) {
AudioDebug_ScrPrt((const s8*)D_80133340, req->sfxId);

View file

@ -368,6 +368,16 @@ extern f32 D_80130F28;
void Audio_QueueSeqCmd(u32 cmd)
{
u8 op = cmd >> 28;
if (op == 0 || op == 2 || op == 12){
u16 oldSeqId = cmd & 0xFFFF;
u16 newSeqId = SfxEditor_GetReplacementSeq(oldSeqId);
if (newSeqId != oldSeqId) {
cmd &= ~0xFFFF;
cmd |= newSeqId;
}
}
sAudioSeqCmds[sSeqCmdWrPos++] = cmd;
}