diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index 505e6582ca..4c4ce22126 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -1734,7 +1734,6 @@ DoubleChallengeMeter=Double Challenge Meter [StepMania] Announcer=Announcer -Couldn't open any loading windows.=Couldn't open any loading windows. Fullscreen=Fullscreen Initializing %s...=Initializing %s... No video renderers attempted.=No video renderers attempted. @@ -1751,6 +1750,22 @@ Windowed=Windowed color=color texture=texture +[LoadingWindow] +Couldn't open any loading windows.=Couldn't open any loading windows. +Starting sound subsystem...=Starting sound subsystem... +Initializing bookkeeper...=Initializing bookkeeper... +Starting lights subsystem...=Starting lights subsystem... +Loading game type...=Loading game type... +Building song cache index...=Building song cache index... +Loading banner cache...=Loading banner cache... +Initializing memory card system...=Initializing memory card system... +Initializing character system...=Initializing character system... +Initializing profile system...=Initializing profile system... +Updating popular song list...=Updating popular song list... +Updating course rankings...=Updating course rankings... +Initializing statics manager...=Initializing statics manager... +Initializing message system...=Initializing message system... + [StepsType] dance-couple=couple dance-double=double diff --git a/src/SongManager.cpp b/src/SongManager.cpp index 9550ae3c75..59bf15fc1f 100644 --- a/src/SongManager.cpp +++ b/src/SongManager.cpp @@ -1,6 +1,7 @@ #include "global.h" #include "SongManager.h" #include "arch/LoadingWindow/LoadingWindow.h" +#include "arch/ArchHooks/ArchHooks.h" #include "AnnouncerManager.h" #include "BackgroundUtil.h" #include "BannerCache.h" @@ -253,7 +254,7 @@ void SongManager::LoadStepManiaSongDir( RString sDir ) songCount = 0; FOREACH_CONST( RString, arrayGroupDirs, s ) // foreach dir in /Songs/ { - + if(HOOKS->UserQuit()) break; RString sGroupDirName = *s; SanityCheckGroupDir(sDir+sGroupDirName); @@ -291,6 +292,7 @@ void SongManager::LoadStepManiaSongDir( RString sDir ) for( unsigned j=0; j< arraySongDirs.size(); ++j ) // for each song dir { + if(HOOKS->UserQuit()) break; RString sSongDirName = arraySongDirs[j]; // this is a song directory. Load a new song. @@ -769,6 +771,7 @@ void SongManager::InitCoursesFromDisk() vector vsCourseGroupNames; FOREACH_CONST( RString, vsCourseDirs, sDir ) { + if(HOOKS->UserQuit()) break; // Find all group directories in Courses dir GetDirListing( *sDir + "*", vsCourseGroupNames, true, true ); StripCvsAndSvn( vsCourseGroupNames ); @@ -781,6 +784,7 @@ void SongManager::InitCoursesFromDisk() FOREACH_CONST( RString, vsCourseGroupNames, sCourseGroup ) // for each dir in /Courses/ { + if(HOOKS->UserQuit()) break; // Find all CRS files in this group directory vector vsCoursePaths; GetDirListing( *sCourseGroup + "/*.crs", vsCoursePaths, false, true ); @@ -819,6 +823,7 @@ void SongManager::InitAutogenCourses() Course* pCourse; for( unsigned g=0; gUserQuit()) break; RString sGroupName = saGroupNames[g]; // Generate random courses from each group. @@ -857,6 +862,7 @@ void SongManager::InitAutogenCourses() vector aSongs; unsigned i = 0; do { + if(HOOKS->UserQuit()) break; RString sArtist = i >= apSongs.size()? RString(""): apSongs[i]->GetDisplayArtist(); RString sTranslitArtist = i >= apSongs.size()? RString(""): apSongs[i]->GetTranslitArtist(); if( i < apSongs.size() && !sCurArtist.CompareNoCase(sArtist) ) diff --git a/src/StepMania.cpp b/src/StepMania.cpp index a3d4af5c6f..9c9b4f2758 100644 --- a/src/StepMania.cpp +++ b/src/StepMania.cpp @@ -932,7 +932,20 @@ static void ApplyLogPreferences() Checkpoints::LogCheckpoints( PREFSMAN->m_bLogCheckpoints ); } -static LocalizedString COULDNT_OPEN_LOADING_WINDOW( "StepMania", "Couldn't open any loading windows." ); +static LocalizedString COULDNT_OPEN_LOADING_WINDOW( "LoadingWindow", "Couldn't open any loading windows." ); +static LocalizedString STARTING_SOUND ( "LoadingWindow", "Starting sound subsystem..."); +static LocalizedString INIT_BOOKKEEPER ( "LoadingWindow", "Initializing bookkeeper..."); +static LocalizedString START_LIGHTS ( "LoadingWindow", "Starting lights subsystem..."); +static LocalizedString LOAD_GAMETYPE ( "LoadingWindow", "Loading game type..."); +static LocalizedString BUILD_SONG_CACHE_INDEX ( "LoadingWindow", "Building song cache index..."); +static LocalizedString LOAD_BANNER_CACHE ( "LoadingWindow", "Loading banner cache..."); +static LocalizedString INIT_MEMCARD ( "LoadingWindow", "Initializing memory card system..."); +static LocalizedString INIT_CHARS ( "LoadingWindow", "Initializing character system..."); +static LocalizedString INIT_PROFILES ( "LoadingWindow", "Initializing profile system..."); +static LocalizedString UPDATE_POPULAR ( "LoadingWindow", "Updating popular song list..."); +static LocalizedString UPDATE_COURSE_RANKS ( "LoadingWindow", "Updating course rankings..."); +static LocalizedString INIT_STATICS ( "LoadingWindow", "Initializing statics manager..."); +static LocalizedString INIT_MESSAGE ( "LoadingWindow", "Initializing message system..."); int main(int argc, char* argv[]) { @@ -1059,65 +1072,76 @@ int main(int argc, char* argv[]) if( PREFSMAN->m_iSoundWriteAhead ) LOG->Info( "Sound writeahead has been overridden to %i", PREFSMAN->m_iSoundWriteAhead.Get() ); - pLoadingWindow->SetText("Starting sound subsystem..."); + pLoadingWindow->SetText(STARTING_SOUND); SOUNDMAN = new RageSoundManager; SOUNDMAN->Init(); SOUNDMAN->SetMixVolume(); SOUND = new GameSoundManager; - pLoadingWindow->SetText("Initializing bookkeeper..."); + pLoadingWindow->SetText(INIT_BOOKKEEPER); BOOKKEEPER = new Bookkeeper; - pLoadingWindow->SetText("Starting lights subsystem..."); + pLoadingWindow->SetText(START_LIGHTS); LIGHTSMAN = new LightsManager; INPUTFILTER = new InputFilter; INPUTMAPPER = new InputMapper; - pLoadingWindow->SetText("Loading game type..."); + pLoadingWindow->SetText(LOAD_GAMETYPE); StepMania::ChangeCurrentGame( GAMESTATE->GetCurrentGame() ); INPUTQUEUE = new InputQueue; - pLoadingWindow->SetText("Building song cache index..."); + pLoadingWindow->SetText(BUILD_SONG_CACHE_INDEX); SONGINDEX = new SongCacheIndex; - pLoadingWindow->SetText("Loading banner cache..."); + pLoadingWindow->SetText(LOAD_BANNER_CACHE); BANNERCACHE = new BannerCache; //BACKGROUNDCACHE = new BackgroundCache; +#define earlyBail if( ArchHooks::UserQuit() ) { \ + ShutdownGame(); \ + SAFE_DELETE( pLoadingWindow ); \ + return 0; \ + } \ + // depends on SONGINDEX: SONGMAN = new SongManager; SONGMAN->InitAll(); // this takes a long time + earlyBail CRYPTMAN = new CryptManager; // need to do this before ProfileMan if( PREFSMAN->m_bSignProfileData ) CRYPTMAN->GenerateGlobalKeys(); - pLoadingWindow->SetText("Initializing memory card system..."); + earlyBail + pLoadingWindow->SetText(INIT_MEMCARD); MEMCARDMAN = new MemoryCardManager; - pLoadingWindow->SetText("Initializing character system..."); + earlyBail + pLoadingWindow->SetText(INIT_CHARS); + earlyBail CHARMAN = new CharacterManager; - pLoadingWindow->SetText("Initializing profile system..."); + pLoadingWindow->SetText(INIT_PROFILES); + earlyBail PROFILEMAN = new ProfileManager; PROFILEMAN->Init(); // must load after SONGMAN + earlyBail UNLOCKMAN = new UnlockManager; - pLoadingWindow->SetText("Updating popular song list..."); + pLoadingWindow->SetText(UPDATE_POPULAR); + earlyBail SONGMAN->UpdatePopular(); SONGMAN->UpdatePreferredSort(); + earlyBail NSMAN = new NetworkSyncManager( pLoadingWindow ); - pLoadingWindow->SetText("Initializing message system..."); + pLoadingWindow->SetText(INIT_MESSAGE); MESSAGEMAN = new MessageManager; - pLoadingWindow->SetText("Initializing statics manager..."); + pLoadingWindow->SetText(INIT_STATICS); STATSMAN = new StatsManager; + earlyBail // Initialize which courses are ranking courses here. - pLoadingWindow->SetText("Updating cource rankings..."); + pLoadingWindow->SetText(UPDATE_COURSE_RANKS); SONGMAN->UpdateRankingCourses(); + earlyBail - SAFE_DELETE( pLoadingWindow ); // destroy this before init'ing Display - - /* If the user has tried to quit during the loading, do it before creating - * the main window. This prevents going to full screen just to quit. */ - if( ArchHooks::UserQuit() ) - { - ShutdownGame(); - return 0; - } + // destroy this before init'ing Display, for now + // we will lose the rights to be focused, but that's not too important + // when we are going fullscreen + SAFE_DELETE( pLoadingWindow ); StartDisplay(); diff --git a/src/arch/LoadingWindow/LoadingWindow_Win32.cpp b/src/arch/LoadingWindow/LoadingWindow_Win32.cpp index 99f79fa244..f628d22a65 100644 --- a/src/arch/LoadingWindow/LoadingWindow_Win32.cpp +++ b/src/arch/LoadingWindow/LoadingWindow_Win32.cpp @@ -6,6 +6,7 @@ #include "archutils/win32/WindowsResources.h" #include "archutils/win32/WindowIcon.h" #include "archutils/win32/ErrorStrings.h" +#include "arch/ArchHooks/ArchHooks.h" #include #include "CommCtrl.h" #include "RageSurface_Load.h" @@ -138,6 +139,7 @@ INT_PTR CALLBACK LoadingWindow_Win32::DlgProc( HWND hWnd, UINT msg, WPARAM wPara break; case WM_CLOSE: + HOOKS->SetUserQuit(); return FALSE; case WM_DESTROY: