theme some common exception strings

This commit is contained in:
Chris Danford
2005-12-20 02:45:25 +00:00
parent 349d7745a6
commit 9cd3b4d4ba
7 changed files with 44 additions and 25 deletions
+4 -1
View File
@@ -10,6 +10,7 @@
#include "RageTimer.h" #include "RageTimer.h"
#include "RageSoundReader_Preload.h" #include "RageSoundReader_Preload.h"
#include "Foreach.h" #include "Foreach.h"
#include "ThemeMetric.h"
#include "arch/Sound/RageSoundDriver.h" #include "arch/Sound/RageSoundDriver.h"
@@ -35,11 +36,13 @@ RageSoundManager::RageSoundManager()
m_bPlayOnlyCriticalSounds = false; m_bPlayOnlyCriticalSounds = false;
} }
static ThemeMetric<CString> COULDNT_FIND_SOUND_DRIVER( "RageSoundManager", "Couldn't find a sound driver that works" );
void RageSoundManager::Init( CString sDrivers ) void RageSoundManager::Init( CString sDrivers )
{ {
m_pDriver = MakeRageSoundDriver( sDrivers ); m_pDriver = MakeRageSoundDriver( sDrivers );
if( m_pDriver == NULL ) if( m_pDriver == NULL )
RageException::Throw( "Couldn't find a sound driver that works" ); RageException::Throw( COULDNT_FIND_SOUND_DRIVER.GetValue() );
} }
RageSoundManager::~RageSoundManager() RageSoundManager::~RageSoundManager()
+4 -8
View File
@@ -102,6 +102,9 @@ void SongManager::InitSongsFromDisk( LoadingWindow *ld )
LOG->Trace( "Found %d songs in %f seconds.", (int)m_pSongs.size(), tm.GetDeltaTime() ); LOG->Trace( "Found %d songs in %f seconds.", (int)m_pSongs.size(), tm.GetDeltaTime() );
} }
static ThemeMetric<CString> FOLDER_CONTAINS_MUSIC_FILES( "SongManager", "The folder '%s' appears to be a song folder. All song folders must reside in a group folder. For example, 'Songs/Originals/My Song'." );
void SongManager::SanityCheckGroupDir( CString sDir ) const void SongManager::SanityCheckGroupDir( CString sDir ) const
{ {
// Check to see if they put a song directly inside the group folder. // Check to see if they put a song directly inside the group folder.
@@ -110,14 +113,7 @@ void SongManager::SanityCheckGroupDir( CString sDir ) const
GetDirListing( sDir + "/*.ogg", arrayFiles ); GetDirListing( sDir + "/*.ogg", arrayFiles );
GetDirListing( sDir + "/*.wav", arrayFiles ); GetDirListing( sDir + "/*.wav", arrayFiles );
if( !arrayFiles.empty() ) if( !arrayFiles.empty() )
RageException::Throw( RageException::Throw( FOLDER_CONTAINS_MUSIC_FILES.GetValue(), sDir.c_str() );
"The folder '%s' contains music files.\n\n"
"This means that you have a music outside of a song folder.\n"
"All song folders must reside in a group folder. For example, 'Songs/Originals/MySong'.\n"
"See the StepMania readme for more info.",
sDir.c_str()
);
} }
void SongManager::AddGroup( CString sDir, CString sGroupDirName ) void SongManager::AddGroup( CString sDir, CString sGroupDirName )
+23 -9
View File
@@ -664,6 +664,13 @@ found_defaults:
LOG->Info( "Video renderers: '%s'", PREFSMAN->m_sVideoRenderers.Get().c_str() ); LOG->Info( "Video renderers: '%s'", PREFSMAN->m_sVideoRenderers.Get().c_str() );
} }
static ThemeMetric<CString> ERROR_INITIALIZING_CARD ( "StepMania", "There was an error while initializing your video card." );
static ThemeMetric<CString> ERROR_DONT_FILE_BUG ( "StepMania", "Please do not file this error as a bug! Use the web page below to troubleshoot this problem." );
static ThemeMetric<CString> ERROR_VIDEO_DRIVER ( "StepMania", "Video Driver: %s" );
static ThemeMetric<CString> ERROR_NO_VIDEO_RENDERERS ( "StepMania", "No video renderers attempted." );
static ThemeMetric<CString> ERROR_INITIALIZING ( "StepMania", "Initializing %s..." );
static ThemeMetric<CString> ERROR_UNKNOWN_VIDEO_RENDERER ( "StepMania", "Unknown video renderer value: %s" );
RageDisplay *CreateDisplay() RageDisplay *CreateDisplay()
{ {
/* We never want to bother users with having to decide which API to use. /* We never want to bother users with having to decide which API to use.
@@ -694,16 +701,16 @@ RageDisplay *CreateDisplay()
VideoModeParams params; VideoModeParams params;
StepMania::GetPreferredVideoModeParams( params ); StepMania::GetPreferredVideoModeParams( params );
CString error = "There was an error while initializing your video card.\n\n" CString error = ERROR_INITIALIZING_CARD.GetValue()+"\n\n"+
"Please do not file this error as a bug! Use the web page below to troubleshoot this problem.\n\n" ERROR_DONT_FILE_BUG.GetValue()+"\n\n"
VIDEO_TROUBLESHOOTING_URL "\n\n" VIDEO_TROUBLESHOOTING_URL "\n\n"+
"Video Driver: "+GetVideoDriverName()+"\n\n"; ssprintf(ERROR_VIDEO_DRIVER.GetValue(), GetVideoDriverName().c_str())+"\n\n";
vector<CString> asRenderers; vector<CString> asRenderers;
split( PREFSMAN->m_sVideoRenderers, ",", asRenderers, true ); split( PREFSMAN->m_sVideoRenderers, ",", asRenderers, true );
if( asRenderers.empty() ) if( asRenderers.empty() )
RageException::Throw("No video renderers attempted."); RageException::Throw( ERROR_NO_VIDEO_RENDERERS.GetValue() );
for( unsigned i=0; i<asRenderers.size(); i++ ) for( unsigned i=0; i<asRenderers.size(); i++ )
{ {
@@ -716,7 +723,7 @@ RageDisplay *CreateDisplay()
CString sError = pRet->Init( params, PREFSMAN->m_bAllowUnacceleratedRenderer ); CString sError = pRet->Init( params, PREFSMAN->m_bAllowUnacceleratedRenderer );
if( sError == "" ) if( sError == "" )
return pRet; return pRet;
error += "Initializing OpenGL...\n" + sError; error += ssprintf(ERROR_INITIALIZING.GetValue(),"OpenGL")+"\n" + sError;
delete pRet; delete pRet;
#endif #endif
} }
@@ -727,14 +734,18 @@ RageDisplay *CreateDisplay()
CString sError = pRet->Init( params ); CString sError = pRet->Init( params );
if( sError == "" ) if( sError == "" )
return pRet; return pRet;
error += "Initializing Direct3D...\n" + sError; error += ssprintf(ERROR_INITIALIZING.GetValue(),"Direct3D")+"\n" + sError;
delete pRet; delete pRet;
#endif #endif
} }
else if( sRenderer.CompareNoCase("null")==0 ) else if( sRenderer.CompareNoCase("null")==0 )
{
return new RageDisplay_Null( params ); return new RageDisplay_Null( params );
}
else else
RageException::Throw("Unknown video renderer value: %s", sRenderer.c_str() ); {
RageException::Throw( ERROR_UNKNOWN_VIDEO_RENDERER.GetValue(), sRenderer.c_str() );
}
error += "\n\n\n"; error += "\n\n\n";
} }
@@ -893,6 +904,9 @@ static void ApplyLogPreferences()
Checkpoints::LogCheckpoints( PREFSMAN->m_bLogCheckpoints ); Checkpoints::LogCheckpoints( PREFSMAN->m_bLogCheckpoints );
} }
static ThemeMetric<CString> COULDNT_OPEN_LOADING_WINDOW( "StepMania", "Couldn't open any loading windows." );
#ifdef _XBOX #ifdef _XBOX
void __cdecl main() void __cdecl main()
#else #else
@@ -997,7 +1011,7 @@ int main(int argc, char* argv[])
/* This requires PREFSMAN, for PREFSMAN->m_bShowLoadingWindow. */ /* This requires PREFSMAN, for PREFSMAN->m_bShowLoadingWindow. */
LoadingWindow *loading_window = MakeLoadingWindow(); LoadingWindow *loading_window = MakeLoadingWindow();
if( loading_window == NULL ) if( loading_window == NULL )
RageException::Throw( "Couldn't open any loading windows." ); RageException::Throw( COULDNT_OPEN_LOADING_WINDOW.GetValue() );
srand( time(NULL) ); // seed number generator srand( time(NULL) ); // seed number generator
-1
View File
@@ -20,7 +20,6 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h" #include "RageLog.h"
#include "NoteData.h" #include "NoteData.h"
#include "RageException.h"
#include "GameManager.h" #include "GameManager.h"
#include "NoteDataUtil.h" #include "NoteDataUtil.h"
#include "NotesLoaderSM.h" #include "NotesLoaderSM.h"
@@ -218,6 +218,7 @@ void ArchHooks_Unix::SetTime( tm newtime )
#include "RageFileManager.h" #include "RageFileManager.h"
#include <sys/stat.h> #include <sys/stat.h>
static ThemeMetric<CString> COULDNT_FIND_SONGS( "ArchHooks_Unix", "Couldn't find 'Songs'" );
void ArchHooks_Unix::MountInitialFilesystems( const CString &sDirOfExecutable ) void ArchHooks_Unix::MountInitialFilesystems( const CString &sDirOfExecutable )
{ {
#if defined(LINUX) #if defined(LINUX)
@@ -258,7 +259,7 @@ void ArchHooks_Unix::MountInitialFilesystems( const CString &sDirOfExecutable )
if( Root == "" && !stat( RageFileManagerUtil::sInitialWorkingDirectory + "/Songs", &st ) && st.st_mode&S_IFDIR ) if( Root == "" && !stat( RageFileManagerUtil::sInitialWorkingDirectory + "/Songs", &st ) && st.st_mode&S_IFDIR )
Root = RageFileManagerUtil::sInitialWorkingDirectory; Root = RageFileManagerUtil::sInitialWorkingDirectory;
if( Root == "" ) if( Root == "" )
RageException::Throw( "Couldn't find \"Songs\"" ); RageException::Throw( COULDNT_FIND_SONGS );
FILEMAN->Mount( "dir", Root, "/" ); FILEMAN->Mount( "dir", Root, "/" );
#else #else
@@ -19,11 +19,12 @@
#include <X11/extensions/XTest.h> #include <X11/extensions/XTest.h>
#endif #endif
static ThemeMetric<CString> FAILED_CONNECTION_XSERVER( "LowLevelWindow_X11", "Failed to establish a connection with the X server'" );
LowLevelWindow_X11::LowLevelWindow_X11() LowLevelWindow_X11::LowLevelWindow_X11()
{ {
m_bWindowIsOpen = false; m_bWindowIsOpen = false;
if( !X11Helper::Go() ) if( !X11Helper::Go() )
RageException::Throw( "Failed to establish a connection with the X server." ); RageException::Throw( FAILED_CONNECTION_XSERVER );
const int iScreen = DefaultScreen( X11Helper::Dpy ); const int iScreen = DefaultScreen( X11Helper::Dpy );
+9 -4
View File
@@ -9,15 +9,17 @@
#include "arch.h" #include "arch.h"
#include "arch_platform.h" #include "arch_platform.h"
#include "Foreach.h" #include "Foreach.h"
#include "ThemeMetric.h"
#include "InputHandler/Selector_InputHandler.h" #include "InputHandler/Selector_InputHandler.h"
static ThemeMetric<CString> INPUT_HANDLERS_EMPTY( "Arch", "Input Handlers cannot be empty." );
void MakeInputHandlers(CString drivers, vector<InputHandler *> &Add) void MakeInputHandlers(CString drivers, vector<InputHandler *> &Add)
{ {
vector<CString> DriversToTry; vector<CString> DriversToTry;
split(drivers, ",", DriversToTry, true); split(drivers, ",", DriversToTry, true);
if( DriversToTry.empty() ) if( DriversToTry.empty() )
RageException::Throw( "Input Handlers cannot be empty." ); RageException::Throw( INPUT_HANDLERS_EMPTY.GetValue() );
CString Driver; CString Driver;
@@ -177,6 +179,8 @@ MemoryCardDriver *MakeMemoryCardDriver()
#include "MovieTexture/Selector_MovieTexture.h" #include "MovieTexture/Selector_MovieTexture.h"
static void DumpAVIDebugInfo( const CString& fn ); static void DumpAVIDebugInfo( const CString& fn );
/* Try drivers in order of preference until we find one that works. */ /* Try drivers in order of preference until we find one that works. */
static ThemeMetric<CString> MOVIE_DRIVERS_EMPTY ( "Arch", "Movie Drivers cannot be empty." );
static ThemeMetric<CString> COULDNT_CREATE_MOVIE_DRIVER( "Arch", "Couldn't create a movie driver." );
RageMovieTexture *MakeRageMovieTexture( RageTextureID ID ) RageMovieTexture *MakeRageMovieTexture( RageTextureID ID )
{ {
DumpAVIDebugInfo( ID.filename ); DumpAVIDebugInfo( ID.filename );
@@ -185,7 +189,7 @@ RageMovieTexture *MakeRageMovieTexture( RageTextureID ID )
split( PREFSMAN->GetMovieDrivers(), ",", DriversToTry, true ); split( PREFSMAN->GetMovieDrivers(), ",", DriversToTry, true );
if( DriversToTry.empty() ) if( DriversToTry.empty() )
RageException::Throw( "Movie Drivers cannot be empty." ); RageException::Throw( MOVIE_DRIVERS_EMPTY.GetValue() );
CString Driver; CString Driver;
RageMovieTexture *ret = NULL; RageMovieTexture *ret = NULL;
@@ -220,7 +224,7 @@ RageMovieTexture *MakeRageMovieTexture( RageTextureID ID )
} }
} }
if (!ret) if (!ret)
RageException::Throw("Couldn't create a movie texture"); RageException::Throw( COULDNT_CREATE_MOVIE_DRIVER.GetValue() );
LOG->Trace("Created movie texture \"%s\" with driver \"%s\"", LOG->Trace("Created movie texture \"%s\" with driver \"%s\"",
ID.filename.c_str(), Driver.c_str() ); ID.filename.c_str(), Driver.c_str() );
@@ -228,13 +232,14 @@ RageMovieTexture *MakeRageMovieTexture( RageTextureID ID )
} }
#include "Sound/Selector_RageSoundDriver.h" #include "Sound/Selector_RageSoundDriver.h"
static ThemeMetric<CString> SOUND_DRIVERS_CANNOT_EMPTY( "Arch", "Sound Drivers cannot be empty." );
RageSoundDriver *MakeRageSoundDriver(CString drivers) RageSoundDriver *MakeRageSoundDriver(CString drivers)
{ {
vector<CString> DriversToTry; vector<CString> DriversToTry;
split(drivers, ",", DriversToTry, true); split(drivers, ",", DriversToTry, true);
if( DriversToTry.empty() ) if( DriversToTry.empty() )
RageException::Throw( "Sound Drivers cannot be empty." ); RageException::Throw( SOUND_DRIVERS_CANNOT_EMPTY.GetValue() );
CString Driver; CString Driver;
RageSoundDriver *ret = NULL; RageSoundDriver *ret = NULL;