From d2ea94648e7be1343d9c66097967b5111caa59ae Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Mon, 20 May 2013 17:47:58 -0400 Subject: [PATCH 1/4] Ensure a decent sample length. Apparently some versions of DWI messed this up. Thank (or blame) confuzled if this fails. --- src/NotesLoaderDWI.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/NotesLoaderDWI.cpp b/src/NotesLoaderDWI.cpp index 4009744d9a..4ffb97d1cc 100644 --- a/src/NotesLoaderDWI.cpp +++ b/src/NotesLoaderDWI.cpp @@ -632,7 +632,15 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set &Bla out.m_fMusicSampleStartSeconds = ParseBrokenDWITimestamp(sParams[1], sParams[2], sParams[3]); else if( sValueName.EqualsNoCase("SAMPLELENGTH") ) - out.m_fMusicSampleLengthSeconds = ParseBrokenDWITimestamp(sParams[1], sParams[2], sParams[3]); + { + float sampleLength = ParseBrokenDWITimestamp(sParams[1], sParams[2], sParams[3]); + if (sampleLength > 0 && sampleLength < 1) { + // there were multiple versions of this tag allegedly: ensure a decent length if requested. + sampleLength *= 1000; + } + out.m_fMusicSampleLengthSeconds = sampleLength; + + } else if( sValueName.EqualsNoCase("FREEZE") ) { From eaf79353f927d78b2a4ffaea076d2a2032a1ace7 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Mon, 20 May 2013 18:06:25 -0400 Subject: [PATCH 2/4] Adjust Dancing Monkey modified files. Sometimes it sucks watching over others' bugs. --- src/NotesLoaderDWI.cpp | 13 +++++++++++++ src/NotesLoaderSM.cpp | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/NotesLoaderDWI.cpp b/src/NotesLoaderDWI.cpp index 4ffb97d1cc..82d200b390 100644 --- a/src/NotesLoaderDWI.cpp +++ b/src/NotesLoaderDWI.cpp @@ -743,6 +743,19 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set &Bla // do nothing. We don't care about this value name } } + + if (out.m_sArtist == "The Dancing Monkeys Project" && out.m_sMainTitle.find_first_of('-') != string::npos) + { + // Dancing Monkeys had a bug/feature where the artist was replaced. Restore it. + vector titleParts; + split(out.m_sMainTitle, "-", titleParts); + out.m_sArtist = titleParts.front; + Trim(out.m_sArtist); + titleParts.erase(titleParts.begin()); + out.m_sMainTitle = join("-", titleParts); + Trim(out.m_sMainTitle); + } + return true; } diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index 17e6f55162..23e0a25cab 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -965,6 +965,18 @@ bool SMLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache LOG->UserLog( "Song file", sPath, "has an unexpected value named \"%s\".", sValueName.c_str() ); } + if (out.m_sArtist == "The Dancing Monkeys Project" && out.m_sMainTitle.find_first_of('-') != string::npos) + { + // Dancing Monkeys had a bug/feature where the artist was replaced. Restore it. + vector titleParts; + split(out.m_sMainTitle, "-", titleParts); + out.m_sArtist = titleParts.front; + Trim(out.m_sArtist); + titleParts.erase(titleParts.begin()); + out.m_sMainTitle = join("-", titleParts); + Trim(out.m_sMainTitle); + } + // Turn negative time changes into warps ProcessBPMsAndStops(out.m_SongTiming, vBPMChanges, vStops); out.m_SongTiming.SortSegments( SEGMENT_WARP ); From c6ec5a4390cde8d13d1ec05acdc3ff69d8a5eeda Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Mon, 20 May 2013 18:07:28 -0400 Subject: [PATCH 3/4] Forced to invalidate the cache due to the commits. Cue the hate! --- src/Song.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Song.cpp b/src/Song.cpp index 54b5241986..7f67491f7d 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -42,7 +42,7 @@ * @brief The internal version of the cache for StepMania. * * Increment this value to invalidate the current cache. */ -const int FILE_CACHE_VERSION = 208; +const int FILE_CACHE_VERSION = 210; /** @brief How long does a song sample last by default? */ const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f; From 9c61d060f078063392f42e2f979aa8691d4ad841 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Mon, 20 May 2013 18:12:36 -0400 Subject: [PATCH 4/4] Fix compile, put in the right spot. Thanks Henke. --- src/NotesLoaderDWI.cpp | 12 ------------ src/NotesLoaderSM.cpp | 12 ------------ src/Song.cpp | 12 ++++++++++++ 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/NotesLoaderDWI.cpp b/src/NotesLoaderDWI.cpp index 82d200b390..55a408b58e 100644 --- a/src/NotesLoaderDWI.cpp +++ b/src/NotesLoaderDWI.cpp @@ -744,18 +744,6 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set &Bla } } - if (out.m_sArtist == "The Dancing Monkeys Project" && out.m_sMainTitle.find_first_of('-') != string::npos) - { - // Dancing Monkeys had a bug/feature where the artist was replaced. Restore it. - vector titleParts; - split(out.m_sMainTitle, "-", titleParts); - out.m_sArtist = titleParts.front; - Trim(out.m_sArtist); - titleParts.erase(titleParts.begin()); - out.m_sMainTitle = join("-", titleParts); - Trim(out.m_sMainTitle); - } - return true; } diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index 23e0a25cab..17e6f55162 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -965,18 +965,6 @@ bool SMLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache LOG->UserLog( "Song file", sPath, "has an unexpected value named \"%s\".", sValueName.c_str() ); } - if (out.m_sArtist == "The Dancing Monkeys Project" && out.m_sMainTitle.find_first_of('-') != string::npos) - { - // Dancing Monkeys had a bug/feature where the artist was replaced. Restore it. - vector titleParts; - split(out.m_sMainTitle, "-", titleParts); - out.m_sArtist = titleParts.front; - Trim(out.m_sArtist); - titleParts.erase(titleParts.begin()); - out.m_sMainTitle = join("-", titleParts); - Trim(out.m_sMainTitle); - } - // Turn negative time changes into warps ProcessBPMsAndStops(out.m_SongTiming, vBPMChanges, vStops); out.m_SongTiming.SortSegments( SEGMENT_WARP ); diff --git a/src/Song.cpp b/src/Song.cpp index 7f67491f7d..d28ae5398b 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -465,6 +465,18 @@ void Song::TidyUpData( bool fromCache, bool /* duringCache */ ) FixupPath( m_sBackgroundFile, m_sSongDir ); FixupPath( m_sCDTitleFile, m_sSongDir ); + if (this->m_sArtist == "The Dancing Monkeys Project" && this->m_sMainTitle.find_first_of('-') != string::npos) + { + // Dancing Monkeys had a bug/feature where the artist was replaced. Restore it. + vector titleParts; + split(this->m_sMainTitle, "-", titleParts); + this->m_sArtist = titleParts.front(); + Trim(this->m_sArtist); + titleParts.erase(titleParts.begin()); + this->m_sMainTitle = join("-", titleParts); + Trim(this->m_sMainTitle); + } + if( !HasMusic() ) { vector arrayPossibleMusic;