diff --git a/src/NotesLoaderSSC.cpp b/src/NotesLoaderSSC.cpp index 810c8d9599..332bcfd007 100644 --- a/src/NotesLoaderSSC.cpp +++ b/src/NotesLoaderSSC.cpp @@ -1075,6 +1075,7 @@ bool SSCLoader::LoadEditFromMsd(const MsdFile &msd, StepsTagInfo reused_steps_info(&*this, pSong, sEditFilePath, false); reused_steps_info.for_load_edit= true; + reused_steps_info.timing= &stepsTiming; for(unsigned int i = 0; i < msd.GetNumValues(); ++i) { @@ -1088,7 +1089,7 @@ bool SSCLoader::LoadEditFromMsd(const MsdFile &msd, reused_steps_info.params= &sParams; steps_handler_map_t::iterator handler= parser_helper.steps_tag_handlers.find(sValueName); - if(handler != parser_helper.steps_tag_handlers.end()) + if(pNewNotes != NULL && handler != parser_helper.steps_tag_handlers.end()) { handler->second(reused_steps_info); } @@ -1180,6 +1181,7 @@ bool SSCLoader::LoadEditFromMsd(const MsdFile &msd, this->SetSongTitle(sParams[1]); sSongFullTitle.Replace('\\', '/'); pSong = SONGMAN->FindSong(sSongFullTitle); + reused_steps_info.song= pSong; if(pSong == NULL) { LOG->UserLog("Edit file", sEditFilePath, diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 021fc87e83..bc8c590d9e 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -20,6 +20,7 @@ #include "NotesWriterSM.h" #include "PrefsManager.h" #include "RageSoundManager.h" +#include "RageSoundReader_FileReader.h" #include "RageInput.h" #include "RageLog.h" #include "ScreenDimensions.h" @@ -4457,7 +4458,25 @@ static void ChangeCredit( const RString &sNew ) static void ChangePreview(const RString& sNew) { Song* pSong = GAMESTATE->m_pCurSong; - pSong->m_PreviewFile= sNew; + if(!sNew.empty()) + { + RString error; + RageSoundReader* sample= RageSoundReader_FileReader::OpenFile(pSong->GetPreviewMusicPath(), error); + if(sample == NULL) + { + LOG->UserLog( "Preview file", pSong->GetPreviewMusicPath(), "couldn't be opened: %s", error.c_str() ); + } + else + { + pSong->m_fMusicSampleLengthSeconds= sample->GetLength() / 1000.0f; + pSong->m_PreviewFile= sNew; + delete sample; + } + } + else + { + pSong->m_PreviewFile= sNew; + } } static void ChangeMainTitleTranslit( const RString &sNew ) diff --git a/src/Song.cpp b/src/Song.cpp index 6009d6e0dd..e9726ffd5b 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -627,22 +627,6 @@ void Song::TidyUpData( bool fromCache, bool /* duringCache */ ) m_fMusicLengthSeconds); } - if(!m_PreviewFile.empty() && m_fMusicSampleStartSeconds == -1) - { - RString error; - RageSoundReader* sample= RageSoundReader_FileReader::OpenFile(GetPreviewMusicPath(), error); - if(sample == NULL) - { - LOG->UserLog( "Preview file", GetPreviewMusicPath(), "couldn't be opened: %s", error.c_str() ); - m_PreviewFile= ""; - } - else - { - m_fMusicSampleLengthSeconds= sample->GetLength() / 1000.0f; - delete sample; - } - } - if( m_fMusicLengthSeconds < 0 ) { LOG->UserLog("Sound file",