attempt to load .sm files if loading .ssc files fails
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "TimingData.h"
|
#include "TimingData.h"
|
||||||
#include "NotesLoaderSSC.h"
|
#include "NotesLoaderSSC.h"
|
||||||
|
#include "NotesLoaderSM.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "RageDisplay.h"
|
#include "RageDisplay.h"
|
||||||
#include "AnnouncerManager.h"
|
#include "AnnouncerManager.h"
|
||||||
@@ -150,6 +151,15 @@ static void StartMusic( MusicToPlay &ToPlay )
|
|||||||
if( pStepsCabinetLights )
|
if( pStepsCabinetLights )
|
||||||
pStepsCabinetLights->GetNoteData( ToPlay.m_LightsData );
|
pStepsCabinetLights->GetNoteData( ToPlay.m_LightsData );
|
||||||
}
|
}
|
||||||
|
else if( SMLoader::LoadFromSMFile(ToPlay.m_sTimingFile, song) )
|
||||||
|
{
|
||||||
|
ToPlay.HasTiming = true;
|
||||||
|
ToPlay.m_TimingData = song.m_Timing;
|
||||||
|
// get cabinet lights if any
|
||||||
|
Steps *pStepsCabinetLights = SongUtil::GetOneSteps( &song, StepsType_lights_cabinet );
|
||||||
|
if( pStepsCabinetLights )
|
||||||
|
pStepsCabinetLights->GetNoteData( ToPlay.m_LightsData );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ToPlay.HasTiming )
|
if( ToPlay.HasTiming )
|
||||||
@@ -704,6 +714,7 @@ void GameSoundManager::PlayMusic( PlayMusicParams params, PlayMusicParams Fallba
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* If no timing data was provided, look for it in the same place as the music file. */
|
/* If no timing data was provided, look for it in the same place as the music file. */
|
||||||
|
// todo: allow loading .ssc files as well -aj
|
||||||
ToPlay.m_sTimingFile = SetExtension( params.sFile, "sm" );
|
ToPlay.m_sTimingFile = SetExtension( params.sFile, "sm" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-1
@@ -223,8 +223,15 @@ bool Song::LoadFromSongDir( RString sDir )
|
|||||||
if( bUseCache )
|
if( bUseCache )
|
||||||
{
|
{
|
||||||
// LOG->Trace( "Loading '%s' from cache file '%s'.", m_sSongDir.c_str(), GetCacheFilePath().c_str() );
|
// LOG->Trace( "Loading '%s' from cache file '%s'.", m_sSongDir.c_str(), GetCacheFilePath().c_str() );
|
||||||
SSCLoader::LoadFromSSCFile( sCacheFilePath, *this, true );
|
bool bLoadedFromSSC = SSCLoader::LoadFromSSCFile( sCacheFilePath, *this, true );
|
||||||
|
if( bLoadedFromSSC )
|
||||||
SSCLoader::TidyUpData( *this, true );
|
SSCLoader::TidyUpData( *this, true );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// load from .sm
|
||||||
|
SMLoader::LoadFromSMFile( sCacheFilePath, *this, true );
|
||||||
|
SMLoader::TidyUpData( *this, true );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-2
@@ -21,6 +21,7 @@
|
|||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "NoteDataUtil.h"
|
#include "NoteDataUtil.h"
|
||||||
#include "NotesLoaderSSC.h"
|
#include "NotesLoaderSSC.h"
|
||||||
|
#include "NotesLoaderSM.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -229,13 +230,18 @@ void Steps::Decompress() const
|
|||||||
|
|
||||||
if( !m_sFilename.empty() && m_sNoteDataCompressed.empty() )
|
if( !m_sFilename.empty() && m_sNoteDataCompressed.empty() )
|
||||||
{
|
{
|
||||||
/* We have data on disk and not in memory. Load it. */
|
// We have data on disk and not in memory. Load it.
|
||||||
Song s;
|
Song s;
|
||||||
if( !SSCLoader::LoadFromSSCFile(m_sFilename, s, true) )
|
bool bLoadedFromSSC = SSCLoader::LoadFromSSCFile(m_sFilename, s, true);
|
||||||
|
if( !bLoadedFromSSC )
|
||||||
|
{
|
||||||
|
// try reading from .sm instead
|
||||||
|
if( !SMLoader::LoadFromSMFile(m_sFilename, s, true) )
|
||||||
{
|
{
|
||||||
LOG->Warn( "Couldn't load \"%s\"", m_sFilename.c_str() );
|
LOG->Warn( "Couldn't load \"%s\"", m_sFilename.c_str() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Find the steps. */
|
/* Find the steps. */
|
||||||
StepsID ID;
|
StepsID ID;
|
||||||
|
|||||||
Reference in New Issue
Block a user