Skip to content

Commit

Permalink
Fix stuff in merge from develop into tracy
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Oct 28, 2020
1 parent 4239f3b commit 5714418
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 67 deletions.
3 changes: 1 addition & 2 deletions extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
64 changes: 32 additions & 32 deletions src/Etterna/Singletons/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
67 changes: 34 additions & 33 deletions src/Etterna/Singletons/ScoreManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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<float>(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<float>(maxpoints));
}
}

Expand Down Expand Up @@ -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
}
}
}
};
Expand Down

0 comments on commit 5714418

Please sign in to comment.