keep the frontend loaded

This commit is contained in:
GaryOderNichts 2021-01-29 22:05:55 +01:00
parent 1846d08365
commit 1ddf1834d2
3 changed files with 54 additions and 20 deletions

View File

@ -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,8 +5684,16 @@ CMenuManager::SwitchMenuOnAndOff()
}
void
#ifdef KEEP_FRONTEND_LOADED
CMenuManager::UnloadTextures(bool forceUnload)
#else
CMenuManager::UnloadTextures()
#endif
{
#ifdef KEEP_FRONTEND_LOADED
if (forceUnload)
#endif
{
if (!m_bSpritesLoaded)
return;
@ -5696,6 +5715,10 @@ CMenuManager::UnloadTextures()
CTxdStore::RemoveTxd(menu);
m_bSpritesLoaded = false;
}
#ifdef KEEP_FRONTEND_LOADED
m_bFrontendLoaded = false;
#endif
}
void

View File

@ -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();

View File

@ -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 )