diff --git a/stepmania/src/BannerCache.cpp b/stepmania/src/BannerCache.cpp index 382fff0d9f..754ce61f7a 100644 --- a/stepmania/src/BannerCache.cpp +++ b/stepmania/src/BannerCache.cpp @@ -297,7 +297,7 @@ RageTextureID BannerCache::LoadCachedBanner( RString BannerPath ) BannerData.GetValue( BannerPath, "Rotated", WasRotatedBanner ); if(src_width == 0 || src_height == 0) { - LOG->UserLog( "Couldn't load '%s'", BannerPath.c_str() ); + LOG->UserLog( RageLog::LogType_CacheFile, BannerPath, "couldn't be loaded." ); return ID; } @@ -377,7 +377,7 @@ void BannerCache::CacheBannerInternal( RString BannerPath ) RageSurface *img = RageSurfaceUtils::LoadFile( BannerPath, error ); if( img == NULL ) { - LOG->UserLog( "BannerCache::CacheBanner: Couldn't load %s: %s", BannerPath.c_str(), error.c_str() ); + LOG->UserLog( RageLog::LogType_CacheFile, BannerPath, "couldn't be loaded: %s", error.c_str() ); return; } diff --git a/stepmania/src/CourseLoaderCRS.cpp b/stepmania/src/CourseLoaderCRS.cpp index a73ee68ad7..9cf884b12e 100644 --- a/stepmania/src/CourseLoaderCRS.cpp +++ b/stepmania/src/CourseLoaderCRS.cpp @@ -75,8 +75,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou const CourseDifficulty cd = StringToCourseDifficulty( sParams[1] ); if( cd == DIFFICULTY_INVALID ) { - LOG->UserLog( "Course file '%s' contains an invalid #METER string: \"%s\"", - sPath.c_str(), sParams[1].c_str() ); + LOG->UserLog( RageLog::LogType_CourseFile, sPath, "contains an invalid #METER string: \"%s\"", sParams[1].c_str() ); continue; } out.m_iCustomMeter[cd] = max( atoi(sParams[2]), 0 ); @@ -114,8 +113,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou if( attack.fSecsRemaining <= 0.0f) { - LOG->UserLog( "Course file \"%s\" has an attack with a nonpositive length: %s", - sPath.c_str(), sBits[1].c_str() ); + LOG->UserLog( RageLog::LogType_CourseFile, sPath, "has an attack with a nonpositive length: %s", sBits[1].c_str() ); attack.fSecsRemaining = 0.0f; } @@ -127,8 +125,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou } else { - LOG->UserLog( "Course file \"%s\" has an unexpected value named '%s'", - sPath.c_str(), sBits[0].c_str() ); + LOG->UserLog( RageLog::LogType_CourseFile, sPath, "has an unexpected value named '%s'", sBits[0].c_str() ); } } @@ -168,16 +165,14 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou } else { - LOG->UserLog( "Course file '%s' contains a random_within_group entry '%s' that is invalid. " - "Song should be in the format '/*'.", - sPath.c_str(), sSong.c_str() ); + LOG->UserLog( RageLog::LogType_CourseFile, sPath, "contains a random_within_group entry \"%s\" that is invalid. " + "Song should be in the format \"/*\".", sSong.c_str() ); } if( !SONGMAN->DoesSongGroupExist(new_entry.songCriteria.m_sGroupName) ) { - LOG->UserLog( "Course file '%s' random_within_group entry '%s' specifies a group that doesn't exist. " - "This entry will be ignored.", - sPath.c_str(), sSong.c_str() ); + LOG->UserLog( RageLog::LogType_CourseFile, sPath, "random_within_group entry \"%s\" specifies a group that doesn't exist. " + "This entry will be ignored.", sSong.c_str() ); continue; // skip this #SONG } } @@ -200,9 +195,8 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou if( new_entry.pSong == NULL ) { - LOG->UserLog( "Course file '%s' contains a fixed song entry '%s' that does not exist. " - "This entry will be ignored.", - sPath.c_str(), sSong.c_str()); + LOG->UserLog( RageLog::LogType_CourseFile, sPath, "contains a fixed song entry \"%s\" that does not exist. " + "This entry will be ignored.", sSong.c_str()); continue; // skip this #SONG } } @@ -215,8 +209,8 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou new_entry.stepsCriteria.m_iHighMeter = new_entry.stepsCriteria.m_iLowMeter; else if( retval != 2 ) { - LOG->UserLog( "Course file '%s' contains an invalid difficulty setting: \"%s\", 3..6 used instead", - sPath.c_str(), sParams[2].c_str() ); + LOG->UserLog( RageLog::LogType_CourseFile, sPath, "contains an invalid difficulty setting: \"%s\", 3..6 used instead", + sParams[2].c_str() ); new_entry.stepsCriteria.m_iLowMeter = 3; new_entry.stepsCriteria.m_iHighMeter = 6; } @@ -271,7 +265,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou } else { - LOG->UserLog( "Unexpected value named '%s'", sValueName.c_str() ); + LOG->UserLog( RageLog::LogType_CourseFile, sPath, "contains an unexpected value named \"%s\"", sValueName.c_str() ); } } static TitleSubst tsub("Courses"); @@ -342,7 +336,7 @@ bool CourseLoaderCRS::LoadFromCRSFile( const RString &_sPath, Course &out ) if( !msd.ReadFile(sPath) ) { - LOG->UserLog( "Error opening CRS file '%s': %s.", sPath.c_str(), msd.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_CourseFile, sPath, "couldn't be opened: %s.", msd.GetError().c_str() ); return false; } @@ -371,14 +365,14 @@ bool CourseLoaderCRS::LoadEditFromFile( const RString &sEditFilePath, ProfileSlo int iBytes = FILEMAN->GetFileSizeInBytes( sEditFilePath ); if( iBytes > MAX_EDIT_COURSE_SIZE_BYTES ) { - LOG->UserLog( "The edit '%s' is unreasonably large. It won't be loaded.", sEditFilePath.c_str() ); + LOG->UserLog( RageLog::LogType_EditFile, sEditFilePath, "is unreasonably large. It won't be loaded." ); return false; } MsdFile msd; if( !msd.ReadFile( sEditFilePath ) ) { - LOG->UserLog( "Error opening edit file \"%s\": %s", sEditFilePath.c_str(), msd.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_EditFile, sEditFilePath, "couldn't be opened: %s", msd.GetError().c_str() ); return false; } Course *pCourse = new Course; diff --git a/stepmania/src/CourseWriterCRS.cpp b/stepmania/src/CourseWriterCRS.cpp index d7c0c8ba4c..b085e41d00 100644 --- a/stepmania/src/CourseWriterCRS.cpp +++ b/stepmania/src/CourseWriterCRS.cpp @@ -13,7 +13,7 @@ bool CourseWriterCRS::Write( const Course &course, const RString &sPath, bool bS RageFile f; if( !f.Open( sPath, RageFile::WRITE ) ) { - LOG->UserLog( "Could not write course file '%s': %s", sPath.c_str(), f.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_CourseFile, sPath, "couldn't be written: %s", f.GetError().c_str() ); return false; } diff --git a/stepmania/src/NoteDataUtil.cpp b/stepmania/src/NoteDataUtil.cpp index 82804821aa..32a2419886 100644 --- a/stepmania/src/NoteDataUtil.cpp +++ b/stepmania/src/NoteDataUtil.cpp @@ -219,7 +219,7 @@ static void LoadFromSMNoteDataStringWithPlayer( NoteData& out, const RString &sS if( tn.type == TapNote::hold_head && tn.iDuration == MAX_NOTE_ROW ) { int iRow = begin->first; - LOG->UserLog( "Unmatched 2 at beat %f", NoteRowToBeat(iRow) ); + LOG->UserLog( RageLog::LogType_General, "", "While loading SM note data, there was an unmatched 2 at beat %f", NoteRowToBeat(iRow) ); out.RemoveTapNote( t, begin ); } diff --git a/stepmania/src/NotesLoaderBMS.cpp b/stepmania/src/NotesLoaderBMS.cpp index 16f65839fe..d665b30ea3 100644 --- a/stepmania/src/NotesLoaderBMS.cpp +++ b/stepmania/src/NotesLoaderBMS.cpp @@ -134,7 +134,7 @@ static RString FindLargestInitialSubstring( const RString &string1, const RStrin return string1.substr( 0, i ); } -static StepsType DetermineStepsType( int iPlayer, const NoteData &nd ) +static StepsType DetermineStepsType( int iPlayer, const NoteData &nd, const RString &sPath ) { ASSERT( NUM_BMS_TRACKS == nd.GetNumTracks() ); @@ -197,7 +197,7 @@ static StepsType DetermineStepsType( int iPlayer, const NoteData &nd ) default: return STEPS_TYPE_INVALID; } default: - LOG->UserLog( "Invalid #PLAYER value %d", iPlayer ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has an invalid #PLAYER value %d.", iPlayer ); return STEPS_TYPE_INVALID; } } @@ -394,7 +394,7 @@ bool BMSLoader::LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNa ndNotes.SetTapNote( iTrack, iBegin, TAP_ORIGINAL_TAP ); } - out.m_StepsType = DetermineStepsType( iPlayer, ndNotes ); + out.m_StepsType = DetermineStepsType( iPlayer, ndNotes, sPath ); if( out.m_StepsType == STEPS_TYPE_BEAT_SINGLE5 && GetTagFromMap( mapNameToData, "#title", sData ) ) { /* Hack: guess at 6-panel. */ @@ -410,7 +410,7 @@ bool BMSLoader::LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNa if( out.m_StepsType == STEPS_TYPE_INVALID ) { - LOG->UserLog( "Couldn't determine note type of file '%s'", sPath.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has an unknown steps type" ); return false; } @@ -429,7 +429,7 @@ bool BMSLoader::LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNa } else { - LOG->UserLog( "In BMS file \"%s\", there is no room to shift the autokeysound tracks.", sPath.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has no room to shift the autokeysound tracks." ); } } } @@ -556,7 +556,7 @@ bool BMSLoader::ReadBMSFile( const RString &sPath, NameToData_t &mapNameToData ) RageFile file; if( !file.Open(sPath) ) { - LOG->UserLog( "Failed to open \"%s\" for reading: %s", sPath.c_str(), file.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "couldn't be opened: %s", file.GetError().c_str() ); return false; } @@ -565,7 +565,7 @@ bool BMSLoader::ReadBMSFile( const RString &sPath, NameToData_t &mapNameToData ) RString line; if( file.GetLine(line) == -1 ) { - LOG->UserLog( "Error reading \"%s\": %s", sPath.c_str(), file.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "had a read error: %s", file.GetError().c_str() ); return false; } @@ -652,8 +652,8 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out ) } else { - LOG->UserLog( "In BMS file \"%s\", there is an invalid BPM change at beat %f, BPM %f.", - out.GetSongFilePath().c_str(), NoteRowToBeat(0), fBPM ); + LOG->UserLog( RageLog::LogType_SongFile, m_sDir, "has an invalid BPM change at beat %f, BPM %f.", + NoteRowToBeat(0), fBPM ); } } @@ -687,8 +687,7 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out ) } } if( !IsAFile(out.GetSongDir()+sData) ) - LOG->UserLog( "Song \"%s\" references key \"%s\" that can't be found", - m_sDir.c_str(), sData.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, m_sDir, "references key \"%s\" that can't be found", sData.c_str() ); sWavID.MakeUpper(); // HACK: undo the MakeLower() out.m_vsKeysoundFile.push_back( sData ); @@ -735,8 +734,8 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out ) } else { - LOG->UserLog( "In BMS file \"%s\", there is an invalid BPM change at beat %f, BPM %d.", - out.GetSongFilePath().c_str(), fBeat, iVal ); + LOG->UserLog( RageLog::LogType_SongFile, m_sDir, "has an invalid BPM change at beat %f, BPM %d.", + fBeat, iVal ); } break; @@ -756,13 +755,13 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out ) } else { - LOG->UserLog( "In BMS file \"%s\", there is an invalid BPM change at beat %f, BPM %f", - out.GetSongFilePath().c_str(), fBeat, fBPM ); + LOG->UserLog( RageLog::LogType_SongFile, m_sDir, "has an invalid BPM change at beat %f, BPM %f", + fBeat, fBPM ); } } else { - LOG->UserLog( "Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), m_sDir.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, m_sDir, "has tag \"%s\" which cannot be found.", sTagToLookFor.c_str() ); } break; } @@ -783,7 +782,7 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out ) } else { - LOG->UserLog( "Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), m_sDir.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, m_sDir, "has tag \"%s\" which cannot be found.", sTagToLookFor.c_str() ); } break; } @@ -813,13 +812,13 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out ) } else { - LOG->UserLog( "In BMS file \"%s\", there is an invalid BPM change at beat %f, BPM %f.", - out.GetSongFilePath().c_str(), NoteRowToBeat(iStepIndex), fBPM ); + LOG->UserLog( RageLog::LogType_SongFile, m_sDir, "has an invalid BPM change at beat %f, BPM %f.", + NoteRowToBeat(iStepIndex), fBPM ); } } else { - LOG->UserLog( "Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), m_sDir.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, m_sDir, "has tag \"%s\" which cannot be found.", sTagToLookFor.c_str() ); } break; @@ -949,7 +948,7 @@ bool BMSLoader::LoadFromDir( const RString &sDir, Song &out ) { // All bets are off; the titles don't match at all. // At this rate we're lucky if we even get the title right. - LOG->UserLog( "BMS files in %s have inconsistent titles", sDir.c_str() ); + LOG->UserLog( RageLog::LogType_Song, sDir, "has BMS files with inconsistent titles." ); } /* Create a Steps for each. */ diff --git a/stepmania/src/NotesLoaderDWI.cpp b/stepmania/src/NotesLoaderDWI.cpp index 1e4eea7666..d2ae10b6be 100644 --- a/stepmania/src/NotesLoaderDWI.cpp +++ b/stepmania/src/NotesLoaderDWI.cpp @@ -60,7 +60,7 @@ void DWILoader::DWIcharToNote( char c, GameController i, int ¬e1Out, int ¬ case 'L': note1Out = DANCE_NOTE_PAD1_UPRIGHT; note2Out = DANCE_NOTE_PAD1_RIGHT; break; case 'M': note1Out = DANCE_NOTE_PAD1_UPLEFT; note2Out = DANCE_NOTE_PAD1_UPRIGHT; break; default: - LOG->UserLog( "Encountered invalid DWI note character '%c' in '%s'", c, m_sLoadingFile.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, m_sLoadingFile, "has an invalid DWI note character '%c'.", c ); note1Out = DANCE_NOTE_NONE; note2Out = DANCE_NOTE_NONE; break; } @@ -232,7 +232,7 @@ bool DWILoader::LoadFromDWITokens( { if( c == '!' ) { - LOG->UserLog( "Unexpected character in '%s': '!'", m_sLoadingFile.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, m_sLoadingFile, "has an unexpected character: '!'." ); continue; } @@ -314,8 +314,8 @@ bool DWILoader::LoadFromDWITokens( if( !bFound ) { /* The hold was never closed. */ - LOG->UserLog( "File \"%s\":\"%s\" failed to close a hold note on track %i", - m_sLoadingFile.c_str(), sDescription.c_str(), t ); + LOG->UserLog( RageLog::LogType_SongFile, m_sLoadingFile, "failed to close a hold note in \"%s\" on track %i", + sDescription.c_str(), t ); newNoteData.SetTapNote( t, iHeadRow, TAP_EMPTY ); } @@ -364,7 +364,7 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out ) MsdFile msd; if( !msd.ReadFile( sPath ) ) { - LOG->UserLog( "Error opening file \"%s\": %s", sPath.c_str(), msd.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "couldn't be opened: %s", msd.GetError().c_str() ); return false; } @@ -376,7 +376,7 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out ) if( iNumParams < 1 ) { - LOG->UserLog( "Got \"%s\" tag with no parameters in '%s'", sValueName.c_str(), m_sLoadingFile.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has tag \"%s\" with no parameters.", sValueName.c_str() ); continue; } @@ -410,8 +410,8 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out ) if( fBPM > 0.0f ) out.AddBPMSegment( BPMSegment(0, fBPM) ); else - LOG->UserLog( "Invalid BPM change at beat %f, BPM %f in \"%s\".", - NoteRowToBeat(0), fBPM, sPath.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has an invalid BPM change at beat %f, BPM %f.", + NoteRowToBeat(0), fBPM ); } else if( 0==stricmp(sValueName,"DISPLAYBPM") ) { @@ -458,7 +458,7 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out ) split( arrayFreezeExpressions[f], "=", arrayFreezeValues ); if( arrayFreezeValues.size() != 2 ) { - LOG->UserLog( "Invalid FREEZE in '%s': '%s'", m_sLoadingFile.c_str(), arrayFreezeExpressions[f].c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has an invalid FREEZE: '%s'.", arrayFreezeExpressions[f].c_str() ); continue; } int iFreezeRow = BeatToNoteRow( StringToFloat(arrayFreezeValues[0]) / 4.0f ); @@ -480,7 +480,7 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out ) split( arrayBPMChangeExpressions[b], "=", arrayBPMChangeValues ); if( arrayBPMChangeValues.size() != 2 ) { - LOG->UserLog( "Invalid CHANGEBPM in '%s': '%s'", m_sLoadingFile.c_str(), arrayBPMChangeExpressions[b].c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, m_sLoadingFile, "has an invalid CHANGEBPM: '%s'.", arrayBPMChangeExpressions[b].c_str() ); continue; } @@ -493,16 +493,16 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out ) } else { - LOG->UserLog( "Invalid BPM change at beat %f, BPM %f in \"%s\".", - NoteRowToBeat(iStartIndex), fBPM, m_sLoadingFile.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, m_sLoadingFile, "has an invalid BPM change at beat %f, BPM %f.", + NoteRowToBeat(iStartIndex), fBPM ); } } } else if( 0==stricmp(sValueName,"SINGLE") || - 0==stricmp(sValueName,"DOUBLE") || - 0==stricmp(sValueName,"COUPLE") || - 0==stricmp(sValueName,"SOLO")) + 0==stricmp(sValueName,"DOUBLE") || + 0==stricmp(sValueName,"COUPLE") || + 0==stricmp(sValueName,"SOLO") ) { Steps* pNewNotes = new Steps; LoadFromDWITokens( @@ -564,7 +564,7 @@ bool DWILoader::LoadFromDir( const RString &sPath, Song &out ) if( aFileNames.size() > 1 ) { - LOG->UserLog( "There is more than one DWI file in '%s'. There should be only one!", sPath.c_str() ); + LOG->UserLog( RageLog::LogType_Song, sPath, "has more than one DWI file. There should be only one!" ); return false; } diff --git a/stepmania/src/NotesLoaderKSF.cpp b/stepmania/src/NotesLoaderKSF.cpp index 443e198013..19817b02aa 100644 --- a/stepmania/src/NotesLoaderKSF.cpp +++ b/stepmania/src/NotesLoaderKSF.cpp @@ -69,7 +69,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s MsdFile msd; if( !msd.ReadFile( sPath ) ) { - LOG->UserLog( "Error opening file '%s'.", sPath.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "couldn't be opened: %s", msd.GetError().c_str() ); return false; } @@ -87,7 +87,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s m_iTickCount = atoi( sParams[1] ); if( m_iTickCount <= 0 ) { - LOG->UserLog( "KSF file \"%s\" has an invalid tick count: %d", sPath.c_str(), m_iTickCount ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has an invalid tick count: %d.", m_iTickCount ); return false; } } @@ -106,7 +106,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s if( m_iTickCount == -1 ) { m_iTickCount = 2; - LOG->UserLog( "\"%s\": TICKCOUNT not found; defaulting to %i", sPath.c_str(), m_iTickCount ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "doesn't have a TICKCOUNT. Defaulting to %i.", m_iTickCount ); } NoteData notedata; // read it into here @@ -200,8 +200,8 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s { if( m_bKIUCompliant ) { - LOG->UserLog( "File \"%s\" had illegal syntax (\"%s\") which can't be in KIU complient files.", - sPath.c_str(), sRowString.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has illegal syntax \"%s\" which can't be in KIU complient files.", + sRowString.c_str() ); return false; } if( BeginsWith(sRowString, "|B") || BeginsWith(sRowString, "|D") ) @@ -218,8 +218,8 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s } else { - LOG->UserLog( "File %s had a RowString with an improper length (\"%s\"); corrupt notes ignored", - sPath.c_str(), sRowString.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has a RowString with an improper length \"%s\"; corrupt notes ignored.", + sRowString.c_str() ); return false; } } @@ -264,8 +264,8 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s case '0': tap = TAP_EMPTY; break; case '1': tap = TAP_ORIGINAL_TAP; break; default: - LOG->UserLog( "File %s had an invalid row (\"%s\"); corrupt notes ignored", - sPath.c_str(), sRowString.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has an invalid row \"%s\"; corrupt notes ignored.", + sRowString.c_str() ); return false; } @@ -338,7 +338,7 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out ) MsdFile msd; if( !msd.ReadFile( sPath ) ) { - LOG->UserLog( "Error opening file \"%s\": %s", sPath.c_str(), msd.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "couldn't be opened: %s", msd.GetError().c_str() ); return false; } @@ -419,8 +419,8 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out ) } else { - LOG->UserLog( "In KSF file \"%s\", there was an unexpected value named '%s'", - sPath.c_str(), sValueName.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has an unexpected value named \"%s\".", + sValueName.c_str() ); } } @@ -503,8 +503,8 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out ) else { /* Quit while we're ahead if any bad syntax is spotted. */ - LOG->UserLog( "File %s has a RowString which matches no known syntax rules (\"%s\"); bad file", - sPath.c_str(), NoteRowString.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has an invalid RowString \"%s\".", + NoteRowString.c_str() ); return false; } } @@ -559,11 +559,7 @@ bool KSFLoader::LoadFromDir( const RString &sDir, Song &out ) GetDirListing( sDir + RString("*.ksf"), arrayKSFFileNames ); /* We shouldn't have been called to begin with if there were no KSFs. */ - if( arrayKSFFileNames.empty() ) - { - LOG->UserLog( "Couldn't find any KSF files in '%s'", sDir.c_str() ); - return false; - } + ASSERT( arrayKSFFileNames.size() ); /* If only the first file is read, it will cause problems for other simfiles with * different BPM changes and tickcounts. This command will probably have to be diff --git a/stepmania/src/NotesLoaderSM.cpp b/stepmania/src/NotesLoaderSM.cpp index 4f2093398d..5603f3039f 100644 --- a/stepmania/src/NotesLoaderSM.cpp +++ b/stepmania/src/NotesLoaderSM.cpp @@ -73,7 +73,7 @@ bool SMLoader::LoadTimingFromFile( const RString &fn, TimingData &out ) MsdFile msd; if( !msd.ReadFile( fn ) ) { - LOG->UserLog( "Couldn't load %s, \"%s\"", fn.c_str(), msd.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, fn, "couldn't be loaded: %s", msd.GetError().c_str() ); return false; } @@ -110,7 +110,7 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) if( arrayFreezeValues.size() != 2 ) { // XXX: Hard to tell which file caused this. - LOG->UserLog( "Invalid #%s value \"%s\" (must have exactly one '='), ignored", + LOG->UserLog( RageLog::LogType_SongFile, "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.", sValueName.c_str(), arrayFreezeExpressions[f].c_str() ); continue; } @@ -138,7 +138,7 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) // XXX: Hard to tell which file caused this. if( arrayBPMChangeValues.size() != 2 ) { - LOG->UserLog( "Invalid #%s value \"%s\" (must have exactly one '='), ignored", + LOG->UserLog( RageLog::LogType_SongFile, "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.", sValueName.c_str(), arrayBPMChangeExpressions[b].c_str() ); continue; } @@ -149,7 +149,7 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) if( fNewBPM > 0.0f ) out.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) ); else - LOG->UserLog( "Invalid BPM change at beat %f, BPM %f.", fBeat, fNewBPM ); + LOG->UserLog( RageLog::LogType_SongFile, "(UNKNOWN)", "has an invalid BPM change at beat %f, BPM %f.", fBeat, fNewBPM ); } } } @@ -228,7 +228,7 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out ) MsdFile msd; if( !msd.ReadFile( sPath ) ) { - LOG->UserLog( "Error opening file \"%s\": %s", sPath.c_str(), msd.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "couldn't be opened: %s", msd.GetError().c_str() ); return false; } @@ -357,7 +357,7 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out ) else if(!stricmp(sParams[1],"ROULETTE")) out.m_SelectionDisplay = out.SHOW_ROULETTE; else - LOG->UserLog( "The song file '%s' has an unknown #SELECTABLE value, '%s'; ignored.", sPath.c_str(), sParams[1].c_str()); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has an unknown #SELECTABLE value, \"%s\"; ignored.", sParams[1].c_str() ); } else if( sValueName.Left(strlen("BGCHANGES"))=="BGCHANGES" || sValueName=="ANIMATIONS" ) @@ -369,7 +369,7 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out ) bool bValid = iLayer>=0 && iLayerUserLog( "The song file '%s' has a BGCHANGES tag '%s' that is out of range.", sPath.c_str(), sValueName.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has a #BGCHANGES tag \"%s\" that is out of range.", sValueName.c_str() ); } else { @@ -407,7 +407,7 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out ) { if( iNumParams < 7 ) { - LOG->UserLog( "The song file '%s' is has %d fields in a #NOTES tag, but should have at least %d.", sPath.c_str(), iNumParams, 7 ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has %d fields in a #NOTES tag, but should have at least 7.", iNumParams ); continue; } @@ -426,7 +426,7 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out ) else if( sValueName=="OFFSET" || sValueName=="BPMS" || sValueName=="STOPS" || sValueName=="FREEZES" ) ; else - LOG->UserLog( "The song file \"%s\" has an unexpected value named '%s'", sPath.c_str(), sValueName.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "has an unexpected value named \"%s\".", sValueName.c_str() ); } return true; @@ -440,7 +440,7 @@ bool SMLoader::LoadFromDir( const RString &sPath, Song &out ) if( aFileNames.size() > 1 ) { - LOG->UserLog( "There is more than one SM file in '%s'. There should be only one!", sPath.c_str() ); + LOG->UserLog( RageLog::LogType_Song, sPath, "has more than one SM file. There should be only one!" ); return false; } @@ -458,14 +458,14 @@ bool SMLoader::LoadEditFromFile( RString sEditFilePath, ProfileSlot slot, bool b int iBytes = FILEMAN->GetFileSizeInBytes( sEditFilePath ); if( iBytes > MAX_EDIT_STEPS_SIZE_BYTES ) { - LOG->UserLog( "The edit '%s' is unreasonably large. It won't be loaded.", sEditFilePath.c_str() ); + LOG->UserLog( RageLog::LogType_EditFile, sEditFilePath, "is unreasonably large. It won't be loaded." ); return false; } MsdFile msd; if( !msd.ReadFile( sEditFilePath ) ) { - LOG->UserLog( "Error opening edit file \"%s\": %s", sEditFilePath.c_str(), msd.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_EditFile, sEditFilePath, "couldn't be opened: %s", msd.GetError().c_str() ); return false; } @@ -495,7 +495,7 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath { if( pSong ) { - LOG->UserLog( "The edit file '%s' has more than one #SONG tag.", sEditFilePath.c_str() ); + LOG->UserLog( RageLog::LogType_EditFile, sEditFilePath, "has more than one #SONG tag." ); return false; } @@ -505,13 +505,13 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath pSong = SONGMAN->FindSong( sSongFullTitle ); if( pSong == NULL ) { - LOG->UserLog( "The edit file '%s' required a song '%s' that isn't present.", sEditFilePath.c_str(), sSongFullTitle.c_str() ); + LOG->UserLog( RageLog::LogType_EditFile, sEditFilePath, "requires a song \"%s\" that isn't present.", sSongFullTitle.c_str() ); return false; } if( pSong->GetNumStepsLoadedFromProfile(slot) >= MAX_EDITS_PER_SONG_PER_PROFILE ) { - LOG->UserLog( "The song '%s' already has the maximum number of edits allowed for ProfileSlotP%d.", sSongFullTitle.c_str(), slot+1 ); + LOG->UserLog( RageLog::LogType_SongFile, sSongFullTitle, "already has the maximum number of edits allowed for ProfileSlotP%d.", slot+1 ); return false; } } @@ -520,13 +520,13 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath { if( pSong == NULL ) { - LOG->UserLog( "The edit file '%s' has doesn't have a #SONG tag preceeding the first #NOTES tag.", sEditFilePath.c_str() ); + LOG->UserLog( RageLog::LogType_EditFile, sEditFilePath, "doesn't have a #SONG tag preceeding the first #NOTES tag." ); return false; } if( iNumParams < 7 ) { - LOG->UserLog( "The edit file '%s' is has %d fields in a #NOTES tag, but should have at least %d.", sEditFilePath.c_str(), iNumParams, 7 ); + LOG->UserLog( RageLog::LogType_EditFile, sEditFilePath, "has %d fields in a #NOTES tag, but should have at least 7.", iNumParams ); continue; } @@ -544,7 +544,7 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath if( pSong->IsEditAlreadyLoaded(pNewNotes) ) { - LOG->UserLog( "The edit file '%s' is a duplicate of another edit that was already loaded.", sEditFilePath.c_str() ); + LOG->UserLog( RageLog::LogType_EditFile, sEditFilePath, "is a duplicate of another edit that was already loaded." ); SAFE_DELETE( pNewNotes ); return false; } @@ -554,7 +554,7 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath } else { - LOG->UserLog( "The edit file \"%s\" has an unexpected value named '%s'", sEditFilePath.c_str(), sValueName.c_str() ); + LOG->UserLog( RageLog::LogType_EditFile, sEditFilePath, "has an unexpected value \"%s\".", sValueName.c_str() ); } } diff --git a/stepmania/src/NotesWriterDWI.cpp b/stepmania/src/NotesWriterDWI.cpp index 2cde639225..d96d793864 100644 --- a/stepmania/src/NotesWriterDWI.cpp +++ b/stepmania/src/NotesWriterDWI.cpp @@ -348,7 +348,7 @@ bool NotesWriterDWI::Write( RString sPath, const Song &out ) RageFile f; if( !f.Open( sPath, RageFile::WRITE ) ) { - LOG->UserLog( "Error opening song file \"%s\" for writing: \"%s\"", sPath.c_str(), f.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "couldn't be opened for writing: %s", f.GetError().c_str() ); return false; } diff --git a/stepmania/src/NotesWriterSM.cpp b/stepmania/src/NotesWriterSM.cpp index d0162eba89..7834c6a3bd 100644 --- a/stepmania/src/NotesWriterSM.cpp +++ b/stepmania/src/NotesWriterSM.cpp @@ -209,7 +209,7 @@ bool NotesWriterSM::Write( RString sPath, const Song &out, bool bSavingCache ) RageFile f; if( !f.Open( sPath, flags ) ) { - LOG->UserLog( "Error opening song file '%s' for writing: %s", sPath.c_str(), f.GetError().c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sPath, "couldn't be opened for writing: %s", f.GetError().c_str() ); return false; } diff --git a/stepmania/src/PlayerOptions.cpp b/stepmania/src/PlayerOptions.cpp index bf6c97f03a..5d3fe9376c 100644 --- a/stepmania/src/PlayerOptions.cpp +++ b/stepmania/src/PlayerOptions.cpp @@ -245,7 +245,7 @@ void PlayerOptions::FromString( const RString &sOptions, bool bWarnOnInvalid ) { if( bWarnOnInvalid ) { - LOG->UserLog( "Invalid player options '%s'; did you mean '*%d'?", + LOG->UserLog( RageLog::LogType_General, "", "Invalid player options \"%s\"; did you mean '*%d'?", s->c_str(), atoi(*s) ); } // XXX We know what they want, is there any reason not to handle it? @@ -360,8 +360,8 @@ void PlayerOptions::FromString( const RString &sOptions, bool bWarnOnInvalid ) { if( bWarnOnInvalid ) { - RString sWarning = ssprintf( "The options string '%s' contains an invalid mod name '%s'", sOptions.c_str(), sBit.c_str() ); - LOG->UserLog( "%s", sWarning.c_str() ); + RString sWarning = ssprintf( "The options string \"%s\" contains an invalid mod name \"%s\".", sOptions.c_str(), sBit.c_str() ); + LOG->UserLog( RageLog::LogType_General, "", "%s", sWarning.c_str() ); Dialog::OK( sWarning, "INVALID_PLAYER_OPTION_WARNING" ); } } diff --git a/stepmania/src/RageSoundReader_FileReader.cpp b/stepmania/src/RageSoundReader_FileReader.cpp index 8e144e3ad4..a9baf66f12 100644 --- a/stepmania/src/RageSoundReader_FileReader.cpp +++ b/stepmania/src/RageSoundReader_FileReader.cpp @@ -119,7 +119,7 @@ SoundReader *SoundReader_FileReader::OpenFile( RString filename, RString &error SoundReader_FileReader *NewSample = TryOpenFile( filename, error, *it, bKeepTrying ); if( NewSample ) { - LOG->UserLog( "File \"%s\" is really %s", filename.c_str(), it->c_str() ); + LOG->UserLog( RageLog::LogType_SoundFile, filename, "is really %s.", it->c_str() ); return NewSample; } } diff --git a/stepmania/src/RageSurface_Load.cpp b/stepmania/src/RageSurface_Load.cpp index 1bc2d0bfd9..b37bf8abf8 100644 --- a/stepmania/src/RageSurface_Load.cpp +++ b/stepmania/src/RageSurface_Load.cpp @@ -108,7 +108,7 @@ RageSurface *RageSurfaceUtils::LoadFile( const RString &sPath, RString &error, b RageSurface *ret = TryOpenFile( sPath, bHeaderOnly, error, *it, bKeepTrying ); if( ret ) { - LOG->UserLog( "File \"%s\" is really %s", sPath.c_str(), it->c_str() ); + LOG->UserLog( RageLog::LogType_GraphicFile, sPath, "is really %s", it->c_str() ); return ret; } } diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index c1219e12ef..6a551d53b5 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -236,7 +236,7 @@ bool Song::LoadFromSongDir( RString sDir ) } else { - LOG->UserLog( "Couldn't find any SM, DWI, BMS, or KSF files in '%s'.", sDir.c_str() ); + LOG->UserLog( RageLog::LogType_Song, sDir, "has no SM, DWI, BMS, or KSF files." ); vector vs; GetDirListing( sDir + "*.mp3", vs, false, false ); @@ -245,7 +245,7 @@ bool Song::LoadFromSongDir( RString sDir ) if( !bHasMusic ) { - LOG->UserLog( "No music file in this directory either. Ignoring this song directory." ); + LOG->UserLog( RageLog::LogType_Song, sDir, "has no music file either. Ignoring this song directory." ); return false; } @@ -277,7 +277,7 @@ bool Song::LoadFromSongDir( RString sDir ) if( !m_bHasMusic ) { - LOG->UserLog( "Song \"%s\" ignored (no music)", sDir.c_str() ); + LOG->UserLog( RageLog::LogType_Song, sDir, "has no music; ignored." ); return false; // don't load this song } @@ -349,7 +349,7 @@ void Song::TidyUpData() * (which have no music file, per se) but it's something of a hack. */ if( Sample == NULL && m_sMusicFile != "" ) { - LOG->UserLog( "Error opening sound \"%s\": %s", GetMusicPath().c_str(), error.c_str() ); + LOG->UserLog( RageLog::LogType_SoundFile, GetMusicPath(), "couldn't be opened: %s", error.c_str() ); /* Don't use this file. */ m_sMusicFile = ""; @@ -366,19 +366,19 @@ void Song::TidyUpData() } else if( m_fMusicLengthSeconds == 0 ) { - LOG->UserLog( "File \"%s\" is empty?", GetMusicPath().c_str() ); + LOG->UserLog( RageLog::LogType_SoundFile, GetMusicPath(), "is empty." ); } } } else // ! HasMusic() { m_fMusicLengthSeconds = 100; // guess - LOG->UserLog( "Song \"%s\" has no music file; guessing at %f seconds", this->GetSongDir().c_str(), m_fMusicLengthSeconds ); + LOG->UserLog( RageLog::LogType_Song, GetSongDir(), "has no music file; guessing at %f seconds", m_fMusicLengthSeconds ); } if( m_fMusicLengthSeconds < 0 ) { - LOG->UserLog( "File %s has negative length? (%f)", GetMusicPath().c_str(), m_fMusicLengthSeconds ); + LOG->UserLog( RageLog::LogType_SoundFile, GetMusicPath(), "has a negative length %f.", m_fMusicLengthSeconds ); m_fMusicLengthSeconds = 0; } @@ -403,8 +403,7 @@ void Song::TidyUpData() if( m_Timing.m_BPMSegments.empty() ) { - LOG->UserLog( "No BPM segments specified in '%s%s', default provided.", - m_sSongDir.c_str(), m_sSongFileName.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, m_sSongDir + m_sSongFileName, "hs no BPM segments, default provided." ); m_Timing.AddBPMSegment( BPMSegment(0, 60) ); } @@ -527,7 +526,7 @@ void Song::TidyUpData() RageSurface *img = RageSurfaceUtils::LoadFile( sPath, error, true ); if( !img ) { - LOG->UserLog( "Couldn't load '%s': %s", sPath.c_str(), error.c_str() ); + LOG->UserLog( RageLog::LogType_GraphicFile, sPath, "couldn't be loaded: %s", error.c_str() ); continue; } @@ -739,7 +738,7 @@ void Song::Save() if( !FileCopy( sOldPath, sNewPath ) ) { - LOG->UserLog( "Backup of \"%s\" failed", sOldPath.c_str() ); + LOG->UserLog( RageLog::LogType_SongFile, sOldPath, "couldn't be backed up." ); /* Don't remove. */ } else