Added methods for writing/loading #GROOVESTATSHASH to cache. When calling Lua GetGrooveStatsHash(), calculate it if it's not already been calculated.

This commit is contained in:
Michael Votaw
2025-03-23 01:26:45 -07:00
committed by teejusb
parent 632f456ea0
commit 25a3979975
4 changed files with 20 additions and 3 deletions
+4 -2
View File
@@ -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<RString> 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<std::vector<int>> &allNotesPerMeasures = in.GetAllNotesPerMeasures();
@@ -468,11 +468,13 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa
const std::vector<float> &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" ) );
}