Merge pull request #8861 from JosJuice/netplay-hash

Make netplay's "same game" check more robust
This commit is contained in:
JMC47
2020-09-06 17:14:08 -04:00
committed by GitHub
35 changed files with 523 additions and 157 deletions

View File

@ -398,9 +398,7 @@ void GameList::ShowContextMenu(const QPoint&)
QAction* netplay_host = new QAction(tr("Host with NetPlay"), menu);
connect(netplay_host, &QAction::triggered, [this, game] {
emit NetPlayHost(QString::fromStdString(game->GetUniqueIdentifier()));
});
connect(netplay_host, &QAction::triggered, [this, game] { emit NetPlayHost(*game); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, menu, [=](Core::State state) {
netplay_host->setEnabled(state == Core::State::Uninitialized);
@ -740,6 +738,11 @@ GameList::FindSecondDisc(const UICommon::GameFile& game) const
return m_model->FindSecondDisc(game);
}
std::string GameList::GetNetPlayName(const UICommon::GameFile& game) const
{
return m_model->GetNetPlayName(game);
}
void GameList::SetViewColumn(int col, bool view)
{
m_list->setColumnHidden(col, !view);

View File

@ -32,6 +32,7 @@ public:
bool HasMultipleSelected() const;
std::shared_ptr<const UICommon::GameFile> FindGame(const std::string& path) const;
std::shared_ptr<const UICommon::GameFile> FindSecondDisc(const UICommon::GameFile& game) const;
std::string GetNetPlayName(const UICommon::GameFile& game) const;
void SetListView() { SetPreferredView(true); }
void SetGridView() { SetPreferredView(false); }
@ -47,7 +48,7 @@ public:
signals:
void GameSelected();
void NetPlayHost(const QString& game_id);
void NetPlayHost(const UICommon::GameFile& game);
void SelectionChanged(std::shared_ptr<const UICommon::GameFile> game_file);
void OpenGeneralSettings();

View File

@ -313,14 +313,9 @@ std::shared_ptr<const UICommon::GameFile> GameListModel::GetGameFile(int index)
return m_games[index];
}
QString GameListModel::GetPath(int index) const
std::string GameListModel::GetNetPlayName(const UICommon::GameFile& game) const
{
return QString::fromStdString(m_games[index]->GetFilePath());
}
QString GameListModel::GetUniqueIdentifier(int index) const
{
return QString::fromStdString(m_games[index]->GetUniqueIdentifier());
return game.GetNetPlayName(m_title_database);
}
void GameListModel::AddGame(const std::shared_ptr<const UICommon::GameFile>& game)

View File

@ -37,10 +37,7 @@ public:
int columnCount(const QModelIndex& parent) const override;
std::shared_ptr<const UICommon::GameFile> GetGameFile(int index) const;
// Path of the game at the specified index.
QString GetPath(int index) const;
// Unique identifier of the game at the specified index.
QString GetUniqueIdentifier(int index) const;
std::string GetNetPlayName(const UICommon::GameFile& game) const;
bool ShouldDisplayGameListItem(int index) const;
void SetSearchTerm(const QString& term);