Skip to content

Commit

Permalink
Qt/Patches, Cheats: Reload lists if serial changes
Browse files Browse the repository at this point in the history
  • Loading branch information
CookiePLMonster authored and F0bes committed Jan 11, 2025
1 parent d8e310e commit 33b3661
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions pcsx2-qt/Settings/GameCheatSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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."));
Expand Down
1 change: 1 addition & 0 deletions pcsx2-qt/Settings/GamePatchSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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."));
Expand Down
10 changes: 9 additions & 1 deletion pcsx2-qt/Settings/GameSummaryWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions pcsx2-qt/Settings/SettingsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion pcsx2-qt/Settings/SettingsWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -96,7 +97,7 @@ class SettingsWindow final : public QWidget
void saveAndReloadGameSettings();

Q_SIGNALS:
void settingsResetToDefaults();
void discSerialChanged();

private Q_SLOTS:
void onCategoryCurrentRowChanged(int row);
Expand Down

0 comments on commit 33b3661

Please sign in to comment.