Move warnings meant for the user to userlog.txt. These are as inconsistent in format as before but at least they're all in one place.

This commit is contained in:
Steve Checkoway
2006-09-03 05:16:09 +00:00
parent c6eb78a3cf
commit 4606d68fdf
14 changed files with 158 additions and 137 deletions
+7 -7
View File
@@ -123,7 +123,7 @@ void BannerCache::LoadBanner( RString BannerPath )
RageSurface *img = RageSurfaceUtils::LoadSurface( CachePath );
if( img == NULL )
{
if(tries == 0)
if( tries == 0 )
{
/* The file doesn't exist. It's possible that the banner cache file is
* missing, so try to create it. Don't do this first, for efficiency. */
@@ -216,7 +216,7 @@ struct BannerTexture: public RageTexture
if( img->w > DISPLAY->GetMaxTextureSize() ||
img->h > DISPLAY->GetMaxTextureSize() )
{
LOG->Warn("Converted %s at runtime", GetID().filename.c_str() );
LOG->Warn( "Converted %s at runtime", GetID().filename.c_str() );
int width = min( img->w, DISPLAY->GetMaxTextureSize() );
int height = min( img->h, DISPLAY->GetMaxTextureSize() );
RageSurfaceUtils::Zoom( img, width, height );
@@ -270,7 +270,7 @@ RageTextureID BannerCache::LoadCachedBanner( RString BannerPath )
if( BannerPath == "" )
return ID;
LOG->Trace("BannerCache::LoadCachedBanner(%s): %s", BannerPath.c_str(), ID.filename.c_str() );
LOG->Trace( "BannerCache::LoadCachedBanner(%s): %s", BannerPath.c_str(), ID.filename.c_str() );
/* Hack: make sure Banner::Load doesn't change our return value and end up
* reloading. */
@@ -297,7 +297,7 @@ RageTextureID BannerCache::LoadCachedBanner( RString BannerPath )
BannerData.GetValue( BannerPath, "Rotated", WasRotatedBanner );
if(src_width == 0 || src_height == 0)
{
LOG->Warn("Couldn't load '%s'", BannerPath.c_str() );
LOG->UserLog( "Couldn't load '%s'", BannerPath.c_str() );
return ID;
}
@@ -312,8 +312,8 @@ RageTextureID BannerCache::LoadCachedBanner( RString BannerPath )
if( TEXTUREMAN->IsTextureRegistered(ID) )
return ID; /* It's all set. */
LOG->Trace("Loading banner texture %s; src %ix%i; image %ix%i",
ID.filename.c_str(), src_width, src_height, img->w, img->h );
LOG->Trace( "Loading banner texture %s; src %ix%i; image %ix%i",
ID.filename.c_str(), src_width, src_height, img->w, img->h );
RageTexture *pTexture = new BannerTexture( ID, img, src_width, src_height );
ID.Policy = RageTextureID::TEX_VOLATILE;
@@ -377,7 +377,7 @@ void BannerCache::CacheBannerInternal( RString BannerPath )
RageSurface *img = RageSurfaceUtils::LoadFile( BannerPath, error );
if( img == NULL )
{
LOG->Warn( "BannerCache::CacheBanner: Couldn't load %s: %s", BannerPath.c_str(), error.c_str() );
LOG->UserLog( "BannerCache::CacheBanner: Couldn't load %s: %s", BannerPath.c_str(), error.c_str() );
return;
}
+20 -22
View File
@@ -75,7 +75,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
const CourseDifficulty cd = StringToCourseDifficulty( sParams[1] );
if( cd == DIFFICULTY_INVALID )
{
LOG->Warn( "Course file '%s' contains an invalid #METER string: \"%s\"",
LOG->UserLog( "Course file '%s' contains an invalid #METER string: \"%s\"",
sPath.c_str(), sParams[1].c_str() );
continue;
}
@@ -114,7 +114,8 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
if( attack.fSecsRemaining <= 0.0f)
{
LOG->Warn( "Attack has nonpositive length: %s", sBits[1].c_str() );
LOG->UserLog( "Course file \"%s\" has an attack with a nonpositive length: %s",
sPath.c_str(), sBits[1].c_str() );
attack.fSecsRemaining = 0.0f;
}
@@ -126,7 +127,8 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
}
else
{
LOG->Warn( "Unexpected value named '%s'", sBits[0].c_str() );
LOG->UserLog( "Course file \"%s\" has an unexpected value named '%s'",
sPath.c_str(), sBits[0].c_str() );
}
}
@@ -166,18 +168,16 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
}
else
{
LOG->Warn( "Course file '%s' contains a random_within_group entry '%s' that is invalid. "
"Song should be in the format '<group>/*'.",
sPath.c_str(), sSong.c_str() );
LOG->UserLog( "Course file '%s' contains a random_within_group entry '%s' that is invalid. "
"Song should be in the format '<group>/*'.",
sPath.c_str(), sSong.c_str() );
}
if( !SONGMAN->DoesSongGroupExist(new_entry.songCriteria.m_sGroupName) )
{
/* XXX: We need a place to put "user warnings". This is too loud for info.txt--
* it obscures important warnings--and regular users never look there, anyway. */
LOG->Trace( "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( "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() );
continue; // skip this #SONG
}
}
@@ -200,11 +200,9 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
if( new_entry.pSong == NULL )
{
/* XXX: We need a place to put "user warnings". This is too loud for info.txt--
* it obscures important warnings--and regular users never look there, anyway. */
LOG->Trace( "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( "Course file '%s' contains a fixed song entry '%s' that does not exist. "
"This entry will be ignored.",
sPath.c_str(), sSong.c_str());
continue; // skip this #SONG
}
}
@@ -217,8 +215,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->Warn( "Course file '%s' contains an invalid difficulty setting: \"%s\", 3..6 used instead",
sPath.c_str(), sParams[2].c_str() );
LOG->UserLog( "Course file '%s' contains an invalid difficulty setting: \"%s\", 3..6 used instead",
sPath.c_str(), sParams[2].c_str() );
new_entry.stepsCriteria.m_iLowMeter = 3;
new_entry.stepsCriteria.m_iHighMeter = 6;
}
@@ -273,7 +271,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
}
else
{
LOG->Warn( "Unexpected value named '%s'", sValueName.c_str() );
LOG->UserLog( "Unexpected value named '%s'", sValueName.c_str() );
}
}
static TitleSubst tsub("Courses");
@@ -344,7 +342,7 @@ bool CourseLoaderCRS::LoadFromCRSFile( const RString &_sPath, Course &out )
if( !msd.ReadFile(sPath) )
{
LOG->Trace( "Error opening CRS file '%s': %s.", sPath.c_str(), msd.GetError().c_str() );
LOG->UserLog( "Error opening CRS file '%s': %s.", sPath.c_str(), msd.GetError().c_str() );
return false;
}
@@ -373,14 +371,14 @@ bool CourseLoaderCRS::LoadEditFromFile( const RString &sEditFilePath, ProfileSlo
int iBytes = FILEMAN->GetFileSizeInBytes( sEditFilePath );
if( iBytes > MAX_EDIT_COURSE_SIZE_BYTES )
{
LOG->Warn( "The edit '%s' is unreasonably large. It won't be loaded.", sEditFilePath.c_str() );
LOG->UserLog( "The edit '%s' is unreasonably large. It won't be loaded.", sEditFilePath.c_str() );
return false;
}
MsdFile msd;
if( !msd.ReadFile( sEditFilePath ) )
{
LOG->Warn( "Error opening edit file \"%s\": %s", sEditFilePath.c_str(), msd.GetError().c_str() );
LOG->UserLog( "Error opening edit file \"%s\": %s", sEditFilePath.c_str(), msd.GetError().c_str() );
return false;
}
Course *pCourse = new Course;
+1 -1
View File
@@ -13,7 +13,7 @@ bool CourseWriterCRS::Write( const Course &course, const RString &sPath, bool bS
RageFile f;
if( !f.Open( sPath, RageFile::WRITE ) )
{
LOG->Warn( "Could not write course file '%s': %s", sPath.c_str(), f.GetError().c_str() );
LOG->UserLog( "Could not write course file '%s': %s", sPath.c_str(), f.GetError().c_str() );
return false;
}
+1 -1
View File
@@ -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->Warn( "Unmatched 2 at beat %f", NoteRowToBeat(iRow) );
LOG->UserLog( "Unmatched 2 at beat %f", NoteRowToBeat(iRow) );
out.RemoveTapNote( t, begin );
}
+23 -16
View File
@@ -197,7 +197,7 @@ static StepsType DetermineStepsType( int iPlayer, const NoteData &nd )
default: return STEPS_TYPE_INVALID;
}
default:
LOG->Warn( "Invalid #PLAYER value %d", iPlayer );
LOG->UserLog( "Invalid #PLAYER value %d", iPlayer );
return STEPS_TYPE_INVALID;
}
}
@@ -410,7 +410,7 @@ bool BMSLoader::LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNa
if( out.m_StepsType == STEPS_TYPE_INVALID )
{
LOG->Warn( "Couldn't determine note type of file '%s'", sPath.c_str() );
LOG->UserLog( "Couldn't determine note type of file '%s'", sPath.c_str() );
return false;
}
@@ -429,7 +429,7 @@ bool BMSLoader::LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNa
}
else
{
LOG->Warn( "No room to shift." );
LOG->UserLog( "In BMS file \"%s\", there is no room to shift the autokeysound tracks.", sPath.c_str() );
}
}
}
@@ -555,13 +555,17 @@ bool BMSLoader::ReadBMSFile( const RString &sPath, NameToData_t &mapNameToData )
{
RageFile file;
if( !file.Open(sPath) )
RageException::Throw( "Failed to open \"%s\" for reading: %s", sPath.c_str(), file.GetError().c_str() );
{
LOG->UserLog( "Failed to open \"%s\" for reading: %s", sPath.c_str(), file.GetError().c_str() );
return false;
}
while( !file.AtEOF() )
{
RString line;
if( file.GetLine(line) == -1 )
{
LOG->Warn( "Error reading \"%s\": %s", sPath.c_str(), file.GetError().c_str() );
LOG->UserLog( "Error reading \"%s\": %s", sPath.c_str(), file.GetError().c_str() );
return false;
}
@@ -648,7 +652,8 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
}
else
{
LOG->Trace( "Invalid BPM change at beat %f, BPM %f.", NoteRowToBeat(0), fBPM );
LOG->UserLog( "In BMS file \"%s\", there is an invalid BPM change at beat %f, BPM %f.",
out.GetSongFilePath().c_str(), NoteRowToBeat(0), fBPM );
}
}
@@ -682,8 +687,8 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
}
}
if( !IsAFile(out.GetSongDir()+sData) )
LOG->Trace( "Song \"%s\" references key \"%s\" that can't be found",
m_sDir.c_str(), sData.c_str() );
LOG->UserLog( "Song \"%s\" references key \"%s\" that can't be found",
m_sDir.c_str(), sData.c_str() );
sWavID.MakeUpper(); // HACK: undo the MakeLower()
out.m_vsKeysoundFile.push_back( sData );
@@ -730,8 +735,8 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
}
else
{
// This is too loud for warn.
LOG->Trace( "Invalid BPM change at beat %f, BPM %d.", fBeat, iVal );
LOG->UserLog( "In BMS file \"%s\", there is an invalid BPM change at beat %f, BPM %d.",
out.GetSongFilePath().c_str(), fBeat, iVal );
}
break;
@@ -751,12 +756,13 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
}
else
{
LOG->Trace( "Invalid BPM change at beat %f, BPM %f", fBeat, fBPM );
LOG->UserLog( "In BMS file \"%s\", there is an invalid BPM change at beat %f, BPM %f",
out.GetSongFilePath().c_str(), fBeat, fBPM );
}
}
else
{
LOG->Warn( "Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), m_sDir.c_str() );
LOG->UserLog( "Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), m_sDir.c_str() );
}
break;
}
@@ -777,7 +783,7 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
}
else
{
LOG->Warn( "Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), m_sDir.c_str() );
LOG->UserLog( "Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), m_sDir.c_str() );
}
break;
}
@@ -807,12 +813,13 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
}
else
{
LOG->Trace( "Invalid BPM change at beat %f, BPM %f.", NoteRowToBeat(iStepIndex), fBPM );
LOG->UserLog( "In BMS file \"%s\", there is an invalid BPM change at beat %f, BPM %f.",
out.GetSongFilePath().c_str(), NoteRowToBeat(iStepIndex), fBPM );
}
}
else
{
LOG->Warn( "Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), m_sDir.c_str() );
LOG->UserLog( "Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), m_sDir.c_str() );
}
break;
@@ -942,7 +949,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->Warn("BMS files in %s have inconsistent titles", sDir.c_str() );
LOG->UserLog( "BMS files in %s have inconsistent titles", sDir.c_str() );
}
/* Create a Steps for each. */
+19 -13
View File
@@ -60,7 +60,7 @@ void DWILoader::DWIcharToNote( char c, GameController i, int &note1Out, int &not
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->Warn( "Encountered invalid DWI note character '%c' in '%s'", c, m_sLoadingFile.c_str() );
LOG->UserLog( "Encountered invalid DWI note character '%c' in '%s'", c, m_sLoadingFile.c_str() );
note1Out = DANCE_NOTE_NONE; note2Out = DANCE_NOTE_NONE; break;
}
@@ -234,7 +234,7 @@ bool DWILoader::LoadFromDWITokens(
{
if( c == '!' )
{
LOG->Warn( "Unexpected character in '%s': '!'", m_sLoadingFile.c_str() );
LOG->UserLog( "Unexpected character in '%s': '!'", m_sLoadingFile.c_str() );
continue;
}
@@ -316,10 +316,8 @@ bool DWILoader::LoadFromDWITokens(
if( !bFound )
{
/* The hold was never closed. */
LOG->Warn( "File \"%s\":\"%s\" failed to close a hold note on track %i",
m_sLoadingFile.c_str(),
sDescription.c_str(),
t );
LOG->UserLog( "File \"%s\":\"%s\" failed to close a hold note on track %i",
m_sLoadingFile.c_str(), sDescription.c_str(), t );
newNoteData.SetTapNote( t, iHeadRow, TAP_EMPTY );
}
@@ -366,7 +364,10 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out )
MsdFile msd;
if( !msd.ReadFile( sPath ) )
RageException::Throw( "Error opening file \"%s\": %s", sPath.c_str(), msd.GetError().c_str() );
{
LOG->UserLog( "Error opening file \"%s\": %s", sPath.c_str(), msd.GetError().c_str() );
return false;
}
for( unsigned i=0; i<msd.GetNumValues(); i++ )
{
@@ -376,7 +377,7 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out )
if(iNumParams < 1)
{
LOG->Warn("Got \"%s\" tag with no parameters in '%s'", sValueName.c_str(), m_sLoadingFile.c_str() );
LOG->UserLog( "Got \"%s\" tag with no parameters in '%s'", sValueName.c_str(), m_sLoadingFile.c_str() );
continue;
}
@@ -410,7 +411,8 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out )
if( fBPM > 0.0f )
out.AddBPMSegment( BPMSegment(0, fBPM) );
else
LOG->Trace( "Invalid BPM change at beat %f, BPM %f.", NoteRowToBeat(0), fBPM );
LOG->UserLog( "Invalid BPM change at beat %f, BPM %f in \"%s\".",
NoteRowToBeat(0), fBPM, sPath.c_str() );
}
else if( 0==stricmp(sValueName,"DISPLAYBPM") )
{
@@ -457,7 +459,7 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out )
split( arrayFreezeExpressions[f], "=", arrayFreezeValues );
if( arrayFreezeValues.size() != 2 )
{
LOG->Warn( "Invalid FREEZE in '%s': '%s'", m_sLoadingFile.c_str(), arrayFreezeExpressions[f].c_str() );
LOG->UserLog( "Invalid FREEZE in '%s': '%s'", m_sLoadingFile.c_str(), arrayFreezeExpressions[f].c_str() );
continue;
}
int iFreezeRow = BeatToNoteRow( StringToFloat(arrayFreezeValues[0]) / 4.0f );
@@ -479,7 +481,7 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out )
split( arrayBPMChangeExpressions[b], "=", arrayBPMChangeValues );
if( arrayBPMChangeValues.size() != 2 )
{
LOG->Warn( "Invalid CHANGEBPM in '%s': '%s'", m_sLoadingFile.c_str(), arrayBPMChangeExpressions[b].c_str() );
LOG->UserLog( "Invalid CHANGEBPM in '%s': '%s'", m_sLoadingFile.c_str(), arrayBPMChangeExpressions[b].c_str() );
continue;
}
@@ -492,7 +494,8 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out )
}
else
{
LOG->Trace( "Invalid BPM change at beat %f, BPM %f.", NoteRowToBeat(iStartIndex), fBPM );
LOG->UserLog( "Invalid BPM change at beat %f, BPM %f in \"%s\".",
NoteRowToBeat(iStartIndex), fBPM, m_sLoadingFile.c_str() );
}
}
}
@@ -561,7 +564,10 @@ bool DWILoader::LoadFromDir( const RString &sPath, Song &out )
GetApplicableFiles( sPath, aFileNames );
if( aFileNames.size() > 1 )
RageException::Throw( "There is more than one DWI file in '%s'. There should be only one!", sPath.c_str() );
{
LOG->UserLog( "There is more than one DWI file in '%s'. There should be only one!", sPath.c_str() );
return false;
}
/* We should have exactly one; if we had none, we shouldn't have been
* called to begin with. */
+37 -26
View File
@@ -68,7 +68,10 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
MsdFile msd;
if( !msd.ReadFile( sPath ) )
RageException::Throw( "Error opening file '%s'.", sPath.c_str() );
{
LOG->UserLog( "Error opening file '%s'.", sPath.c_str() );
return false;
}
m_iTickCount = -1; // this is the value we read for TICKCOUNT
m_vNoteRows.clear(); //Start from a clean slate.
@@ -84,8 +87,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
m_iTickCount = atoi( sParams[1] );
if( m_iTickCount <= 0 )
{
// XXX need a place for user warnings.
LOG->Warn( "Invalid tick count: %d", m_iTickCount );
LOG->UserLog( "KSF file \"%s\" has an invalid tick count: %d", sPath.c_str(), m_iTickCount );
return false;
}
}
@@ -104,7 +106,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
if( m_iTickCount == -1 )
{
m_iTickCount = 2;
LOG->Warn( "\"%s\": TICKCOUNT not found; defaulting to %i", sPath.c_str(), m_iTickCount );
LOG->UserLog( "\"%s\": TICKCOUNT not found; defaulting to %i", sPath.c_str(), m_iTickCount );
}
NoteData notedata; // read it into here
@@ -196,10 +198,10 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
if( sRowString.size() != 13 )
{
if (m_bKIUCompliant)
if( m_bKIUCompliant )
{
LOG->Warn("File %s had illegal syntax (\"%s\") which can't be in KIU complient files.",
sPath.c_str(), sRowString.c_str());
LOG->UserLog( "File \"%s\" had illegal syntax (\"%s\") which can't be in KIU complient files.",
sPath.c_str(), sRowString.c_str() );
return false;
}
if( BeginsWith(sRowString, "|B") || BeginsWith(sRowString, "|D") )
@@ -216,8 +218,8 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
}
else
{
LOG->Warn("File %s had a RowString with an improper length (\"%s\"); corrupt notes ignored",
sPath.c_str(), sRowString.c_str());
LOG->UserLog( "File %s had a RowString with an improper length (\"%s\"); corrupt notes ignored",
sPath.c_str(), sRowString.c_str() );
return false;
}
}
@@ -227,7 +229,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
sRowString.erase( 0, 2 );
// Update TICKCOUNT for Direct Move files.
if (m_bTickChangeNeeded)
if( m_bTickChangeNeeded )
{
m_iTickCount = newTick;
m_bTickChangeNeeded = false;
@@ -262,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->Warn( "File %s had an invalid row (\"%s\"); corrupt notes ignored",
sPath.c_str(), sRowString.c_str() );
LOG->UserLog( "File %s had an invalid row (\"%s\"); corrupt notes ignored",
sPath.c_str(), sRowString.c_str() );
return false;
}
@@ -335,7 +337,10 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
{
MsdFile msd;
if( !msd.ReadFile( sPath ) )
RageException::Throw( "Error opening file \"%s\": %s", sPath.c_str(), msd.GetError().c_str() );
{
LOG->UserLog( "Error opening file \"%s\": %s", sPath.c_str(), msd.GetError().c_str() );
return false;
}
float SMGap1 = 0, SMGap2 = 0, BPM1 = -1, BPMPos2 = -1, BPM2 = -1, BPMPos3 = -1, BPM3 = -1;
m_iTickCount = -1;
@@ -413,21 +418,24 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
continue;
}
else
LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() );
{
LOG->UserLog( "In KSF file \"%s\", there was an unexpected value named '%s'",
sPath.c_str(), sValueName.c_str() );
}
}
/* BPM Change checks are done here. If m_bKIUCompliant, it's short and sweet.
* Otherwise, the whole file has to be processed. Right now, this is only
* called once, for the initial file (often the Crazy steps). Hopefully that
* will end up changing soon. */
if (m_bKIUCompliant)
if( m_bKIUCompliant )
{
if( BPM2 > 0 && BPMPos2 > 0 )
{
const float BeatsPerSecond = BPM1 / 60.0f;
const float beat = (BPMPos2 + SMGap1) * BeatsPerSecond;
LOG->Trace( "BPM %f, BPS %f, BPMPos2 %f, beat %f",
BPM1, BeatsPerSecond, BPMPos2, beat );
BPM1, BeatsPerSecond, BPMPos2, beat );
out.AddBPMSegment( BPMSegment(BeatToNoteRow(beat), BPM2) );
}
@@ -495,27 +503,27 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
else
{
/* Quit while we're ahead if any bad syntax is spotted. */
LOG->Warn("File %s has a RowString which matches no known syntax rules (\"%s\"); bad file",
sPath.c_str(), NoteRowString.c_str());
LOG->UserLog( "File %s has a RowString which matches no known syntax rules (\"%s\"); bad file",
sPath.c_str(), NoteRowString.c_str() );
return false;
}
}
if (m_bTickChangeNeeded)
if( m_bTickChangeNeeded )
{
m_iTickCount = tickToChange;
m_bTickChangeNeeded = false;
}
if (m_bBPMChangeNeeded)
if( m_bBPMChangeNeeded )
{
LOG->Trace( "Adding tempo change of %f BPM at beat %f", speedToChange, m_fCurBeat);
out.AddBPMSegment(BPMSegment(BeatToNoteRow(m_fCurBeat),speedToChange));
LOG->Trace( "Adding tempo change of %f BPM at beat %f", speedToChange, m_fCurBeat );
out.AddBPMSegment( BPMSegment(BeatToNoteRow(m_fCurBeat), speedToChange) );
m_bBPMChangeNeeded = false;
}
if (m_bBPMStopNeeded)
if( m_bBPMStopNeeded )
{
LOG->Trace( "Adding tempo freeze of %f seconds at beat %f", timeToStop, m_fCurBeat);
out.AddStopSegment(StopSegment(BeatToNoteRow(m_fCurBeat),timeToStop));
LOG->Trace( "Adding tempo freeze of %f seconds at beat %f", timeToStop, m_fCurBeat );
out.AddStopSegment( StopSegment(BeatToNoteRow(m_fCurBeat),timeToStop) );
m_bBPMStopNeeded = false;
}
m_fCurBeat += 1.0f / m_iTickCount;
@@ -552,7 +560,10 @@ bool KSFLoader::LoadFromDir( const RString &sDir, Song &out )
/* We shouldn't have been called to begin with if there were no KSFs. */
if( arrayKSFFileNames.empty() )
RageException::Throw( "Couldn't find any KSF files in '%s'", sDir.c_str() );
{
LOG->UserLog( "Couldn't find any KSF files in '%s'", sDir.c_str() );
return false;
}
/* 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
+25 -28
View File
@@ -73,7 +73,7 @@ bool SMLoader::LoadTimingFromFile( const RString &fn, TimingData &out )
MsdFile msd;
if( !msd.ReadFile( fn ) )
{
LOG->Warn( "Couldn't load %s, \"%s\"", fn.c_str(), msd.GetError().c_str() );
LOG->UserLog( "Couldn't load %s, \"%s\"", fn.c_str(), msd.GetError().c_str() );
return false;
}
@@ -107,12 +107,11 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out )
{
vector<RString> arrayFreezeValues;
split( arrayFreezeExpressions[f], "=", arrayFreezeValues );
/* XXX: Once we have a way to display warnings that the user actually
* cares about (unlike most warnings), this should be one of them. */
if( arrayFreezeValues.size() != 2 )
{
LOG->Warn( "Invalid #%s value \"%s\" (must have exactly one '='), ignored",
sValueName.c_str(), arrayFreezeExpressions[f].c_str() );
// XXX: Hard to tell which file caused this.
LOG->UserLog( "Invalid #%s value \"%s\" (must have exactly one '='), ignored",
sValueName.c_str(), arrayFreezeExpressions[f].c_str() );
continue;
}
@@ -136,12 +135,11 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out )
{
vector<RString> arrayBPMChangeValues;
split( arrayBPMChangeExpressions[b], "=", arrayBPMChangeValues );
/* XXX: Once we have a way to display warnings that the user actually
* cares about (unlike most warnings), this should be one of them. */
if(arrayBPMChangeValues.size() != 2)
// XXX: Hard to tell which file caused this.
if( arrayBPMChangeValues.size() != 2 )
{
LOG->Warn( "Invalid #%s value \"%s\" (must have exactly one '='), ignored",
sValueName.c_str(), arrayBPMChangeExpressions[b].c_str() );
LOG->UserLog( "Invalid #%s value \"%s\" (must have exactly one '='), ignored",
sValueName.c_str(), arrayBPMChangeExpressions[b].c_str() );
continue;
}
@@ -151,7 +149,7 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out )
if( fNewBPM > 0.0f )
out.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) );
else
LOG->Trace( "Invalid BPM change at beat %f, BPM %f.", fBeat, fNewBPM );
LOG->UserLog( "Invalid BPM change at beat %f, BPM %f.", fBeat, fNewBPM );
}
}
}
@@ -230,7 +228,7 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out )
MsdFile msd;
if( !msd.ReadFile( sPath ) )
{
LOG->Warn( "Error opening file \"%s\": %s", sPath.c_str(), msd.GetError().c_str() );
LOG->UserLog( "Error opening file \"%s\": %s", sPath.c_str(), msd.GetError().c_str() );
return false;
}
@@ -359,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->Warn( "The song file '%s' has an unknown #SELECTABLE value, '%s'; ignored.", sPath.c_str(), sParams[1].c_str());
LOG->UserLog( "The song file '%s' has an unknown #SELECTABLE value, '%s'; ignored.", sPath.c_str(), sParams[1].c_str());
}
else if( sValueName.Left(strlen("BGCHANGES"))=="BGCHANGES" || sValueName=="ANIMATIONS" )
@@ -371,7 +369,7 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out )
bool bValid = iLayer>=0 && iLayer<NUM_BackgroundLayer;
if( !bValid )
{
LOG->Warn( "The song file '%s' has a BGCHANGES tag '%s' that is out of range.", sPath.c_str(), sValueName.c_str() );
LOG->UserLog( "The song file '%s' has a BGCHANGES tag '%s' that is out of range.", sPath.c_str(), sValueName.c_str() );
}
else
{
@@ -409,7 +407,7 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out )
{
if( iNumParams < 7 )
{
LOG->Trace( "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( "The song file '%s' is has %d fields in a #NOTES tag, but should have at least %d.", sPath.c_str(), iNumParams, 7 );
continue;
}
@@ -425,11 +423,10 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out )
out.AddSteps( pNewNotes );
}
else if( sValueName=="OFFSET" || sValueName=="BPMS" ||
sValueName=="STOPS" || sValueName=="FREEZES" )
else if( sValueName=="OFFSET" || sValueName=="BPMS" || sValueName=="STOPS" || sValueName=="FREEZES" )
;
else
LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() );
LOG->UserLog( "The song file \"%s\" has an unexpected value named '%s'", sPath.c_str(), sValueName.c_str() );
}
return true;
@@ -443,7 +440,7 @@ bool SMLoader::LoadFromDir( const RString &sPath, Song &out )
if( aFileNames.size() > 1 )
{
LOG->Warn( "There is more than one SM file in '%s'. There should be only one!", sPath.c_str() );
LOG->UserLog( "There is more than one SM file in '%s'. There should be only one!", sPath.c_str() );
return false;
}
@@ -461,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->Warn( "The edit '%s' is unreasonably large. It won't be loaded.", sEditFilePath.c_str() );
LOG->UserLog( "The edit '%s' is unreasonably large. It won't be loaded.", sEditFilePath.c_str() );
return false;
}
MsdFile msd;
if( !msd.ReadFile( sEditFilePath ) )
{
LOG->Warn( "Error opening edit file \"%s\": %s", sEditFilePath.c_str(), msd.GetError().c_str() );
LOG->UserLog( "Error opening edit file \"%s\": %s", sEditFilePath.c_str(), msd.GetError().c_str() );
return false;
}
@@ -498,7 +495,7 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath
{
if( pSong )
{
LOG->Warn( "The edit file '%s' has more than one #SONG tag.", sEditFilePath.c_str() );
LOG->UserLog( "The edit file '%s' has more than one #SONG tag.", sEditFilePath.c_str() );
return false;
}
@@ -508,13 +505,13 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath
pSong = SONGMAN->FindSong( sSongFullTitle );
if( pSong == NULL )
{
LOG->Warn( "The edit file '%s' required a song '%s' that isn't present.", sEditFilePath.c_str(), sSongFullTitle.c_str() );
LOG->UserLog( "The edit file '%s' required a song '%s' that isn't present.", sEditFilePath.c_str(), sSongFullTitle.c_str() );
return false;
}
if( pSong->GetNumStepsLoadedFromProfile(slot) >= MAX_EDITS_PER_SONG_PER_PROFILE )
{
LOG->Warn( "The song '%s' already has the maximum number of edits allowed for ProfileSlotP%d.", sSongFullTitle.c_str(), slot+1 );
LOG->UserLog( "The song '%s' already has the maximum number of edits allowed for ProfileSlotP%d.", sSongFullTitle.c_str(), slot+1 );
return false;
}
}
@@ -523,13 +520,13 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath
{
if( pSong == NULL )
{
LOG->Warn( "The edit file '%s' has doesn't have a #SONG tag preceeding the first #NOTES tag.", sEditFilePath.c_str() );
LOG->UserLog( "The edit file '%s' has doesn't have a #SONG tag preceeding the first #NOTES tag.", sEditFilePath.c_str() );
return false;
}
if( iNumParams < 7 )
{
LOG->Trace( "The song file '%s' is has %d fields in a #NOTES tag, but should have at least %d.", sEditFilePath.c_str(), 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 );
continue;
}
@@ -547,7 +544,7 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath
if( pSong->IsEditAlreadyLoaded(pNewNotes) )
{
LOG->Warn( "The edit file '%s' is a duplicate of another edit that was already loaded.", sEditFilePath.c_str() );
LOG->UserLog( "The edit file '%s' is a duplicate of another edit that was already loaded.", sEditFilePath.c_str() );
SAFE_DELETE( pNewNotes );
return false;
}
@@ -557,7 +554,7 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath
}
else
{
LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() );
LOG->UserLog( "The edit file \"%s\" has an unexpected value named '%s'", sEditFilePath.c_str(), sValueName.c_str() );
}
}
+4 -1
View File
@@ -347,7 +347,10 @@ bool NotesWriterDWI::Write( RString sPath, const Song &out )
{
RageFile f;
if( !f.Open( sPath, RageFile::WRITE ) )
RageException::Throw( "Error opening song file \"%s\" for writing: \"%s\"", sPath.c_str(), f.GetError().c_str() );
{
LOG->UserLog( "Error opening song file \"%s\" for writing: \"%s\"", sPath.c_str(), f.GetError().c_str() );
return false;
}
/* Write transliterations, if we have them, since DWI doesn't support UTF-8. */
f.PutLine( ssprintf("#TITLE:%s;", out.GetTranslitFullTitle().c_str()) );
+1 -1
View File
@@ -209,7 +209,7 @@ bool NotesWriterSM::Write( RString sPath, const Song &out, bool bSavingCache )
RageFile f;
if( !f.Open( sPath, flags ) )
{
LOG->Warn( "Error opening song file '%s' for writing: %s", sPath.c_str(), f.GetError().c_str() );
LOG->UserLog( "Error opening song file '%s' for writing: %s", sPath.c_str(), f.GetError().c_str() );
return false;
}
+3 -3
View File
@@ -245,8 +245,8 @@ void PlayerOptions::FromString( const RString &sOptions, bool bWarnOnInvalid )
{
if( bWarnOnInvalid )
{
LOG->Warn( "Invalid player options '%s'; did you mean '*%d'?",
s->c_str(), atoi(*s) );
LOG->UserLog( "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?
speed = StringToFloat( *s );
@@ -361,7 +361,7 @@ 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->Warn( "%s", sWarning.c_str() );
LOG->UserLog( "%s", sWarning.c_str() );
Dialog::OK( sWarning, "INVALID_PLAYER_OPTION_WARNING" );
}
}
+1 -1
View File
@@ -119,7 +119,7 @@ SoundReader *SoundReader_FileReader::OpenFile( RString filename, RString &error
SoundReader_FileReader *NewSample = TryOpenFile( filename, error, *it, bKeepTrying );
if( NewSample )
{
LOG->Warn("File \"%s\" is really %s", filename.c_str(), it->c_str());
LOG->UserLog( "File \"%s\" is really %s", filename.c_str(), it->c_str() );
return NewSample;
}
}
+2 -2
View File
@@ -105,10 +105,10 @@ RageSurface *RageSurfaceUtils::LoadFile( const RString &sPath, RString &error, b
for( set<RString>::iterator it = FileTypes.begin(); bKeepTrying && it != FileTypes.end(); ++it )
{
RageSurface *ret = TryOpenFile( sPath, bHeaderOnly, error, *it, bKeepTrying );
RageSurface *ret = TryOpenFile( sPath, bHeaderOnly, error, *it, bKeepTrying );
if( ret )
{
LOG->Warn("File \"%s\" is really %s", sPath.c_str(), it->c_str());
LOG->UserLog( "File \"%s\" is really %s", sPath.c_str(), it->c_str() );
return ret;
}
}
+14 -15
View File
@@ -236,7 +236,7 @@ bool Song::LoadFromSongDir( RString sDir )
}
else
{
LOG->Warn( "Couldn't find any SM, DWI, BMS, or KSF files in '%s'.", sDir.c_str() );
LOG->UserLog( "Couldn't find any SM, DWI, BMS, or KSF files in '%s'.", sDir.c_str() );
vector<RString> vs;
GetDirListing( sDir + "*.mp3", vs, false, false );
@@ -245,7 +245,7 @@ bool Song::LoadFromSongDir( RString sDir )
if( !bHasMusic )
{
LOG->Warn( "No music file in this directory either. Ignoring this song directory." );
LOG->UserLog( "No music file in this directory either. Ignoring this song directory." );
return false;
}
@@ -277,7 +277,7 @@ bool Song::LoadFromSongDir( RString sDir )
if( !m_bHasMusic )
{
LOG->Trace( "Song \"%s\" ignored (no music)", sDir.c_str() );
LOG->UserLog( "Song \"%s\" ignored (no music)", sDir.c_str() );
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->Warn( "Error opening sound \"%s\": %s", GetMusicPath().c_str(), error.c_str() );
LOG->UserLog( "Error opening sound \"%s\": %s", GetMusicPath().c_str(), error.c_str() );
/* Don't use this file. */
m_sMusicFile = "";
@@ -366,19 +366,19 @@ void Song::TidyUpData()
}
else if( m_fMusicLengthSeconds == 0 )
{
LOG->Warn( "File %s is empty?", GetMusicPath().c_str() );
LOG->UserLog( "File \"%s\" is empty?", GetMusicPath().c_str() );
}
}
}
else // ! HasMusic()
{
m_fMusicLengthSeconds = 100; // guess
LOG->Warn("Song \"%s\" has no music file; guessing at %f seconds", this->GetSongDir().c_str(), m_fMusicLengthSeconds);
LOG->UserLog( "Song \"%s\" has no music file; guessing at %f seconds", this->GetSongDir().c_str(), m_fMusicLengthSeconds );
}
if(m_fMusicLengthSeconds < 0)
if( m_fMusicLengthSeconds < 0 )
{
LOG->Warn( "File %s has negative length? (%f)", GetMusicPath().c_str(), m_fMusicLengthSeconds );
LOG->UserLog( "File %s has negative length? (%f)", GetMusicPath().c_str(), m_fMusicLengthSeconds );
m_fMusicLengthSeconds = 0;
}
@@ -403,10 +403,8 @@ void Song::TidyUpData()
if( m_Timing.m_BPMSegments.empty() )
{
/* XXX: Once we have a way to display warnings that the user actually
* cares about (unlike most warnings), this should be one of them. */
LOG->Warn( "No BPM segments specified in '%s%s', default provided.",
m_sSongDir.c_str(), m_sSongFileName.c_str() );
LOG->UserLog( "No BPM segments specified in '%s%s', default provided.",
m_sSongDir.c_str(), m_sSongFileName.c_str() );
m_Timing.AddBPMSegment( BPMSegment(0, 60) );
}
@@ -529,7 +527,7 @@ void Song::TidyUpData()
RageSurface *img = RageSurfaceUtils::LoadFile( sPath, error, true );
if( !img )
{
LOG->Trace( "Couldn't load '%s': %s", sPath.c_str(), error.c_str() );
LOG->UserLog( "Couldn't load '%s': %s", sPath.c_str(), error.c_str() );
continue;
}
@@ -741,9 +739,10 @@ void Song::Save()
if( !FileCopy( sOldPath, sNewPath ) )
{
LOG->Warn( "Backup of \"%s\" failed", sOldPath.c_str() );
LOG->UserLog( "Backup of \"%s\" failed", sOldPath.c_str() );
/* Don't remove. */
} else
}
else
FILEMAN->Remove( sOldPath );
}
}