Get SSCLoader used when appropriate.
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "TimingData.h"
|
#include "TimingData.h"
|
||||||
#include "NotesLoaderSM.h"
|
#include "NotesLoaderSSC.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "RageDisplay.h"
|
#include "RageDisplay.h"
|
||||||
#include "AnnouncerManager.h"
|
#include "AnnouncerManager.h"
|
||||||
@@ -141,7 +141,7 @@ static void StartMusic( MusicToPlay &ToPlay )
|
|||||||
{
|
{
|
||||||
LOG->Trace( "Found '%s'", ToPlay.m_sTimingFile.c_str() );
|
LOG->Trace( "Found '%s'", ToPlay.m_sTimingFile.c_str() );
|
||||||
Song song;
|
Song song;
|
||||||
if( SMLoader::LoadFromSMFile(ToPlay.m_sTimingFile, song) )
|
if( SSCLoader::LoadFromSSCFile(ToPlay.m_sTimingFile, song) )
|
||||||
{
|
{
|
||||||
ToPlay.HasTiming = true;
|
ToPlay.HasTiming = true;
|
||||||
ToPlay.m_TimingData = song.m_Timing;
|
ToPlay.m_TimingData = song.m_Timing;
|
||||||
|
|||||||
+7
-3
@@ -1,6 +1,7 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "NotesLoader.h"
|
#include "NotesLoader.h"
|
||||||
#include "NotesLoaderSM.h"
|
#include "NotesLoaderSM.h"
|
||||||
|
#include "NotesLoaderSSC.h"
|
||||||
#include "NotesLoaderDWI.h"
|
#include "NotesLoaderDWI.h"
|
||||||
#include "NotesLoaderBMS.h"
|
#include "NotesLoaderBMS.h"
|
||||||
#include "NotesLoaderPMS.h"
|
#include "NotesLoaderPMS.h"
|
||||||
@@ -30,14 +31,17 @@ bool NotesLoader::LoadFromDir( const RString &sPath, Song &out, set<RString> &Bl
|
|||||||
vector<RString> list;
|
vector<RString> list;
|
||||||
|
|
||||||
BlacklistedImages.clear();
|
BlacklistedImages.clear();
|
||||||
SMLoader::GetApplicableFiles( sPath, list );
|
SSCLoader::GetApplicableFiles( sPath, list );
|
||||||
if( !list.empty() )
|
if( !list.empty() )
|
||||||
{
|
{
|
||||||
if( !SMLoader::LoadFromDir(sPath, out) )
|
if( !SSCLoader::LoadFromDir( sPath, out ) )
|
||||||
return false;
|
return false;
|
||||||
SMLoader::TidyUpData( out, false );
|
SSCLoader::TidyUpData( out, false );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
SMLoader::GetApplicableFiles( sPath, list );
|
||||||
|
if (!list.empty() )
|
||||||
|
return SMLoader::LoadFromDir( sPath, out );
|
||||||
DWILoader::GetApplicableFiles( sPath, list );
|
DWILoader::GetApplicableFiles( sPath, list );
|
||||||
if( !list.empty() )
|
if( !list.empty() )
|
||||||
return DWILoader::LoadFromDir( sPath, out, BlacklistedImages );
|
return DWILoader::LoadFromDir( sPath, out, BlacklistedImages );
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* NotesWriterSM - Writes a Song to an .SSC file. */
|
/* NotesWriterSSC - Writes a Song to an .SSC file. */
|
||||||
|
|
||||||
#ifndef NOTES_WRITER_SSC_H
|
#ifndef NOTES_WRITER_SSC_H
|
||||||
#define NOTES_WRITER_SSC_H
|
#define NOTES_WRITER_SSC_H
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "ScreenGameplaySyncMachine.h"
|
#include "ScreenGameplaySyncMachine.h"
|
||||||
#include "NotesLoaderSM.h"
|
#include "NotesLoaderSSC.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
@@ -19,7 +19,7 @@ void ScreenGameplaySyncMachine::Init()
|
|||||||
AdjustSync::ResetOriginalSyncData();
|
AdjustSync::ResetOriginalSyncData();
|
||||||
|
|
||||||
RString sFile = THEME->GetPathO("ScreenGameplaySyncMachine","music.sm");
|
RString sFile = THEME->GetPathO("ScreenGameplaySyncMachine","music.sm");
|
||||||
SMLoader::LoadFromSMFile( sFile, m_Song );
|
SSCLoader::LoadFromSSCFile( sFile, m_Song );
|
||||||
m_Song.SetSongDir( Dirname(sFile) );
|
m_Song.SetSongDir( Dirname(sFile) );
|
||||||
m_Song.TidyUpData();
|
m_Song.TidyUpData();
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "NotesLoaderSM.h"
|
#include "NotesLoaderSSC.h"
|
||||||
#include "GameSoundManager.h"
|
#include "GameSoundManager.h"
|
||||||
#include "Model.h"
|
#include "Model.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
@@ -132,7 +132,7 @@ void ScreenHowToPlay::Init()
|
|||||||
ActorUtil::LoadAllCommandsAndSetXY( m_pLifeMeterBar, m_sName );
|
ActorUtil::LoadAllCommandsAndSetXY( m_pLifeMeterBar, m_sName );
|
||||||
m_pLifeMeterBar->FillForHowToPlay( NUM_W2S, NUM_MISSES );
|
m_pLifeMeterBar->FillForHowToPlay( NUM_W2S, NUM_MISSES );
|
||||||
|
|
||||||
SMLoader::LoadFromSMFile( THEME->GetPathO(m_sName, "steps"), m_Song, false );
|
SSCLoader::LoadFromSSCFile( THEME->GetPathO(m_sName, "steps"), m_Song, false );
|
||||||
m_Song.AddAutoGenNotes();
|
m_Song.AddAutoGenNotes();
|
||||||
|
|
||||||
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "PlayerState.h"
|
#include "PlayerState.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
#include "StepMania.h"
|
#include "StepMania.h"
|
||||||
#include "NotesLoaderSM.h"
|
#include "NotesLoaderSSC.h"
|
||||||
|
|
||||||
static LocalizedString BOOKKEEPING_DATA_CLEARED( "ScreenServiceAction", "Bookkeeping data cleared." );
|
static LocalizedString BOOKKEEPING_DATA_CLEARED( "ScreenServiceAction", "Bookkeeping data cleared." );
|
||||||
static RString ClearBookkeepingData()
|
static RString ClearBookkeepingData()
|
||||||
@@ -197,7 +197,7 @@ static void CopyEdits( const RString &sFromProfileDir, const RString &sToProfile
|
|||||||
iNumErrored++;
|
iNumErrored++;
|
||||||
|
|
||||||
// Test whether the song we need for this edit is present and ignore this edit if not present.
|
// Test whether the song we need for this edit is present and ignore this edit if not present.
|
||||||
if( !SMLoader::LoadEditFromFile( sFromDir+*i, ProfileSlot_Machine, false ) )
|
if( !SSCLoader::LoadEditFromFile( sFromDir+*i, ProfileSlot_Machine, false ) )
|
||||||
{
|
{
|
||||||
iNumIgnored++;
|
iNumIgnored++;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+24
-10
@@ -25,8 +25,10 @@
|
|||||||
#include "SpecialFiles.h"
|
#include "SpecialFiles.h"
|
||||||
#include "NotesLoader.h"
|
#include "NotesLoader.h"
|
||||||
#include "NotesLoaderSM.h"
|
#include "NotesLoaderSM.h"
|
||||||
|
#include "NotesLoaderSSC.h"
|
||||||
#include "NotesWriterDWI.h"
|
#include "NotesWriterDWI.h"
|
||||||
#include "NotesWriterSM.h"
|
#include "NotesWriterSM.h"
|
||||||
|
#include "NotesWriterSSC.h"
|
||||||
#include "UnlockManager.h"
|
#include "UnlockManager.h"
|
||||||
#include "LyricsLoader.h"
|
#include "LyricsLoader.h"
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
const int FILE_CACHE_VERSION = 162; // increment this to invalidate cache
|
const int FILE_CACHE_VERSION = 163; // increment this to invalidate cache
|
||||||
|
|
||||||
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
|
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
|
||||||
|
|
||||||
@@ -214,8 +216,8 @@ 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() );
|
||||||
SMLoader::LoadFromSMFile( sCacheFilePath, *this, true );
|
SSCLoader::LoadFromSSCFile( sCacheFilePath, *this, true );
|
||||||
SMLoader::TidyUpData( *this, true );
|
SSCLoader::TidyUpData( *this, true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -844,9 +846,10 @@ void Song::Save()
|
|||||||
TranslateTitles();
|
TranslateTitles();
|
||||||
|
|
||||||
// Save the new files. These calls make backups on their own.
|
// Save the new files. These calls make backups on their own.
|
||||||
if( !SaveToSMFile(GetSongFilePath(), false) )
|
if( !SaveToSSCFile(GetSongFilePath(), false) )
|
||||||
return;
|
return;
|
||||||
SaveToDWIFile();
|
SaveToSMFile();
|
||||||
|
//SaveToDWIFile();
|
||||||
SaveToCacheFile();
|
SaveToCacheFile();
|
||||||
|
|
||||||
/* We've safely written our files and created backups. Rename non-SM and
|
/* We've safely written our files and created backups. Rename non-SM and
|
||||||
@@ -871,10 +874,21 @@ void Song::Save()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Song::SaveToSMFile()
|
||||||
bool Song::SaveToSMFile( RString sPath, bool bSavingCache )
|
|
||||||
{
|
{
|
||||||
LOG->Trace( "Song::SaveToSMFile('%s')", sPath.c_str() );
|
const RString sPath = SetExtension( GetSongFilePath(), "sm" );
|
||||||
|
LOG->Trace( "Song::SaveToSMFile(%s)", sPath.c_str() );
|
||||||
|
|
||||||
|
// If the file exists, make a backup.
|
||||||
|
if( IsAFile(sPath) )
|
||||||
|
FileCopy( sPath, sPath + ".old" );
|
||||||
|
return NotesWriterSM::Write( sPath, *this );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Song::SaveToSSCFile( RString sPath, bool bSavingCache )
|
||||||
|
{
|
||||||
|
LOG->Trace( "Song::SaveToSSCFile('%s')", sPath.c_str() );
|
||||||
|
|
||||||
// If the file exists, make a backup.
|
// If the file exists, make a backup.
|
||||||
if( !bSavingCache && IsAFile(sPath) )
|
if( !bSavingCache && IsAFile(sPath) )
|
||||||
@@ -894,7 +908,7 @@ bool Song::SaveToSMFile( RString sPath, bool bSavingCache )
|
|||||||
vpStepsToSave.push_back( pSteps );
|
vpStepsToSave.push_back( pSteps );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !NotesWriterSM::Write(sPath, *this, vpStepsToSave, bSavingCache) )
|
if( !NotesWriterSSC::Write(sPath, *this, vpStepsToSave, bSavingCache) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !bSavingCache && g_BackUpAllSongSaves.Get() )
|
if( !bSavingCache && g_BackUpAllSongSaves.Get() )
|
||||||
@@ -932,7 +946,7 @@ bool Song::SaveToCacheFile()
|
|||||||
{
|
{
|
||||||
SONGINDEX->AddCacheIndex(m_sSongDir, GetHashForDirectory(m_sSongDir));
|
SONGINDEX->AddCacheIndex(m_sSongDir, GetHashForDirectory(m_sSongDir));
|
||||||
const RString sPath = GetCacheFilePath();
|
const RString sPath = GetCacheFilePath();
|
||||||
if( !SaveToSMFile(sPath, true) )
|
if( !SaveToSSCFile(sPath, true) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FOREACH( Steps*, m_vpSteps, pSteps )
|
FOREACH( Steps*, m_vpSteps, pSteps )
|
||||||
|
|||||||
+8
-6
@@ -61,7 +61,7 @@ public:
|
|||||||
enum SelectionDisplay
|
enum SelectionDisplay
|
||||||
{
|
{
|
||||||
SHOW_ALWAYS, // always
|
SHOW_ALWAYS, // always
|
||||||
SHOW_NEVER // never (unless song hiding is turned off)
|
SHOW_NEVER // never (unless song hiding is turned off)
|
||||||
} m_SelectionDisplay;
|
} m_SelectionDisplay;
|
||||||
|
|
||||||
Song();
|
Song();
|
||||||
@@ -78,9 +78,10 @@ public:
|
|||||||
void ReCalculateRadarValuesAndLastBeat(); // called by TidyUpData, and after saving
|
void ReCalculateRadarValuesAndLastBeat(); // called by TidyUpData, and after saving
|
||||||
void TranslateTitles(); // called by TidyUpData
|
void TranslateTitles(); // called by TidyUpData
|
||||||
|
|
||||||
bool SaveToSMFile( RString sPath, bool bSavingCache );
|
bool SaveToSSCFile( RString sPath, bool bSavingCache );
|
||||||
void Save(); // saves SM and DWI
|
void Save(); // saves SSC and SM guaranteed.
|
||||||
bool SaveToCacheFile();
|
bool SaveToCacheFile();
|
||||||
|
bool SaveToSMFile();
|
||||||
bool SaveToDWIFile();
|
bool SaveToDWIFile();
|
||||||
|
|
||||||
const RString &GetSongFilePath() const;
|
const RString &GetSongFilePath() const;
|
||||||
@@ -93,9 +94,10 @@ public:
|
|||||||
// Directory this song data came from:
|
// Directory this song data came from:
|
||||||
const RString &GetSongDir() const { return m_sSongDir; }
|
const RString &GetSongDir() const { return m_sSongDir; }
|
||||||
|
|
||||||
/* Filename associated with this file. This will always have an .SM extension.
|
/* Filename associated with this file. This will always have a
|
||||||
* If we loaded an .SM, this will point to it, but if we loaded any other
|
* .SSC extension. If we loaded a .SSC, this will point to it,
|
||||||
* type, this will point to a generated .SM filename. */
|
* but if we loaded any other type, this will point to a
|
||||||
|
* generated .SSC filename. */
|
||||||
RString m_sSongFileName;
|
RString m_sSongFileName;
|
||||||
|
|
||||||
RString m_sGroupName;
|
RString m_sGroupName;
|
||||||
|
|||||||
+2
-2
@@ -15,7 +15,7 @@
|
|||||||
#include "MsdFile.h"
|
#include "MsdFile.h"
|
||||||
#include "NoteSkinManager.h"
|
#include "NoteSkinManager.h"
|
||||||
#include "NotesLoaderDWI.h"
|
#include "NotesLoaderDWI.h"
|
||||||
#include "NotesLoaderSM.h"
|
#include "NotesLoaderSSC.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "Profile.h"
|
#include "Profile.h"
|
||||||
#include "ProfileManager.h"
|
#include "ProfileManager.h"
|
||||||
@@ -1653,7 +1653,7 @@ void SongManager::LoadStepEditsFromProfileDir( const RString &sProfileDir, Profi
|
|||||||
{
|
{
|
||||||
RString fn = vsFiles[i];
|
RString fn = vsFiles[i];
|
||||||
|
|
||||||
SMLoader::LoadEditFromFile( fn, slot, true );
|
SSCLoader::LoadEditFromFile( fn, slot, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -20,7 +20,7 @@
|
|||||||
#include "NoteData.h"
|
#include "NoteData.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "NoteDataUtil.h"
|
#include "NoteDataUtil.h"
|
||||||
#include "NotesLoaderSM.h"
|
#include "NotesLoaderSSC.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ void Steps::Decompress() const
|
|||||||
{
|
{
|
||||||
/* 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( !SMLoader::LoadFromSMFile(m_sFilename, s, true) )
|
if( !SSCLoader::LoadFromSSCFile(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;
|
||||||
|
|||||||
Reference in New Issue
Block a user