Disable cheats in hardcore mode

RetroAchievements does not allow cheats such as Action Replay or Gecko in hardcore mode, for fairness.
This commit is contained in:
LillyJadeKatrin 2023-06-07 21:53:38 -04:00
parent 0abfa94bc8
commit 3aebbbb3e7
17 changed files with 105 additions and 9 deletions

View File

@ -114,7 +114,7 @@ struct ARAddr
// AR Remote Functions // AR Remote Functions
void ApplyCodes(std::span<const ARCode> codes) void ApplyCodes(std::span<const ARCode> codes)
{ {
if (!Config::Get(Config::MAIN_ENABLE_CHEATS)) if (!Config::AreCheatsEnabled())
return; return;
std::lock_guard guard(s_lock); std::lock_guard guard(s_lock);
@ -143,7 +143,7 @@ void UpdateSyncedCodes(std::span<const ARCode> codes)
std::vector<ARCode> ApplyAndReturnCodes(std::span<const ARCode> codes) std::vector<ARCode> ApplyAndReturnCodes(std::span<const ARCode> codes)
{ {
if (Config::Get(Config::MAIN_ENABLE_CHEATS)) if (Config::AreCheatsEnabled())
{ {
std::lock_guard guard(s_lock); std::lock_guard guard(s_lock);
s_disable_logging = false; s_disable_logging = false;
@ -158,7 +158,7 @@ std::vector<ARCode> ApplyAndReturnCodes(std::span<const ARCode> codes)
void AddCode(ARCode code) void AddCode(ARCode code)
{ {
if (!Config::Get(Config::MAIN_ENABLE_CHEATS)) if (!Config::AreCheatsEnabled())
return; return;
if (code.enabled) if (code.enabled)
@ -990,7 +990,7 @@ static bool RunCodeLocked(const Core::CPUThreadGuard& guard, const ARCode& arcod
void RunAllActive(const Core::CPUThreadGuard& cpu_guard) void RunAllActive(const Core::CPUThreadGuard& cpu_guard)
{ {
if (!Config::Get(Config::MAIN_ENABLE_CHEATS)) if (!Config::AreCheatsEnabled())
return; return;
// If the mutex is idle then acquiring it should be cheap, fast mutexes // If the mutex is idle then acquiring it should be cheap, fast mutexes

View File

@ -16,6 +16,7 @@
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Config/AchievementSettings.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/PowerPC/MMU.h" #include "Core/PowerPC/MMU.h"
@ -206,6 +207,10 @@ Cheats::NewSearch(const Core::CPUThreadGuard& guard,
PowerPC::RequestedAddressSpace address_space, bool aligned, PowerPC::RequestedAddressSpace address_space, bool aligned,
const std::function<bool(const T& value)>& validator) const std::function<bool(const T& value)>& validator)
{ {
#ifdef USE_RETRO_ACHIEVEMENTS
if (Config::Get(Config::RA_HARDCORE_ENABLED))
return Cheats::SearchErrorCode::DisabledInHardcoreMode;
#endif // USE_RETRO_ACHIEVEMENTS
const u32 data_size = sizeof(T); const u32 data_size = sizeof(T);
std::vector<Cheats::SearchResult<T>> results; std::vector<Cheats::SearchResult<T>> results;
Cheats::SearchErrorCode error_code = Cheats::SearchErrorCode::Success; Cheats::SearchErrorCode error_code = Cheats::SearchErrorCode::Success;
@ -269,6 +274,10 @@ Cheats::NextSearch(const Core::CPUThreadGuard& guard,
PowerPC::RequestedAddressSpace address_space, PowerPC::RequestedAddressSpace address_space,
const std::function<bool(const T& new_value, const T& old_value)>& validator) const std::function<bool(const T& new_value, const T& old_value)>& validator)
{ {
#ifdef USE_RETRO_ACHIEVEMENTS
if (Config::Get(Config::RA_HARDCORE_ENABLED))
return Cheats::SearchErrorCode::DisabledInHardcoreMode;
#endif // USE_RETRO_ACHIEVEMENTS
std::vector<Cheats::SearchResult<T>> results; std::vector<Cheats::SearchResult<T>> results;
Cheats::SearchErrorCode error_code = Cheats::SearchErrorCode::Success; Cheats::SearchErrorCode error_code = Cheats::SearchErrorCode::Success;
Core::RunAsCPUThread([&] { Core::RunAsCPUThread([&] {
@ -444,6 +453,10 @@ MakeCompareFunctionForLastValue(Cheats::CompareType op)
template <typename T> template <typename T>
Cheats::SearchErrorCode Cheats::CheatSearchSession<T>::RunSearch(const Core::CPUThreadGuard& guard) Cheats::SearchErrorCode Cheats::CheatSearchSession<T>::RunSearch(const Core::CPUThreadGuard& guard)
{ {
#ifdef USE_RETRO_ACHIEVEMENTS
if (Config::Get(Config::RA_HARDCORE_ENABLED))
return Cheats::SearchErrorCode::DisabledInHardcoreMode;
#endif // USE_RETRO_ACHIEVEMENTS
Common::Result<SearchErrorCode, std::vector<SearchResult<T>>> result = Common::Result<SearchErrorCode, std::vector<SearchResult<T>>> result =
Cheats::SearchErrorCode::InvalidParameters; Cheats::SearchErrorCode::InvalidParameters;
if (m_filter_type == FilterType::CompareAgainstSpecificValue) if (m_filter_type == FilterType::CompareAgainstSpecificValue)

View File

@ -99,6 +99,11 @@ enum class SearchErrorCode
// This is returned if PowerPC::RequestedAddressSpace::Virtual is given but the MSR.DR flag is // This is returned if PowerPC::RequestedAddressSpace::Virtual is given but the MSR.DR flag is
// currently off in the emulated game. // currently off in the emulated game.
VirtualAddressesCurrentlyNotAccessible, VirtualAddressesCurrentlyNotAccessible,
#ifdef USE_RETRO_ACHIEVEMENTS
// Cheats and memory reading are disabled in RetroAchievements hardcore mode.
DisabledInHardcoreMode,
#endif // USE_RETRO_ACHIEVEMENTS
}; };
// Returns the corresponding DataType enum for the value currently held by the given SearchValue. // Returns the corresponding DataType enum for the value currently held by the given SearchValue.

View File

@ -18,6 +18,7 @@
#include "Common/MathUtil.h" #include "Common/MathUtil.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/Version.h" #include "Common/Version.h"
#include "Core/Config/AchievementSettings.h"
#include "Core/Config/DefaultLocale.h" #include "Core/Config/DefaultLocale.h"
#include "Core/HW/EXI/EXI.h" #include "Core/HW/EXI/EXI.h"
#include "Core/HW/EXI/EXI_Device.h" #include "Core/HW/EXI/EXI_Device.h"
@ -739,6 +740,15 @@ bool IsDefaultGCIFolderPathConfigured(ExpansionInterface::Slot slot)
return Config::Get(GetInfoForGCIPath(slot)).empty(); return Config::Get(GetInfoForGCIPath(slot)).empty();
} }
bool AreCheatsEnabled()
{
#ifdef USE_RETRO_ACHIEVEMENTS
return Config::Get(::Config::MAIN_ENABLE_CHEATS) && !::Config::Get(::Config::RA_HARDCORE_ENABLED);
#else // USE_RETRO_ACHIEVEMENTS
return Config::Get(::Config::MAIN_ENABLE_CHEATS);
#endif // USE_RETRO_ACHIEVEMENTS
}
bool IsDebuggingEnabled() bool IsDebuggingEnabled()
{ {
#ifdef USE_RETRO_ACHIEVEMENTS #ifdef USE_RETRO_ACHIEVEMENTS

View File

@ -378,5 +378,6 @@ std::string GetGCIFolderPath(ExpansionInterface::Slot slot, std::optional<DiscIO
std::string GetGCIFolderPath(std::string configured_folder, ExpansionInterface::Slot slot, std::string GetGCIFolderPath(std::string configured_folder, ExpansionInterface::Slot slot,
std::optional<DiscIO::Region> region); std::optional<DiscIO::Region> region);
bool IsDefaultGCIFolderPathConfigured(ExpansionInterface::Slot slot); bool IsDefaultGCIFolderPathConfigured(ExpansionInterface::Slot slot);
bool AreCheatsEnabled();
bool IsDebuggingEnabled(); bool IsDebuggingEnabled();
} // namespace Config } // namespace Config

View File

@ -71,7 +71,7 @@ void SetActiveCodes(std::span<const GeckoCode> gcodes)
std::lock_guard lk(s_active_codes_lock); std::lock_guard lk(s_active_codes_lock);
s_active_codes.clear(); s_active_codes.clear();
if (Config::Get(Config::MAIN_ENABLE_CHEATS)) if (Config::AreCheatsEnabled())
{ {
s_active_codes.reserve(gcodes.size()); s_active_codes.reserve(gcodes.size());
std::copy_if(gcodes.begin(), gcodes.end(), std::back_inserter(s_active_codes), std::copy_if(gcodes.begin(), gcodes.end(), std::back_inserter(s_active_codes),
@ -103,7 +103,7 @@ std::vector<GeckoCode> SetAndReturnActiveCodes(std::span<const GeckoCode> gcodes
std::lock_guard lk(s_active_codes_lock); std::lock_guard lk(s_active_codes_lock);
s_active_codes.clear(); s_active_codes.clear();
if (Config::Get(Config::MAIN_ENABLE_CHEATS)) if (Config::AreCheatsEnabled())
{ {
s_active_codes.reserve(gcodes.size()); s_active_codes.reserve(gcodes.size());
std::copy_if(gcodes.begin(), gcodes.end(), std::back_inserter(s_active_codes), std::copy_if(gcodes.begin(), gcodes.end(), std::back_inserter(s_active_codes),
@ -238,7 +238,7 @@ void Shutdown()
void RunCodeHandler(const Core::CPUThreadGuard& guard) void RunCodeHandler(const Core::CPUThreadGuard& guard)
{ {
if (!Config::Get(Config::MAIN_ENABLE_CHEATS)) if (!Config::AreCheatsEnabled())
return; return;
// NOTE: Need to release the lock because of GUI deadlocks with PanicAlert in HostWrite_* // NOTE: Need to release the lock because of GUI deadlocks with PanicAlert in HostWrite_*

View File

@ -90,7 +90,7 @@ void PatchFixedFunctions(Core::System& system)
// HLE jump to loader (homebrew). Disabled when Gecko is active as it interferes with the code // HLE jump to loader (homebrew). Disabled when Gecko is active as it interferes with the code
// handler // handler
if (!Config::Get(Config::MAIN_ENABLE_CHEATS)) if (!Config::AreCheatsEnabled())
{ {
Patch(system, 0x80001800, "HBReload"); Patch(system, 0x80001800, "HBReload");
auto& memory = system.GetMemory(); auto& memory = system.GetMemory();

View File

@ -1356,7 +1356,7 @@ bool NetPlayServer::SetupNetSettings()
// Copy all relevant settings // Copy all relevant settings
settings.cpu_thread = Config::Get(Config::MAIN_CPU_THREAD); settings.cpu_thread = Config::Get(Config::MAIN_CPU_THREAD);
settings.cpu_core = Config::Get(Config::MAIN_CPU_CORE); settings.cpu_core = Config::Get(Config::MAIN_CPU_CORE);
settings.enable_cheats = Config::Get(Config::MAIN_ENABLE_CHEATS); settings.enable_cheats = Config::AreCheatsEnabled();
settings.selected_language = Config::Get(Config::MAIN_GC_LANGUAGE); settings.selected_language = Config::Get(Config::MAIN_GC_LANGUAGE);
settings.override_region_settings = Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS); settings.override_region_settings = Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS);
settings.dsp_hle = Config::Get(Config::MAIN_DSP_HLE); settings.dsp_hle = Config::Get(Config::MAIN_DSP_HLE);

View File

@ -143,6 +143,12 @@ void CheatsManager::RefreshCodeTabs(Core::State state, bool force)
connect(m_ar_code, &ARCodeWidget::OpenGeneralSettings, this, &CheatsManager::OpenGeneralSettings); connect(m_ar_code, &ARCodeWidget::OpenGeneralSettings, this, &CheatsManager::OpenGeneralSettings);
connect(m_gecko_code, &GeckoCodeWidget::OpenGeneralSettings, this, connect(m_gecko_code, &GeckoCodeWidget::OpenGeneralSettings, this,
&CheatsManager::OpenGeneralSettings); &CheatsManager::OpenGeneralSettings);
#ifdef USE_RETRO_ACHIEVEMENTS
connect(m_ar_code, &ARCodeWidget::OpenAchievementSettings, this,
&CheatsManager::OpenAchievementSettings);
connect(m_gecko_code, &GeckoCodeWidget::OpenAchievementSettings, this,
&CheatsManager::OpenAchievementSettings);
#endif // USE_RETRO_ACHIEVEMENTS
} }
void CheatsManager::CreateWidgets() void CheatsManager::CreateWidgets()

View File

@ -37,6 +37,9 @@ public:
signals: signals:
void OpenGeneralSettings(); void OpenGeneralSettings();
#ifdef USE_RETRO_ACHIEVEMENTS
void OpenAchievementSettings();
#endif // USE_RETRO_ACHIEVEMENTS
void ShowMemory(u32 address); void ShowMemory(u32 address);
void RequestWatch(QString name, u32 address); void RequestWatch(QString name, u32 address);

View File

@ -21,6 +21,7 @@
#include "DolphinQt/Config/CheatCodeEditor.h" #include "DolphinQt/Config/CheatCodeEditor.h"
#include "DolphinQt/Config/CheatWarningWidget.h" #include "DolphinQt/Config/CheatWarningWidget.h"
#include "DolphinQt/Config/HardcoreWarningWidget.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h" #include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h" #include "DolphinQt/QtUtils/SetWindowDecorations.h"
@ -55,6 +56,9 @@ ARCodeWidget::~ARCodeWidget() = default;
void ARCodeWidget::CreateWidgets() void ARCodeWidget::CreateWidgets()
{ {
m_warning = new CheatWarningWidget(m_game_id, m_restart_required, this); m_warning = new CheatWarningWidget(m_game_id, m_restart_required, this);
#ifdef USE_RETRO_ACHIEVEMENTS
m_hc_warning = new HardcoreWarningWidget(this);
#endif // USE_RETRO_ACHIEVEMENTS
m_code_list = new QListWidget; m_code_list = new QListWidget;
m_code_add = new NonDefaultQPushButton(tr("&Add New Code...")); m_code_add = new NonDefaultQPushButton(tr("&Add New Code..."));
m_code_edit = new NonDefaultQPushButton(tr("&Edit Code...")); m_code_edit = new NonDefaultQPushButton(tr("&Edit Code..."));
@ -76,6 +80,9 @@ void ARCodeWidget::CreateWidgets()
QVBoxLayout* layout = new QVBoxLayout; QVBoxLayout* layout = new QVBoxLayout;
layout->addWidget(m_warning); layout->addWidget(m_warning);
#ifdef USE_RETRO_ACHIEVEMENTS
layout->addWidget(m_hc_warning);
#endif // USE_RETRO_ACHIEVEMENTS
layout->addWidget(m_code_list); layout->addWidget(m_code_list);
layout->addLayout(button_layout); layout->addLayout(button_layout);
@ -86,6 +93,10 @@ void ARCodeWidget::ConnectWidgets()
{ {
connect(m_warning, &CheatWarningWidget::OpenCheatEnableSettings, this, connect(m_warning, &CheatWarningWidget::OpenCheatEnableSettings, this,
&ARCodeWidget::OpenGeneralSettings); &ARCodeWidget::OpenGeneralSettings);
#ifdef USE_RETRO_ACHIEVEMENTS
connect(m_hc_warning, &HardcoreWarningWidget::OpenAchievementSettings, this,
&ARCodeWidget::OpenAchievementSettings);
#endif // USE_RETRO_ACHIEVEMENTS
connect(m_code_list, &QListWidget::itemChanged, this, &ARCodeWidget::OnItemChanged); connect(m_code_list, &QListWidget::itemChanged, this, &ARCodeWidget::OnItemChanged);
connect(m_code_list, &QListWidget::itemSelectionChanged, this, &ARCodeWidget::OnSelectionChanged); connect(m_code_list, &QListWidget::itemSelectionChanged, this, &ARCodeWidget::OnSelectionChanged);

View File

@ -16,6 +16,9 @@ struct ARCode;
} }
class CheatWarningWidget; class CheatWarningWidget;
#ifdef USE_RETRO_ACHIEVEMENTS
class HardcoreWarningWidget;
#endif // USE_RETRO_ACHIEVEMENTS
class QLabel; class QLabel;
class QListWidget; class QListWidget;
class QListWidgetItem; class QListWidgetItem;
@ -32,6 +35,9 @@ public:
signals: signals:
void OpenGeneralSettings(); void OpenGeneralSettings();
#ifdef USE_RETRO_ACHIEVEMENTS
void OpenAchievementSettings();
#endif // USE_RETRO_ACHIEVEMENTS
private: private:
void OnSelectionChanged(); void OnSelectionChanged();
@ -56,6 +62,9 @@ private:
u16 m_game_revision; u16 m_game_revision;
CheatWarningWidget* m_warning; CheatWarningWidget* m_warning;
#ifdef USE_RETRO_ACHIEVEMENTS
HardcoreWarningWidget* m_hc_warning;
#endif // USE_RETRO_ACHIEVEMENTS
QListWidget* m_code_list; QListWidget* m_code_list;
QPushButton* m_code_add; QPushButton* m_code_add;
QPushButton* m_code_edit; QPushButton* m_code_edit;

View File

@ -26,6 +26,7 @@
#include "DolphinQt/Config/CheatCodeEditor.h" #include "DolphinQt/Config/CheatCodeEditor.h"
#include "DolphinQt/Config/CheatWarningWidget.h" #include "DolphinQt/Config/CheatWarningWidget.h"
#include "DolphinQt/Config/HardcoreWarningWidget.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h" #include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h" #include "DolphinQt/QtUtils/SetWindowDecorations.h"
@ -61,6 +62,9 @@ GeckoCodeWidget::~GeckoCodeWidget() = default;
void GeckoCodeWidget::CreateWidgets() void GeckoCodeWidget::CreateWidgets()
{ {
m_warning = new CheatWarningWidget(m_game_id, m_restart_required, this); m_warning = new CheatWarningWidget(m_game_id, m_restart_required, this);
#ifdef USE_RETRO_ACHIEVEMENTS
m_hc_warning = new HardcoreWarningWidget(this);
#endif // USE_RETRO_ACHIEVEMENTS
m_code_list = new QListWidget; m_code_list = new QListWidget;
m_name_label = new QLabel; m_name_label = new QLabel;
m_creator_label = new QLabel; m_creator_label = new QLabel;
@ -102,6 +106,9 @@ void GeckoCodeWidget::CreateWidgets()
auto* layout = new QVBoxLayout; auto* layout = new QVBoxLayout;
layout->addWidget(m_warning); layout->addWidget(m_warning);
#ifdef USE_RETRO_ACHIEVEMENTS
layout->addWidget(m_hc_warning);
#endif // USE_RETRO_ACHIEVEMENTS
layout->addWidget(m_code_list); layout->addWidget(m_code_list);
auto* info_layout = new QFormLayout; auto* info_layout = new QFormLayout;
@ -150,6 +157,10 @@ void GeckoCodeWidget::ConnectWidgets()
connect(m_download_codes, &QPushButton::clicked, this, &GeckoCodeWidget::DownloadCodes); connect(m_download_codes, &QPushButton::clicked, this, &GeckoCodeWidget::DownloadCodes);
connect(m_warning, &CheatWarningWidget::OpenCheatEnableSettings, this, connect(m_warning, &CheatWarningWidget::OpenCheatEnableSettings, this,
&GeckoCodeWidget::OpenGeneralSettings); &GeckoCodeWidget::OpenGeneralSettings);
#ifdef USE_RETRO_ACHIEVEMENTS
connect(m_hc_warning, &HardcoreWarningWidget::OpenAchievementSettings, this,
&GeckoCodeWidget::OpenAchievementSettings);
#endif // USE_RETRO_ACHIEVEMENTS
} }
void GeckoCodeWidget::OnSelectionChanged() void GeckoCodeWidget::OnSelectionChanged()

View File

@ -11,6 +11,9 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
class CheatWarningWidget; class CheatWarningWidget;
#ifdef USE_RETRO_ACHIEVEMENTS
class HardcoreWarningWidget;
#endif // USE_RETRO_ACHIEVEMENTS
class QLabel; class QLabel;
class QListWidget; class QListWidget;
class QListWidgetItem; class QListWidgetItem;
@ -32,6 +35,9 @@ public:
signals: signals:
void OpenGeneralSettings(); void OpenGeneralSettings();
#ifdef USE_RETRO_ACHIEVEMENTS
void OpenAchievementSettings();
#endif // USE_RETRO_ACHIEVEMENTS
private: private:
void OnSelectionChanged(); void OnSelectionChanged();
@ -56,6 +62,9 @@ private:
u16 m_game_revision; u16 m_game_revision;
CheatWarningWidget* m_warning; CheatWarningWidget* m_warning;
#ifdef USE_RETRO_ACHIEVEMENTS
HardcoreWarningWidget* m_hc_warning;
#endif // USE_RETRO_ACHIEVEMENTS
QListWidget* m_code_list; QListWidget* m_code_list;
QLabel* m_name_label; QLabel* m_name_label;
QLabel* m_creator_label; QLabel* m_creator_label;

View File

@ -52,6 +52,10 @@ PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& ga
connect(ar, &ARCodeWidget::OpenGeneralSettings, this, &PropertiesDialog::OpenGeneralSettings); connect(ar, &ARCodeWidget::OpenGeneralSettings, this, &PropertiesDialog::OpenGeneralSettings);
#ifdef USE_RETRO_ACHIEVEMENTS #ifdef USE_RETRO_ACHIEVEMENTS
connect(ar, &ARCodeWidget::OpenAchievementSettings, this,
&PropertiesDialog::OpenAchievementSettings);
connect(gecko, &GeckoCodeWidget::OpenAchievementSettings, this,
&PropertiesDialog::OpenAchievementSettings);
connect(patches, &PatchesWidget::OpenAchievementSettings, this, connect(patches, &PatchesWidget::OpenAchievementSettings, this,
&PropertiesDialog::OpenAchievementSettings); &PropertiesDialog::OpenAchievementSettings);
#endif // USE_RETRO_ACHIEVEMENTS #endif // USE_RETRO_ACHIEVEMENTS

View File

@ -247,6 +247,8 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters,
&MainWindow::ShowGeneralWindow); &MainWindow::ShowGeneralWindow);
#ifdef USE_RETRO_ACHIEVEMENTS #ifdef USE_RETRO_ACHIEVEMENTS
connect(m_cheats_manager, &CheatsManager::OpenAchievementSettings, this,
&MainWindow::ShowAchievementSettings);
connect(m_game_list, &GameList::OpenAchievementSettings, this, connect(m_game_list, &GameList::OpenAchievementSettings, this,
&MainWindow::ShowAchievementSettings); &MainWindow::ShowAchievementSettings);
#endif // USE_RETRO_ACHIEVEMENTS #endif // USE_RETRO_ACHIEVEMENTS
@ -2027,6 +2029,12 @@ void MainWindow::ShowRiivolutionBootWidget(const UICommon::GameFile& game)
RiivolutionBootWidget w(disc.volume->GetGameID(), disc.volume->GetRevision(), RiivolutionBootWidget w(disc.volume->GetGameID(), disc.volume->GetRevision(),
disc.volume->GetDiscNumber(), game.GetFilePath(), this); disc.volume->GetDiscNumber(), game.GetFilePath(), this);
SetQWidgetWindowDecorations(&w); SetQWidgetWindowDecorations(&w);
#ifdef USE_RETRO_ACHIEVEMENTS
connect(&w, &RiivolutionBootWidget::OpenAchievementSettings, this,
&MainWindow::ShowAchievementSettings);
#endif // USE_RETRO_ACHIEVEMENTS
w.exec(); w.exec();
if (!w.ShouldBoot()) if (!w.ShouldBoot())
return; return;

View File

@ -15,6 +15,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWidget> #include <QWidget>
#include "Core/Config/AchievementSettings.h"
#include "Core/Config/MainSettings.h" #include "Core/Config/MainSettings.h"
#include "Core/Config/UISettings.h" #include "Core/Config/UISettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
@ -84,7 +85,12 @@ void GeneralPane::OnEmulationStateChanged(Core::State state)
const bool running = state != Core::State::Uninitialized; const bool running = state != Core::State::Uninitialized;
m_checkbox_dualcore->setEnabled(!running); m_checkbox_dualcore->setEnabled(!running);
#ifdef USE_RETRO_ACHIEVEMENTS
bool hardcore = Config::Get(Config::RA_HARDCORE_ENABLED);
m_checkbox_cheats->setEnabled(!running && !hardcore);
#else // USE_RETRO_ACHIEVEMENTS
m_checkbox_cheats->setEnabled(!running); m_checkbox_cheats->setEnabled(!running);
#endif // USE_RETRO_ACHIEVEMENTS
m_checkbox_override_region_settings->setEnabled(!running); m_checkbox_override_region_settings->setEnabled(!running);
#ifdef USE_DISCORD_PRESENCE #ifdef USE_DISCORD_PRESENCE
m_checkbox_discord_presence->setEnabled(!running); m_checkbox_discord_presence->setEnabled(!running);