diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 4035b9c4..0928b769 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3576,8 +3576,14 @@ CMenuManager::InitialiseChangedLanguageSettings() void CMenuManager::LoadAllTextures() { +#ifndef KEEP_FRONTEND_LOADED if (m_bSpritesLoaded) return; +#else + if (m_bFrontendLoaded) + return; + m_bFrontendLoaded = true; +#endif CentreMousePointer(); DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); @@ -3599,6 +3605,11 @@ CMenuManager::LoadAllTextures() } else if (m_PrefsRadioStation > CHATTERBOX) m_PrefsRadioStation = CGeneral::GetRandomNumber() % (CHATTERBOX + 1); +#ifdef KEEP_FRONTEND_LOADED + if (m_bSpritesLoaded) + return; +#endif + CFileMgr::SetDir(""); //CFileMgr::SetDir(""); CTimer::Stop(); @@ -5673,29 +5684,41 @@ CMenuManager::SwitchMenuOnAndOff() } void +#ifdef KEEP_FRONTEND_LOADED +CMenuManager::UnloadTextures(bool forceUnload) +#else CMenuManager::UnloadTextures() -{ - if (!m_bSpritesLoaded) - return; - - printf("REMOVE frontend\n"); - for (int i = 0; i < ARRAY_SIZE(FrontendFilenames); ++i) - m_aFrontEndSprites[i].Delete(); - - int frontend = CTxdStore::FindTxdSlot("frontend"); - CTxdStore::RemoveTxd(frontend); - - printf("REMOVE menu textures\n"); - for (int i = 0; i < ARRAY_SIZE(MenuFilenames); ++i) - m_aMenuSprites[i].Delete(); -#ifdef MENU_MAP - for (int i = 0; i < ARRAY_SIZE(MapFilenames); ++i) - m_aMapSprites[i].Delete(); #endif - int menu = CTxdStore::FindTxdSlot("menu"); - CTxdStore::RemoveTxd(menu); +{ +#ifdef KEEP_FRONTEND_LOADED + if (forceUnload) +#endif + { + if (!m_bSpritesLoaded) + return; - m_bSpritesLoaded = false; + printf("REMOVE frontend\n"); + for (int i = 0; i < ARRAY_SIZE(FrontendFilenames); ++i) + m_aFrontEndSprites[i].Delete(); + + int frontend = CTxdStore::FindTxdSlot("frontend"); + CTxdStore::RemoveTxd(frontend); + + printf("REMOVE menu textures\n"); + for (int i = 0; i < ARRAY_SIZE(MenuFilenames); ++i) + m_aMenuSprites[i].Delete(); +#ifdef MENU_MAP + for (int i = 0; i < ARRAY_SIZE(MapFilenames); ++i) + m_aMapSprites[i].Delete(); +#endif + int menu = CTxdStore::FindTxdSlot("menu"); + CTxdStore::RemoveTxd(menu); + + m_bSpritesLoaded = false; + } +#ifdef KEEP_FRONTEND_LOADED + m_bFrontendLoaded = false; +#endif } void diff --git a/src/core/Frontend.h b/src/core/Frontend.h index b0100fdc..223f2adb 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -601,6 +601,9 @@ public: char field_455; bool m_bStartWaitingForKeyBind; bool m_bSpritesLoaded; +#ifdef KEEP_FRONTEND_LOADED + bool m_bFrontendLoaded; +#endif CSprite2d m_aFrontEndSprites[NUM_FE_SPRITES]; CSprite2d m_aMenuSprites[NUM_MENU_SPRITES]; int32 field_518; @@ -769,7 +772,11 @@ public: float StretchX(float); float StretchY(float); void SwitchMenuOnAndOff(); +#ifdef KEEP_FRONTEND_LOADED + void UnloadTextures(bool forceUnload = false); +#else void UnloadTextures(); +#endif void WaitForUserCD(); void PrintController(); int GetNumOptionsCntrlConfigScreens(); diff --git a/src/skel/wiiu/wiiu.cpp b/src/skel/wiiu/wiiu.cpp index 64433a05..0a6e4c63 100644 --- a/src/skel/wiiu/wiiu.cpp +++ b/src/skel/wiiu/wiiu.cpp @@ -1301,6 +1301,10 @@ main(int argc, char *argv[]) #endif } +#ifdef KEEP_FRONTEND_LOADED + // since we kept our frontend loaded free the textures now + FrontEndMenuManager.UnloadTextures(true); +#endif #ifndef MASTER if ( gbModelViewer )