diff --git a/src/NotesLoaderSSC.cpp b/src/NotesLoaderSSC.cpp index 31f11ad785..c257033130 100644 --- a/src/NotesLoaderSSC.cpp +++ b/src/NotesLoaderSSC.cpp @@ -412,7 +412,6 @@ void SetNpsPerMeasure(StepsTagInfo& info) { if (info.from_cache || info.for_load_edit) { - std::vector valuesPerPlayer; split((*info.params)[1], "|", valuesPerPlayer, true); @@ -504,6 +503,16 @@ void SetPeakNps(StepsTagInfo& info) info.ssc_format= true; } +void SetGrooveStatsHash(StepsTagInfo& info) +{ + if (info.from_cache || info.for_load_edit) + { + RString value = (*info.params)[1]; + info.steps->SetCachedGrooveStatsHash(value); + } + info.ssc_format = true; +} + void SetCredit(StepsTagInfo& info) { info.steps->SetCredit((*info.params)[1]); @@ -748,6 +757,7 @@ struct ssc_parser_helper_t steps_tag_handlers["NPSPERMEASURE"] = &SetNpsPerMeasure; steps_tag_handlers["NOTESPERMEASURE"] = &SetNotesPerMeasure; steps_tag_handlers["PEAKNPS"] = &SetPeakNps; + steps_tag_handlers["GROOVESTATSHASH"] = &SetGrooveStatsHash; /* If this is called, the chart does not use the same attacks * as the Song's timing. No other changes are required. */ steps_tag_handlers["ATTACKS"]= &SetStepsAttacks; diff --git a/src/NotesWriterSSC.cpp b/src/NotesWriterSSC.cpp index f216834522..808ff8e32c 100644 --- a/src/NotesWriterSSC.cpp +++ b/src/NotesWriterSSC.cpp @@ -429,6 +429,7 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa if (bSavingCache) { lines.push_back( ssprintf( "// step cache tags:" ) ); + std::vector asTechCounts; FOREACH_PlayerNumber( pn ) { @@ -452,7 +453,6 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa { npsPerMeasureStrings.push_back(serialize(npsPerMeasure, ",", 3)); } - lines.push_back( ssprintf( "#NPSPERMEASURE:%s;", join("|",npsPerMeasureStrings).c_str() ) ); const std::vector> &allNotesPerMeasures = in.GetAllNotesPerMeasures(); @@ -468,11 +468,13 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa const std::vector &peakNps = in.GetAllPeakNps(); lines.push_back("#PEAKNPS:" + serialize(peakNps, "|", 3) + ";"); + RString GrooveStatsHash = in.GetGrooveStatsHash(); + lines.push_back(ssprintf("#GROOVESTATSHASH:%s;", GrooveStatsHash.c_str())); + // NOTE(MV): #STEPFILENAME has to be at the end of the cache tags, // because it's used in SSCLoader::LoadFromSimfile to determine when // to switch the state back to GETTING_SONG_INFO, which means any tags // after it will be ignored. - lines.push_back(ssprintf("#STEPFILENAME:%s;", in.GetFilename().c_str())); lines.push_back( ssprintf( "// end step cache tags" ) ); } diff --git a/src/Steps.cpp b/src/Steps.cpp index 69b7038c82..3669ea98c2 100644 --- a/src/Steps.cpp +++ b/src/Steps.cpp @@ -1157,6 +1157,10 @@ public: static int GetGrooveStatsHash(T *p, lua_State *L) { + if(p->GetGrooveStatsHash().empty()) + { + p->CalculateGrooveStatsHash(); + } lua_pushstring(L, p->GetGrooveStatsHash()); return 1; } diff --git a/src/Steps.h b/src/Steps.h index 749ab144ff..8f60c44109 100644 --- a/src/Steps.h +++ b/src/Steps.h @@ -155,6 +155,7 @@ public: void SetCachedNpsPerMeasure(std::vector>& npsPerMeasure); void SetCachedNotesPerMeasure(std::vector>& notesPerMeasure); void SetPeakNps(std::vector& peakNps); + void SetCachedGrooveStatsHash(const RString key); float PredictMeter() const; unsigned GetHash() const;