[loading window->deafult] Noone could think of a good reason not to merge into default.

This commit is contained in:
Henrik Andersson
2011-07-20 22:19:07 +02:00
6 changed files with 433 additions and 315 deletions
+16 -1
View File
@@ -1735,7 +1735,6 @@ DoubleChallengeMeter=Double Challenge Meter
[StepMania] [StepMania]
Announcer=Announcer Announcer=Announcer
Couldn't open any loading windows.=Couldn't open any loading windows.
Fullscreen=Fullscreen Fullscreen=Fullscreen
Initializing %s...=Initializing %s... Initializing %s...=Initializing %s...
No video renderers attempted.=No video renderers attempted. No video renderers attempted.=No video renderers attempted.
@@ -1752,6 +1751,22 @@ Windowed=Windowed
color=color color=color
texture=texture 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] [StepsType]
dance-couple=couple dance-couple=couple
dance-double=double dance-double=double
+7 -1
View File
@@ -1,6 +1,7 @@
#include "global.h" #include "global.h"
#include "SongManager.h" #include "SongManager.h"
#include "arch/LoadingWindow/LoadingWindow.h" #include "arch/LoadingWindow/LoadingWindow.h"
#include "arch/ArchHooks/ArchHooks.h"
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "BackgroundUtil.h" #include "BackgroundUtil.h"
#include "BannerCache.h" #include "BannerCache.h"
@@ -253,7 +254,7 @@ void SongManager::LoadStepManiaSongDir( RString sDir )
songCount = 0; songCount = 0;
FOREACH_CONST( RString, arrayGroupDirs, s ) // foreach dir in /Songs/ FOREACH_CONST( RString, arrayGroupDirs, s ) // foreach dir in /Songs/
{ {
if(HOOKS->UserQuit()) break;
RString sGroupDirName = *s; RString sGroupDirName = *s;
SanityCheckGroupDir(sDir+sGroupDirName); SanityCheckGroupDir(sDir+sGroupDirName);
@@ -291,6 +292,7 @@ void SongManager::LoadStepManiaSongDir( RString sDir )
for( unsigned j=0; j< arraySongDirs.size(); ++j ) // for each song dir for( unsigned j=0; j< arraySongDirs.size(); ++j ) // for each song dir
{ {
if(HOOKS->UserQuit()) break;
RString sSongDirName = arraySongDirs[j]; RString sSongDirName = arraySongDirs[j];
// this is a song directory. Load a new song. // this is a song directory. Load a new song.
@@ -770,6 +772,7 @@ void SongManager::InitCoursesFromDisk()
vector<RString> vsCourseGroupNames; vector<RString> vsCourseGroupNames;
FOREACH_CONST( RString, vsCourseDirs, sDir ) FOREACH_CONST( RString, vsCourseDirs, sDir )
{ {
if(HOOKS->UserQuit()) break;
// Find all group directories in Courses dir // Find all group directories in Courses dir
GetDirListing( *sDir + "*", vsCourseGroupNames, true, true ); GetDirListing( *sDir + "*", vsCourseGroupNames, true, true );
StripCvsAndSvn( vsCourseGroupNames ); StripCvsAndSvn( vsCourseGroupNames );
@@ -782,6 +785,7 @@ void SongManager::InitCoursesFromDisk()
FOREACH_CONST( RString, vsCourseGroupNames, sCourseGroup ) // for each dir in /Courses/ FOREACH_CONST( RString, vsCourseGroupNames, sCourseGroup ) // for each dir in /Courses/
{ {
if(HOOKS->UserQuit()) break;
// Find all CRS files in this group directory // Find all CRS files in this group directory
vector<RString> vsCoursePaths; vector<RString> vsCoursePaths;
GetDirListing( *sCourseGroup + "/*.crs", vsCoursePaths, false, true ); GetDirListing( *sCourseGroup + "/*.crs", vsCoursePaths, false, true );
@@ -820,6 +824,7 @@ void SongManager::InitAutogenCourses()
Course* pCourse; Course* pCourse;
for( unsigned g=0; g<saGroupNames.size(); g++ ) // foreach Group for( unsigned g=0; g<saGroupNames.size(); g++ ) // foreach Group
{ {
if(HOOKS->UserQuit()) break;
RString sGroupName = saGroupNames[g]; RString sGroupName = saGroupNames[g];
// Generate random courses from each group. // Generate random courses from each group.
@@ -858,6 +863,7 @@ void SongManager::InitAutogenCourses()
vector<Song *> aSongs; vector<Song *> aSongs;
unsigned i = 0; unsigned i = 0;
do { do {
if(HOOKS->UserQuit()) break;
RString sArtist = i >= apSongs.size()? RString(""): apSongs[i]->GetDisplayArtist(); RString sArtist = i >= apSongs.size()? RString(""): apSongs[i]->GetDisplayArtist();
RString sTranslitArtist = i >= apSongs.size()? RString(""): apSongs[i]->GetTranslitArtist(); RString sTranslitArtist = i >= apSongs.size()? RString(""): apSongs[i]->GetTranslitArtist();
if( i < apSongs.size() && !sCurArtist.CompareNoCase(sArtist) ) if( i < apSongs.size() && !sCurArtist.CompareNoCase(sArtist) )
+47 -23
View File
@@ -932,7 +932,20 @@ static void ApplyLogPreferences()
Checkpoints::LogCheckpoints( PREFSMAN->m_bLogCheckpoints ); 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[]) int main(int argc, char* argv[])
{ {
@@ -1060,65 +1073,76 @@ int main(int argc, char* argv[])
if( PREFSMAN->m_iSoundWriteAhead ) if( PREFSMAN->m_iSoundWriteAhead )
LOG->Info( "Sound writeahead has been overridden to %i", PREFSMAN->m_iSoundWriteAhead.Get() ); 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 = new RageSoundManager;
SOUNDMAN->Init(); SOUNDMAN->Init();
SOUNDMAN->SetMixVolume(); SOUNDMAN->SetMixVolume();
SOUND = new GameSoundManager; SOUND = new GameSoundManager;
pLoadingWindow->SetText("Initializing bookkeeper..."); pLoadingWindow->SetText(INIT_BOOKKEEPER);
BOOKKEEPER = new Bookkeeper; BOOKKEEPER = new Bookkeeper;
pLoadingWindow->SetText("Starting lights subsystem..."); pLoadingWindow->SetText(START_LIGHTS);
LIGHTSMAN = new LightsManager; LIGHTSMAN = new LightsManager;
INPUTFILTER = new InputFilter; INPUTFILTER = new InputFilter;
INPUTMAPPER = new InputMapper; INPUTMAPPER = new InputMapper;
pLoadingWindow->SetText("Loading game type..."); pLoadingWindow->SetText(LOAD_GAMETYPE);
StepMania::ChangeCurrentGame( GAMESTATE->GetCurrentGame() ); StepMania::ChangeCurrentGame( GAMESTATE->GetCurrentGame() );
INPUTQUEUE = new InputQueue; INPUTQUEUE = new InputQueue;
pLoadingWindow->SetText("Building song cache index..."); pLoadingWindow->SetText(BUILD_SONG_CACHE_INDEX);
SONGINDEX = new SongCacheIndex; SONGINDEX = new SongCacheIndex;
pLoadingWindow->SetText("Loading banner cache..."); pLoadingWindow->SetText(LOAD_BANNER_CACHE);
BANNERCACHE = new BannerCache; BANNERCACHE = new BannerCache;
//BACKGROUNDCACHE = new BackgroundCache; //BACKGROUNDCACHE = new BackgroundCache;
#define earlyBail if( ArchHooks::UserQuit() ) { \
ShutdownGame(); \
SAFE_DELETE( pLoadingWindow ); \
return 0; \
} \
// depends on SONGINDEX: // depends on SONGINDEX:
SONGMAN = new SongManager; SONGMAN = new SongManager;
SONGMAN->InitAll(); // this takes a long time SONGMAN->InitAll(); // this takes a long time
earlyBail
CRYPTMAN = new CryptManager; // need to do this before ProfileMan CRYPTMAN = new CryptManager; // need to do this before ProfileMan
if( PREFSMAN->m_bSignProfileData ) if( PREFSMAN->m_bSignProfileData )
CRYPTMAN->GenerateGlobalKeys(); CRYPTMAN->GenerateGlobalKeys();
pLoadingWindow->SetText("Initializing memory card system..."); earlyBail
pLoadingWindow->SetText(INIT_MEMCARD);
MEMCARDMAN = new MemoryCardManager; MEMCARDMAN = new MemoryCardManager;
pLoadingWindow->SetText("Initializing character system..."); earlyBail
pLoadingWindow->SetText(INIT_CHARS);
earlyBail
CHARMAN = new CharacterManager; CHARMAN = new CharacterManager;
pLoadingWindow->SetText("Initializing profile system..."); pLoadingWindow->SetText(INIT_PROFILES);
earlyBail
PROFILEMAN = new ProfileManager; PROFILEMAN = new ProfileManager;
PROFILEMAN->Init(); // must load after SONGMAN PROFILEMAN->Init(); // must load after SONGMAN
earlyBail
UNLOCKMAN = new UnlockManager; UNLOCKMAN = new UnlockManager;
pLoadingWindow->SetText("Updating popular song list..."); pLoadingWindow->SetText(UPDATE_POPULAR);
earlyBail
SONGMAN->UpdatePopular(); SONGMAN->UpdatePopular();
SONGMAN->UpdatePreferredSort(); SONGMAN->UpdatePreferredSort();
earlyBail
NSMAN = new NetworkSyncManager( pLoadingWindow ); NSMAN = new NetworkSyncManager( pLoadingWindow );
pLoadingWindow->SetText("Initializing message system..."); pLoadingWindow->SetText(INIT_MESSAGE);
MESSAGEMAN = new MessageManager; MESSAGEMAN = new MessageManager;
pLoadingWindow->SetText("Initializing statics manager..."); pLoadingWindow->SetText(INIT_STATICS);
STATSMAN = new StatsManager; STATSMAN = new StatsManager;
earlyBail
// Initialize which courses are ranking courses here. // Initialize which courses are ranking courses here.
pLoadingWindow->SetText("Updating course rankings..."); pLoadingWindow->SetText(UPDATE_COURSE_RANKS);
SONGMAN->UpdateRankingCourses(); SONGMAN->UpdateRankingCourses();
earlyBail
SAFE_DELETE( pLoadingWindow ); // destroy this before init'ing Display // destroy this before init'ing Display, for now
// we will lose the rights to be focused, but that's not too important
/* If the user has tried to quit during the loading, do it before creating // when we are going fullscreen
* the main window. This prevents going to full screen just to quit. */ SAFE_DELETE( pLoadingWindow );
if( ArchHooks::UserQuit() )
{
ShutdownGame();
return 0;
}
StartDisplay(); StartDisplay();
@@ -6,6 +6,7 @@
#include "archutils/win32/WindowsResources.h" #include "archutils/win32/WindowsResources.h"
#include "archutils/win32/WindowIcon.h" #include "archutils/win32/WindowIcon.h"
#include "archutils/win32/ErrorStrings.h" #include "archutils/win32/ErrorStrings.h"
#include "arch/ArchHooks/ArchHooks.h"
#include <windows.h> #include <windows.h>
#include "CommCtrl.h" #include "CommCtrl.h"
#include "RageSurface_Load.h" #include "RageSurface_Load.h"
@@ -15,6 +16,7 @@
#include "ProductInfo.h" #include "ProductInfo.h"
#include "LocalizedString.h" #include "LocalizedString.h"
#include "RageSurfaceUtils_Zoom.h" #include "RageSurfaceUtils_Zoom.h"
static HBITMAP g_hBitmap = NULL; static HBITMAP g_hBitmap = NULL;
@@ -90,6 +92,30 @@ INT_PTR CALLBACK LoadingWindow_Win32::DlgProc( HWND hWnd, UINT msg, WPARAM wPara
self=(LoadingWindow_Win32 *)GetWindowLong(hWnd,DWL_USER); self=(LoadingWindow_Win32 *)GetWindowLong(hWnd,DWL_USER);
} }
#if(WINVER >= 0x0601)
if (self && msg == self->taskbarCreatedEvent && !self->pTaskbarList) {
HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&self->pTaskbarList));
if (SUCCEEDED(hr)) {
self->pTaskbarList->HrInit();
if (FAILED(hr)) {
self->pTaskbarList->Release();
self->pTaskbarList = NULL;
} else {
if(self->m_indeterminate) {
self->pTaskbarList->SetProgressState(hWnd, TBPF_INDETERMINATE);
} else {
self->pTaskbarList->SetProgressState(hWnd, TBPF_NORMAL);
self->pTaskbarList->SetProgressValue(hWnd, self->m_progress, self->m_totalWork);
}
}
}
}
#endif
switch( msg ) switch( msg )
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
@@ -111,9 +137,18 @@ INT_PTR CALLBACK LoadingWindow_Win32::DlgProc( HWND hWnd, UINT msg, WPARAM wPara
break; break;
case WM_CLOSE: case WM_CLOSE:
HOOKS->SetUserQuit();
return FALSE; return FALSE;
case WM_DESTROY: case WM_DESTROY:
#if(WINVER >= 0x0601)
if (self->pTaskbarList) {
self->pTaskbarList->Release();
self->pTaskbarList = NULL;
}
#endif
DeleteObject( g_hBitmap ); DeleteObject( g_hBitmap );
g_hBitmap = NULL; g_hBitmap = NULL;
self->runMessageLoop=false; self->runMessageLoop=false;
@@ -164,11 +199,18 @@ void LoadingWindow_Win32::SetSplash( const RString sPath )
LoadingWindow_Win32::LoadingWindow_Win32() LoadingWindow_Win32::LoadingWindow_Win32()
{ {
INITCOMMONCONTROLSEX cceData; INITCOMMONCONTROLSEX cceData;
cceData.dwSize=sizeof(INITCOMMONCONTROLSEX); cceData.dwSize=sizeof(INITCOMMONCONTROLSEX);
cceData.dwICC=ICC_PROGRESS_CLASS; cceData.dwICC=ICC_PROGRESS_CLASS;
InitCommonControlsEx(&cceData); InitCommonControlsEx(&cceData);
#if(WINVER >= 0x0601)
pTaskbarList=NULL;
taskbarCreatedEvent=RegisterWindowMessage("TaskbarButtonCreated");
#endif
m_hIcon = NULL; m_hIcon = NULL;
runMessageLoop=true; runMessageLoop=true;
@@ -239,6 +281,11 @@ void LoadingWindow_Win32::SetProgress(const int progress)
m_progress=progress; m_progress=progress;
HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS ); HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS );
::SendMessage(hwndItem,PBM_SETPOS,progress,0); ::SendMessage(hwndItem,PBM_SETPOS,progress,0);
#if(WINVER >= 0x0601)
if(pTaskbarList) {
pTaskbarList->SetProgressValue(hwnd, m_progress, m_totalWork);
}
#endif
} }
void LoadingWindow_Win32::SetTotalWork(const int totalWork) void LoadingWindow_Win32::SetTotalWork(const int totalWork)
@@ -246,6 +293,11 @@ void LoadingWindow_Win32::SetTotalWork(const int totalWork)
m_totalWork=totalWork; m_totalWork=totalWork;
HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS ); HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS );
SendMessage(hwndItem,PBM_SETRANGE32,0,totalWork); SendMessage(hwndItem,PBM_SETRANGE32,0,totalWork);
#if(WINVER >= 0x0601)
if(pTaskbarList) {
pTaskbarList->SetProgressValue(hwnd, m_progress, m_totalWork);
}
#endif
} }
void LoadingWindow_Win32::SetIndeterminate(bool indeterminate) { void LoadingWindow_Win32::SetIndeterminate(bool indeterminate) {
@@ -254,11 +306,21 @@ void LoadingWindow_Win32::SetIndeterminate(bool indeterminate) {
HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS ); HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS );
if(indeterminate) { if(indeterminate) {
#if(WINVER >= 0x0601)
if(pTaskbarList) {
pTaskbarList->SetProgressState(hwnd, TBPF_INDETERMINATE);
}
#endif
SetWindowLong(hwndItem,GWL_STYLE, PBS_MARQUEE | GetWindowLong(hwndItem,GWL_STYLE)); SetWindowLong(hwndItem,GWL_STYLE, PBS_MARQUEE | GetWindowLong(hwndItem,GWL_STYLE));
SendMessage(hwndItem,PBM_SETMARQUEE,1,0); SendMessage(hwndItem,PBM_SETMARQUEE,1,0);
} else { } else {
SendMessage(hwndItem,PBM_SETMARQUEE,0,0); SendMessage(hwndItem,PBM_SETMARQUEE,0,0);
SetWindowLong(hwndItem,GWL_STYLE, (~PBS_MARQUEE) & GetWindowLong(hwndItem,GWL_STYLE)); SetWindowLong(hwndItem,GWL_STYLE, (~PBS_MARQUEE) & GetWindowLong(hwndItem,GWL_STYLE));
#if(WINVER >= 0x0601)
if(pTaskbarList) {
pTaskbarList->SetProgressState(hwnd, TBPF_NORMAL);
}
#endif
} }
} }
@@ -3,10 +3,16 @@
#ifndef LOADING_WINDOW_WIN32_H #ifndef LOADING_WINDOW_WIN32_H
#define LOADING_WINDOW_WIN32_H #define LOADING_WINDOW_WIN32_H
#include "global.h"
#include "LoadingWindow.h" #include "LoadingWindow.h"
#include <windows.h> #include <windows.h>
#include "archutils/Win32/AppInstance.h" #include "archutils/Win32/AppInstance.h"
#if(WINVER >= 0x0601)
#include "Shobjidl.h"
#endif
class LoadingWindow_Win32: public LoadingWindow class LoadingWindow_Win32: public LoadingWindow
{ {
public: public:
@@ -29,6 +35,11 @@ private:
DWORD pumpThreadId; DWORD pumpThreadId;
HANDLE guiReadyEvent; HANDLE guiReadyEvent;
#if(WINVER >= 0x0601)
UINT taskbarCreatedEvent;
ITaskbarList3 *pTaskbarList;
#endif
volatile bool runMessageLoop; volatile bool runMessageLoop;
static DWORD WINAPI MessagePump(LPVOID thisAsVoidPtr); static DWORD WINAPI MessagePump(LPVOID thisAsVoidPtr);
+1 -1
View File
@@ -66,7 +66,7 @@ C4355: 'this' : used in base member initializer list
/* Pull in NT-only definitions. Note that we support Win98 and WinME; you can /* Pull in NT-only definitions. Note that we support Win98 and WinME; you can
* make NT calls, but be sure to fall back on 9x if they're not supported. */ * make NT calls, but be sure to fall back on 9x if they're not supported. */
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x0601
#define _WIN32_IE 0x0400 #define _WIN32_IE 0x0400
// If this isn't defined to 0, VC fails to define things like stat and alloca. // If this isn't defined to 0, VC fails to define things like stat and alloca.