From 1d5f4379bc1b4e9d66e87fea4cfd6ee6eaaf51c4 Mon Sep 17 00:00:00 2001 From: Patrick McIlroy Date: Sat, 21 Jul 2012 00:39:18 -0700 Subject: [PATCH] Fix edgecases presented by bugzilla #740: fallback to .sm file if .ssc file in cache is missing --- src/Steps.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Steps.cpp b/src/Steps.cpp index 83f0ab3445..70c6edc168 100644 --- a/src/Steps.cpp +++ b/src/Steps.cpp @@ -108,7 +108,27 @@ bool Steps::GetNoteDataFromSimfile() if (extension.empty() || extension == "ssc") // remember cache files. { SSCLoader loader; - return loader.LoadNoteDataFromSimfile(stepFile, *this); + if ( ! loader.LoadNoteDataFromSimfile(stepFile, *this) ) + { + /* + HACK: 7/20/12 -- see bugzilla #740 + users who edit songs using the ever popular .sm file + that remove or tamper with the .ssc file later on + complain of blank steps in the editor after reloading. + Despite the blank steps being well justified since + the cache files contain only the SSC step file, + give the user some leeway and search for a .sm replacement + */ + SMLoader backup_loader; + RString transformedStepFile = stepFile; + transformedStepFile.Replace(".ssc", ".sm"); + + return backup_loader.LoadNoteDataFromSimfile(transformedStepFile, *this); + } + else + { + return true; + } } else if (extension == "sm") {