Qt: Note when patches are not allowed for achievements

This commit is contained in:
Stenzek 2025-05-17 01:07:52 +10:00
parent 871323f4e1
commit 21aaec99f1
No known key found for this signature in database
4 changed files with 13 additions and 5 deletions

View File

@ -1320,6 +1320,10 @@ bool Cheats::ExtractCodeInfo(CodeInfoList* dst, std::string_view file_data, bool
}
}
}
else if (key == "DisallowForAchievements")
{
current_code.disallow_for_achievements = StringUtil::FromChars<bool>(value).value_or(false);
}
else if (key == "Ignore")
{
ignore_this_code = StringUtil::FromChars<bool>(value).value_or(false);

View File

@ -60,6 +60,7 @@ struct CodeInfo
CodeType type = CodeType::Gameshark;
CodeActivation activation = CodeActivation::EndFrame;
bool from_database = false;
bool disallow_for_achievements = false;
std::string_view GetNamePart() const;
std::string_view GetNameParentPart() const;

View File

@ -15,7 +15,8 @@
#include <algorithm>
GamePatchDetailsWidget::GamePatchDetailsWidget(std::string name, const std::string& author,
const std::string& description, bool enabled, SettingsWindow* dialog,
const std::string& description, bool enabled,
bool disallowed_for_achievements, SettingsWindow* dialog,
QWidget* parent)
: QWidget(parent), m_dialog(dialog), m_name(name)
{
@ -23,8 +24,10 @@ GamePatchDetailsWidget::GamePatchDetailsWidget(std::string name, const std::stri
m_ui.name->setText(QString::fromStdString(name));
m_ui.description->setText(
tr("<strong>Author: </strong>%1<br>%2")
tr("<strong>Author: </strong>%1%2<br>%3")
.arg(author.empty() ? tr("Unknown") : QString::fromStdString(author))
.arg(disallowed_for_achievements ? tr("<br><strong>Not permitted in RetroAchievements hardcore mode.</strong>") :
QString())
.arg(description.empty() ? tr("No description provided.") : QString::fromStdString(description)));
DebugAssert(dialog->getSettingsInterface());
@ -108,8 +111,8 @@ void GamePatchSettingsWidget::reloadList()
}
const bool enabled = (std::find(enabled_list.begin(), enabled_list.end(), pi.name) != enabled_list.end());
GamePatchDetailsWidget* it =
new GamePatchDetailsWidget(std::move(pi.name), pi.author, pi.description, enabled, m_dialog, container);
GamePatchDetailsWidget* it = new GamePatchDetailsWidget(
std::move(pi.name), pi.author, pi.description, pi.disallow_for_achievements, enabled, m_dialog, container);
layout->addWidget(it);
}
}

View File

@ -20,7 +20,7 @@ class GamePatchDetailsWidget : public QWidget
public:
GamePatchDetailsWidget(std::string name, const std::string& author, const std::string& description, bool enabled,
SettingsWindow* dialog, QWidget* parent);
bool disallowed_for_achievements, SettingsWindow* dialog, QWidget* parent);
~GamePatchDetailsWidget();
private Q_SLOTS: