From a41166bb376820389d9863ce23cf6fab20cb3b5f Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 7 Jun 2020 22:58:03 +0200 Subject: Make netplay's "same game" check more robust Instead of comparing the game ID, revision, disc number and name, we can compare a hash of important parts of the disc including all the aforementioned data but also additional data such as the FST. The primary reason why I'm making this change is to let us catch more desyncs before they happen, but this should also fix https://bugs.dolphin-emu.org/issues/12115. As a bonus, the UI can now distinguish the case where a client doesn't have the game at all from the case where a client has the wrong version of the game. --- Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp') diff --git a/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp index a9e31f5ed4..5f51f4a7cd 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp @@ -4,6 +4,8 @@ #include "DolphinQt/NetPlay/NetPlaySetupDialog.h" +#include + #include #include #include @@ -24,6 +26,7 @@ #include "DolphinQt/QtUtils/UTF8CodePointCountValidator.h" #include "DolphinQt/Settings.h" +#include "UICommon/GameFile.h" #include "UICommon/NetPlayIndex.h" NetPlaySetupDialog::NetPlaySetupDialog(QWidget* parent) @@ -347,7 +350,7 @@ void NetPlaySetupDialog::accept() return; } - emit Host(items[0]->text()); + emit Host(*items[0]->data(Qt::UserRole).value>()); } } @@ -358,11 +361,10 @@ void NetPlaySetupDialog::PopulateGameList() m_host_games->clear(); for (int i = 0; i < m_game_list_model->rowCount(QModelIndex()); i++) { - auto title = m_game_list_model->GetUniqueIdentifier(i); - auto path = m_game_list_model->GetPath(i); + std::shared_ptr game = m_game_list_model->GetGameFile(i); - auto* item = new QListWidgetItem(title); - item->setData(Qt::UserRole, path); + auto* item = new QListWidgetItem(QString::fromStdString(game->GetNetPlayName())); + item->setData(Qt::UserRole, QVariant::fromValue(std::move(game))); m_host_games->addItem(item); } -- cgit v1.2.3 From 5cad82137d496328ce8e3ea6e5edf9dac524a11a Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 10 Jun 2020 18:49:22 +0200 Subject: Allow translations and custom names in GameFile::GetNetPlayName There is no longer any major reason for why this function would need to return the same result for all players. --- Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp') diff --git a/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp index 5f51f4a7cd..adcfa3faf3 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp @@ -363,7 +363,8 @@ void NetPlaySetupDialog::PopulateGameList() { std::shared_ptr game = m_game_list_model->GetGameFile(i); - auto* item = new QListWidgetItem(QString::fromStdString(game->GetNetPlayName())); + auto* item = + new QListWidgetItem(QString::fromStdString(m_game_list_model->GetNetPlayName(*game))); item->setData(Qt::UserRole, QVariant::fromValue(std::move(game))); m_host_games->addItem(item); } -- cgit v1.2.3