From 33b366180e6087e5debf1d5b02665175dcecde8a Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 27 Dec 2024 20:22:06 +0100 Subject: [PATCH] Qt/Patches, Cheats: Reload lists if serial changes --- pcsx2-qt/Settings/GameCheatSettingsWidget.cpp | 1 + pcsx2-qt/Settings/GamePatchSettingsWidget.cpp | 1 + pcsx2-qt/Settings/GameSummaryWidget.cpp | 10 +++++++++- pcsx2-qt/Settings/SettingsWindow.cpp | 6 ++++++ pcsx2-qt/Settings/SettingsWindow.h | 3 ++- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp b/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp index 1eaab7b48a9e7..586b40ea1a6b5 100644 --- a/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp +++ b/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp @@ -56,6 +56,7 @@ GameCheatSettingsWidget::GameCheatSettingsWidget(SettingsWindow* dialog, QWidget m_model_proxy->setFilterFixedString(text); m_ui.cheatList->expandAll(); }); + connect(m_dialog, &SettingsWindow::discSerialChanged, this, &GameCheatSettingsWidget::reloadList); dialog->registerWidgetHelp(m_ui.allCRCsCheckbox, tr("Show Cheats For All CRCs"), tr("Checked"), tr("Toggles scanning patch files for all CRCs of the game. With this enabled available patches for the game serial with different CRCs will also be loaded.")); diff --git a/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp b/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp index b7ab8da9580f7..0e830b1115732 100644 --- a/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp +++ b/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp @@ -81,6 +81,7 @@ GamePatchSettingsWidget::GamePatchSettingsWidget(SettingsWindow* dialog, QWidget connect(m_ui.reload, &QPushButton::clicked, this, &GamePatchSettingsWidget::onReloadClicked); connect(m_ui.allCRCsCheckbox, &QCheckBox::checkStateChanged, this, &GamePatchSettingsWidget::reloadList); + connect(m_dialog, &SettingsWindow::discSerialChanged, this, &GamePatchSettingsWidget::reloadList); dialog->registerWidgetHelp(m_ui.allCRCsCheckbox, tr("Show Patches For All CRCs"), tr("Checked"), tr("Toggles scanning patch files for all CRCs of the game. With this enabled available patches for the game serial with different CRCs will also be loaded.")); diff --git a/pcsx2-qt/Settings/GameSummaryWidget.cpp b/pcsx2-qt/Settings/GameSummaryWidget.cpp index f99db3f7ad993..ca58158ff3cb7 100644 --- a/pcsx2-qt/Settings/GameSummaryWidget.cpp +++ b/pcsx2-qt/Settings/GameSummaryWidget.cpp @@ -156,7 +156,15 @@ void GameSummaryWidget::onDiscPathChanged(const QString& value) // force rescan of elf to update the serial g_main_window->rescanFile(m_entry_path); - repopulateCurrentDetails(); + + auto lock = GameList::GetLock(); + const GameList::Entry* entry = GameList::GetEntryForPath(m_entry_path.c_str()); + if (entry) + { + populateDetails(entry); + m_dialog->setSerial(entry->serial); + m_ui.checkWiki->setEnabled(!entry->serial.empty()); + } } void GameSummaryWidget::onDiscPathBrowseClicked() diff --git a/pcsx2-qt/Settings/SettingsWindow.cpp b/pcsx2-qt/Settings/SettingsWindow.cpp index 9db57ebec211f..f8c2cd6208df3 100644 --- a/pcsx2-qt/Settings/SettingsWindow.cpp +++ b/pcsx2-qt/Settings/SettingsWindow.cpp @@ -447,6 +447,12 @@ void SettingsWindow::setWindowTitle(const QString& title) QWidget::setWindowTitle(QStringLiteral("%1 [%2]").arg(title, m_filename)); } +void SettingsWindow::setSerial(std::string serial) +{ + m_serial = std::move(serial); + emit discSerialChanged(); +} + bool SettingsWindow::getEffectiveBoolValue(const char* section, const char* key, bool default_value) const { bool value; diff --git a/pcsx2-qt/Settings/SettingsWindow.h b/pcsx2-qt/Settings/SettingsWindow.h index 33031bcfcde69..da77424bb2ade 100644 --- a/pcsx2-qt/Settings/SettingsWindow.h +++ b/pcsx2-qt/Settings/SettingsWindow.h @@ -72,6 +72,7 @@ class SettingsWindow final : public QWidget bool eventFilter(QObject* object, QEvent* event) override; void setWindowTitle(const QString& title); + void setSerial(std::string serial); QString getCategory() const; void setCategory(const char* category); @@ -96,7 +97,7 @@ class SettingsWindow final : public QWidget void saveAndReloadGameSettings(); Q_SIGNALS: - void settingsResetToDefaults(); + void discSerialChanged(); private Q_SLOTS: void onCategoryCurrentRowChanged(int row);