Skip to content

Commit

Permalink
make a jack diff debug output hook
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Jul 17, 2020
1 parent 1fa1ba7 commit ca3397a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/Etterna/Models/StepsAndStyles/Steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,35 @@ class LunaSteps : public Luna<Steps>
lua_pushnumber(L, p->GetNoteData().GetNumTracks());
return 1;
}
static auto GetCalcDebugJack(T* p, lua_State* L) -> int
{
lua_newtable(L);
lua_pushstring(L, "JackHand");
lua_createtable(L, 0, 2);
if (p->calcdebugoutput.empty()) {
for (auto i = 0; i < 2; i++) {
lua_pushstring(L, i ? "Right" : "Left");
vector<float> nothing;
LuaHelpers::CreateTableFromArray(nothing, L);
lua_rawset(L, -3);
}
return 1;
}
for (auto hand = 0; hand < 2; hand++) {
lua_pushstring(L, hand ? "Right" : "Left");
lua_createtable(L, 0, SONGMAN->calc->jack_diff.at(hand).size());
auto vals = SONGMAN->calc->jack_diff.at(hand);
for (auto i = 0; i < vals.size(); i++) {
auto p = vals[i];
vector<float> pair{ p.first, p.second };
LuaHelpers::CreateTableFromArray(pair, L);
lua_rawseti(L, -2, i + 1);
}
lua_rawset(L, -3);
}
lua_rawset(L, -3);
return 1;
}
static auto GetCalcDebugOutput(T* p, lua_State* L) -> int
{
p->GetCalcDebugOutput();
Expand Down Expand Up @@ -1208,6 +1237,7 @@ class LunaSteps : public Luna<Steps>
ADD_METHOD(GetCDGraphVectors);
ADD_METHOD(GetNumColumns);
ADD_METHOD(GetNonEmptyNoteData);
ADD_METHOD(GetCalcDebugJack);
ADD_METHOD(GetCalcDebugOutput);
ADD_METHOD(GetDebugStrings);
ADD_METHOD(GetLengthSeconds);
Expand Down

0 comments on commit ca3397a

Please sign in to comment.