song: update .ssc version to v0.51

.ssc v0.51: make version the very first tag, limit it to two decimal places.
This commit is contained in:
AJ Kelly
2011-02-13 11:06:34 -06:00
parent 39aa06f306
commit 0c756e1e75
3 changed files with 185 additions and 202 deletions
+21 -33
View File
@@ -138,7 +138,12 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
{
case GETTING_SONG_INFO:
{
if( sValueName=="TITLE" )
if( sValueName=="VERSION" )
{
out.m_fVersion = StringToFloat( sParams[1] );
}
else if( sValueName=="TITLE" )
{
out.m_sMainTitle = sParams[1];
}
@@ -168,11 +173,6 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
out.m_sArtistTranslit = sParams[1];
}
else if( sValueName=="VERSION" )
{
out.m_fVersion = StringToFloat( sParams[1] );
}
else if( sValueName=="GENRE" )
{
out.m_sGenre = sParams[1];
@@ -239,7 +239,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
else if( sValueName=="MUSICBYTES" )
{
; /* ignore */
; // ignore
}
else if( sValueName=="SAMPLESTART" )
@@ -380,11 +380,8 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
{
out.m_Timing.m_fBeat0OffsetInSeconds = StringToFloat( sParams[1] );
}
/*
* Below are the song based timings that
* should only be used if the steps do
* not have their own timing.
*/
/* Below are the song based timings that should only be used
* if the steps do not have their own timing. */
else if( sValueName=="STOPS" )
{
vector<RString> arrayFreezeExpressions;
@@ -398,7 +395,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
{
// XXX: Hard to tell which file caused this.
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.",
sValueName.c_str(), arrayFreezeExpressions[f].c_str() );
sValueName.c_str(), arrayFreezeExpressions[f].c_str() );
continue;
}
@@ -437,7 +434,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
{
// XXX: Hard to tell which file caused this.
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.",
sValueName.c_str(), arrayDelayExpressions[f].c_str() );
sValueName.c_str(), arrayDelayExpressions[f].c_str() );
continue;
}
@@ -468,15 +465,13 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
if( arrayBPMChangeValues.size() != 2 )
{
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.",
sValueName.c_str(), arrayBPMChangeExpressions[b].c_str() );
sValueName.c_str(), arrayBPMChangeExpressions[b].c_str() );
continue;
}
const float fBeat = StringToFloat( arrayBPMChangeValues[0] );
const float fNewBPM = StringToFloat( arrayBPMChangeValues[1] );
if(fNewBPM > 0.0f)
out.m_Timing.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) );
else
@@ -549,7 +544,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
{
// XXX: Hard to tell which file caused this.
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.",
sValueName.c_str(), arrayTickcountExpressions[f].c_str() );
sValueName.c_str(), arrayTickcountExpressions[f].c_str() );
continue;
}
@@ -581,7 +576,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
if( arrayComboValues.size() != 2 )
{
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.",
sValueName.c_str(), arrayComboExpressions[f].c_str() );
sValueName.c_str(), arrayComboExpressions[f].c_str() );
continue;
}
const float fComboBeat = StringToFloat( arrayComboValues[0] );
@@ -592,11 +587,8 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
*/
}
/*
* The following are cache tags.
* Never fill their values directly:
* only from the cached version.
*/
/* The following are cache tags. Never fill their values
* directly: only from the cached version. */
else if( sValueName=="FIRSTBEAT" )
{
if( bFromCache )
@@ -700,15 +692,13 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
if( arrayBPMChangeValues.size() != 2 )
{
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.",
sValueName.c_str(), arrayBPMChangeExpressions[b].c_str() );
sValueName.c_str(), arrayBPMChangeExpressions[b].c_str() );
continue;
}
const float fBeat = StringToFloat( arrayBPMChangeValues[0] );
const float fNewBPM = StringToFloat( arrayBPMChangeValues[1] );
if(fNewBPM > 0.0f)
pNewNotes->m_Timing.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) );
else
@@ -741,7 +731,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
{
// XXX: Hard to tell which file caused this.
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.",
sValueName.c_str(), arrayFreezeExpressions[f].c_str() );
sValueName.c_str(), arrayFreezeExpressions[f].c_str() );
continue;
}
@@ -782,7 +772,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
{
// XXX: Hard to tell which file caused this.
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.",
sValueName.c_str(), arrayDelayExpressions[f].c_str() );
sValueName.c_str(), arrayDelayExpressions[f].c_str() );
continue;
}
@@ -861,7 +851,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
{
// XXX: Hard to tell which file caused this.
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.",
sValueName.c_str(), arrayTickcountExpressions[f].c_str() );
sValueName.c_str(), arrayTickcountExpressions[f].c_str() );
continue;
}
@@ -881,7 +871,6 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
}
*/
}
else if( sValueName=="COMBOS" )
{
/*
@@ -895,7 +884,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
if( arrayComboValues.size() != 2 )
{
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.",
sValueName.c_str(), arrayComboExpressions[f].c_str() );
sValueName.c_str(), arrayComboExpressions[f].c_str() );
continue;
}
const float fComboBeat = StringToFloat( arrayComboValues[0] );
@@ -913,7 +902,6 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
else if( sValueName=="NOTES" )
{
state = GETTING_SONG_INFO;
// pNewNotes->m_Timing.m_fBeat0OffsetInSeconds = out.m_Timing.m_fBeat0OffsetInSeconds;
pNewNotes->SetSMNoteData( sParams[1] );
+9 -13
View File
@@ -39,14 +39,13 @@ static RString BackgroundChangeToString( const BackgroundChange &bgc )
static void WriteGlobalTags( RageFile &f, const Song &out )
{
//f.PutLine( ssprintf( "#SMVERSION:;", SmEscape(RString("ssc-v1.0")).c_str() ) );
f.PutLine( ssprintf( "#VERSION:%.2f;", out.m_fVersion ) );
f.PutLine( ssprintf( "#TITLE:%s;", SmEscape(out.m_sMainTitle).c_str() ) );
f.PutLine( ssprintf( "#SUBTITLE:%s;", SmEscape(out.m_sSubTitle).c_str() ) );
f.PutLine( ssprintf( "#ARTIST:%s;", SmEscape(out.m_sArtist).c_str() ) );
f.PutLine( ssprintf( "#TITLETRANSLIT:%s;", SmEscape(out.m_sMainTitleTranslit).c_str() ) );
f.PutLine( ssprintf( "#SUBTITLETRANSLIT:%s;", SmEscape(out.m_sSubTitleTranslit).c_str() ) );
f.PutLine( ssprintf( "#ARTISTTRANSLIT:%s;", SmEscape(out.m_sArtistTranslit).c_str() ) );
f.PutLine( ssprintf( "#VERSION:%f;", out.m_fVersion ) );
f.PutLine( ssprintf( "#GENRE:%s;", SmEscape(out.m_sGenre).c_str() ) );
f.PutLine( ssprintf( "#CREDIT:%s;", SmEscape(out.m_sCredit).c_str() ) );
f.PutLine( ssprintf( "#BANNER:%s;", SmEscape(out.m_sBannerFile).c_str() ) );
@@ -98,7 +97,6 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
break;
}
f.Write( "#BPMS:" );
for( unsigned i=0; i<out.m_Timing.m_BPMSegments.size(); i++ )
{
@@ -200,10 +198,10 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
FOREACH_CONST( BackgroundChange, out.GetBackgroundChanges(b), bgc )
f.PutLine( BackgroundChangeToString(*bgc)+"," );
/* If there's an animation plan at all, add a dummy "-nosongbg-" tag to indicate that
* this file doesn't want a song BG entry added at the end. See SSCLoader::TidyUpData.
* This tag will be removed on load. Add it at a very high beat, so it won't cause
* problems if loaded in older versions. */
/* If there's an animation plan at all, add a dummy "-nosongbg-" tag to
* indicate that this file doesn't want a song BG entry added at the end.
* See SSCLoader::TidyUpData. This tag will be removed on load. Add it
* at a very high beat, so it won't cause problems if loaded in older versions. */
if( b==0 && !out.GetBackgroundChanges(b).empty() )
f.PutLine( "99999=-nosongbg-=1.000=0=0=0 // don't automatically add -songbackground-" );
f.PutLine( ";" );
@@ -235,7 +233,7 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
f.Write( ssprintf( "%s", sData.c_str() ) );
if( a != (out.m_sAttackString.size() - 1) )
f.Write( ":" ); // Not the end, so write a divider ':'
f.Write( ":" ); // Not the end, so write a divider ':'
}
f.PutLine( ";" );
}
@@ -245,7 +243,7 @@ static RString JoinLineList( vector<RString> &lines )
for( unsigned i = 0; i < lines.size(); ++i )
TrimRight( lines[i] );
/* Skip leading blanks. */
// Skip leading blanks.
unsigned j = 0;
while( j < lines.size() && lines.size() == 0 )
++j;
@@ -278,7 +276,7 @@ static RString GetSSCNotesTag( const Song &song, const Steps &in, bool bSavingCa
lines.push_back( ssprintf( "#CREDIT:%s;", SmEscape(in.GetCredit()).c_str() ) );
// TODO: Remove this block, uncommon below block for Split Timing. -Wolfman2000
// TODO: Remove this block, uncomment below block for Split Timing. -Wolfman2000
lines.push_back( "#BPMS:;" );
lines.push_back( "#STOPS:;" );
lines.push_back( "#DELAYS:;" );
@@ -319,7 +317,6 @@ static RString GetSSCNotesTag( const Song &song, const Steps &in, bool bSavingCa
}
lines.push_back( ssprintf( "#DELAYS:%s;", join("\n,", asDelayValues).c_str() ) );
ASSERT( !in.m_Timing.m_vTimeSignatureSegments.empty() );
vector<RString> asTimeSigValues;
FOREACH_CONST( TimeSignatureSegment, in.m_Timing.m_vTimeSignatureSegments, iter )
@@ -358,7 +355,6 @@ static RString GetSSCNotesTag( const Song &song, const Steps &in, bool bSavingCa
lines.push_back( song.m_vsKeysoundFile.empty() ? "#NOTES:" : "#NOTES2:" );
split( sNoteData, "\n", lines, true );
lines.push_back( ";" );
@@ -370,7 +366,7 @@ bool NotesWriterSSC::Write( RString sPath, const Song &out, const vector<Steps*>
int flags = RageFile::WRITE;
/* If we're not saving cache, we're saving real data, so enable SLOW_FLUSH
* to prevent data loss. If we're saving cache, this will slow things down
* to prevent data loss. If we're saving cache, this will slow things down
* too much. */
if( !bSavingCache )
flags |= RageFile::SLOW_FLUSH;
+1 -2
View File
@@ -36,6 +36,7 @@
#include <set>
#include <float.h>
const static float VERSION_NUMBER = 0.51f;
const int FILE_CACHE_VERSION = 163; // increment this to invalidate cache
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
@@ -52,8 +53,6 @@ static const char *InstrumentTrackNames[] = {
XToString( InstrumentTrack );
StringToX( InstrumentTrack );
const static float VERSION_NUMBER = 0.5f;
Song::Song()
{
FOREACH_BackgroundLayer( i )