diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index 8efa4b50db..1ed5a0b6e7 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -133,7 +133,7 @@ void BGAnimation::LoadFromAniDir( const CString &_sAniDir ) GetDirListing( sAniDir+"*.mpg", asImagePaths, false, true ); GetDirListing( sAniDir+"*.mpeg", asImagePaths, false, true ); - SortCStringArray( asImagePaths ); + SortRStringArray( asImagePaths ); for( unsigned i=0; iGetLineWidthInSourcePixels( CStringToWstring(sWord) ); + int iWidthWord = m_pFont->GetLineWidthInSourcePixels( RStringToWstring(sWord) ); if( sCurLine.empty() ) { @@ -404,12 +404,12 @@ void BitmapText::SetText( const CString& _sText, const CString& _sAlternateText, } else { - m_wTextLines.push_back( CStringToWstring(sCurLine) ); + m_wTextLines.push_back( RStringToWstring(sCurLine) ); sCurLine = sWord; iCurLineWidth = iWidthWord; } } - m_wTextLines.push_back( CStringToWstring(sCurLine) ); + m_wTextLines.push_back( RStringToWstring(sCurLine) ); } } @@ -471,11 +471,11 @@ bool BitmapText::StringWillUseAlternate( const CString& sText, const CString& sA return false; /* False if the alternate isn't needed. */ - if( m_pFont->FontCompleteForString(CStringToWstring(sText)) ) + if( m_pFont->FontCompleteForString(RStringToWstring(sText)) ) return false; /* False if the alternate is also incomplete. */ - if( !m_pFont->FontCompleteForString(CStringToWstring(sAlternateText)) ) + if( !m_pFont->FontCompleteForString(RStringToWstring(sAlternateText)) ) return false; return true; @@ -654,7 +654,7 @@ void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternate CString curCStr = m_sText.substr( i, 1 ); char curChar = curCStr.c_str()[0]; - int iCharLen = m_pFont->GetLineWidthInSourcePixels( CStringToWstring( curCStr ) ); + int iCharLen = m_pFont->GetLineWidthInSourcePixels( RStringToWstring( curCStr ) ); switch( curChar ) { @@ -673,7 +673,7 @@ void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternate SimpleAddLine( sCurrentLine, iLineWidth ); if( iWordWidth > 0 ) iLineWidth = iWordWidth + //Add the width of a space - m_pFont->GetLineWidthInSourcePixels( CStringToWstring( " " ) ); + m_pFont->GetLineWidthInSourcePixels( RStringToWstring( " " ) ); sCurrentLine = sCurrentWord + " "; iWordWidth = 0; sCurrentWord = ""; @@ -725,7 +725,7 @@ void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternate void ColorBitmapText::SimpleAddLine( const CString &sAddition, const int iWidthPixels) { - m_wTextLines.push_back( CStringToWstring( sAddition ) ); + m_wTextLines.push_back( RStringToWstring( sAddition ) ); m_iLineWidths.push_back( iWidthPixels ); } diff --git a/stepmania/src/Font.cpp b/stepmania/src/Font.cpp index 89e69c76ac..2e474fa9e8 100644 --- a/stepmania/src/Font.cpp +++ b/stepmania/src/Font.cpp @@ -538,7 +538,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const CStr ini.GetPath().c_str(), iFirstFrame, iNumFramesHigh ); /* Decode the string. */ - const wstring wdata( CStringToWstring(sValue) ); + const wstring wdata( RStringToWstring(sValue) ); if( int(wdata.size()) > iNumFramesWide ) RageException::Throw( "The font definition \"%s\" assigns %i characters to row %i (\"%ls\"), but the font only has %i characters wide", diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index a5d643b95d..fbf6c324c0 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -516,6 +516,9 @@ void InputMapper::SaveMappingsToDisk() ini.WriteFile( SpecialFiles::KEYMAPS_PATH ); } +static LocalizedString CONNECTED ( "InputMapper", "Connected" ); +static LocalizedString DISCONNECTED ( "InputMapper", "Disconnected" ); +static LocalizedString REMAPPING_ALL_JOYSTICKS ( "InputMapper", "Remapping all joysticks." ); bool InputMapper::CheckForChangedInputDevicesAndRemap( CString &sMessage ) { // @@ -537,13 +540,13 @@ bool InputMapper::CheckForChangedInputDevicesAndRemap( CString &sMessage ) sMessage = CString(); if( !vsConnects.empty() ) - sMessage += "Connected: " + join( "\n", vsConnects ) + "\n"; + sMessage += CONNECTED.GetValue()+": " + join( "\n", vsConnects ) + "\n"; if( !vsDisconnects.empty() ) - sMessage += "Disconnected: " + join( "\n", vsDisconnects ) + "\n"; + sMessage += DISCONNECTED.GetValue()+": " + join( "\n", vsDisconnects ) + "\n"; if( g_bAutoMapOnJoyChange ) { - sMessage += "Remapping all joysticks."; + sMessage += REMAPPING_ALL_JOYSTICKS.GetValue(); AutoMapJoysticksForCurrentGame(); SaveMappingsToDisk(); } diff --git a/stepmania/src/NetworkSyncManager.cpp b/stepmania/src/NetworkSyncManager.cpp index 6a95717b33..89c921f200 100644 --- a/stepmania/src/NetworkSyncManager.cpp +++ b/stepmania/src/NetworkSyncManager.cpp @@ -501,7 +501,9 @@ void NetworkSyncManager::StartRequest(short position) NetPlayerClient->blocking=false; } - + +static LocalizedString CONNECTION_SUCCESSFUL( "NetworkSyncManager", "Connection to '%s' successful." ); +static LocalizedString CONNECTION_FAILED ( "NetworkSyncManager", "Connection failed." ); void NetworkSyncManager::DisplayStartupStatus() { CString sMessage(""); @@ -512,13 +514,13 @@ void NetworkSyncManager::DisplayStartupStatus() //Networking wasn't attepmpted return; case 1: - sMessage = "Connection to " + m_ServerName + " successful."; + sMessage = ssprintf( CONNECTION_SUCCESSFUL.GetValue(), m_ServerName.c_str() ); break; case 2: - sMessage = "Connection failed."; + sMessage = CONNECTION_FAILED.GetValue(); break; } - SCREENMAN->SystemMessage(sMessage); + SCREENMAN->SystemMessage( sMessage ); } void NetworkSyncManager::Update(float fDeltaTime) @@ -565,13 +567,14 @@ void NetworkSyncManager::Update(float fDeltaTime) } } +static LocalizedString CONNECTION_DROPPED( "NetworkSyncManager", "Connection to server dropped." ); void NetworkSyncManager::ProcessInput() { //If we're disconnected, just exit if ((NetPlayerClient->state!=NetPlayerClient->skCONNECTED) || NetPlayerClient->IsError()) { - SCREENMAN->SystemMessageNoAnimate("Connection to server dropped."); + SCREENMAN->SystemMessageNoAnimate( CONNECTION_DROPPED ); useSMserver=false; isSMOnline = false; FOREACH_PlayerNumber(pn) diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index fd39598552..c2a819ae9a 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -1308,6 +1308,8 @@ void Player::HandleStep( int col, const RageTimer &tm, bool bHeld ) } } +static LocalizedString AUTOSYNC_CORRECTION_APPLIED ( "Player", "Autosync: Correction applied." ); +static LocalizedString AUTOSYNC_CORRECTION_NOT_APPLIED ( "Player", "Autosync: Correction NOT applied. Deviation too high." ); void Player::HandleAutosync(float fNoteOffset) { if( GAMESTATE->m_SongOptions.m_AutosyncType == SongOptions::AUTOSYNC_OFF ) @@ -1349,11 +1351,11 @@ void Player::HandleAutosync(float fNoteOffset) ASSERT(0); } - SCREENMAN->SystemMessage( "Autosync: Correction applied." ); + SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_APPLIED.GetValue() ); } else { - SCREENMAN->SystemMessage( "Autosync: Correction NOT applied.\n Timing deviation too high." ); + SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_NOT_APPLIED.GetValue() ); } m_iOffsetSample = 0; diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 01c7bad4fd..385979d8d7 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -1151,10 +1151,10 @@ ProfileLoadResult Profile::LoadEditableDataFromDir( CString sDir ) ini.GetValue( "Editable", "WeightPounds", m_iWeightPounds ); // This is data that the user can change, so we have to validate it. - wstring wstr = CStringToWstring(m_sDisplayName); + wstring wstr = RStringToWstring(m_sDisplayName); if( wstr.size() > PROFILE_MAX_DISPLAY_NAME_LENGTH ) wstr = wstr.substr(0, PROFILE_MAX_DISPLAY_NAME_LENGTH); - m_sDisplayName = WStringToCString(wstr); + m_sDisplayName = WStringToRString(wstr); // TODO: strip invalid chars? if( m_iWeightPounds != 0 ) CLAMP( m_iWeightPounds, 20, 1000 ); diff --git a/stepmania/src/RageSoundManager.cpp b/stepmania/src/RageSoundManager.cpp index 1d3c6612e5..b00e361590 100644 --- a/stepmania/src/RageSoundManager.cpp +++ b/stepmania/src/RageSoundManager.cpp @@ -10,7 +10,6 @@ #include "RageTimer.h" #include "RageSoundReader_Preload.h" #include "Foreach.h" -#include "ThemeMetric.h" #include "arch/Sound/RageSoundDriver.h" @@ -36,7 +35,7 @@ RageSoundManager::RageSoundManager() m_bPlayOnlyCriticalSounds = false; } -static ThemeMetric COULDNT_FIND_SOUND_DRIVER( "RageSoundManager", "Couldn't find a sound driver that works" ); +static LocalizedString COULDNT_FIND_SOUND_DRIVER( "RageSoundManager", "Couldn't find a sound driver that works" ); void RageSoundManager::Init( CString sDrivers ) { diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index d26e39e27c..a5e226ef0b 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -81,7 +81,7 @@ int power_of_two(int input) return value; } -bool IsAnInt( const CString &s ) +bool IsAnInt( const RString &s ) { if( !s.size() ) return false; @@ -93,7 +93,7 @@ bool IsAnInt( const CString &s ) return true; } -bool IsHexVal( const CString &s ) +bool IsHexVal( const RString &s ) { if( !s.size() ) return false; @@ -106,9 +106,9 @@ bool IsHexVal( const CString &s ) return true; } -float HHMMSSToSeconds( const CString &sHHMMSS ) +float HHMMSSToSeconds( const RString &sHHMMSS ) { - vector arrayBits; + vector arrayBits; split( sHHMMSS, ":", arrayBits, false ); while( arrayBits.size() < 3 ) @@ -122,50 +122,50 @@ float HHMMSSToSeconds( const CString &sHHMMSS ) return fSeconds; } -CString SecondsToHHMMSS( float fSecs ) +RString SecondsToHHMMSS( float fSecs ) { const int iMinsDisplay = (int)fSecs/60; const int iSecsDisplay = (int)fSecs - iMinsDisplay*60; - CString sReturn = ssprintf( "%02d:%02d:%02d", iMinsDisplay/60, iMinsDisplay%60, iSecsDisplay ); + RString sReturn = ssprintf( "%02d:%02d:%02d", iMinsDisplay/60, iMinsDisplay%60, iSecsDisplay ); return sReturn; } -CString SecondsToMMSSMsMs( float fSecs ) +RString SecondsToMMSSMsMs( float fSecs ) { const int iMinsDisplay = (int)fSecs/60; const int iSecsDisplay = (int)fSecs - iMinsDisplay*60; const int iLeftoverDisplay = (int) ( (fSecs - iMinsDisplay*60 - iSecsDisplay) * 100 ); - CString sReturn = ssprintf( "%02d:%02d.%02d", iMinsDisplay, iSecsDisplay, min(99,iLeftoverDisplay) ); + RString sReturn = ssprintf( "%02d:%02d.%02d", iMinsDisplay, iSecsDisplay, min(99,iLeftoverDisplay) ); return sReturn; } -CString SecondsToMSSMsMs( float fSecs ) +RString SecondsToMSSMsMs( float fSecs ) { const int iMinsDisplay = (int)fSecs/60; const int iSecsDisplay = (int)fSecs - iMinsDisplay*60; const int iLeftoverDisplay = (int) ( (fSecs - iMinsDisplay*60 - iSecsDisplay) * 100 ); - CString sReturn = ssprintf( "%01d:%02d.%02d", iMinsDisplay, iSecsDisplay, min(99,iLeftoverDisplay) ); + RString sReturn = ssprintf( "%01d:%02d.%02d", iMinsDisplay, iSecsDisplay, min(99,iLeftoverDisplay) ); return sReturn; } -CString SecondsToMMSSMsMsMs( float fSecs ) +RString SecondsToMMSSMsMsMs( float fSecs ) { const int iMinsDisplay = (int)fSecs/60; const int iSecsDisplay = (int)fSecs - iMinsDisplay*60; const int iLeftoverDisplay = (int) ( (fSecs - iMinsDisplay*60 - iSecsDisplay) * 1000 ); - CString sReturn = ssprintf( "%02d:%02d.%03d", iMinsDisplay, iSecsDisplay, min(999,iLeftoverDisplay) ); + RString sReturn = ssprintf( "%02d:%02d.%03d", iMinsDisplay, iSecsDisplay, min(999,iLeftoverDisplay) ); return sReturn; } -CString PrettyPercent( float fNumerator, float fDenominator) +RString PrettyPercent( float fNumerator, float fDenominator) { return ssprintf("%0.2f%%",fNumerator/fDenominator*100); } -CString Commify( int iNum ) +RString Commify( int iNum ) { - CString sNum = ssprintf("%d",iNum); - CString sReturn; + RString sNum = ssprintf("%d",iNum); + RString sReturn; for( unsigned i=0; i foo bar */ TrimRight( text ); /* "foo\r\n" -> "foo" */ va_list va; va_start(va, fmt); - CString s = vssprintf( fmt, va ); + RString s = vssprintf( fmt, va ); va_end(va); return s += ssprintf( " (%s)", text.c_str() ); } -CString ConvertWstringToACP( wstring s ) +RString ConvertWstringToACP( wstring s ) { if( s.empty() ) - return CString(); + return RString(); int iBytes = WideCharToMultiByte( CP_ACP, 0, s.data(), s.size(), NULL, 0, NULL, FALSE ); ASSERT_M( iBytes > 0, werr_ssprintf( GetLastError(), "WideCharToMultiByte" ).c_str() ); - CString ret; + RString ret; WideCharToMultiByte( CP_ACP, 0, s.data(), s.size(), ret.GetBuf( iBytes ), iBytes, NULL, FALSE ); ret.RelBuf( iBytes ); @@ -286,21 +286,21 @@ CString ConvertWstringToACP( wstring s ) return ret; } -CString ConvertUTF8ToACP( CString s ) +RString ConvertUTF8ToACP( RString s ) { - return ConvertWstringToACP( CStringToWstring(s) ); + return ConvertWstringToACP( RStringToWstring(s) ); } #endif -static map g_mapLangToName2Letter; +static map g_mapLangToName2Letter; void InitLanguages() { if( !g_mapLangToName2Letter.empty() ) return; { - map &m = g_mapLangToName2Letter; + map &m = g_mapLangToName2Letter; m["AA"] = "Afar"; m["AB"] = "Abkhazian"; m["AF"] = "Afrikaans"; @@ -441,22 +441,22 @@ void InitLanguages() } /* We don't use 3-letter codes, so we don't bother supporting them. */ -CString GetLanguageNameFromISO639Code( CString sName ) +RString GetLanguageNameFromISO639Code( RString sName ) { InitLanguages(); - map::const_iterator it = g_mapLangToName2Letter.find(sName); + map::const_iterator it = g_mapLangToName2Letter.find(sName); if( it != g_mapLangToName2Letter.end() ) return it->second; return ""; } -CString join( const CString &Deliminator, const vector& Source) +RString join( const RString &Deliminator, const vector& Source) { if( Source.empty() ) - return CString(); + return RString(); - CString csTmp; + RString csTmp; // Loop through the Array and Append the Deliminator for( unsigned iNum = 0; iNum < Source.size()-1; iNum++ ) { @@ -467,12 +467,12 @@ CString join( const CString &Deliminator, const vector& Source) return csTmp; } -CString join( const CString &Delimitor, vector::const_iterator begin, vector::const_iterator end ) +RString join( const RString &Delimitor, vector::const_iterator begin, vector::const_iterator end ) { if( begin == end ) - return CString(); + return RString(); - CString ret; + RString ret; while( begin != end ) { ret += *begin; @@ -524,8 +524,8 @@ void do_split( const S &Source, const C Delimitor, vector &AddIt, const bool AddIt.push_back(Source); else { - const S AddCString = Source.substr(startpos, pos-startpos); - AddIt.push_back(AddCString); + const S AddRString = Source.substr(startpos, pos-startpos); + AddIt.push_back(AddRString); } } @@ -534,7 +534,7 @@ void do_split( const S &Source, const C Delimitor, vector &AddIt, const bool } -void split( const CString &Source, const CString &Delimitor, vector &AddIt, const bool bIgnoreEmpty ) +void split( const RString &Source, const RString &Delimitor, vector &AddIt, const bool bIgnoreEmpty ) { if( Delimitor.size() == 1 ) do_split( Source, Delimitor[0], AddIt, bIgnoreEmpty ); @@ -552,7 +552,7 @@ void split( const wstring &Source, const wstring &Delimitor, vector &Ad /* Use: -CString str="a,b,c"; +RString str="a,b,c"; int start = 0, size = -1; while( 1 ) { @@ -596,7 +596,7 @@ void do_split( const S &Source, const S &Delimitor, int &begin, int &size, int l size = pos - begin; } -void split( const CString &Source, const CString &Delimitor, int &begin, int &size, int len, const bool bIgnoreEmpty ) +void split( const RString &Source, const RString &Delimitor, int &begin, int &size, int len, const bool bIgnoreEmpty ) { do_split( Source, Delimitor, begin, size, len, bIgnoreEmpty ); @@ -607,7 +607,7 @@ void split( const wstring &Source, const wstring &Delimitor, int &begin, int &si do_split( Source, Delimitor, begin, size, len, bIgnoreEmpty ); } -void split( const CString &Source, const CString &Delimitor, int &begin, int &size, const bool bIgnoreEmpty ) +void split( const RString &Source, const RString &Delimitor, int &begin, int &size, const bool bIgnoreEmpty ) { do_split( Source, Delimitor, begin, size, Source.size(), bIgnoreEmpty ); } @@ -624,11 +624,11 @@ void split( const wstring &Source, const wstring &Delimitor, int &begin, int &si * c:\foo\bar.txt -> "c:\foo\", "bar", ".txt" * \\foo\fum -> "\\foo\", "fum", "" */ -void splitpath( const CString &Path, CString& Dir, CString& Filename, CString& Ext ) +void splitpath( const RString &Path, RString& Dir, RString& Filename, RString& Ext ) { Dir = Filename = Ext = ""; - vector mat; + vector mat; /* One level of escapes for the regex, one for C. Ew. * This is really: @@ -638,7 +638,7 @@ void splitpath( const CString &Path, CString& Dir, CString& Filename, CString& E ASSERT(check); Dir = mat[0]; - const CString Base = mat[1]; + const RString Base = mat[1]; /* ^(.*)(\.[^\.]+)$ */ static Regex SplitExt("^(.*)(\\.[^\\.]+)$"); @@ -654,29 +654,29 @@ void splitpath( const CString &Path, CString& Dir, CString& Filename, CString& E /* "foo.bar", "baz" -> "foo.baz" * "foo", "baz" -> "foo.baz" * "foo.bar", "" -> "foo" */ -CString SetExtension( const CString &path, const CString &ext ) +RString SetExtension( const RString &path, const RString &ext ) { - CString Dir, FName, OldExt; + RString Dir, FName, OldExt; splitpath( path, Dir, FName, OldExt ); return Dir + FName + (ext.size()? ".":"") + ext; } -CString GetExtension( const CString &sPath ) +RString GetExtension( const RString &sPath ) { size_t pos = sPath.rfind( '.' ); if( pos == sPath.npos ) - return CString(); + return RString(); size_t slash = sPath.find( '/', pos ); if( slash != sPath.npos ) - return CString(); /* rare: path/dir.ext/fn */ + return RString(); /* rare: path/dir.ext/fn */ return sPath.substr( pos+1, sPath.size()-pos+1 ); } -CString GetFileNameWithoutExtension( const CString &sPath ) +RString GetFileNameWithoutExtension( const RString &sPath ) { - CString sThrowAway, sFName; + RString sThrowAway, sFName; splitpath( sPath, sThrowAway, sFName, sThrowAway ); return sFName; } @@ -697,16 +697,16 @@ void SetCommandlineArguments( int argc, char **argv ) * common, general use, so having short options isn't currently needed.) * If argument is non-NULL, accept an argument. */ -bool GetCommandlineArgument( const CString &option, CString *argument, int iIndex ) +bool GetCommandlineArgument( const RString &option, RString *argument, int iIndex ) { - const CString optstr = "--" + option; + const RString optstr = "--" + option; for( int arg = 1; arg < g_argc; ++arg ) { - const CString CurArgument = g_argv[arg]; + const RString CurArgument = g_argv[arg]; const size_t i = CurArgument.find( "=" ); - CString CurOption = CurArgument.substr(0,i); + RString CurOption = CurArgument.substr(0,i); if( CurOption.CompareNoCase(optstr) ) continue; /* no match */ @@ -719,7 +719,7 @@ bool GetCommandlineArgument( const CString &option, CString *argument, int iInde if( argument ) { - if( i != CString::npos ) + if( i != RString::npos ) *argument = CurArgument.substr( i+1 ); else *argument = ""; @@ -731,7 +731,7 @@ bool GetCommandlineArgument( const CString &option, CString *argument, int iInde return false; } -CString GetCwd() +RString GetCwd() { #ifdef _XBOX return SYS_BASE_PATH; @@ -780,7 +780,7 @@ void CRC32( unsigned int &iCRC, const void *pVoidBuffer, size_t iSize ) iCRC ^= 0xFFFFFFFF; } -unsigned int GetHashForString ( const CString &s ) +unsigned int GetHashForString ( const RString &s ) { unsigned crc = 0; CRC32( crc, s.data(), s.size() ); @@ -789,32 +789,32 @@ unsigned int GetHashForString ( const CString &s ) /* Return true if "dir" is empty or does not exist. */ -bool DirectoryIsEmpty( const CString &dir ) +bool DirectoryIsEmpty( const RString &dir ) { if(dir == "") return true; if(!DoesFileExist(dir)) return true; - vector asFileNames; + vector asFileNames; GetDirListing( dir, asFileNames ); return asFileNames.empty(); } -bool CompareCStringsAsc(const CString &str1, const CString &str2) +bool CompareRStringsAsc(const RString &str1, const RString &str2) { return str1.CompareNoCase( str2 ) < 0; } -bool CompareCStringsDesc(const CString &str1, const CString &str2) +bool CompareRStringsDesc(const RString &str1, const RString &str2) { return str1.CompareNoCase( str2 ) > 0; } -void SortCStringArray( vector &arrayCStrings, const bool bSortAscending ) +void SortRStringArray( vector &arrayRStrings, const bool bSortAscending ) { - sort( arrayCStrings.begin(), arrayCStrings.end(), - bSortAscending?CompareCStringsAsc:CompareCStringsDesc); + sort( arrayRStrings.begin(), arrayRStrings.end(), + bSortAscending?CompareRStringsAsc:CompareRStringsDesc); } float calc_mean(const float *start, const float *end) @@ -837,7 +837,7 @@ float calc_stddev(const float *start, const float *end) return dev; } -void TrimLeft(CString &str, const char *s) +void TrimLeft(RString &str, const char *s) { int n = 0; while(n < int(str.size()) && strchr(s, str[n])) @@ -846,7 +846,7 @@ void TrimLeft(CString &str, const char *s) str.erase(str.begin(), str.begin()+n); } -void TrimRight(CString &str, const char *s) +void TrimRight(RString &str, const char *s) { int n = str.size(); while(n > 0 && strchr(s, str[n-1])) @@ -857,19 +857,19 @@ void TrimRight(CString &str, const char *s) str.erase(str.begin()+n, str.end()); } -void StripCrnl(CString &s) +void StripCrnl(RString &s) { while( s.size() && (s[s.size()-1] == '\r' || s[s.size()-1] == '\n') ) s.erase(s.size()-1); } -bool BeginsWith( const CString &sTestThis, const CString &sBeginning ) +bool BeginsWith( const RString &sTestThis, const RString &sBeginning ) { ASSERT( !sBeginning.empty() ); return sTestThis.compare( 0, sBeginning.length(), sBeginning ) == 0; } -bool EndsWith( const CString &sTestThis, const CString &sEnding ) +bool EndsWith( const RString &sTestThis, const RString &sEnding ) { ASSERT( !sEnding.empty() ); if( sTestThis.size() < sEnding.size() ) @@ -877,7 +877,7 @@ bool EndsWith( const CString &sTestThis, const CString &sEnding ) return sTestThis.compare( sTestThis.length()-sEnding.length(), sEnding.length(), sEnding ) == 0; } -void StripCvs( vector &vs ) +void StripCvs( vector &vs ) { for( unsigned i=0; i &vs ) } /* path is a .redir pathname. Read it and return the real one. */ -CString DerefRedir(const CString &_path) +RString DerefRedir(const RString &_path) { - CString path = _path; + RString path = _path; for( int i=0; i<100; i++ ) { @@ -898,22 +898,22 @@ CString DerefRedir(const CString &_path) return path; } - CString sNewFileName; + RString sNewFileName; GetFileContents( path, sNewFileName, true ); /* Empty is invalid. */ if( sNewFileName == "" ) - return CString(); + return RString(); FixSlashesInPlace( sNewFileName ); - CString path2 = Dirname(path) + sNewFileName; + RString path2 = Dirname(path) + sNewFileName; CollapsePath( path2 ); path2 += "*"; - vector matches; + vector matches; GetDirListing( path2, matches, false, true ); if( matches.empty() ) @@ -927,7 +927,7 @@ CString DerefRedir(const CString &_path) RageException::Throw( "Circular redirect '%s'", path.c_str() ); } -bool GetFileContents( const CString &sPath, CString &sOut, bool bOneLine ) +bool GetFileContents( const RString &sPath, RString &sOut, bool bOneLine ) { /* Don't warn if the file doesn't exist, but do warn if it exists and fails to open. */ if( !IsAFile(sPath) ) @@ -940,7 +940,7 @@ bool GetFileContents( const CString &sPath, CString &sOut, bool bOneLine ) return false; } - CString sData; + RString sData; int iGot; if( bOneLine ) iGot = file.GetLine( sData ); @@ -979,7 +979,7 @@ void Regex::Compile() ASSERT(backrefs < 128); } -void Regex::Set(const CString &str) +void Regex::Set(const RString &str) { Release(); pattern=str; @@ -993,7 +993,7 @@ void Regex::Release() pattern = ""; } -Regex::Regex(const CString &str) +Regex::Regex(const RString &str) { reg = NULL; Set(str); @@ -1016,7 +1016,7 @@ Regex::~Regex() Release(); } -bool Regex::Compare(const CString &str) +bool Regex::Compare(const RString &str) { int mat[128*3]; int ret = pcre_exec( (pcre *) reg, NULL, @@ -1029,7 +1029,7 @@ bool Regex::Compare(const CString &str) return ret >= 0; } -bool Regex::Compare(const CString &str, vector &matches) +bool Regex::Compare(const RString &str, vector &matches) { matches.clear(); @@ -1073,7 +1073,7 @@ void Regex::Compile() ASSERT(backrefs+1 < 128); } -void Regex::Set(const CString &str) +void Regex::Set(const RString &str) { Release(); pattern=str; @@ -1087,7 +1087,7 @@ void Regex::Release() pattern = ""; } -Regex::Regex(const CString &str) +Regex::Regex(const RString &str) { reg = NULL; Set(str); @@ -1110,12 +1110,12 @@ Regex::~Regex() Release(); } -bool Regex::Compare(const CString &str) +bool Regex::Compare(const RString &str) { return regexec((regex_t *) reg, str.c_str(), 0, NULL, 0) != REG_NOMATCH; } -bool Regex::Compare(const CString &str, vector &matches) +bool Regex::Compare(const RString &str, vector &matches) { matches.clear(); @@ -1139,9 +1139,9 @@ bool Regex::Compare(const CString &str, vector &matches) // Arguments and behavior are the same are similar to // http://us3.php.net/manual/en/function.preg-replace.php -bool Regex::Replace(const CString &replacement, const CString &subject, CString &out) +bool Regex::Replace(const RString &replacement, const RString &subject, RString &out) { - vector matches; + vector matches; if( !Compare(subject,matches) ) return false; @@ -1150,8 +1150,8 @@ bool Regex::Replace(const CString &replacement, const CString &subject, CString // TODO: optimize me by iterating only once over the string for( unsigned i=0; i= s.size() ) return false; @@ -1244,7 +1244,7 @@ bool utf8_to_wchar_ec( const CString &s, unsigned &start, wchar_t &ch ) } /* Like utf8_to_wchar_ec, but only does enough error checking to prevent crashing. */ -bool utf8_to_wchar( const CString &s, unsigned &start, wchar_t &ch ) +bool utf8_to_wchar( const RString &s, unsigned &start, wchar_t &ch ) { if( start >= s.size() ) return false; @@ -1304,7 +1304,7 @@ bool utf8_to_wchar( const CString &s, unsigned &start, wchar_t &ch ) /* UTF-8 encode ch and append to out. */ -void wchar_to_utf8( wchar_t ch, CString &out ) +void wchar_to_utf8( wchar_t ch, RString &out ) { if( ch < 0x80 ) { out.append( 1, (char) ch ); return; } @@ -1329,7 +1329,7 @@ void wchar_to_utf8( wchar_t ch, CString &out ) } -wchar_t utf8_get_char( const CString &s ) +wchar_t utf8_get_char( const RString &s ) { unsigned start = 0; wchar_t ret; @@ -1341,9 +1341,9 @@ wchar_t utf8_get_char( const CString &s ) /* Replace invalid sequences in s. */ -void utf8_sanitize( CString &s ) +void utf8_sanitize( RString &s ) { - CString ret; + RString ret; for( unsigned start = 0; start < s.size(); ) { wchar_t ch; @@ -1357,7 +1357,7 @@ void utf8_sanitize( CString &s ) } -bool utf8_is_valid( const CString &s ) +bool utf8_is_valid( const RString &s ) { for( unsigned start = 0; start < s.size(); ) { @@ -1370,7 +1370,7 @@ bool utf8_is_valid( const CString &s ) /* Windows tends to drop garbage BOM characters at the start of UTF-8 text files. * Remove them. */ -void utf8_remove_bom( CString &sLine ) +void utf8_remove_bom( RString &sLine ) { if( !sLine.compare(0, 3, "\xef\xbb\xbf") ) sLine.erase(0, 3); @@ -1378,7 +1378,7 @@ void utf8_remove_bom( CString &sLine ) const wchar_t INVALID_CHAR = 0xFFFD; /* U+FFFD REPLACEMENT CHARACTER */ -wstring CStringToWstring( const CString &s ) +wstring RStringToWstring( const RString &s ) { wstring ret; ret.reserve( s.size() ); @@ -1402,9 +1402,9 @@ wstring CStringToWstring( const CString &s ) return ret; } -CString WStringToCString(const wstring &str) +RString WStringToRString(const wstring &str) { - CString ret; + RString ret; for(unsigned i = 0; i < str.size(); ++i) wchar_to_utf8( str[i], ret ); @@ -1413,17 +1413,17 @@ CString WStringToCString(const wstring &str) } -CString WcharToUTF8( wchar_t c ) +RString WcharToUTF8( wchar_t c ) { - CString ret; + RString ret; wchar_to_utf8( c, ret ); return ret; } /* &a; -> a */ -void ReplaceEntityText( CString &sText, const map &m ) +void ReplaceEntityText( RString &sText, const map &m ) { - CString sRet; + RString sRet; size_t iOffset = 0; while( iOffset != sText.size() ) @@ -1455,10 +1455,10 @@ void ReplaceEntityText( CString &sText, const map &m ) continue; } - CString sElement = sText.substr( iStart+1, iEnd-iStart-1 ); + RString sElement = sText.substr( iStart+1, iEnd-iStart-1 ); sElement.MakeLower(); - map::const_iterator it = m.find( sElement ); + map::const_iterator it = m.find( sElement ); if( it == m.end() ) { sRet.append( sText, iStart, iEnd-iStart+1 ); @@ -1466,7 +1466,7 @@ void ReplaceEntityText( CString &sText, const map &m ) continue; } - const CString &sTo = it->second; + const RString &sTo = it->second; sRet.append( sTo ); iOffset = iEnd + 1; } @@ -1475,14 +1475,14 @@ void ReplaceEntityText( CString &sText, const map &m ) } /* abcd -> &a; &b; &c; &d; */ -void ReplaceEntityText( CString &sText, const map &m ) +void ReplaceEntityText( RString &sText, const map &m ) { - CString sFind; + RString sFind; - FOREACHM_CONST( char, CString, m, c ) + FOREACHM_CONST( char, RString, m, c ) sFind.append( 1, c->first ); - CString sRet; + RString sRet; size_t iOffset = 0; while( iOffset != sText.size() ) @@ -1505,10 +1505,10 @@ void ReplaceEntityText( CString &sText, const map &m ) char sElement = sText[iStart]; - map::const_iterator it = m.find( sElement ); + map::const_iterator it = m.find( sElement ); ASSERT( it != m.end() ); - const CString &sTo = it->second; + const RString &sTo = it->second; sRet.append( 1, '&' ); sRet.append( sTo ); sRet.append( 1, ';' ); @@ -1519,7 +1519,7 @@ void ReplaceEntityText( CString &sText, const map &m ) } /* Replace &#nnnn; (decimal) &xnnnn; (hex) with corresponding UTF-8 characters. */ -void Replace_Unicode_Markers( CString &Text ) +void Replace_Unicode_Markers( RString &Text ) { unsigned start = 0; while(start < Text.size()) @@ -1563,9 +1563,9 @@ void Replace_Unicode_Markers( CString &Text ) } /* Form a string to identify a wchar_t with ASCII. */ -CString WcharDisplayText(wchar_t c) +RString WcharDisplayText(wchar_t c) { - CString chr; + RString chr; chr = ssprintf("U+%4.4x", c); if(c < 128) chr += ssprintf(" ('%c')", char(c)); return chr; @@ -1575,11 +1575,11 @@ CString WcharDisplayText(wchar_t c) * a/b/c -> c * a/b/c/ -> c */ -CString Basename( const CString &dir ) +RString Basename( const RString &dir ) { size_t end = dir.find_last_not_of( "/\\" ); if( end == dir.npos ) - return CString(); + return RString(); size_t start = dir.find_last_of( "/\\", end ); if( start == dir.npos ) @@ -1597,7 +1597,7 @@ CString Basename( const CString &dir ) * /foo -> / * / -> / */ -CString Dirname( const CString &dir ) +RString Dirname( const RString &dir ) { /* Special case: "/" -> "/". */ if( dir.size() == 1 && dir[0] == '/' ) @@ -1618,11 +1618,11 @@ CString Dirname( const CString &dir ) return dir.substr(0, pos+1); } -CString Capitalize( const CString &s ) +RString Capitalize( const RString &s ) { if( s.GetLength()==0 ) - return CString(); - CString s2 = s; + return RString(); + RString s2 = s; /* XXX: utf-8 */ if( !(s2[0] & 0x80) ) s2[0] = (char) toupper( s2[0] ); @@ -1649,14 +1649,14 @@ char char_traits_char_nocase::uptab[256] = '\xF0','\xF1','\xF2','\xF3','\xF4','\xF5','\xF6','\xF7','\xF8','\xF9','\xFA','\xFB','\xFC','\xFD','\xFE','\xFF', }; -void FixSlashesInPlace( CString &sPath ) +void FixSlashesInPlace( RString &sPath ) { for( unsigned i = 0; i < sPath.size(); ++i ) if( sPath[i] == '\\' ) sPath[i] = '/'; } -CString FixSlashes( CString sPath ) +RString FixSlashes( RString sPath ) { FixSlashesInPlace( sPath ); return sPath; @@ -1678,9 +1678,9 @@ CString FixSlashes( CString sPath ) * ./// -> ./ */ -void CollapsePath( CString &sPath, bool bRemoveLeadingDot ) +void CollapsePath( RString &sPath, bool bRemoveLeadingDot ) { - CString sOut; + RString sOut; sOut.reserve( sPath.size() ); size_t iPos = 0; @@ -1689,7 +1689,7 @@ void CollapsePath( CString &sPath, bool bRemoveLeadingDot ) { /* Find the next slash. */ iNext = sPath.find( '/', iPos ); - if( iNext == CString::npos ) + if( iNext == RString::npos ) iNext = sPath.size(); else ++iNext; @@ -1721,7 +1721,7 @@ void CollapsePath( CString &sPath, bool bRemoveLeadingDot ) /* Search backwards for the previous path element. */ size_t iPrev = sOut.rfind( '/', sOut.size()-2 ); - if( iPrev == CString::npos ) + if( iPrev == RString::npos ) iPrev = 0; else ++iPrev; @@ -1745,7 +1745,7 @@ void CollapsePath( CString &sPath, bool bRemoveLeadingDot ) } -bool FromString( const CString &sValue, int &out ) +bool FromString( const RString &sValue, int &out ) { if( sscanf( sValue.c_str(), "%d", &out ) == 1 ) return true; @@ -1754,7 +1754,7 @@ bool FromString( const CString &sValue, int &out ) return false; } -bool FromString( const CString &sValue, unsigned &out ) +bool FromString( const RString &sValue, unsigned &out ) { if( sscanf( sValue.c_str(), "%u", &out ) == 1 ) return true; @@ -1763,14 +1763,14 @@ bool FromString( const CString &sValue, unsigned &out ) return false; } -bool FromString( const CString &sValue, float &out ) +bool FromString( const RString &sValue, float &out ) { const char *endptr = sValue.data() + sValue.size(); out = strtof( sValue, (char **) &endptr ); return endptr != sValue.data(); } -bool FromString( const CString &sValue, bool &out ) +bool FromString( const RString &sValue, bool &out ) { if( sValue.size() == 0 ) return false; @@ -1779,22 +1779,22 @@ bool FromString( const CString &sValue, bool &out ) return true; } -CString ToString( int value ) +RString ToString( int value ) { return ssprintf( "%i", value ); } -CString ToString( unsigned value ) +RString ToString( unsigned value ) { return ssprintf( "%u", value ); } -CString ToString( float value ) +RString ToString( float value ) { return ssprintf( "%f", value ); } -CString ToString( bool value ) +RString ToString( bool value ) { return ssprintf( "%i", value ); } @@ -1803,7 +1803,7 @@ CString ToString( bool value ) // // Helper function for reading/writing scores // -bool FileRead(RageFileBasic& f, CString& sOut) +bool FileRead(RageFileBasic& f, RString& sOut) { if (f.AtEOF()) return false; @@ -1814,7 +1814,7 @@ bool FileRead(RageFileBasic& f, CString& sOut) bool FileRead(RageFileBasic& f, int& iOut) { - CString s; + RString s; if (!FileRead(f, s)) return false; iOut = atoi(s); @@ -1823,7 +1823,7 @@ bool FileRead(RageFileBasic& f, int& iOut) bool FileRead(RageFileBasic& f, unsigned& uOut) { - CString s; + RString s; if (!FileRead(f, s)) return false; uOut = atoi(s); @@ -1832,14 +1832,14 @@ bool FileRead(RageFileBasic& f, unsigned& uOut) bool FileRead(RageFileBasic& f, float& fOut) { - CString s; + RString s; if (!FileRead(f, s)) return false; fOut = strtof( s, NULL ); return true; } -void FileWrite(RageFileBasic& f, const CString& sWrite) +void FileWrite(RageFileBasic& f, const RString& sWrite) { f.PutLine( sWrite ); } @@ -1859,7 +1859,7 @@ void FileWrite(RageFileBasic& f, float fWrite) f.PutLine( ssprintf("%f", fWrite) ); } -bool FileCopy( CString sSrcFile, CString sDstFile ) +bool FileCopy( RString sSrcFile, RString sDstFile ) { if( !sSrcFile.CompareNoCase(sDstFile) ) { @@ -1875,7 +1875,7 @@ bool FileCopy( CString sSrcFile, CString sDstFile ) if( !out.Open(sDstFile, RageFile::WRITE) ) return false; - CString sError; + RString sError; if( !FileCopy(in, out, sError) ) { LOG->Warn( "FileCopy(%s,%s): %s", @@ -1886,11 +1886,11 @@ bool FileCopy( CString sSrcFile, CString sDstFile ) return true; } -bool FileCopy( RageFileBasic &in, RageFileBasic &out, CString &sError, bool *bReadError ) +bool FileCopy( RageFileBasic &in, RageFileBasic &out, RString &sError, bool *bReadError ) { while(1) { - CString data; + RString data; if( in.Read(data, 1024*32) == -1 ) { sError = ssprintf( "read error: %s", in.GetError().c_str() ); @@ -1921,6 +1921,55 @@ bool FileCopy( RageFileBasic &in, RageFileBasic &out, CString &sError, bool *bRe return true; } +static RString (*g_pfnLocalizer)(const RString&,const RString&) = NULL; + +void RegisterLocalizer( RString (*pfnLocalizer)(const RString&, const RString&) ) +{ + g_pfnLocalizer = pfnLocalizer; +} + +#include "SubscriptionManager.h" +template<> +set* SubscriptionManager::s_pSubscribers = NULL; + +void RefreshLocalizedStrings() +{ + FOREACHS( LocalizedString*, *SubscriptionManager::s_pSubscribers, p ) + (*p)->Refresh(); +} + +LocalizedString::LocalizedString( const RString &sSection, const RString &sName ) +{ + m_sSection = sSection; + m_sName = sName; + + SubscriptionManager::Subscribe( this ); +} + + +LocalizedString::~LocalizedString() +{ + SubscriptionManager::Unsubscribe( this ); +} + + +LocalizedString::operator const CString&() +{ + return GetValue(); +} + +const CString &LocalizedString::GetValue() +{ + ASSERT(!m_sValue.empty()); return m_sValue; +} + +void LocalizedString::Refresh() +{ + ASSERT( g_pfnLocalizer ); + m_sValue = g_pfnLocalizer( m_sSection, m_sName ); +} + + /* * Copyright (c) 2001-2005 Chris Danford, Glenn Maynard * All rights reserved. diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index cfb0f708d8..f50f2fe68e 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -276,9 +276,9 @@ wchar_t utf8_get_char( const RString &s ); bool utf8_is_valid( const RString &s ); void utf8_remove_bom( RString &s ); -RString WStringToCString( const wstring &sString ); +RString WStringToRString( const wstring &sString ); RString WcharToUTF8( wchar_t c ); -wstring CStringToWstring( const RString &sString ); +wstring RStringToWstring( const RString &sString ); RString GetLanguageNameFromISO639Code( RString sName ); @@ -311,9 +311,9 @@ unsigned int GetHashForFile( const RString &sPath ); unsigned int GetHashForDirectory( const RString &sDir ); // a hash value that remains the same as long as nothing in the directory has changed bool DirectoryIsEmpty( const RString &sPath ); -bool CompareCStringsAsc( const RString &sStr1, const RString &sStr2 ); -bool CompareCStringsDesc( const RString &sStr1, const RString &sStr2 ); -void SortCStringArray( vector &asAddTo, const bool bSortAscending = true ); +bool CompareRStringsAsc( const RString &sStr1, const RString &sStr2 ); +bool CompareRStringsDesc( const RString &sStr1, const RString &sStr2 ); +void SortRStringArray( vector &asAddTo, const bool bSortAscending = true ); /* Find the mean and standard deviation of all numbers in [start,end). */ float calc_mean( const float *pStart, const float *pEnd ); @@ -503,6 +503,24 @@ void GetConnectsDisconnects( const vector &before, const vector &after, ve GetAsNotInBs( after, before, connects ); } +// String localization +void RegisterLocalizer( RString (*pfnLocalizer)(const RString&,const RString&) ); +void RefreshLocalizedStrings(); + +class LocalizedString +{ +public: + LocalizedString( const RString &sSection, const RString &sName ); + ~LocalizedString(); + void Refresh(); + operator const CString&(); + const CString &GetValue(); +private: + RString m_sSection; + RString m_sName; + RString m_sValue; +}; + #endif /* diff --git a/stepmania/src/RageUtil_CharConversions.cpp b/stepmania/src/RageUtil_CharConversions.cpp index 40ba6bb0d3..c97a4262de 100644 --- a/stepmania/src/RageUtil_CharConversions.cpp +++ b/stepmania/src/RageUtil_CharConversions.cpp @@ -27,7 +27,7 @@ static bool CodePageConvert(CString &txt, int cp) size = MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, txt.data(), txt.size(), (wchar_t *) out.data(), size); ASSERT( size != 0 ); - txt = WStringToCString(out); + txt = WStringToRString(out); return true; } diff --git a/stepmania/src/ScreenCenterImage.cpp b/stepmania/src/ScreenCenterImage.cpp index 27b28083c2..cabbe680aa 100644 --- a/stepmania/src/ScreenCenterImage.cpp +++ b/stepmania/src/ScreenCenterImage.cpp @@ -157,6 +157,7 @@ void ScreenCenterImage::Input( const InputEventPlus &input ) m_fScale[axis] = fScale; } +static LocalizedString CENTERING( "ScreenCenterImage", "Centering: x %d, y %d, width %d, height %d" ); void ScreenCenterImage::Move( Axis axis, float fDelta ) { Preference *piValues[4] = @@ -176,7 +177,7 @@ void ScreenCenterImage::Move( Axis axis, float fDelta ) PREFSMAN->m_fCenterImageAddHeight ); CString sMessage = - ssprintf( "Centering: x=%d, y=%d, width=%d, height=%d", + ssprintf( CENTERING.GetValue(), PREFSMAN->m_iCenterImageTranslateX.Get(), PREFSMAN->m_iCenterImageTranslateY.Get(), PREFSMAN->m_fCenterImageAddWidth.Get(), diff --git a/stepmania/src/ScreenDebugOverlay.cpp b/stepmania/src/ScreenDebugOverlay.cpp index 05c5343e1c..ddc8ebedec 100644 --- a/stepmania/src/ScreenDebugOverlay.cpp +++ b/stepmania/src/ScreenDebugOverlay.cpp @@ -345,16 +345,49 @@ void ChangeVolume( float fDelta ) // #define DECLARE_ONE( x ) static x g_##x + +static LocalizedString AUTO_PLAY ( "ScreenDebugOverlay", "AutoPlay" ); +static LocalizedString ASSIST_TICK ( "ScreenDebugOverlay", "AssistTick" ); +static LocalizedString AUTOSYNC ( "ScreenDebugOverlay", "Autosync" ); +static LocalizedString COIN_MODE ( "ScreenDebugOverlay", "CoinMode" ); +static LocalizedString HALT ( "ScreenDebugOverlay", "Halt" ); +static LocalizedString LIGHTS_DEBUG ( "ScreenDebugOverlay", "Lights Debug" ); +static LocalizedString MONKEY_INPUT ( "ScreenDebugOverlay", "Monkey Input" ); +static LocalizedString RENDERING_STATS ( "ScreenDebugOverlay", "Rendering Stats" ); +static LocalizedString VSYNC ( "ScreenDebugOverlay", "Vsync" ); +static LocalizedString MULTITEXTURE ( "ScreenDebugOverlay", "Multitexture" ); +static LocalizedString SCREEN_TEST_MODE ( "ScreenDebugOverlay", "Screen Test Mode" ); +static LocalizedString CLEAR_MACHINE_STATS ( "ScreenDebugOverlay", "Clear Machine Stats" ); +static LocalizedString FILL_MACHINE_STATS ( "ScreenDebugOverlay", "Fill Machine Stats" ); +static LocalizedString SEND_NOTES_ENDED ( "ScreenDebugOverlay", "Send Notes Ended" ); +static LocalizedString RELOAD ( "ScreenDebugOverlay", "Reload" ); +static LocalizedString RELOAD_THEME_AND_TEXTURES ( "ScreenDebugOverlay", "Reload Theme and Textures" ); +static LocalizedString WRITE_PROFILES ( "ScreenDebugOverlay", "Write Profiles" ); +static LocalizedString WRITE_PREFERENCES ( "ScreenDebugOverlay", "Write Preferences" ); +static LocalizedString MENU_TIMER ( "ScreenDebugOverlay", "Menu Timer" ); +static LocalizedString FLUSH_LOG ( "ScreenDebugOverlay", "Flush Log" ); +static LocalizedString PULL_BACK_CAMERA ( "ScreenDebugOverlay", "Pull Back Camera" ); +static LocalizedString VOLUME_UP ( "ScreenDebugOverlay", "Volume Up" ); +static LocalizedString VOLUME_DOWN ( "ScreenDebugOverlay", "Volume Down" ); +static LocalizedString UPTIME ( "ScreenDebugOverlay", "Uptime" ); +static LocalizedString SLOW ( "ScreenDebugOverlay", "Slow" ); +static LocalizedString ON ( "ScreenDebugOverlay", "on" ); +static LocalizedString OFF ( "ScreenDebugOverlay", "off" ); +static LocalizedString CPU ( "ScreenDebugOverlay", "CPU" ); +static LocalizedString SONG ( "ScreenDebugOverlay", "Song" ); +static LocalizedString MACHINE ( "ScreenDebugOverlay", "Machine" ); + + class DebugLineAutoplay : public IDebugLine { - virtual CString GetDescription() { return "AutoPlay"; } + virtual CString GetDescription() { return AUTO_PLAY; } virtual CString GetValue() { switch( PREFSMAN->m_AutoPlay ) { - case PC_HUMAN: return "off"; break; - case PC_AUTOPLAY: return "on"; break; - case PC_CPU: return "CPU"; break; + case PC_HUMAN: return OFF; break; + case PC_AUTOPLAY: return ON; break; + case PC_CPU: return CPU; break; default: ASSERT(0); return NULL; } } @@ -374,8 +407,8 @@ class DebugLineAutoplay : public IDebugLine class DebugLineAssistTick : public IDebugLine { - virtual CString GetDescription() { return "AssistTick"; } - virtual CString GetValue() { return IsEnabled() ? "on":"off"; } + virtual CString GetDescription() { return ASSIST_TICK; } + virtual CString GetValue() { return IsEnabled() ? ON:OFF; } virtual bool IsEnabled() { return GAMESTATE->m_SongOptions.m_bAssistTick; } virtual void Do( CString &sMessageOut ) { @@ -389,14 +422,14 @@ class DebugLineAssistTick : public IDebugLine class DebugLineAutosync : public IDebugLine { - virtual CString GetDescription() { return "Autosync"; } + virtual CString GetDescription() { return AUTOSYNC; } virtual CString GetValue() { switch( GAMESTATE->m_SongOptions.m_AutosyncType ) { - case SongOptions::AUTOSYNC_OFF: return "off"; break; - case SongOptions::AUTOSYNC_SONG: return "Song"; break; - case SongOptions::AUTOSYNC_MACHINE: return "Machine"; break; + case SongOptions::AUTOSYNC_OFF: return OFF; break; + case SongOptions::AUTOSYNC_SONG: return SONG; break; + case SongOptions::AUTOSYNC_MACHINE: return MACHINE; break; default: ASSERT(0); } } @@ -413,7 +446,7 @@ class DebugLineAutosync : public IDebugLine class DebugLineCoinMode : public IDebugLine { - virtual CString GetDescription() { return "CoinMode"; } + virtual CString GetDescription() { return COIN_MODE; } virtual CString GetValue() { return CoinModeToString(PREFSMAN->m_CoinMode); } virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) @@ -428,8 +461,8 @@ class DebugLineCoinMode : public IDebugLine class DebugLineSlow : public IDebugLine { - virtual CString GetDescription() { return "Slow"; } - virtual CString GetValue() { return IsEnabled() ? "on":"off"; } + virtual CString GetDescription() { return SLOW; } + virtual CString GetValue() { return IsEnabled() ? ON:OFF; } virtual bool IsEnabled() { return g_bIsSlow; } virtual void Do( CString &sMessageOut ) { @@ -441,8 +474,8 @@ class DebugLineSlow : public IDebugLine class DebugLineHalt : public IDebugLine { - virtual CString GetDescription() { return "Halt"; } - virtual CString GetValue() { return IsEnabled() ? "on":"off"; } + virtual CString GetDescription() { return HALT; } + virtual CString GetValue() { return IsEnabled() ? ON:OFF; } virtual bool IsEnabled() { return g_bIsHalt; } virtual void Do( CString &sMessageOut ) { @@ -455,8 +488,8 @@ class DebugLineHalt : public IDebugLine class DebugLineLightsDebug : public IDebugLine { - virtual CString GetDescription() { return "Lights Debug"; } - virtual CString GetValue() { return IsEnabled() ? "on":"off"; } + virtual CString GetDescription() { return LIGHTS_DEBUG; } + virtual CString GetValue() { return IsEnabled() ? ON:OFF; } virtual bool IsEnabled() { return PREFSMAN->m_bDebugLights.Get(); } virtual void Do( CString &sMessageOut ) { @@ -467,8 +500,8 @@ class DebugLineLightsDebug : public IDebugLine class DebugLineMonkeyInput : public IDebugLine { - virtual CString GetDescription() { return "MonkeyInput"; } - virtual CString GetValue() { return IsEnabled() ? "on":"off"; } + virtual CString GetDescription() { return MONKEY_INPUT; } + virtual CString GetValue() { return IsEnabled() ? ON:OFF; } virtual bool IsEnabled() { return PREFSMAN->m_bMonkeyInput.Get(); } virtual void Do( CString &sMessageOut ) { @@ -479,8 +512,8 @@ class DebugLineMonkeyInput : public IDebugLine class DebugLineStats : public IDebugLine { - virtual CString GetDescription() { return "Rendering Stats"; } - virtual CString GetValue() { return IsEnabled() ? "on":"off"; } + virtual CString GetDescription() { return RENDERING_STATS; } + virtual CString GetValue() { return IsEnabled() ? ON:OFF; } virtual bool IsEnabled() { return PREFSMAN->m_bShowStats.Get(); } virtual void Do( CString &sMessageOut ) { @@ -491,8 +524,8 @@ class DebugLineStats : public IDebugLine class DebugLineVsync : public IDebugLine { - virtual CString GetDescription() { return "Vsync"; } - virtual CString GetValue() { return IsEnabled() ? "on":"off"; } + virtual CString GetDescription() { return VSYNC; } + virtual CString GetValue() { return IsEnabled() ? ON:OFF; } virtual bool IsEnabled() { return PREFSMAN->m_bVsync.Get(); } virtual void Do( CString &sMessageOut ) { @@ -504,8 +537,8 @@ class DebugLineVsync : public IDebugLine class DebugLineAllowMultitexture : public IDebugLine { - virtual CString GetDescription() { return "Multitexture"; } - virtual CString GetValue() { return IsEnabled() ? "on":"off"; } + virtual CString GetDescription() { return MULTITEXTURE; } + virtual CString GetValue() { return IsEnabled() ? ON:OFF; } virtual bool IsEnabled() { return PREFSMAN->m_bAllowMultitexture.Get(); } virtual void Do( CString &sMessageOut ) { @@ -516,8 +549,8 @@ class DebugLineAllowMultitexture : public IDebugLine class DebugLineScreenTestMode : public IDebugLine { - virtual CString GetDescription() { return "Screen Test Mode"; } - virtual CString GetValue() { return IsEnabled() ? "on":"off"; } + virtual CString GetDescription() { return SCREEN_TEST_MODE; } + virtual CString GetValue() { return IsEnabled() ? ON:OFF; } virtual bool IsEnabled() { return PREFSMAN->m_bScreenTestMode.Get(); } virtual void Do( CString &sMessageOut ) { @@ -528,7 +561,7 @@ class DebugLineScreenTestMode : public IDebugLine class DebugLineClearMachineStats : public IDebugLine { - virtual CString GetDescription() { return "Clear Machine Stats"; } + virtual CString GetDescription() { return CLEAR_MACHINE_STATS; } virtual CString GetValue() { return NULL; } virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) @@ -542,7 +575,7 @@ class DebugLineClearMachineStats : public IDebugLine class DebugLineFillMachineStats : public IDebugLine { - virtual CString GetDescription() { return "Fill Machine Stats"; } + virtual CString GetDescription() { return FILL_MACHINE_STATS; } virtual CString GetValue() { return NULL; } virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) @@ -556,7 +589,7 @@ class DebugLineFillMachineStats : public IDebugLine class DebugLineSendNotesEnded : public IDebugLine { - virtual CString GetDescription() { return "Send Notes Ended"; } + virtual CString GetDescription() { return SEND_NOTES_ENDED; } virtual CString GetValue() { return NULL; } virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) @@ -568,7 +601,7 @@ class DebugLineSendNotesEnded : public IDebugLine class DebugLineReloadCurrentScreen : public IDebugLine { - virtual CString GetDescription() { return "Reload"; } + virtual CString GetDescription() { return RELOAD; } virtual CString GetValue() { return SCREENMAN ? SCREENMAN->GetTopScreen()->GetName() : NULL; } virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) @@ -583,7 +616,7 @@ class DebugLineReloadCurrentScreen : public IDebugLine class DebugLineReloadTheme : public IDebugLine { - virtual CString GetDescription() { return "Reload Theme and Textures"; } + virtual CString GetDescription() { return RELOAD_THEME_AND_TEXTURES; } virtual CString GetValue() { return NULL; } virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) @@ -600,7 +633,7 @@ class DebugLineReloadTheme : public IDebugLine class DebugLineWriteProfiles : public IDebugLine { - virtual CString GetDescription() { return "Write Profiles"; } + virtual CString GetDescription() { return WRITE_PROFILES; } virtual CString GetValue() { return NULL; } virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) @@ -639,7 +672,7 @@ class DebugLineWritePreferences : public IDebugLine class DebugLineMenuTimer : public IDebugLine { - virtual CString GetDescription() { return "Menu Timer"; } + virtual CString GetDescription() { return MENU_TIMER; } virtual CString GetValue() { return NULL; } virtual bool IsEnabled() { return PREFSMAN->m_bMenuTimer.Get(); } virtual void Do( CString &sMessageOut ) @@ -651,7 +684,7 @@ class DebugLineMenuTimer : public IDebugLine class DebugLineFlushLog : public IDebugLine { - virtual CString GetDescription() { return "Flush Log"; } + virtual CString GetDescription() { return FLUSH_LOG; } virtual CString GetValue() { return NULL; } virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) @@ -663,7 +696,7 @@ class DebugLineFlushLog : public IDebugLine class DebugLinePullBackCamera : public IDebugLine { - virtual CString GetDescription() { return "Pull Back Camera"; } + virtual CString GetDescription() { return PULL_BACK_CAMERA; } virtual CString GetValue() { return NULL; } virtual bool IsEnabled() { return g_fImageScaleDestination != 1; } virtual void Do( CString &sMessageOut ) @@ -678,7 +711,7 @@ class DebugLinePullBackCamera : public IDebugLine class DebugLineVolumeUp : public IDebugLine { - virtual CString GetDescription() { return "Volume Up"; } + virtual CString GetDescription() { return VOLUME_UP; } virtual CString GetValue() { return ssprintf("%.0f%%",PREFSMAN->m_fSoundVolume.Get()*100); } virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) @@ -690,7 +723,7 @@ class DebugLineVolumeUp : public IDebugLine class DebugLineVolumeDown : public IDebugLine { - virtual CString GetDescription() { return "Volume Down"; } + virtual CString GetDescription() { return VOLUME_DOWN; } virtual CString GetValue() { return NULL; } virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) @@ -702,7 +735,7 @@ class DebugLineVolumeDown : public IDebugLine class DebugLineUptime : public IDebugLine { - virtual CString GetDescription() { return "Uptime"; } + virtual CString GetDescription() { return UPTIME; } virtual CString GetValue() { return SecondsToMMSSMsMsMs(RageTimer::GetTimeSinceStart()); } virtual bool IsEnabled() { return false; } virtual void Do( CString &sMessageOut ) {} diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index aa1928e9b4..b7fc9121e1 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -1086,6 +1086,8 @@ static void ShiftToRightSide( int &iCol, int iNumTracks ) } } +static LocalizedString SWITCHED_TO ( "ScreenEdit", "Switched to" ); +static LocalizedString NO_BACKGROUNDS_AVAILABLE ( "ScreenEdit", "No backgrounds available" ); void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB ) { if( input.type == IET_LEVEL_CHANGED ) @@ -1372,7 +1374,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB ) m_pSteps = pSteps; pSteps->GetNoteData( m_NoteDataEdit ); CString s = ssprintf( - "Switched to %s %s '%s' (%d of %d)", + SWITCHED_TO.GetValue() + " %s %s '%s' (%d of %d)", GAMEMAN->StepsTypeToString( pSteps->m_StepsType ).c_str(), DifficultyToString( pSteps->GetDifficulty() ).c_str(), pSteps->GetDescription().c_str(), @@ -1670,7 +1672,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB ) if( sName.empty() ) { SCREENMAN->PlayInvalidSound(); - SCREENMAN->SystemMessage( "No backgrounds available" ); + SCREENMAN->SystemMessage( NO_BACKGROUNDS_AVAILABLE ); } else { @@ -2479,6 +2481,8 @@ static void ChangeArtistTranslit( const CString &sNew ) // End helper functions +static LocalizedString SAVED_AS_SM_AND_DWI ( "ScreenEdit", "Saved as SM and DWI." ); +static LocalizedString SAVED_AS_SM ( "ScreenEdit", "Saved as SM." ); void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAnswers ) { switch( c ) @@ -2591,9 +2595,9 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAns // dance, it just looks tacky and people may be wondering where the // DWI file is :-) if ((int)pSteps->m_StepsType <= (int)STEPS_TYPE_DANCE_SOLO) - SCREENMAN->SystemMessage( "Saved as SM and DWI." ); + SCREENMAN->SystemMessage( SAVED_AS_SM_AND_DWI ); else - SCREENMAN->SystemMessage( "Saved as SM." ); + SCREENMAN->SystemMessage( SAVED_AS_SM ); HandleScreenMessage( SM_Success ); } @@ -3216,6 +3220,8 @@ void ScreenEdit::SaveUndo() m_Undo.CopyAll( m_NoteDataEdit ); } +static LocalizedString UNDO ("ScreenEdit", "Undo"); +static LocalizedString CANT_UNDO ("ScreenEdit", "Can't undo - no undo data."); void ScreenEdit::Undo() { if( m_bHasUndo ) @@ -3225,11 +3231,11 @@ void ScreenEdit::Undo() m_NoteDataEdit.CopyAll( m_Undo ); m_Undo.CopyAll( temp ); - SCREENMAN->SystemMessage( "Undo" ); + SCREENMAN->SystemMessage( UNDO ); } else { - SCREENMAN->SystemMessage( "Can't undo - no undo data." ); + SCREENMAN->SystemMessage( CANT_UNDO ); SCREENMAN->PlayInvalidSound(); } } diff --git a/stepmania/src/ScreenNameEntryTraditional.cpp b/stepmania/src/ScreenNameEntryTraditional.cpp index 0bd603ce66..9dca33302a 100644 --- a/stepmania/src/ScreenNameEntryTraditional.cpp +++ b/stepmania/src/ScreenNameEntryTraditional.cpp @@ -233,7 +233,7 @@ void ScreenNameEntryTraditional::Init() /* Add letters to m_Keyboard. */ const CString fontpath = THEME->GetPathF(m_sName,"letters"); - const wstring Chars = CStringToWstring(KEYBOARD_LETTERS); + const wstring Chars = RStringToWstring(KEYBOARD_LETTERS); for( unsigned ch = 0; ch < Chars.size(); ++ch ) { BitmapText *Letter = new BitmapText; @@ -293,7 +293,7 @@ void ScreenNameEntryTraditional::Init() const Profile* pProfile = PROFILEMAN->GetProfile(p); if( pProfile && !pProfile->m_sLastUsedHighScoreName.empty() ) { - m_sSelection[p] = CStringToWstring( pProfile->m_sLastUsedHighScoreName ); + m_sSelection[p] = RStringToWstring( pProfile->m_sLastUsedHighScoreName ); if( (int) m_sSelection[p].size() > MAX_RANKING_NAME_LENGTH ) m_sSelection[p].erase( MAX_RANKING_NAME_LENGTH ); ASSERT( (int) m_sSelection[p].size() <= MAX_RANKING_NAME_LENGTH ); @@ -578,7 +578,7 @@ void ScreenNameEntryTraditional::Finish( PlayerNumber pn ) UpdateSelectionText( pn ); /* hide NAME_ cursor */ - CString selection = WStringToCString( m_sSelection[pn] ); + CString selection = WStringToRString( m_sSelection[pn] ); // save last used ranking name Profile* pProfile = PROFILEMAN->GetProfile(pn); @@ -604,7 +604,7 @@ void ScreenNameEntryTraditional::UpdateSelectionText( int pn ) if( m_bStillEnteringName[pn] && (int) text.size() < MAX_RANKING_NAME_LENGTH ) text += L"_"; - m_textSelection[pn].SetText( WStringToCString(text) ); + m_textSelection[pn].SetText( WStringToRString(text) ); } void ScreenNameEntryTraditional::MenuStart( const InputEventPlus &input ) diff --git a/stepmania/src/ScreenNetworkOptions.cpp b/stepmania/src/ScreenNetworkOptions.cpp index c5bad9accd..725921f86a 100644 --- a/stepmania/src/ScreenNetworkOptions.cpp +++ b/stepmania/src/ScreenNetworkOptions.cpp @@ -91,7 +91,8 @@ void ScreenNetworkOptions::Init() m_pRows[PO_SCOREBOARD]->SetOneSharedSelection(PREFSMAN->m_bEnableScoreboard); } - +static LocalizedString SERVER_STARTED ( "ScreenNetworkOptions", "Server started." ); +static LocalizedString SERVER_FAILED ( "ScreenNetworkOptions", "Server failed: %s Code:%d" ); void ScreenNetworkOptions::HandleScreenMessage( const ScreenMessage SM ) { if( SM == SM_DoneConnecting ) @@ -115,17 +116,20 @@ void ScreenNetworkOptions::HandleScreenMessage( const ScreenMessage SM ) if (NSMAN->LANserver->ServerStart()) { NSMAN->isLanServer = true; - SCREENMAN->SystemMessage( "Server Started." ); + SCREENMAN->SystemMessage( SERVER_STARTED ); } else - SCREENMAN->SystemMessage( "Server failed: " + NSMAN->LANserver->lastError + ssprintf(" Code:%d",NSMAN->LANserver->lastErrorCode) ); + { + SCREENMAN->SystemMessage( ssprintf(SERVER_FAILED.GetValue(),NSMAN->LANserver->lastError.c_str(),NSMAN->LANserver->lastErrorCode) ); + } } } ScreenOptions::HandleScreenMessage( SM ); } - +static LocalizedString DISCONNECTED ( "ScreenNetworkOptions", "Disconnected from server." ); +static LocalizedString SERVER_STOPPED ( "ScreenNetworkOptions", "Server stopped." ); void ScreenNetworkOptions::MenuStart( const InputEventPlus &input ) { #if defined( WITHOUT_NETWORKING ) @@ -140,7 +144,7 @@ void ScreenNetworkOptions::MenuStart( const InputEventPlus &input ) else { NSMAN->CloseConnection(); - SCREENMAN->SystemMessage("Disconnected from server."); + SCREENMAN->SystemMessage( DISCONNECTED ); UpdateConnectStatus( ); } break; @@ -156,7 +160,7 @@ void ScreenNetworkOptions::MenuStart( const InputEventPlus &input ) case NO_STOP_SERVER: if ( NSMAN->LANserver != NULL ) NSMAN->LANserver->ServerStop(); - SCREENMAN->SystemMessage( "Server Stopped." ); + SCREENMAN->SystemMessage( SERVER_STOPPED ); NSMAN->isLanServer = false; break; } diff --git a/stepmania/src/ScreenPackages.cpp b/stepmania/src/ScreenPackages.cpp index 8accf381cd..0277e4630b 100644 --- a/stepmania/src/ScreenPackages.cpp +++ b/stepmania/src/ScreenPackages.cpp @@ -253,11 +253,12 @@ void ScreenPackages::MenuRight( const InputEventPlus &input ) ScreenWithMenuElements::MenuRight( input ); } +static LocalizedString DOWNLOAD_CANCELLED( "ScreenPackages", "Download cancelled." ); void ScreenPackages::MenuBack( PlayerNumber pn ) { if ( m_bIsDownloading ) { - SCREENMAN->SystemMessage( "Download Cancelled." ); + SCREENMAN->SystemMessage( DOWNLOAD_CANCELLED ); CancelDownload( ); return; } diff --git a/stepmania/src/ScreenSMOnlineLogin.cpp b/stepmania/src/ScreenSMOnlineLogin.cpp index 67ad0b2314..473dd3bcf3 100644 --- a/stepmania/src/ScreenSMOnlineLogin.cpp +++ b/stepmania/src/ScreenSMOnlineLogin.cpp @@ -28,6 +28,7 @@ ScreenSMOnlineLogin::ScreenSMOnlineLogin(CString sClassName) : ScreenOptions(sCl LOG->Trace( "ScreenSMOnlineLogin::ScreenSMOnlineLogin()" ); } +static LocalizedString DEFINE_A_PROFILE( "ScreenSMOnlineLogin", "You must define a Profile." ); void ScreenSMOnlineLogin::Init() { ScreenOptions::Init(); @@ -37,7 +38,7 @@ void ScreenSMOnlineLogin::Init() if( g_ProfileLine[0].m_vsChoices.empty() ) { - SCREENMAN->SystemMessage("You Must Define A Profile!"); + SCREENMAN->SystemMessage( DEFINE_A_PROFILE ); SCREENMAN->SetNewScreen("ScreenProfileOptions"); } else @@ -92,6 +93,7 @@ void ScreenSMOnlineLogin::ExportOptions( int iRow, const vector &v } } +static LocalizedString UNIQUE_PROFILE( "ScreenSMOnlineLogin", "Each player needs a unique Profile." ); void ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM) { if( SM == SM_PasswordDone ) @@ -141,7 +143,7 @@ void ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM) if(GAMESTATE->IsPlayerEnabled((PlayerNumber) 0) && GAMESTATE->IsPlayerEnabled((PlayerNumber) 1) && (GAMESTATE->GetPlayerDisplayName((PlayerNumber) 0) == GAMESTATE->GetPlayerDisplayName((PlayerNumber) 1))) { - SCREENMAN->SystemMessage("Each Player Needs A Unique Profile!"); + SCREENMAN->SystemMessage( UNIQUE_PROFILE ); SCREENMAN->SetNewScreen("ScreenSMOnlineLogin"); } else diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index f1fa3d42c4..69ad43e0aa 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -229,6 +229,7 @@ int ScreenSelectStyle::GetSelectionIndex( PlayerNumber pn ) return m_iSelection; } +static LocalizedString NO_STYLES_ARE_SELECTABLE( "ScreenSMOnlineLogin", "No Styles are selectable." ); void ScreenSelectStyle::UpdateSelectableChoices() { for( unsigned i=0; iSystemMessage( "No Styles are selectable." ); + SCREENMAN->SystemMessage( NO_STYLES_ARE_SELECTABLE ); this->PostScreenMessage( SM_GoToPrevScreen, 0 ); return; } diff --git a/stepmania/src/ScreenSyncOverlay.cpp b/stepmania/src/ScreenSyncOverlay.cpp index 95f91c524d..7357a14749 100644 --- a/stepmania/src/ScreenSyncOverlay.cpp +++ b/stepmania/src/ScreenSyncOverlay.cpp @@ -155,6 +155,8 @@ void ScreenSyncOverlay::UpdateText() m_textStatus.SetText( s ); } +static LocalizedString CANT_SYNC_WHILE_PLAYING_A_COURSE ("ScreenSyncOverlay","Can't sync while playing a course."); +static LocalizedString SYNC_CHANGES_REVERTED ("ScreenSyncOverlay","Sync changes reverted."); bool ScreenSyncOverlay::OverlayInput( const InputEventPlus &input ) { if( !IsGameplay() ) @@ -172,7 +174,7 @@ bool ScreenSyncOverlay::OverlayInput( const InputEventPlus &input ) case KEY_F12: if( GAMESTATE->IsCourseMode() ) { - SCREENMAN->SystemMessage( "Can't sync while playing a course." ); + SCREENMAN->SystemMessage( CANT_SYNC_WHILE_PLAYING_A_COURSE ); return true; } break; @@ -183,7 +185,7 @@ bool ScreenSyncOverlay::OverlayInput( const InputEventPlus &input ) switch( input.DeviceI.button ) { case KEY_F4: - SCREENMAN->SystemMessage( "Sync changes reverted." ); + SCREENMAN->SystemMessage( SYNC_CHANGES_REVERTED ); GAMESTATE->RevertSyncChanges(); break; case KEY_F9: diff --git a/stepmania/src/ScreenTextEntry.cpp b/stepmania/src/ScreenTextEntry.cpp index 3ced0208af..e8049fa71f 100644 --- a/stepmania/src/ScreenTextEntry.cpp +++ b/stepmania/src/ScreenTextEntry.cpp @@ -133,7 +133,7 @@ ScreenTextEntry::~ScreenTextEntry() void ScreenTextEntry::BeginScreen() { - m_sAnswer = CStringToWstring( g_sInitialAnswer ); + m_sAnswer = RStringToWstring( g_sInitialAnswer ); ScreenWithMenuElements::BeginScreen(); @@ -181,7 +181,7 @@ void ScreenTextEntry::UpdateKeyboardText() void ScreenTextEntry::UpdateAnswerText() { - CString s = WStringToCString(m_sAnswer); + CString s = WStringToRString(m_sAnswer); if( g_bPassword ) { int len = s.GetLength(); @@ -335,7 +335,7 @@ void ScreenTextEntry::MoveY( int iDir ) void ScreenTextEntry::AppendToAnswer( CString s ) { - wstring sNewAnswer = m_sAnswer+CStringToWstring(s); + wstring sNewAnswer = m_sAnswer+RStringToWstring(s); if( (int)sNewAnswer.length() > g_iMaxInputLength ) { SCREENMAN->PlayInvalidSound(); @@ -400,7 +400,7 @@ void ScreenTextEntry::End( bool bCancelled ) } else { - CString sAnswer = WStringToCString(m_sAnswer); + CString sAnswer = WStringToRString(m_sAnswer); CString sError; if ( g_pValidate != NULL ) { @@ -414,7 +414,7 @@ void ScreenTextEntry::End( bool bCancelled ) if( g_pOnOK ) { - CString ret = WStringToCString(m_sAnswer); + CString ret = WStringToRString(m_sAnswer); FontCharAliases::ReplaceMarkers(ret); g_pOnOK( ret ); } @@ -429,7 +429,7 @@ void ScreenTextEntry::End( bool bCancelled ) OFF_COMMAND( m_sprCursor ); s_bCancelledLast = bCancelled; - s_sLastAnswer = bCancelled ? CString("") : WStringToCString(m_sAnswer); + s_sLastAnswer = bCancelled ? CString("") : WStringToRString(m_sAnswer); } void ScreenTextEntry::MenuBack( PlayerNumber pn ) diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 00d577c7a2..fd40a5854c 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -59,6 +59,8 @@ ScreenTitleMenu::~ScreenTitleMenu() CHARMAN->UndemandGraphics(); } +static LocalizedString THEME_ ("ScreenTitleMenu","Theme"); +static LocalizedString ANNOUNCER_ ("ScreenTitleMenu","Announcer"); void ScreenTitleMenu::Input( const InputEventPlus &input ) { LOG->Trace( "ScreenTitleMenu::Input( %d-%d )", input.DeviceI.device, input.DeviceI.button ); // debugging gameport joystick problem @@ -76,7 +78,7 @@ void ScreenTitleMenu::Input( const InputEventPlus &input ) { THEME->NextTheme(); StepMania::ApplyGraphicOptions(); // update window title and icon - SCREENMAN->SystemMessage( "Theme: "+THEME->GetCurThemeName() ); + SCREENMAN->SystemMessage( THEME_.GetValue()+": "+THEME->GetCurThemeName() ); SCREENMAN->SetNewScreen( m_sName ); TEXTUREMAN->DoDelayedDelete(); } @@ -86,7 +88,7 @@ void ScreenTitleMenu::Input( const InputEventPlus &input ) ANNOUNCER->NextAnnouncer(); CString sName = ANNOUNCER->GetCurAnnouncerName(); if( sName=="" ) sName = "(none)"; - SCREENMAN->SystemMessage( "Announcer: "+sName ); + SCREENMAN->SystemMessage( ANNOUNCER_.GetValue()+": "+sName ); SCREENMAN->SetNewScreen( m_sName ); } } diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index e996fe1556..ac9aa1cd98 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -103,7 +103,7 @@ void SongManager::InitSongsFromDisk( LoadingWindow *ld ) } -static ThemeMetric 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'." ); +static LocalizedString 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 { @@ -161,7 +161,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir, LoadingWindow *ld ) // Find all group directories in "Songs" folder vector arrayGroupDirs; GetDirListing( sDir+"*", arrayGroupDirs, true ); - SortCStringArray( arrayGroupDirs ); + SortRStringArray( arrayGroupDirs ); StripCvs( arrayGroupDirs ); FOREACH_CONST( CString, arrayGroupDirs, s ) // foreach dir in /Songs/ @@ -174,7 +174,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir, LoadingWindow *ld ) vector arraySongDirs; GetDirListing( sDir+sGroupDirName + "/*", arraySongDirs, true, true ); StripCvs( arraySongDirs ); - SortCStringArray( arraySongDirs ); + SortRStringArray( arraySongDirs ); LOG->Trace("Attempting to load %i songs from \"%s\"", int(arraySongDirs.size()), (sDir+sGroupDirName).c_str() ); @@ -227,7 +227,7 @@ void SongManager::LoadGroupSymLinks(CString sDir, CString sGroupFolder) // Find all symlink files in this folder vector arraySymLinks; GetDirListing( sDir+sGroupFolder+"/*.include", arraySymLinks, false ); - SortCStringArray( arraySymLinks ); + SortRStringArray( arraySymLinks ); for( unsigned s=0; s< arraySymLinks.size(); s++ ) // for each symlink in this dir, add it in as a song. { MsdFile msdF; @@ -524,14 +524,14 @@ void SongManager::InitCoursesFromDisk( LoadingWindow *ld ) vector vsCourseGroupNames; GetDirListing( COURSES_DIR+"*", vsCourseGroupNames, true ); StripCvs( vsCourseGroupNames ); - SortCStringArray( vsCourseGroupNames ); + SortRStringArray( vsCourseGroupNames ); FOREACH( CString, vsCourseGroupNames, sCourseGroup ) // for each dir in /Courses/ { // Find all CRS files in this group directory vector vsCoursePaths; GetDirListing( COURSES_DIR + *sCourseGroup + "/*.crs", vsCoursePaths, false, true ); - SortCStringArray( vsCoursePaths ); + SortRStringArray( vsCoursePaths ); FOREACH_CONST( CString, vsCoursePaths, sCoursePath ) { diff --git a/stepmania/src/SongUtil.cpp b/stepmania/src/SongUtil.cpp index 3bde53562d..19cbbc6225 100644 --- a/stepmania/src/SongUtil.cpp +++ b/stepmania/src/SongUtil.cpp @@ -90,7 +90,7 @@ static bool CompareSongPointersByBPM( const Song *pSong1, const Song *pSong2 ) if( bpms1.GetMax() > bpms2.GetMax() ) return false; - return CompareCStringsAsc( pSong1->GetSongFilePath(), pSong2->GetSongFilePath() ); + return CompareRStringsAsc( pSong1->GetSongFilePath(), pSong2->GetSongFilePath() ); } void SongUtil::SortSongPointerArrayByBPM( vector &vpSongsInOut ) diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 11b4b8e0c3..1db9ea8bfa 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -106,6 +106,16 @@ void StepMania::GetPreferredVideoModeParams( VideoModeParams ¶msOut ) ); } +static LocalizedString COLOR ("StepMania","color"); +static LocalizedString TEXTURE ("StepMania","texture"); +static LocalizedString WINDOWED ("StepMania","Windowed"); +static LocalizedString FULLSCREEN ("StepMania","Fullscreen"); +static LocalizedString ANNOUNCER_ ("StepMania","Announcer"); +static LocalizedString VSYNC ("StepMania","Vsync"); +static LocalizedString NO_VSYNC ("StepMania","NoVsync"); +static LocalizedString SMOOTH_LINES ("StepMania","SmoothLines"); +static LocalizedString NO_SMOOTH_LINES ("StepMania","NoSmoothLines"); + static void StoreActualGraphicOptions( bool initial ) { // find out what we actually have @@ -116,16 +126,17 @@ static void StoreActualGraphicOptions( bool initial ) PREFSMAN->m_iRefreshRate .Set( DISPLAY->GetActualVideoModeParams().rate ); PREFSMAN->m_bVsync .Set( DISPLAY->GetActualVideoModeParams().vsync ); - CString log = ssprintf("%s %s %dx%d %d color %d texture %dHz %s %s", + CString sFormat = "%s %s %dx%d %d "+COLOR.GetValue()+" %d "+TEXTURE.GetValue()+" %dHz %s %s"; + CString log = ssprintf( sFormat, DISPLAY->GetApiDescription().c_str(), - PREFSMAN->m_bWindowed ? "Windowed" : "Fullscreen", + (PREFSMAN->m_bWindowed ? WINDOWED : FULLSCREEN).GetValue().c_str(), (int)PREFSMAN->m_iDisplayWidth, (int)PREFSMAN->m_iDisplayHeight, (int)PREFSMAN->m_iDisplayColorDepth, (int)PREFSMAN->m_iTextureColorDepth, (int)PREFSMAN->m_iRefreshRate, - PREFSMAN->m_bVsync ? "Vsync" : "NoVsync", - PREFSMAN->m_bSmoothLines? "AA" : "NoAA" ); + (PREFSMAN->m_bVsync ? VSYNC : NO_VSYNC).GetValue().c_str(), + (PREFSMAN->m_bSmoothLines? SMOOTH_LINES : NO_SMOOTH_LINES).GetValue().c_str() ); if( initial ) LOG->Info( "%s", log.c_str() ); else @@ -664,12 +675,12 @@ found_defaults: LOG->Info( "Video renderers: '%s'", PREFSMAN->m_sVideoRenderers.Get().c_str() ); } -static ThemeMetric ERROR_INITIALIZING_CARD ( "StepMania", "There was an error while initializing your video card." ); -static ThemeMetric 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 ERROR_VIDEO_DRIVER ( "StepMania", "Video Driver: %s" ); -static ThemeMetric ERROR_NO_VIDEO_RENDERERS ( "StepMania", "No video renderers attempted." ); -static ThemeMetric ERROR_INITIALIZING ( "StepMania", "Initializing %s..." ); -static ThemeMetric ERROR_UNKNOWN_VIDEO_RENDERER ( "StepMania", "Unknown video renderer value: %s" ); +static LocalizedString ERROR_INITIALIZING_CARD ( "StepMania", "There was an error while initializing your video card." ); +static LocalizedString ERROR_DONT_FILE_BUG ( "StepMania", "Please do not file this error as a bug! Use the web page below to troubleshoot this problem." ); +static LocalizedString ERROR_VIDEO_DRIVER ( "StepMania", "Video Driver: %s" ); +static LocalizedString ERROR_NO_VIDEO_RENDERERS ( "StepMania", "No video renderers attempted." ); +static LocalizedString ERROR_INITIALIZING ( "StepMania", "Initializing %s..." ); +static LocalizedString ERROR_UNKNOWN_VIDEO_RENDERER ( "StepMania", "Unknown video renderer value: %s" ); RageDisplay *CreateDisplay() { @@ -904,8 +915,14 @@ static void ApplyLogPreferences() Checkpoints::LogCheckpoints( PREFSMAN->m_bLogCheckpoints ); } -static ThemeMetric COULDNT_OPEN_LOADING_WINDOW( "StepMania", "Couldn't open any loading windows." ); +static CString LocalizeString( const CString &sSection, const CString &s ) +{ + CString sOut; + THEME->GetMetric( sSection, s, sOut ); + return sOut; +} +static LocalizedString COULDNT_OPEN_LOADING_WINDOW( "StepMania", "Couldn't open any loading windows." ); #ifdef _XBOX void __cdecl main() @@ -1045,6 +1062,10 @@ int main(int argc, char* argv[]) delete pIcon; } + RegisterLocalizer( LocalizeString ); + RefreshLocalizedStrings(); + + if( PREFSMAN->m_iSoundWriteAhead ) LOG->Info( "Sound writeahead has been overridden to %i", PREFSMAN->m_iSoundWriteAhead.Get() ); SOUNDMAN = new RageSoundManager; @@ -1253,6 +1274,7 @@ void StepMania::InsertCredit() /* Returns true if the key has been handled and should be discarded, false if * the key should be sent on to screens. */ +static LocalizedString SERVICE_SWITCH_PRESED ( "StepMania", "Service switch pressed" ); bool HandleGlobalInputs( const InputEventPlus &input ) { /* None of the globals keys act on types other than FIRST_PRESS */ @@ -1268,7 +1290,7 @@ bool HandleGlobalInputs( const InputEventPlus &input ) * (to prevent quitting without storing changes). */ if( SCREENMAN->GetTopScreen()->GetScreenType() != system_menu ) { - SCREENMAN->SystemMessage( "Service switch pressed" ); + SCREENMAN->SystemMessage( SERVICE_SWITCH_PRESED ); GAMESTATE->Reset(); SCREENMAN->PopAllScreens(); SCREENMAN->SetNewScreen( "ScreenOptionsService" ); diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index d8f331bfed..f8f870e959 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -676,13 +676,14 @@ bool ThemeManager::HasMetric( const CString &sClassName, const CString &sValueNa return GetMetricRawRecursive( sClassName, sValueName, sThrowAway ); } +static LocalizedString RELOADED_METRICS( "ThemeManager", "Reloaded metrics" ); void ThemeManager::ReloadMetrics() { // force a reload of the metrics cache LoadThemeMetrics( g_vThemes, m_sCurThemeName, m_sCurLanguage ); if( SCREENMAN ) - SCREENMAN->SystemMessage( "Reloaded metrics" ); + SCREENMAN->SystemMessage( RELOADED_METRICS ); // // clear theme path cache diff --git a/stepmania/src/arch/ArchHooks/ArchHooks_Unix.cpp b/stepmania/src/arch/ArchHooks/ArchHooks_Unix.cpp index 1a757b1d12..5699cb7ab8 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks_Unix.cpp +++ b/stepmania/src/arch/ArchHooks/ArchHooks_Unix.cpp @@ -218,7 +218,7 @@ void ArchHooks_Unix::SetTime( tm newtime ) #include "RageFileManager.h" #include -static ThemeMetric COULDNT_FIND_SONGS( "ArchHooks_Unix", "Couldn't find 'Songs'" ); +static LocalizedString COULDNT_FIND_SONGS( "ArchHooks_Unix", "Couldn't find 'Songs'" ); void ArchHooks_Unix::MountInitialFilesystems( const CString &sDirOfExecutable ) { #if defined(LINUX) diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp index d2b4f9857c..f107cb8cef 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp @@ -19,7 +19,7 @@ #include #endif -static ThemeMetric FAILED_CONNECTION_XSERVER( "LowLevelWindow_X11", "Failed to establish a connection with the X server'" ); +static LocalizedString FAILED_CONNECTION_XSERVER( "LowLevelWindow_X11", "Failed to establish a connection with the X server'" ); LowLevelWindow_X11::LowLevelWindow_X11() { m_bWindowIsOpen = false; diff --git a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Windows.cpp b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Windows.cpp index d9d5e986ec..697fff559d 100644 --- a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Windows.cpp +++ b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Windows.cpp @@ -77,7 +77,7 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( vectorInfo( " %s: %ls (%ls)", @@ -311,7 +311,7 @@ CString MovieTexture_DShow::GetActiveFilterList() if( ret != "" ) ret += ", "; - ret += WStringToCString(FilterInfo.achName); + ret += WStringToRString(FilterInfo.achName); if( FilterInfo.pGraph ) FilterInfo.pGraph->Release(); @@ -347,7 +347,7 @@ CString MovieTexture_DShow::Create() // Add the source filter CComPtr pFSrc; // Source Filter - wstring wFileName = CStringToWstring(actualID.filename); + wstring wFileName = RStringToWstring(actualID.filename); // if this fails, it's probably because the user doesn't have DivX installed /* No, it also happens if the movie can't be opened for some reason; for example, diff --git a/stepmania/src/arch/arch.cpp b/stepmania/src/arch/arch.cpp index 18f8d12aa7..96dacc80ec 100644 --- a/stepmania/src/arch/arch.cpp +++ b/stepmania/src/arch/arch.cpp @@ -9,10 +9,9 @@ #include "arch.h" #include "arch_platform.h" #include "Foreach.h" -#include "ThemeMetric.h" #include "InputHandler/Selector_InputHandler.h" -static ThemeMetric INPUT_HANDLERS_EMPTY( "Arch", "Input Handlers cannot be empty." ); +static LocalizedString INPUT_HANDLERS_EMPTY( "Arch", "Input Handlers cannot be empty." ); void MakeInputHandlers(CString drivers, vector &Add) { vector DriversToTry; @@ -179,8 +178,8 @@ MemoryCardDriver *MakeMemoryCardDriver() #include "MovieTexture/Selector_MovieTexture.h" static void DumpAVIDebugInfo( const CString& fn ); /* Try drivers in order of preference until we find one that works. */ -static ThemeMetric MOVIE_DRIVERS_EMPTY ( "Arch", "Movie Drivers cannot be empty." ); -static ThemeMetric COULDNT_CREATE_MOVIE_DRIVER( "Arch", "Couldn't create a movie driver." ); +static LocalizedString MOVIE_DRIVERS_EMPTY ( "Arch", "Movie Drivers cannot be empty." ); +static LocalizedString COULDNT_CREATE_MOVIE_DRIVER ( "Arch", "Couldn't create a movie driver." ); RageMovieTexture *MakeRageMovieTexture( RageTextureID ID ) { DumpAVIDebugInfo( ID.filename ); @@ -232,7 +231,7 @@ RageMovieTexture *MakeRageMovieTexture( RageTextureID ID ) } #include "Sound/Selector_RageSoundDriver.h" -static ThemeMetric SOUND_DRIVERS_CANNOT_EMPTY( "Arch", "Sound Drivers cannot be empty." ); +static LocalizedString SOUND_DRIVERS_CANNOT_EMPTY( "Arch", "Sound Drivers cannot be empty." ); RageSoundDriver *MakeRageSoundDriver(CString drivers) { vector DriversToTry; diff --git a/stepmania/src/archutils/Win32/GraphicsWindow.cpp b/stepmania/src/archutils/Win32/GraphicsWindow.cpp index a821d7502e..c9733a4e26 100644 --- a/stepmania/src/archutils/Win32/GraphicsWindow.cpp +++ b/stepmania/src/archutils/Win32/GraphicsWindow.cpp @@ -275,7 +275,7 @@ void GraphicsWindow::ConfigureGraphicsWindow( const VideoModeParams &p ) { if( m_bWideWindowClass ) { - if( SetWindowTextW( g_hWndMain, CStringToWstring(p.sWindowTitle).c_str() ) ) + if( SetWindowTextW( g_hWndMain, RStringToWstring(p.sWindowTitle).c_str() ) ) break; } @@ -373,7 +373,7 @@ void GraphicsWindow::Initialize( bool bD3D ) AppInstance inst; do { - const wstring wsClassName = CStringToWstring( g_sClassName ); + const wstring wsClassName = RStringToWstring( g_sClassName ); WNDCLASSW WindowClassW = { CS_OWNDC | CS_BYTEALIGNCLIENT, diff --git a/stepmania/src/smlobby/RageUtil.cpp b/stepmania/src/smlobby/RageUtil.cpp index 7ae2be31a0..8178b19608 100644 --- a/stepmania/src/smlobby/RageUtil.cpp +++ b/stepmania/src/smlobby/RageUtil.cpp @@ -640,7 +640,7 @@ int CompareCStringsDesc(const void* str1, const void* str2) return int(s1->CompareNoCase( LPCTSTR(s2) ) > 0); } -void SortCStringArray( CStringArray &arrayCStrings, const bool bSortAscending ) +void SortRStringArray( CStringArray &arrayCStrings, const bool bSortAscending ) { /*sort( arrayCStrings.begin(), arrayCStrings.end(), bSortAscending?CompareCStringsAsc:CompareCStringsDesc);*/ diff --git a/stepmania/src/smlobby/RageUtil.h b/stepmania/src/smlobby/RageUtil.h index 697e277e41..41b39c7b64 100644 --- a/stepmania/src/smlobby/RageUtil.h +++ b/stepmania/src/smlobby/RageUtil.h @@ -179,7 +179,7 @@ DWORD GetFileSizeInBytes( const CString &sFilePath ); int CompareCStringsAsc(const void* str1, const void* str2); int CompareCStringsDesc(const void* str1, const void* str2); -void SortCStringArray( CStringArray &AddTo, const bool bSortAcsending = true ); +void SortRStringArray( CStringArray &AddTo, const bool bSortAcsending = true ); LONG GetRegKey(HKEY key, const char *subkey, LPTSTR retdata); diff --git a/stepmania/src/smlobby/smlobbyDlg.cpp b/stepmania/src/smlobby/smlobbyDlg.cpp index 46c6f46f59..bc898188ec 100644 --- a/stepmania/src/smlobby/smlobbyDlg.cpp +++ b/stepmania/src/smlobby/smlobbyDlg.cpp @@ -213,7 +213,7 @@ BOOL CSmlobbyDlg::OnInitDialog() // Find all group directories in "Songs" folder CStringArray arrayGroupDirs; GetDirListing( sDir+"\\*.*", arrayGroupDirs, true ); - SortCStringArray( arrayGroupDirs ); + SortRStringArray( arrayGroupDirs ); //FILE *fp = fopen("SongHashes.txt","wt"); //int k=1000; @@ -227,7 +227,7 @@ BOOL CSmlobbyDlg::OnInitDialog() // Find all Song folders in this group directory CStringArray arraySongDirs; GetDirListing( ssprintf("%s\\%s\\*.*", sDir, sGroupDirName), arraySongDirs, true ); - SortCStringArray( arraySongDirs ); + SortRStringArray( arraySongDirs ); for( unsigned j=0; j< arraySongDirs.GetSize(); j++ ) // for each song dir {