Skip to content

Commit

Permalink
fix debug output compile
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Apr 20, 2020
1 parent 5e8467f commit 493f597
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
14 changes: 11 additions & 3 deletions src/Etterna/Globals/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,14 @@ Calc::InitializeHands(const vector<NoteInfo>& NoteInfo, float music_rate)
numitv = static_cast<int>(
std::ceil(NoteInfo.back().rowTime / (music_rate * IntervalSpan)));

if (debugmode) {
left_hand.debugValues.resize(DebugCount);
right_hand.debugValues.resize(DebugCount);
for (size_t i = 0; i < DebugCount; ++i) {
right_hand.debugValues[i].resize(numitv);
}
}

ProcessedFingers fingers;
for (int i = 0; i < 4; i++) {
fingers.emplace_back(ProcessFinger(NoteInfo, i, music_rate));
Expand All @@ -408,11 +416,11 @@ Calc::InitializeHands(const vector<NoteInfo>& NoteInfo, float music_rate)
// these values never change during calc so set them immediately
if (debugmode) {
left_hand.debugValues[Jump] = left_hand.jumpscale;
right_hand.debugValues[Jump] = right_hand.jumpscale;
right_hand.debugValues[Jump] = left_hand.jumpscale;
left_hand.debugValues[Anchor] = left_hand.anchorscale;
right_hand.debugValues[Anchor] = right_hand.anchorscale;
left_hand.debugValues[HS] = left_hand.hsscale;
right_hand.debugValues[HS] = right_hand.hsscale;
right_hand.debugValues[HS] = left_hand.hsscale;
left_hand.debugValues[OHJump] = left_hand.ohjumpscale;
right_hand.debugValues[OHJump] = right_hand.ohjumpscale;
left_hand.debugValues[Roll] = left_hand.rollscale;
Expand Down Expand Up @@ -838,7 +846,7 @@ void
MinaSDCalcDebug(const vector<NoteInfo>& NoteInfo,
float musicrate,
float goal,
vector<vector<float>[DebugCount]> handInfo)
vector<vector<vector<float>>>& handInfo)
{
if (NoteInfo.size() <= 1)
return;
Expand Down
4 changes: 2 additions & 2 deletions src/Etterna/Globals/MinaCalc.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Hand
std::vector<int> v_itvpoints; // Point allotment for each interval
std::vector<float> v_itvNPSdiff,
v_itvMSdiff, pureMSdiff; // Calculated difficulty for each interval
std::vector<float> debugValues[DebugCount];
std::vector<std::vector<float>> debugValues;

private:
const bool SmoothDifficulty =
Expand Down Expand Up @@ -168,6 +168,6 @@ MINACALC_API void
MinaSDCalcDebug(const std::vector<NoteInfo>& NoteInfo,
float musicrate,
float goal,
std::vector<std::vector<float>[DebugCount]> handInfo);
std::vector<std::vector<std::vector<float>>>& handInfo);
MINACALC_API int
GetCalcVersion();
23 changes: 16 additions & 7 deletions src/Etterna/Models/StepsAndStyles/Steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ Steps::CalcEtternaMetadata()
void
Steps::GetCalcDebugOutput()
{
if (!calcdebugoutput.empty())
return;
// function is responsible for producing debug output
Decompress();
const vector<int>& nerv = m_pNoteData->BuildAndGetNerv();
Expand Down Expand Up @@ -962,15 +964,22 @@ class LunaSteps : public Luna<Steps>
lua_pushnumber(L, p->GetNoteData().GetNumTracks());
return 1;
}
static int DootSpooks(T* p, lua_State* L)
static int GetCalcDebugOutput(T* p, lua_State* L)
{
p->GetCalcDebugOutput();
int lazy = 1;
lua_newtable(L);
//for (int i = 0; i < DebugCount; ++i) {
// vector<float> poop = p->calcdebugoutput[i];
// LuaHelpers::CreateTableFromArray(poop, L);
// lua_rawseti(L, -2, i + 1);
//}
for (int i = 0; i < DebugCount; ++i) {
vector<float> poop = p->calcdebugoutput[0][i];
LuaHelpers::CreateTableFromArray(poop, L);
lua_rawseti(L, -2, lazy);
++lazy;

poop = p->calcdebugoutput[1][i];
LuaHelpers::CreateTableFromArray(poop, L);
lua_rawseti(L, -2, lazy);
++lazy;
}
return 1;
}
LunaSteps()
Expand Down Expand Up @@ -1005,7 +1014,7 @@ class LunaSteps : public Luna<Steps>
ADD_METHOD(GetCDGraphVectors);
ADD_METHOD(GetNumColumns);
ADD_METHOD(GetNonEmptyNoteData);
ADD_METHOD(DootSpooks);
ADD_METHOD(GetCalcDebugOutput);
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/StepsAndStyles/Steps.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class Steps

void CalcEtternaMetadata();
void GetCalcDebugOutput(); // now spits out everything with 1 calc call
vector<vector<float[DebugCount]>> calcdebugoutput; // probably should clear this periodically
vector<vector<vector<float>>> calcdebugoutput; // probably should clear this periodically

string GenerateBustedChartKey(NoteData& nd, TimingData* td, int cores);
vector<string> bustedkeys;
Expand Down

0 comments on commit 493f597

Please sign in to comment.