From ffed316fb7d237065f51265d0be33dd9cee90a9a Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 6 Dec 2012 02:02:10 +0100 Subject: fixed the KP map switching crash bug --- src/koopatlas/core.cpp | 6 ++++++ src/koopatlas/mapmusic.cpp | 10 ++++------ src/koopatlas/mapmusic.h | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index 03b8dae..71122e5 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -47,6 +47,7 @@ dScKoopatlas_c *dScKoopatlas_c::build() { } bool WMInit_StartLoading(void*); +bool WMInit_LoadStaticFiles(void*); bool StockWMInit_LoadEffects(void*); bool WMInit_LoadSIAnims(void*); bool WMInit_EndLoading(void*); @@ -58,6 +59,7 @@ bool WMInit_SetupWipe(void*); ChainedFunc initFunctions[] = { WMInit_StartLoading, + WMInit_LoadStaticFiles, StockWMInit_LoadEffects, WMInit_LoadSIAnims, WMInit_EndLoading, @@ -135,6 +137,10 @@ bool WMInit_StartLoading(void *ptr) { return true; } +bool WMInit_LoadStaticFiles(void *ptr) { + return dKPMusic::loadInfo(); +} + bool WMInit_LoadSIAnims(void *ptr) { SpammyReport("WMInit_LoadSIAnims called\n"); diff --git a/src/koopatlas/mapmusic.cpp b/src/koopatlas/mapmusic.cpp index 1ccd775..8fdf264 100644 --- a/src/koopatlas/mapmusic.cpp +++ b/src/koopatlas/mapmusic.cpp @@ -13,7 +13,6 @@ static int s_countdownToSwitch = -1; static int s_countdownToFadeIn = -1; static dDvdLoader_c s_adpcmInfoLoader; -static bool s_adpcmInfoLoaded = false; #define FADE_OUT_LEN 30 #define FADE_IN_LEN 30 @@ -59,12 +58,11 @@ extern "C" void DVDCancel(void *crap); extern "C" void AxVoice_SetADPCM(void *axVoice, void *adpcm); extern "C" void Voice_SetADPCMLoop(void *voice, int channel, void *adpcmLoop); -void dKPMusic::execute() { - if (!s_adpcmInfoLoaded) { - if (s_adpcmInfoLoader.load("/NewerRes/MapADPCMInfo.bin")) - s_adpcmInfoLoaded = true; - } +bool dKPMusic::loadInfo() { + return s_adpcmInfoLoader.load("/NewerRes/MapADPCMInfo.bin"); +} +void dKPMusic::execute() { if (!s_playing) return; diff --git a/src/koopatlas/mapmusic.h b/src/koopatlas/mapmusic.h index 785f870..e5d69f2 100644 --- a/src/koopatlas/mapmusic.h +++ b/src/koopatlas/mapmusic.h @@ -3,6 +3,7 @@ class dKPMusic { public: + static bool loadInfo(); static void play(int id); static void execute(); static void stop(); -- cgit v1.2.3