diff --git a/Source/Core/DolphinQt2/NetPlay/MD5Dialog.cpp b/Source/Core/DolphinQt2/NetPlay/MD5Dialog.cpp index d3aee5c0b8..ecfafac610 100644 --- a/Source/Core/DolphinQt2/NetPlay/MD5Dialog.cpp +++ b/Source/Core/DolphinQt2/NetPlay/MD5Dialog.cpp @@ -4,6 +4,9 @@ #include "DolphinQt2/NetPlay/MD5Dialog.h" +#include +#include + #include #include #include @@ -73,6 +76,8 @@ void MD5Dialog::show(const QString& title) m_progress_bars.clear(); m_status_labels.clear(); + m_results.clear(); + m_check_label->setText(QString::fromStdString("")); for (const auto* player : Settings::Instance().GetNetPlayClient()->GetPlayers()) { @@ -83,8 +88,6 @@ void MD5Dialog::show(const QString& title) m_progress_layout->addWidget(m_status_labels[player->pid]); } - m_last_result = ""; - QDialog::show(); } @@ -110,18 +113,20 @@ void MD5Dialog::SetResult(int pid, const std::string& result) m_status_labels[pid]->setText( tr("%1[%2]: %3").arg(player_name, QString::number(pid), QString::fromStdString(result))); - if (m_last_result.empty()) - { - m_check_label->setText(tr("The hashes match!")); - return; - } + m_results.push_back(result); - if (m_last_result != result) + if (m_results.size() >= Settings::Instance().GetNetPlayClient()->GetPlayers().size()) { - m_check_label->setText(tr("The hashes do not match!")); + if (std::adjacent_find(m_results.begin(), m_results.end(), std::not_equal_to<>()) == + m_results.end()) + { + m_check_label->setText(tr("The hashes match!")); + } + else + { + m_check_label->setText(tr("The hashes do not match!")); + } } - - m_last_result = result; } void MD5Dialog::reject() diff --git a/Source/Core/DolphinQt2/NetPlay/MD5Dialog.h b/Source/Core/DolphinQt2/NetPlay/MD5Dialog.h index 8701f44d40..a68140326d 100644 --- a/Source/Core/DolphinQt2/NetPlay/MD5Dialog.h +++ b/Source/Core/DolphinQt2/NetPlay/MD5Dialog.h @@ -4,6 +4,10 @@ #pragma once +#include +#include +#include + #include class QDialogButtonBox; @@ -32,7 +36,7 @@ private: std::map m_progress_bars; std::map m_status_labels; - std::string m_last_result; + std::vector m_results; QGroupBox* m_progress_box; QVBoxLayout* m_progress_layout;