From 186200d3c67d890e7e6596094257d16afa9c602e Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 17 Jul 2011 13:15:30 -0400 Subject: [PATCH] Prep work for #NOTES-less cache. This commit should be runnable, but I still be careful. --- src/Steps.cpp | 16 +++++++++++++++- src/Steps.h | 13 +++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Steps.cpp b/src/Steps.cpp index 5961172f93..7e9e659c4a 100644 --- a/src/Steps.cpp +++ b/src/Steps.cpp @@ -24,6 +24,11 @@ #include "NoteDataUtil.h" #include "NotesLoaderSSC.h" #include "NotesLoaderSM.h" +#include "NotesLoaderSMA.h" +#include "NotesLoaderDWI.h" +#include "NotesLoaderKSF.h" +#include "NotesLoaderBMS.h" +#include "NotesLoaderPMS.h" #include @@ -78,6 +83,11 @@ unsigned Steps::GetHash() const return m_iHash; } +bool Steps::IsNoteDataEmpty() const +{ + return this->m_sNoteDataCompressed.empty(); +} + void Steps::SetNoteData( const NoteData& noteDataNew ) { ASSERT( noteDataNew.GetNumTracks() == GAMEMAN->GetStepsTypeInfo(m_StepsType).iNumTracks ); @@ -89,7 +99,6 @@ void Steps::SetNoteData( const NoteData& noteDataNew ) m_sNoteDataCompressed = RString(); m_iHash = 0; - m_sFilename = RString(); // We can no longer read from the file because it has changed in memory. } void Steps::GetNoteData( NoteData& noteDataOut ) const @@ -250,6 +259,11 @@ void Steps::CalculateRadarValues( float fMusicLengthSeconds ) } void Steps::Decompress() const +{ + const_cast(this)->Decompress(); +} + +void Steps::Decompress() { if( m_bNoteDataIsFilled ) return; // already decompressed diff --git a/src/Steps.h b/src/Steps.h index a6a4aded2e..877fa1549d 100644 --- a/src/Steps.h +++ b/src/Steps.h @@ -49,6 +49,7 @@ public: void Compress() const; void Decompress() const; + void Decompress(); /** * @brief Determine if these steps were created by the autogenerator. * @return true if they were, false otherwise. @@ -138,6 +139,18 @@ public: void SetNoteData( const NoteData& noteDataNew ); void SetSMNoteData( const RString ¬es_comp ); void GetSMNoteData( RString ¬es_comp_out ) const; + + /** + * @brief Retrieve the NoteData from the original source. + * @return true if successful, false for failure. */ + bool GetNoteDataFromSimfile(); + + /** + * @brief Determine if we are missing any note data. + * + * This takes advantage of the fact that we usually compress our data. + * @return true if our notedata is empty, false otherwise. */ + bool IsNoteDataEmpty() const; void TidyUpData(); void CalculateRadarValues( float fMusicLengthSeconds );