From 571441824209724bbd120f7b37c6e2211f1fe566 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 27 Oct 2020 21:02:45 -0300 Subject: [PATCH] Fix stuff in merge from develop into tracy --- extern/CMakeLists.txt | 3 +- src/Etterna/Singletons/DownloadManager.cpp | 64 ++++++++++----------- src/Etterna/Singletons/ScoreManager.cpp | 67 +++++++++++----------- 3 files changed, 67 insertions(+), 67 deletions(-) diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index 754f56c1d1..283c93f051 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -68,8 +68,7 @@ list(APPEND EXT_TARGETS discord-rpc muFFT zlib libmad pcre ogg vorbis glfw - libcurl tracy) - libcurl fmt) + libcurl fmt tracy) list(APPEND LUA_TARGETS luajit lua minilua buildvm) diff --git a/src/Etterna/Singletons/DownloadManager.cpp b/src/Etterna/Singletons/DownloadManager.cpp index 52deb32cc9..d1b08337f7 100644 --- a/src/Etterna/Singletons/DownloadManager.cpp +++ b/src/Etterna/Singletons/DownloadManager.cpp @@ -551,38 +551,38 @@ DownloadManager::UpdateHTTP(float fDeltaSeconds) } { - ZoneNamedN(check_msgs, "CheckMsgs", true); - // Check for finished http requests - CURLMsg* msg; - int msgs_left; - while ((msg = curl_multi_info_read(mHTTPHandle, &msgs_left))) { - /* Find out which handle this message is about */ - int idx_to_delete = -1; - for (size_t i = 0; i < HTTPRequests.size(); ++i) { - if (msg->easy_handle == HTTPRequests[i]->handle) { - if (msg->data.result == CURLE_UNSUPPORTED_PROTOCOL) { - HTTPRequests[i]->Failed(*(HTTPRequests[i]), msg); - Locator::getLogger()->trace("CURL UNSUPPORTED PROTOCOL (Probably https)"); - } else if (msg->msg == CURLMSG_DONE) { - HTTPRequests[i]->Done(*(HTTPRequests[i]), msg); - } else - HTTPRequests[i]->Failed(*(HTTPRequests[i]), msg); - if (HTTPRequests[i]->handle != nullptr) - curl_easy_cleanup(HTTPRequests[i]->handle); - HTTPRequests[i]->handle = nullptr; - if (HTTPRequests[i]->form != nullptr) - curl_formfree(HTTPRequests[i]->form); - HTTPRequests[i]->form = nullptr; - delete HTTPRequests[i]; - idx_to_delete = i; - break; - } - } - // Delete this here instead of within the loop to avoid iterator - // invalidation - if (idx_to_delete != -1) - HTTPRequests.erase(HTTPRequests.begin() + idx_to_delete); - } + ZoneNamedN(check_msgs, "CheckMsgs", true); + // Check for finished http requests + CURLMsg* msg; + int msgs_left; + while ((msg = curl_multi_info_read(mHTTPHandle, &msgs_left))) { + /* Find out which handle this message is about */ + int idx_to_delete = -1; + for (size_t i = 0; i < HTTPRequests.size(); ++i) { + if (msg->easy_handle == HTTPRequests[i]->handle) { + if (msg->data.result == CURLE_UNSUPPORTED_PROTOCOL) { + HTTPRequests[i]->Failed(*(HTTPRequests[i]), msg); + Locator::getLogger()->trace("CURL UNSUPPORTED PROTOCOL (Probably https)"); + } else if (msg->msg == CURLMSG_DONE) { + HTTPRequests[i]->Done(*(HTTPRequests[i]), msg); + } else + HTTPRequests[i]->Failed(*(HTTPRequests[i]), msg); + if (HTTPRequests[i]->handle != nullptr) + curl_easy_cleanup(HTTPRequests[i]->handle); + HTTPRequests[i]->handle = nullptr; + if (HTTPRequests[i]->form != nullptr) + curl_formfree(HTTPRequests[i]->form); + HTTPRequests[i]->form = nullptr; + delete HTTPRequests[i]; + idx_to_delete = i; + break; + } + } + // Delete this here instead of within the loop to avoid iterator + // invalidation + if (idx_to_delete != -1) + HTTPRequests.erase(HTTPRequests.begin() + idx_to_delete); + } } } void diff --git a/src/Etterna/Singletons/ScoreManager.cpp b/src/Etterna/Singletons/ScoreManager.cpp index abf7df4f2a..422f5d5b84 100644 --- a/src/Etterna/Singletons/ScoreManager.cpp +++ b/src/Etterna/Singletons/ScoreManager.cpp @@ -510,16 +510,15 @@ ScoreManager::RecalculateSSRs(LoadingWindow* ld) auto lastUpdate = 0; for (auto it = workload.first; it != workload.second; ++it) { auto* hs = *it; - { + { ZoneNamedN(PerThread, "Update", true); - if ((ld != nullptr) && scoreIndex % onePercent == 0) { - data->_progress += scoreIndex - lastUpdate; - lastUpdate = scoreIndex; - data->setUpdated(true); + if ((ld != nullptr) && scoreIndex % onePercent == 0) { + data->_progress += scoreIndex - lastUpdate; + lastUpdate = scoreIndex; + data->setUpdated(true); } ++scoreIndex; } - } auto ck = hs->GetChartKey(); auto* steps = SONGMAN->GetStepsByChartkey(ck); @@ -544,15 +543,15 @@ ScoreManager::RecalculateSSRs(LoadingWindow* ld) auto remarried = false; { ZoneNamedN(PerThread, "RecalcWife", true); - if (hs->GetWifeVersion() != 3 && !hs->GetChordCohesion() && - hs->HasReplayData()) { - steps->GetNoteData(nd); - const auto maxpoints = nd.WifeTotalScoreCalc(td); - if (maxpoints <= 0) { - continue; - } - remarried = - hs->RescoreToWife3(static_cast(maxpoints)); + if (hs->GetWifeVersion() != 3 && !hs->GetChordCohesion() && + hs->HasReplayData()) { + steps->GetNoteData(nd); + const auto maxpoints = nd.WifeTotalScoreCalc(td); + if (maxpoints <= 0) { + continue; + } + remarried = + hs->RescoreToWife3(static_cast(maxpoints)); } } @@ -622,24 +621,26 @@ ScoreManager::RecalculateSSRs(LoadingWindow* ld) { ZoneNamedN(PerThread, "CheckCC", true); - /* Some scores were being incorrectly marked as ccon despite - * chord cohesion being disabled. Re-determine chord cohesion - * status from notecount, this should be robust as every score - * up to this point should be a fully completed pass. This will - * also allow us to mark files with 0 chords as being nocc - * (since it doesn't apply to them). */ - const auto totalstepsnotes = - steps->GetRadarValues()[RadarCategory_Notes]; - auto totalscorenotes = 0; - totalscorenotes += hs->GetTapNoteScore(TNS_W1); - totalscorenotes += hs->GetTapNoteScore(TNS_W2); - totalscorenotes += hs->GetTapNoteScore(TNS_W3); - totalscorenotes += hs->GetTapNoteScore(TNS_W4); - totalscorenotes += hs->GetTapNoteScore(TNS_W5); - totalscorenotes += hs->GetTapNoteScore(TNS_Miss); - - if (totalstepsnotes == totalscorenotes) { - hs->SetChordCohesion(1); // the set function isn't inverted + /* Some scores were being incorrectly marked as ccon despite + * chord cohesion being disabled. Re-determine chord + * cohesion status from notecount, this should be robust as + * every score up to this point should be a fully completed + * pass. This will also allow us to mark files with 0 chords + * as being nocc (since it doesn't apply to them). */ + const auto totalstepsnotes = + steps->GetRadarValues()[RadarCategory_Notes]; + auto totalscorenotes = 0; + totalscorenotes += hs->GetTapNoteScore(TNS_W1); + totalscorenotes += hs->GetTapNoteScore(TNS_W2); + totalscorenotes += hs->GetTapNoteScore(TNS_W3); + totalscorenotes += hs->GetTapNoteScore(TNS_W4); + totalscorenotes += hs->GetTapNoteScore(TNS_W5); + totalscorenotes += hs->GetTapNoteScore(TNS_Miss); + + if (totalstepsnotes == totalscorenotes) { + hs->SetChordCohesion( + 1); // the set function isn't inverted + } } } };