From 28b43e1b6007fb76fbec21a1e6567356b88861a7 Mon Sep 17 00:00:00 2001 From: Sonic Dreamcaster Date: Tue, 24 Feb 2026 06:02:54 -0300 Subject: [PATCH] fix scene change code --- src/audio/audio_general.c | 3 ++- src/audio/audio_thread.c | 2 +- src/engine/fox_load.c | 21 ++++++++++++++++++--- src/engine/fox_versus.c | 3 --- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/audio/audio_general.c b/src/audio/audio_general.c index 22f0f7c6..55142c19 100644 --- a/src/audio/audio_general.c +++ b/src/audio/audio_general.c @@ -2824,7 +2824,8 @@ void Audio_StartReset(u8 oldSpecId) { } else { sAudioResetStatus = AUDIORESET_WAIT; } - // LTODO: Workaround for the crash after quitting the Practice mode + + // @port: Workaround for the hang after quitting Training mode sAudioResetStatus = AUDIORESET_WAIT; AUDIOCMD_GLOBAL_UNMUTE(true); diff --git a/src/audio/audio_thread.c b/src/audio/audio_thread.c index 1bd9b1e9..c9074071 100644 --- a/src/audio/audio_thread.c +++ b/src/audio/audio_thread.c @@ -471,7 +471,7 @@ u8* AudioThread_GetFontsForSequence(s32 seqId, u32* outNumFonts) { bool AudioThread_ResetComplete(void) { s32 pad; - OSMesg sp18; + OSMesg sp18 = { 0 }; if (!MQ_GET_MESG(gAudioResetQueue, &sp18)) { return false; diff --git a/src/engine/fox_load.c b/src/engine/fox_load.c index 9ba73553..9baf5d48 100644 --- a/src/engine/fox_load.c +++ b/src/engine/fox_load.c @@ -34,11 +34,26 @@ void Load_RomFile(void* vRomAddress, void* dest, ptrdiff_t size) { u8 Load_SceneFiles(Scene* scene) { #if 1 - // TODO: BUG! sCurrentScene and scene never change so this will never be true. - bool hasSceneChanged = memcmp(&sCurrentScene, scene, sizeof(Scene)) != 0; - sCurrentScene = *scene; + // @port: + static void* sCurrentScenePtr = NULL; + + bool hasSceneChanged = (uintptr_t) sCurrentScenePtr != (uintptr_t) scene; + sCurrentScenePtr = scene; + + if (sFillTimer != 0) { + sFillTimer--; + } else if (gStartNMI == 0) { + Lib_FillScreen(false); + } + + if (hasSceneChanged) { + printf("Scene Changed!\n"); + } + return hasSceneChanged; #else + // Original code: + u8* ramPtr = SEGMENT_VRAM_START(ovl_i1); u8 segment; u8 changeScene = false; diff --git a/src/engine/fox_versus.c b/src/engine/fox_versus.c index 2bba4e29..2c301d8a 100644 --- a/src/engine/fox_versus.c +++ b/src/engine/fox_versus.c @@ -1261,9 +1261,6 @@ s32 func_versus_800C1138(s32 max, s32 arg1) { void Versus_InitMatch(void) { s32 i; - // Until Load_SceneFiles gets fixed, this fixes most of the audio issues in versus - AUDIO_SET_SPEC_ALT(SFXCHAN_3, AUDIOSPEC_16); - for (i = 0, sVsPlayerCount = 0; i < 4; i++) { if (!gPlayerInactive[i]) { sVsPlayerCount++;