diff --git a/first_diff.py b/first_diff.py index fff96557a1..3b8a9dd46a 100755 --- a/first_diff.py +++ b/first_diff.py @@ -93,7 +93,7 @@ def search_rom_address(target_addr): rom = ram - ram_offset sym = line.split()[-1] - if "0x" in sym: + if sym.startswith("0x"): ram_offset = None continue if "/" in sym: @@ -139,7 +139,7 @@ def parse_map(map_fname): rom = ram - ram_offset sym = line.split()[-1] - if "0x" in sym: + if sym.startswith("0x"): ram_offset = None continue elif "/" in sym: diff --git a/include/functions.h b/include/functions.h index 9f715a1385..3051f1618e 100644 --- a/include/functions.h +++ b/include/functions.h @@ -906,8 +906,8 @@ void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 s32 Environment_GetBgsDayCount(void); void Environment_ClearBgsDayCount(void); s32 Environment_GetTotalDays(void); -void func_800775F0(u16); -s32 func_80077600(void); +void Environment_ForcePlaySequence(u16); +s32 Environment_IsForcedSequenceDisabled(void); void func_80077624(GlobalContext* globalCtx); void func_80077684(GlobalContext* globalCtx); void Environment_WarpSongLeave(GlobalContext* globalCtx); diff --git a/include/sequence.h b/include/sequence.h index 2c77087e2c..2b6cc46664 100644 --- a/include/sequence.h +++ b/include/sequence.h @@ -1,10 +1,10 @@ -#ifndef BGM_H -#define BGM_H +#ifndef SEQUENCE_H +#define SEQUENCE_H #define NA_BGM_STOP 0x100000FF #define NA_BGM_GENERAL_SFX 0x0 // General Sound Effects -#define NA_BGM_NATURE_BACKGROUND 0x1 // Environmental nature background sounds +#define NA_BGM_NATURE_AMBIENCE 0x1 // Environmental nature background sounds #define NA_BGM_FIELD_LOGIC 0x2 // Hyrule Field #define NA_BGM_FIELD_INIT 0x3 // Hyrule Field Initial Segment From Loading Area #define NA_BGM_FIELD_MOVE_1 0x4 // Hyrule Field Moving Segment 1 diff --git a/include/z64.h b/include/z64.h index e15c9e2bb9..fbe0112531 100644 --- a/include/z64.h +++ b/include/z64.h @@ -185,10 +185,9 @@ typedef struct { } View; // size = 0x128 typedef struct { - /* 0x00 */ u8 seqIndex; - /* 0x01 */ u8 nightSeqIndex; - /* 0x02 */ char unk_02[0x2]; -} SoundContext; // size = 0x4 + /* 0x00 */ u8 seqId; + /* 0x01 */ u8 natureAmbienceId; +} SequenceContext; // size = 0x2 typedef struct { /* 0x00 */ s32 enabled; @@ -1138,7 +1137,7 @@ typedef struct GlobalContext { /* 0x00790 */ Camera* cameraPtrs[NUM_CAMS]; /* 0x007A0 */ s16 activeCamera; /* 0x007A2 */ s16 nextCamera; - /* 0x007A4 */ SoundContext soundCtx; + /* 0x007A4 */ SequenceContext sequenceCtx; /* 0x007A8 */ LightContext lightCtx; /* 0x007B8 */ FrameAdvanceContext frameAdvCtx; /* 0x007C0 */ CollisionContext colCtx; diff --git a/include/z64save.h b/include/z64save.h index 7cb6193c86..982da9d5c5 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -135,8 +135,8 @@ typedef struct { /* 0x13D6 */ s16 timerX[2]; /* 0x13DA */ s16 timerY[2]; /* 0x13DE */ char unk_13DE[0x0002]; - /* 0x13E0 */ u8 seqIndex; - /* 0x13E1 */ u8 nightSeqIndex; + /* 0x13E0 */ u8 seqId; + /* 0x13E1 */ u8 natureAmbienceId; /* 0x13E2 */ u8 buttonStatus[5]; /* 0x13E7 */ u8 unk_13E7; // alpha related /* 0x13E8 */ u16 unk_13E8; // alpha type? @@ -157,7 +157,7 @@ typedef struct { /* 0x140A */ u8 audioSetting; /* 0x140B */ char unk_140B[0x0001]; /* 0x140C */ u8 zTargetSetting; // 0: Switch; 1: Hold - /* 0x140E */ u16 unk_140E; // bgm related + /* 0x140E */ u16 forcedSeqId; // immediately start playing the sequence if set /* 0x1410 */ u8 unk_1410; // transition related /* 0x1411 */ char unk_1411[0x0001]; /* 0x1412 */ u16 nextCutsceneIndex; diff --git a/include/z64scene.h b/include/z64scene.h index f6cbb5ebef..fcdb5fad8c 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -157,10 +157,10 @@ typedef struct { typedef struct { /* 0x00 */ u8 code; - /* 0x01 */ u8 bgmId; + /* 0x01 */ u8 specId; /* 0x02 */ char pad[4]; - /* 0x06 */ u8 nightSeqIndex; - /* 0x07 */ u8 seqIndex; + /* 0x06 */ u8 natureAmbienceId; + /* 0x07 */ u8 seqId; } SCmdSoundSettings; typedef struct { @@ -513,8 +513,8 @@ typedef enum { #define SCENE_CMD_END() \ { SCENE_CMD_ID_END, 0, CMD_W(0) } -#define SCENE_CMD_SOUND_SETTINGS(audioSessionId, nighttimeSfx, bgmId) \ - { SCENE_CMD_ID_SOUND_SETTINGS, audioSessionId, CMD_BBBB(0, 0, nighttimeSfx, bgmId) } +#define SCENE_CMD_SOUND_SETTINGS(specId, natureAmbienceId, seqId) \ + { SCENE_CMD_ID_SOUND_SETTINGS, specId, CMD_BBBB(0, 0, natureAmbienceId, seqId) } #define SCENE_CMD_ECHO_SETTINGS(echo) \ { SCENE_CMD_ID_ECHO_SETTINGS, 0, CMD_BBBB(0, 0, 0, echo) } diff --git a/src/code/code_800EC960.c b/src/code/code_800EC960.c index 18c23f141d..b1af38f950 100644 --- a/src/code/code_800EC960.c +++ b/src/code/code_800EC960.c @@ -2809,7 +2809,7 @@ void AudioDebug_ProcessInput(void) { if (CHECK_BTN_ANY(sDebugPadPress, BTN_A)) { sAudioSndContWork[5] ^= 1; Audio_SeqCmdE01(SEQ_PLAYER_BGM_MAIN, sAudioSndContWork[5]); - if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) != NA_BGM_NATURE_BACKGROUND) { + if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) != NA_BGM_NATURE_AMBIENCE) { Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, 0); } Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0); @@ -3840,7 +3840,7 @@ void func_800F5BF0(u8 arg0) { u16 temp_v0; temp_v0 = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); - if (temp_v0 != NA_BGM_NATURE_BACKGROUND) { + if (temp_v0 != NA_BGM_NATURE_AMBIENCE) { D_80130628 = temp_v0; } func_800F6FB4(arg0); @@ -3934,7 +3934,7 @@ void func_800F5E90(u8 arg0) { } Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 3, sAudioEnemyVol, phi_t0); Audio_StartSeq(SEQ_PLAYER_BGM_SUB, 10, NA_BGM_ENEMY | 0x800); - if (phi_t1 != NA_BGM_NATURE_BACKGROUND) { + if (phi_t1 != NA_BGM_NATURE_AMBIENCE) { Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 3, (0x7F - sAudioEnemyVol) & 0xFF, 0xA); func_800F510C(sAudioEnemyVol); } @@ -3990,11 +3990,11 @@ void func_800F6114(f32 dist) { sAudioEnemyVol = ((350.0f - adjDist) * 127.0f) / 350.0f; Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 3, sAudioEnemyVol, 0xA); - if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_BACKGROUND) { + if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_AMBIENCE) { Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 3, (0x7F - sAudioEnemyVol), 0xA); } } - if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_BACKGROUND) { + if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_AMBIENCE) { func_800F510C(sAudioEnemyVol); } } @@ -4028,7 +4028,7 @@ void func_800F6268(f32 dist, u16 arg1) { D_8016B9D8++; } } - } else if ((temp_a0 == NA_BGM_NATURE_BACKGROUND) && ((arg1 & 0xFF) == NA_BGM_LONLON)) { + } else if ((temp_a0 == NA_BGM_NATURE_AMBIENCE) && ((arg1 & 0xFF) == NA_BGM_LONLON)) { temp_a0 = (s8)(func_800FA0B4(SEQ_PLAYER_BGM_SUB) & 0xFF); if ((temp_a0 != (arg1 & 0xFF)) && (D_8016B9D8 < 10)) { func_800F5E18(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0); @@ -4151,7 +4151,7 @@ void Audio_SetExtraFilter(u8 filter) { sAudioExtraFilter2 = filter; sAudioExtraFilter = filter; - if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 == NA_BGM_NATURE_BACKGROUND) { + if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 == NA_BGM_NATURE_AMBIENCE) { for (i = 0; i < 16; i++) { t = i; // CHAN_UPD_SCRIPT_IO (seq player 0, all channels, slot 6) @@ -4275,7 +4275,7 @@ void func_800F6D58(u8 arg0, u8 arg1, u8 arg2) { u8 temp_a0; u8 i; - if ((D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_BACKGROUND) && func_800FA11C(1, 0xF00000FF)) { + if ((D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_AMBIENCE) && func_800FA11C(1, 0xF00000FF)) { sAudioNatureFailed = 1; return; } @@ -4316,7 +4316,7 @@ void func_800F6E7C(u16 arg0, u16 arg1) { Audio_SeqCmdE01(SEQ_PLAYER_BGM_MAIN, 0); } - Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_NATURE_BACKGROUND); + Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_NATURE_AMBIENCE); if (i != 0) { Audio_SeqCmdE01(SEQ_PLAYER_BGM_MAIN, 1); diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index f63c9b4af9..fbe01f7c7f 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -8,9 +8,9 @@ void SaveContext_Init(void) { bzero(&gSaveContext, sizeof(gSaveContext)); D_8015FA88 = 0; D_8015FA8C = 0; - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; - gSaveContext.unk_140E = NA_BGM_GENERAL_SFX; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; + gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; gSaveContext.nextCutsceneIndex = 0xFFEF; gSaveContext.cutsceneTrigger = 0; gSaveContext.chamberCutsceneNum = 0; diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index d8e00faade..e9a0eef644 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -62,8 +62,8 @@ void GameOver_Update(GlobalContext* globalCtx) { gSaveContext.nayrusLoveTimer = 2000; gSaveContext.naviTimer = 0; - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; gSaveContext.eventInf[0] = 0; gSaveContext.eventInf[1] = 0; gSaveContext.eventInf[2] = 0; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 6125372013..99d5dffa8f 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1922,34 +1922,34 @@ void func_800758AC(GlobalContext* globalCtx) { // both lost woods exits on the bridge from kokiri to hyrule field if (((void)0, gSaveContext.entranceIndex) == 0x4DE || ((void)0, gSaveContext.entranceIndex) == 0x5E0) { func_800F6FB4(4); - } else if (((void)0, gSaveContext.unk_140E) != NA_BGM_GENERAL_SFX) { - if (!func_80077600()) { - Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | (s32)((void)0, gSaveContext.unk_140E)); + } else if (((void)0, gSaveContext.forcedSeqId) != NA_BGM_GENERAL_SFX) { + if (!Environment_IsForcedSequenceDisabled()) { + Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | (s32)((void)0, gSaveContext.forcedSeqId)); } - gSaveContext.unk_140E = NA_BGM_GENERAL_SFX; - } else if (globalCtx->soundCtx.seqIndex == NA_BGM_NO_MUSIC) { - if (globalCtx->soundCtx.nightSeqIndex == 0x13) { + gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; + } else if (globalCtx->sequenceCtx.seqId == NA_BGM_NO_MUSIC) { + if (globalCtx->sequenceCtx.natureAmbienceId == 0x13) { return; } - if (((void)0, gSaveContext.nightSeqIndex) != globalCtx->soundCtx.nightSeqIndex) { - func_800F6FB4(globalCtx->soundCtx.nightSeqIndex); + if (((void)0, gSaveContext.natureAmbienceId) != globalCtx->sequenceCtx.natureAmbienceId) { + func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId); } - } else if (globalCtx->soundCtx.nightSeqIndex == 0x13) { + } else if (globalCtx->sequenceCtx.natureAmbienceId == 0x13) { // "BGM Configuration" - osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", globalCtx->soundCtx.seqIndex, - ((void)0, gSaveContext.seqIndex)); - if (((void)0, gSaveContext.seqIndex) != globalCtx->soundCtx.seqIndex) { - func_800F5550(globalCtx->soundCtx.seqIndex); + osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", globalCtx->sequenceCtx.seqId, + ((void)0, gSaveContext.seqId)); + if (((void)0, gSaveContext.seqId) != globalCtx->sequenceCtx.seqId) { + func_800F5550(globalCtx->sequenceCtx.seqId); } } else if (((void)0, gSaveContext.dayTime) > 0x4AAA && ((void)0, gSaveContext.dayTime) < 0xB71D) { - if (((void)0, gSaveContext.seqIndex) != globalCtx->soundCtx.seqIndex) { - func_800F5550(globalCtx->soundCtx.seqIndex); + if (((void)0, gSaveContext.seqId) != globalCtx->sequenceCtx.seqId) { + func_800F5550(globalCtx->sequenceCtx.seqId); } globalCtx->envCtx.unk_E0 = 1; } else { - if (((void)0, gSaveContext.nightSeqIndex) != globalCtx->soundCtx.nightSeqIndex) { - func_800F6FB4(globalCtx->soundCtx.nightSeqIndex); + if (((void)0, gSaveContext.natureAmbienceId) != globalCtx->sequenceCtx.natureAmbienceId) { + func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId); } if (((void)0, gSaveContext.dayTime) > 0xB71C && ((void)0, gSaveContext.dayTime) < 0xCAAC) { @@ -1961,10 +1961,10 @@ void func_800758AC(GlobalContext* globalCtx) { } } - osSyncPrintf("\n-----------------\n", ((void)0, gSaveContext.unk_140E)); - osSyncPrintf("\n 強制BGM=[%d]", ((void)0, gSaveContext.unk_140E)); // "Forced BGM" - osSyncPrintf("\n BGM=[%d]", globalCtx->soundCtx.seqIndex); - osSyncPrintf("\n エンブ=[%d]", globalCtx->soundCtx.nightSeqIndex); + osSyncPrintf("\n-----------------\n", ((void)0, gSaveContext.forcedSeqId)); + osSyncPrintf("\n 強制BGM=[%d]", ((void)0, gSaveContext.forcedSeqId)); // "Forced BGM" + osSyncPrintf("\n BGM=[%d]", globalCtx->sequenceCtx.seqId); + osSyncPrintf("\n エンブ=[%d]", globalCtx->sequenceCtx.natureAmbienceId); osSyncPrintf("\n status=[%d]", globalCtx->envCtx.unk_E0); Audio_SetEnvReverb(globalCtx->roomCtx.curRoom.echo); @@ -1977,7 +1977,7 @@ void func_80075B44(GlobalContext* globalCtx) { func_800F6D58(86, 1, 0); if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { osSyncPrintf("\n\n\nNa_StartMorinigBgm\n\n"); - func_800F5510(globalCtx->soundCtx.seqIndex); + func_800F5510(globalCtx->sequenceCtx.seqId); } globalCtx->envCtx.unk_E0++; break; @@ -1997,7 +1997,7 @@ void func_80075B44(GlobalContext* globalCtx) { break; case 3: if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { - func_800F6FB4(globalCtx->soundCtx.nightSeqIndex); + func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId); func_800F6D58(1, 1, 1); } globalCtx->envCtx.unk_E0++; @@ -2390,25 +2390,25 @@ s32 Environment_GetTotalDays(void) { return gSaveContext.totalDays; } -void func_800775F0(u16 arg0) { - gSaveContext.unk_140E = arg0; +void Environment_ForcePlaySequence(u16 seqId) { + gSaveContext.forcedSeqId = seqId; } -s32 func_80077600(void) { - s32 ret = false; +s32 Environment_IsForcedSequenceDisabled(void) { + s32 isDisabled = false; - if (gSaveContext.unk_140E == NA_BGM_DISABLED) { - ret = true; + if (gSaveContext.forcedSeqId == NA_BGM_DISABLED) { + isDisabled = true; } - return ret; + return isDisabled; } void func_80077624(GlobalContext* globalCtx) { - if (globalCtx->soundCtx.nightSeqIndex == 19) { + if (globalCtx->sequenceCtx.natureAmbienceId == 19) { func_800F6FB4(5); } else { - func_800F6FB4(globalCtx->soundCtx.nightSeqIndex); + func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId); } func_800F6D58(14, 1, 1); @@ -2419,8 +2419,8 @@ void func_80077684(GlobalContext* globalCtx) { func_800F6D58(14, 1, 0); func_800F6D58(15, 1, 0); - if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_BACKGROUND) { - gSaveContext.seqIndex = NA_BGM_NATURE_SFX_RAIN; + if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) { + gSaveContext.seqId = NA_BGM_NATURE_SFX_RAIN; func_800758AC(globalCtx); } } diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index c0d674e7cf..03fa51887d 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -4160,8 +4160,8 @@ void Interface_Update(GlobalContext* globalCtx) { globalCtx->sceneLoadFlag = 0x14; gSaveContext.sunsSongState = SUNSSONG_INACTIVE; func_800F6964(30); - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; } else { gSaveContext.sunsSongState = SUNSSONG_SPECIAL; } diff --git a/src/code/z_play.c b/src/code/z_play.c index 7e82bf3b5b..de86b1b2e6 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -393,8 +393,8 @@ void Gameplay_Init(GameState* thisx) { Interface_SetSceneRestrictions(globalCtx); func_800758AC(globalCtx); - gSaveContext.seqIndex = globalCtx->soundCtx.seqIndex; - gSaveContext.nightSeqIndex = globalCtx->soundCtx.nightSeqIndex; + gSaveContext.seqId = globalCtx->sequenceCtx.seqId; + gSaveContext.natureAmbienceId = globalCtx->sequenceCtx.natureAmbienceId; func_8002DF18(globalCtx, GET_PLAYER(globalCtx)); AnimationContext_Update(globalCtx, &globalCtx->animationCtx); gSaveContext.respawnFlag = 0; @@ -479,12 +479,12 @@ void Gameplay_Update(GlobalContext* globalCtx) { if (!(gEntranceTable[globalCtx->nextEntranceIndex + sp6E].field & 0x8000)) { // Continue BGM Off // "Sound initalized. 111" osSyncPrintf("\n\n\nサウンドイニシャル来ました。111"); - if ((globalCtx->fadeTransition < 56) && (func_80077600() == 0)) { + if ((globalCtx->fadeTransition < 56) && !Environment_IsForcedSequenceDisabled()) { // "Sound initalized. 222" osSyncPrintf("\n\n\nサウンドイニシャル来ました。222"); func_800F6964(0x14); - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; } } } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index d6fcf566c9..6948d09cc7 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -413,11 +413,11 @@ void func_80099134(GlobalContext* globalCtx, SceneCmd* cmd) { // Scene Command 0x15: Sound Settings void func_80099140(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->soundCtx.seqIndex = cmd->soundSettings.seqIndex; - globalCtx->soundCtx.nightSeqIndex = cmd->soundSettings.nightSeqIndex; + globalCtx->sequenceCtx.seqId = cmd->soundSettings.seqId; + globalCtx->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId; - if (gSaveContext.seqIndex == (u8)NA_BGM_DISABLED) { - Audio_QueueSeqCmd(cmd->soundSettings.bgmId | 0xF0000000); + if (gSaveContext.seqId == (u8)NA_BGM_DISABLED) { + Audio_QueueSeqCmd(cmd->soundSettings.specId | 0xF0000000); } } diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index f1c379b1cb..245b8c4a2f 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -115,11 +115,11 @@ void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, GlobalConte gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0xF) | 6; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000; globalCtx->fadeTransition = 3; - func_800775F0(NA_BGM_INGO); + Environment_ForcePlaySequence(NA_BGM_INGO); } else { gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0xF) | 4; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000; - func_800775F0(NA_BGM_INGO); + Environment_ForcePlaySequence(NA_BGM_INGO); globalCtx->fadeTransition = 0x2E; } } else { diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index e19acfb3ce..688f218834 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -630,7 +630,7 @@ void func_80A7A4C8(EnIn* this, GlobalContext* globalCtx) { gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x000F) | 0x0001; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000; gSaveContext.infTable[10] &= ~4; - func_800775F0(NA_BGM_HORSE); + Environment_ForcePlaySequence(NA_BGM_HORSE); globalCtx->msgCtx.stateTimer = 0; globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 1c4c8aaa17..d6ec04bf80 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -94,7 +94,7 @@ void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx globalCtx->envCtx.unk_F2[0] = 0; if (globalCtx->csCtx.state == CS_STATE_IDLE) { func_80077684(globalCtx); - } else if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_BACKGROUND) { + } else if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) { func_800F6D58(0xF, 1, 0); func_800F6D58(0xE, 1, 0); } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index a8d1326941..cf35af98de 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -58,7 +58,7 @@ const ActorInit En_Syateki_Man_InitVars = { static u16 sBgmList[] = { NA_BGM_GENERAL_SFX, - NA_BGM_NATURE_BACKGROUND, + NA_BGM_NATURE_AMBIENCE, NA_BGM_FIELD_LOGIC, NA_BGM_DUNGEON, NA_BGM_KAKARIKO_ADULT, diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 4ae609b57a..5c0512ea95 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -2824,8 +2824,8 @@ void func_80836448(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* globalCtx->gameOverCtx.state = GAMEOVER_DEATH_START; func_800F6AB0(0); Audio_PlayFanfare(NA_BGM_GAME_OVER); - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; } OnePointCutscene_Init(globalCtx, 9806, cond ? 120 : 60, &this->actor, MAIN_CAM); @@ -3986,8 +3986,8 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u if (temp == 11) { func_800788CC(NA_SE_OC_SECRET_HOLE_OUT); func_800F6964(5); - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; } else { linearVel = this->linearVelocity; @@ -11923,8 +11923,8 @@ void func_8084E3C4(Player* this, GlobalContext* globalCtx) { Environment_WarpSongLeave(globalCtx); } - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; } } @@ -12440,8 +12440,8 @@ void func_8084F88C(Player* this, GlobalContext* globalCtx) { } else { globalCtx->fadeTransition = 2; gSaveContext.nextTransition = 2; - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; } globalCtx->sceneLoadFlag = 0x14; diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index b9fbf767fb..70561ff539 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1448,8 +1448,8 @@ void FileChoose_LoadGame(GameState* thisx) { gSaveContext.respawn[0].entranceIndex = -1; gSaveContext.respawnFlag = 0; - gSaveContext.seqIndex = 0xFF; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; gSaveContext.showTitleCard = true; gSaveContext.dogParams = 0; gSaveContext.timer1State = 0; @@ -1463,7 +1463,7 @@ void FileChoose_LoadGame(GameState* thisx) { gSaveContext.healthAccumulator = 0; gSaveContext.unk_13F0 = 0; gSaveContext.unk_13F2 = 0; - gSaveContext.unk_140E = 0; + gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; gSaveContext.skyboxTime = 0; gSaveContext.nextTransition = 0xFF; gSaveContext.nextCutsceneIndex = 0xFFEF; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index ee5ef30c70..2d2be81846 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -32,8 +32,8 @@ void Select_LoadGame(SelectContext* this, s32 entranceIndex) { gSaveContext.entranceIndex = entranceIndex; gSaveContext.respawnFlag = 0; gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = -1; - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; gSaveContext.showTitleCard = true; gWeatherMode = 0; this->state.running = false; diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index ade2937a65..4a3df1143b 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -136,8 +136,8 @@ void Title_Main(GameState* thisx) { } if (this->exit) { - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; gSaveContext.gameMode = 1; this->state.running = false; SET_NEXT_GAMESTATE(&this->state, Opening_Init, OpeningContext); diff --git a/sym_info.py b/sym_info.py index ae70bf0501..ed37d6ce29 100755 --- a/sym_info.py +++ b/sym_info.py @@ -64,8 +64,8 @@ def search_address(target_addr): ram = int(line[16 : 16 + 18], 0) rom = ram - ram_offset sym = line.split()[-1] - - if "0x" in sym: + + if sym.startswith("0x"): ram_offset = None continue if "/" in sym: @@ -112,7 +112,7 @@ def search_symbol(target_sym): rom = ram - ram_offset sym = line.split()[-1] - if "0x" in sym: + if sym.startswith("0x"): ram_offset = None continue elif "/" in sym: