Skip to content

Commit

Permalink
Add TOP SECRET BINDING for TOP SECRET CALC TEST STUFF and to SECRET X…
Browse files Browse the repository at this point in the history
…ML NODE

DONT READ THIS TOP SECRET INFORMATION
  • Loading branch information
poco0317 committed May 7, 2020
1 parent 06f4fc1 commit 060d2ef
Show file tree
Hide file tree
Showing 9 changed files with 265 additions and 45 deletions.
1 change: 1 addition & 0 deletions src/Etterna/Globals/StepMania.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,7 @@ sm_main(int argc, char* argv[])
SCOREMAN = new ScoreManager;
PROFILEMAN = new ProfileManager;
PROFILEMAN->Init(pLoadingWindow); // must load after SONGMAN
SONGMAN->CalcTestStuff(); // must be after profileman init

SONGMAN->UpdatePreferredSort();
NSMAN = new NetworkSyncManager(pLoadingWindow);
Expand Down
8 changes: 8 additions & 0 deletions src/Etterna/Models/Misc/Difficulty.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,12 @@ struct Playlist
void PushSelf(lua_State* L);
};

struct CalcTestList
{
Skillset skillset;
map<string, pair<float, float>> filemapping;

XNode* CreateNode() const;
};

#endif
2 changes: 2 additions & 0 deletions src/Etterna/Models/Misc/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ class Profile
// Profile Playlists
map<string, Playlist> allplaylists;

map<Skillset, CalcTestList> calctestlists;

// Editable data
RString m_sDisplayName;
// Dont edit this. Should be unique (Is it?)
Expand Down
58 changes: 58 additions & 0 deletions src/Etterna/Models/Misc/XMLProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,57 @@ XMLProfile::SavePlaylistsCreateNode(const Profile* profile) const
return playlists;
}

XNode*
XMLProfile::SaveCalcTestCreateNode(const Profile* profile) const
{
CHECKPOINT_M("Saving the Calc Test node.");

XNode* calctestlists = new XNode("CalcTest");
auto& pls = profile->calctestlists;
FOREACHM_CONST(Skillset, CalcTestList, pls, i)
calctestlists->AppendChild(i->second.CreateNode());
return calctestlists;
}

void
XMLProfile::LoadCalcTestNode(const XNode* pNode) const
{
CHECKPOINT_M("Loading the Calc Test node.");

FOREACH_CONST_Child(pNode, chartlist) // "For Each Skillset
{
int ssI;
chartlist->GetAttrValue("Skillset", ssI);
Skillset ss = (Skillset)ssI;
CalcTestList tl;
tl.skillset = ss;
FOREACH_CONST_Child(chartlist, uhh) // For Each Chartlist (oops)
{
FOREACH_CONST_Child(uhh, entry) // For Each Chart
{
RString key;
float target;
float rate;
entry->GetAttrValue("Key", key);
entry->GetAttrValue("Target", target);
entry->GetAttrValue("Rate", rate);
pair<float, float> pf(target, rate);
tl.filemapping[key.c_str()] = pf;
}
}
loadingProfile->calctestlists[ss] = tl;
if (SONGMAN->testChartList.count(ss)) {
for (auto c : tl.filemapping) {
// this replaces any duplicates in order of profile load
// so ... dont duplicate them i guess
// but anything that isnt duplicate is added
SONGMAN->testChartList[ss].filemapping[c.first] = c.second;
}
} else
SONGMAN->testChartList[ss] = tl;
}
}

void
XMLProfile::LoadFavoritesFromNode(const XNode* pNode)
{
Expand Down Expand Up @@ -558,6 +609,10 @@ XMLProfile::LoadEttXmlFromNode(const XNode* xml)
if (play)
LoadPlaylistsFromNode(play);

const XNode* calctest = xml->GetChild("CalcTest");
if (calctest)
LoadCalcTestNode(calctest);

const XNode* scores = xml->GetChild("PlayerScores");
if (scores)
LoadEttScoresFromNode(scores);
Expand All @@ -580,6 +635,9 @@ XMLProfile::SaveEttXmlCreateNode(const Profile* profile) const
if (!profile->allplaylists.empty())
xml->AppendChild(SavePlaylistsCreateNode(profile));

if (!profile->calctestlists.empty())
xml->AppendChild(SaveCalcTestCreateNode(profile));

if (!profile->goalmap.empty())
xml->AppendChild(SaveScoreGoalsCreateNode(profile));

Expand Down
6 changes: 2 additions & 4 deletions src/Etterna/Models/Misc/XMLProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ class XMLProfile
public:
static void MoveBackupToDir(const RString& sFromDir, const RString& sToDir);


// Etterna profile
ProfileLoadResult LoadEttFromDir(RString dir);
bool SaveEttXmlToDir(RString sDir, const Profile* profile) const;
void SetLoadingProfile(Profile* p) { loadingProfile = p; }

private:
Profile* loadingProfile;


ProfileLoadResult LoadEttXmlFromNode(const XNode* pNode);

Expand All @@ -33,7 +31,6 @@ class XMLProfile
void LoadScoreGoalsFromNode(const XNode* pNode);
void LoadPlaylistsFromNode(const XNode* pNode);


void LoadScreenshotDataFromNode(const XNode* pNode);

XNode* SaveEttGeneralDataCreateNode(const Profile* profile) const;
Expand All @@ -44,7 +41,8 @@ class XMLProfile
XNode* SavePermaMirrorCreateNode(const Profile* profile) const;
XNode* SaveScoreGoalsCreateNode(const Profile* profile) const;
XNode* SavePlaylistsCreateNode(const Profile* profile) const;

XNode* SaveCalcTestCreateNode(const Profile* profile) const;
void LoadCalcTestNode(const XNode* pNode) const;

XNode* SaveScreenshotDataCreateNode(const Profile* profile) const;

Expand Down
119 changes: 118 additions & 1 deletion src/Etterna/Screen/Others/ScreenSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ AutoScreenMessage(SM_SortOrderChanging);
AutoScreenMessage(SM_SortOrderChanged);
AutoScreenMessage(SM_BackFromPlayerOptions);
AutoScreenMessage(SM_BackFromNamePlaylist);
AutoScreenMessage(SM_BackFromCalcTestStuff);

static bool g_bSampleMusicWaiting = false;
static bool delayedchartupdatewaiting = false;
Expand Down Expand Up @@ -560,6 +561,30 @@ ScreenSelectMusic::Input(const InputEventPlus& input)
GAMESTATE->m_pCurSong->GetDisplayMainTitle().c_str(),
SONGMAN->activeplaylist.c_str()));
return true;
} else if (c == '`' && m_MusicWheel.IsSettled() &&
input.type == IET_FIRST_PRESS &&
GAMESTATE->m_pCurSteps != nullptr) {
auto ck = GAMESTATE->m_pCurSteps->GetChartKey();
Skillset foundSS = Skillset_Invalid;
for (auto ss : SONGMAN->testChartList) {
if (ss.second.filemapping.count(ck)) {
foundSS = ss.first;
break;
}
}
if (foundSS == Skillset_Invalid)
ScreenTextEntry::TextEntry(
SM_BackFromCalcTestStuff,
"FORMAT: MSD SKILLSET RATE or MSD SKILLSET\nOnly 1 rate "
"per chart",
"",
128);
else {
SONGMAN->testChartList[foundSS].filemapping.erase(ck);
SCREENMAN->SystemMessage(ssprintf(
"Removed this chart from the test list (skillset %d)",
foundSS));
}
}
}

Expand Down Expand Up @@ -1019,6 +1044,97 @@ ScreenSelectMusic::HandleScreenMessage(const ScreenMessage SM)
CodeDetector::RefreshCacheItems(CODES);
} else if (SM == SM_LoseFocus) {
CodeDetector::RefreshCacheItems(); // reset for other screens
} else if (SM == SM_BackFromCalcTestStuff) {
string ans = ScreenTextEntry::s_sLastAnswer;
vector<string> words;
istringstream iss(ans);
for (string s; iss >> s;)
words.push_back(s);
Profile* pProfile = PROFILEMAN->GetProfile(PLAYER_1);

// OOPS I COPY PASTED THE SAME CODE TWICE OH NO ITS TOO LATE I ALREADY
// FINISHED WRITING EVERYTHING AAAAAHHHH
if (words.size() == 2) {
try {
float target = stof(words[0]);
Skillset ss = (Skillset)stoi(words[1]);
if (ss < 0 || ss >= NUM_Skillset)
SCREENMAN->SystemMessage("invalid skillset number");
else if (GAMESTATE->m_pCurSteps != nullptr) {
auto ck = GAMESTATE->m_pCurSteps->GetChartKey();
if (SONGMAN->testChartList.count(ss)) {
pair<float, float> pf(target, 1.f);
SONGMAN->testChartList[ss].filemapping[ck] = pf;
} else {
CalcTestList tl;
tl.skillset = ss;
pair<float, float> pf(target, 1.f);
tl.filemapping[ck] = pf;
SONGMAN->testChartList[ss] = tl;
}
if (pProfile->calctestlists.count(ss)) {
pair<float, float> pf(target, 1.f);
pProfile->calctestlists[ss].filemapping[ck] = pf;
} else {
CalcTestList tl;
tl.skillset = ss;
pair<float, float> pf(target, 1.f);
tl.filemapping[ck] = pf;
pProfile->calctestlists[ss] = tl;
}
SCREENMAN->SystemMessage(
ssprintf("added %s to %s at rate 1.0",
ck.c_str(),
SkillsetToString(ss)));
float woo =
GAMESTATE->m_pCurSteps->DoATestThing(target, ss);
}
} catch (...) {
SCREENMAN->SystemMessage("you messed up (input exception)");
}
} else if (words.size() == 3) {
try {
float target = stof(words[0]);
Skillset ss = (Skillset)stoi(words[1]);
float rate = stof(words[2]);
if (ss < 0 || ss >= NUM_Skillset)
SCREENMAN->SystemMessage("invalid skillset number");
else if (GAMESTATE->m_pCurSteps != nullptr) {
auto ck = GAMESTATE->m_pCurSteps->GetChartKey();
if (SONGMAN->testChartList.count(ss)) {
pair<float, float> pf(target, rate);
SONGMAN->testChartList[ss].filemapping[ck] = pf;
} else {
CalcTestList tl;
tl.skillset = ss;
pair<float, float> pf(target, rate);
tl.filemapping[ck] = pf;
SONGMAN->testChartList[ss] = tl;
}
if (pProfile->calctestlists.count(ss)) {
pair<float, float> pf(target, rate);
pProfile->calctestlists[ss].filemapping[ck] = pf;
} else {
CalcTestList tl;
tl.skillset = ss;
pair<float, float> pf(target, rate);
tl.filemapping[ck] = pf;
pProfile->calctestlists[ss] = tl;
}
SCREENMAN->SystemMessage(
ssprintf("added %s to %s at rate %f",
ck.c_str(),
SkillsetToString(ss),
rate));
float woo =
GAMESTATE->m_pCurSteps->DoATestThing(target, ss);
}
} catch (...) {
SCREENMAN->SystemMessage("you messed up (input exception)");
}
} else {
SCREENMAN->SystemMessage("you messed up (wrong input format)");
}
}

if (SM == SM_BackFromNamePlaylist) {
Expand All @@ -1032,7 +1148,8 @@ ScreenSelectMusic::HandleScreenMessage(const ScreenMessage SM)
}

// restart preview music after finishing or cancelling playlist creation
// this is just copypasta'd and should be made a function? or we have something better? idk
// this is just copypasta'd and should be made a function? or we have
// something better? idk
GameSoundManager::PlayMusicParams PlayParams;
PlayParams.sFile = HandleLuaMusicFile(m_sSampleMusicToPlay);
PlayParams.pTiming = m_pSampleMusicTimingData;
Expand Down
Loading

0 comments on commit 060d2ef

Please sign in to comment.