System: Change "Auto Load Cheats" to "Enable Cheats"

This commit is contained in:
Stenzek
2024-03-03 13:43:04 +10:00
parent f4ffaa1e3c
commit e2024f6175
20 changed files with 235 additions and 210 deletions

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>674</width>
<height>481</height>
<height>420</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -249,25 +249,6 @@ Login token generated at:</string>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;justify&quot;&gt;DuckStation uses RetroAchievements as an achievement database and for tracking progress. To use achievements, please sign up for an account at &lt;a href=&quot;https://retroachievements.org/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;retroachievements.org&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p align=&quot;justify&quot;&gt;To view the achievement list in-game, press the hotkey for &lt;span style=&quot; font-weight:600;&quot;&gt;Open Pause Menu&lt;/span&gt; and select &lt;span style=&quot; font-weight:600;&quot;&gt;Achievements&lt;/span&gt; from the menu.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>8</number>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@ -213,6 +213,10 @@ void AdvancedSettingsWidget::addTweakOptions()
"ApplyCompatibilitySettings", true);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Increase Timer Resolution"), "Main",
"IncreaseTimerResolution", true);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Load Devices From Save States"), "Main",
"LoadDevicesFromSaveStates", false);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Compress Save States"), "Main", "CompressSaveStates",
Settings::DEFAULT_SAVE_STATE_COMPRESSION);
if (m_dialog->isPerGameSettings())
{
@ -248,6 +252,7 @@ void AdvancedSettingsWidget::addTweakOptions()
Settings::ParseCDROMMechVersionName, Settings::GetCDROMMechVersionName,
Settings::GetCDROMMechVersionDisplayName, static_cast<u8>(CDROMMechaconVersion::Count),
Settings::DEFAULT_CDROM_MECHACON_VERSION);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("CD-ROM Region Check"), "CDROM", "RegionCheck", false);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Allow Booting Without SBI File"), "CDROM",
"AllowBootingWithoutSBIFile", false);
@ -262,8 +267,10 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
{
int i = 0;
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Apply compatibility settings
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Increase Timer Resolution
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Apply compatibility settings
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Increase Timer Resolution
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Load Devices From Save States
setBooleanTweakOption(m_ui.tweakOptionTable, i++, Settings::DEFAULT_SAVE_STATE_COMPRESSION); // Compress Save States
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
static_cast<int>(Settings::DEFAULT_DMA_MAX_SLICE_TICKS)); // DMA max slice ticks
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
@ -278,6 +285,7 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
Settings::DEFAULT_CPU_FASTMEM_MODE); // Recompiler fastmem mode
setChoiceTweakOption(m_ui.tweakOptionTable, i++,
Settings::DEFAULT_CDROM_MECHACON_VERSION); // CDROM Mechacon Version
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // CDROM Region Check
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Allow booting without SBI file
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Enable PCDRV
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Enable PCDRV Writes
@ -290,6 +298,8 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
SettingsInterface* sif = m_dialog->getSettingsInterface();
sif->DeleteValue("Main", "ApplyCompatibilitySettings");
sif->DeleteValue("Main", "IncreaseTimerResolution");
sif->DeleteValue("Main", "LoadDevicesFromSaveStates");
sif->DeleteValue("Main", "CompressSaveStates");
sif->DeleteValue("Display", "ActiveStartOffset");
sif->DeleteValue("Display", "ActiveEndOffset");
sif->DeleteValue("Display", "LineStartOffset");
@ -302,6 +312,7 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
sif->DeleteValue("CPU", "RecompilerBlockLinking");
sif->DeleteValue("CPU", "FastmemMode");
sif->DeleteValue("CDROM", "MechaconVersion");
sif->DeleteValue("CDROM", "RegionCheck");
sif->DeleteValue("CDROM", "AllowBootingWithoutSBIFile");
sif->DeleteValue("PCDrv", "Enabled");
sif->DeleteValue("PCDrv", "EnableWrites");

View File

@ -344,7 +344,7 @@ CheatList* CheatManagerDialog::getCheatList() const
CheatList* list = System::GetCheatList();
if (!list)
{
System::LoadCheatListFromGameTitle();
System::LoadCheatList();
list = System::GetCheatList();
}
if (!list)

View File

@ -42,6 +42,7 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsWindow* dialog, QWidget* pa
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enable8MBRAM, "Console", "Enable8MBRAM", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.disableAllEnhancements, "Main", "DisableAllEnhancements",
false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableCheats, "Console", "EnableCheats", false);
SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.cpuExecutionMode, "CPU", "ExecutionMode",
&Settings::ParseCPUExecutionMode, &Settings::GetCPUExecutionModeName,
Settings::DEFAULT_CPU_EXECUTION_MODE);
@ -49,7 +50,6 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsWindow* dialog, QWidget* pa
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.recompilerICache, "CPU", "RecompilerICache", false);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.cdromReadaheadSectors, "CDROM", "ReadaheadSectors",
Settings::DEFAULT_CDROM_READAHEAD_SECTORS);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.cdromRegionCheck, "CDROM", "RegionCheck", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.cdromLoadImageToRAM, "CDROM", "LoadImageToRAM", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.cdromLoadImagePatches, "CDROM", "LoadImagePatches", false);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.cdromSeekSpeedup, "CDROM", "SeekSpeedup", 1);
@ -93,8 +93,6 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsWindow* dialog, QWidget* pa
tr("Reduces hitches in emulation by reading/decompressing CD data asynchronously on a "
"worker thread. Higher sector numbers can reduce spikes when streaming FMVs or audio "
"on slower storage or when using compression formats such as CHD."));
dialog->registerWidgetHelp(m_ui.cdromRegionCheck, tr("Enable Region Check"), tr("Checked"),
tr("Simulates the region check present in original, unmodified consoles."));
dialog->registerWidgetHelp(
m_ui.cdromLoadImageToRAM, tr("Preload Image to RAM"), tr("Unchecked"),
tr("Loads the game image into RAM. Useful for network paths that may become unreliable during gameplay. In some "

View File

@ -41,6 +41,13 @@
</item>
<item row="1" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QCheckBox" name="disableAllEnhancements">
<property name="text">
<string>Disable All Enhancements</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="enable8MBRAM">
<property name="text">
@ -48,10 +55,10 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="disableAllEnhancements">
<item row="1" column="0">
<widget class="QCheckBox" name="enableCheats">
<property name="text">
<string>Disable All Enhancements</string>
<string>Enable Cheats</string>
</property>
</widget>
</item>
@ -287,13 +294,6 @@
</item>
<item row="3" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QCheckBox" name="cdromRegionCheck">
<property name="text">
<string>Enable Region Check</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="cdromLoadImageToRAM">
<property name="text">
@ -301,7 +301,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="0" column="1">
<widget class="QCheckBox" name="cdromLoadImagePatches">
<property name="text">
<string>Apply Image Patches</string>

View File

@ -37,10 +37,7 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pauseOnStart, "Main", "StartPaused", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.saveStateOnExit, "Main", "SaveStateOnExit", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.confirmPowerOff, "Main", "ConfirmPowerOff", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.loadDevicesFromSaveStates, "Main", "LoadDevicesFromSaveStates",
false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.applyGameSettings, "Main", "ApplyGameSettings", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.autoLoadCheats, "Main", "AutoLoadCheats", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.startFullscreen, "Main", "StartFullscreen", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.doubleClickTogglesFullscreen, "Main",
@ -52,8 +49,6 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.hideMouseCursor, "Main", "HideCursorInFullscreen", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.createSaveStateBackups, "Main", "CreateSaveStateBackups",
Settings::DEFAULT_SAVE_STATE_BACKUPS);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.compressSaveStates, "Main", "CompressSaveStates",
Settings::DEFAULT_SAVE_STATE_COMPRESSION);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableDiscordPresence, "Main", "EnableDiscordPresence", false);
connect(m_ui.renderToSeparateWindow, &QCheckBox::stateChanged, this,
&InterfaceSettingsWidget::onRenderToSeparateWindowChanged);
@ -88,17 +83,10 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
dialog->registerWidgetHelp(m_ui.pauseOnFocusLoss, tr("Pause On Focus Loss"), tr("Unchecked"),
tr("Pauses the emulator when you minimize the window or switch to another application, "
"and unpauses when you switch back."));
dialog->registerWidgetHelp(
m_ui.loadDevicesFromSaveStates, tr("Load Devices From Save States"), tr("Unchecked"),
tr("When enabled, memory cards and controllers will be overwritten when save states are loaded. This can "
"result in lost saves, and controller type mismatches. For deterministic save states, enable this option, "
"otherwise leave disabled."));
dialog->registerWidgetHelp(
m_ui.applyGameSettings, tr("Apply Per-Game Settings"), tr("Checked"),
tr("When enabled, per-game settings will be applied, and incompatible enhancements will be disabled. You should "
"leave this option enabled except when testing enhancements with incompatible games."));
dialog->registerWidgetHelp(m_ui.autoLoadCheats, tr("Automatically Load Cheats"), tr("Unchecked"),
tr("Automatically loads and applies cheats on game start."));
dialog->registerWidgetHelp(m_ui.enableDiscordPresence, tr("Enable Discord Presence"), tr("Unchecked"),
tr("Shows the game you are currently playing as part of your profile in Discord."));

View File

@ -29,20 +29,6 @@
<string>Behaviour</string>
</property>
<layout class="QGridLayout" name="formLayout_4">
<item row="6" column="1">
<widget class="QCheckBox" name="autoLoadCheats">
<property name="text">
<string>Automatically Load Cheats</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="confirmPowerOff">
<property name="text">
<string>Confirm Power Off</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="saveStateOnExit">
<property name="text">
@ -78,31 +64,24 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="loadDevicesFromSaveStates">
<property name="text">
<string>Load Devices From Save States</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="6" column="1">
<widget class="QCheckBox" name="pauseOnStart">
<property name="text">
<string>Pause On Start</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="enableDiscordPresence">
<item row="3" column="0">
<widget class="QCheckBox" name="confirmPowerOff">
<property name="text">
<string>Enable Discord Presence</string>
<string>Confirm Power Off</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="compressSaveStates">
<widget class="QCheckBox" name="enableDiscordPresence">
<property name="text">
<string>Compress Save States</string>
<string>Enable Discord Presence</string>
</property>
</widget>
</item>

View File

@ -1006,6 +1006,75 @@ void MainWindow::populateChangeDiscSubImageMenu(QMenu* menu, QActionGroup* actio
}
}
void MainWindow::updateCheatActionsVisibility()
{
// If the cheat system is disabled, put an action to enable it in place of the menu under System.
const bool cheats_enabled = Host::GetBoolSettingValue("Console", "EnableCheats", false);
m_ui.actionCheats->setVisible(!cheats_enabled);
m_ui.menuCheats->menuAction()->setVisible(cheats_enabled);
}
void MainWindow::onCheatsActionTriggered()
{
const bool cheats_enabled = Host::GetBoolSettingValue("Console", "EnableCheats", false);
if (cheats_enabled)
{
m_ui.menuCheats->exec(QCursor::pos());
return;
}
SystemLock lock(pauseAndLockSystem());
QMessageBox mb(this);
mb.setWindowTitle(tr("Enable Cheats"));
mb.setText(
tr("Using cheats can have unpredictable effects on games, causing crashes, graphical glitches, and corrupted "
"saves. By using the cheat manager, you agree that it is an unsupported configuration, and we will not "
"provide you with any assistance when games break.\n\nCheats persist through save states even after being "
"disabled, please remember to reset/reboot the game after turning off any codes.\n\nAre you sure you want "
"to continue?"));
mb.setIcon(QMessageBox::Warning);
QPushButton* global = mb.addButton(tr("Enable For All Games"), QMessageBox::DestructiveRole);
QPushButton* game = mb.addButton(tr("Enable For This Game"), QMessageBox::AcceptRole);
game->setEnabled(s_system_valid && !s_current_game_serial.isEmpty());
QPushButton* cancel = mb.addButton(tr("Cancel"), QMessageBox::RejectRole);
mb.setDefaultButton(cancel);
mb.setEscapeButton(cancel);
mb.exec();
if (mb.clickedButton() == global)
{
// enable globally
Host::SetBaseBoolSettingValue("Console", "EnableCheats", true);
Host::CommitBaseSettingChanges();
g_emu_thread->applySettings(false);
}
else if (mb.clickedButton() == game)
{
if (!SettingsWindow::setGameSettingsBoolForSerial(s_current_game_serial.toStdString(), "Console", "EnableCheats",
true))
{
QMessageBox::critical(this, tr("Error"), tr("Failed to enable cheats for %1.").arg(s_current_game_serial));
return;
}
g_emu_thread->reloadGameSettings(false);
}
else
{
// do nothing
return;
}
}
void MainWindow::onCheatsMenuAboutToShow()
{
m_ui.menuCheats->clear();
connect(m_ui.menuCheats->addAction(tr("Cheat Manager")), &QAction::triggered, this,
&MainWindow::onToolsCheatManagerTriggered);
m_ui.menuCheats->addSeparator();
populateCheatsMenu(m_ui.menuCheats);
}
void MainWindow::populateCheatsMenu(QMenu* menu)
{
if (!s_system_valid)
@ -1238,15 +1307,6 @@ void MainWindow::onSaveStateMenuAboutToShow()
populateSaveStateMenu(s_current_game_serial.toUtf8().constData(), m_ui.menuSaveState);
}
void MainWindow::onCheatsMenuAboutToShow()
{
m_ui.menuCheats->clear();
connect(m_ui.menuCheats->addAction(tr("Cheat Manager")), &QAction::triggered, this,
&MainWindow::onToolsCheatManagerTriggered);
m_ui.menuCheats->addSeparator();
populateCheatsMenu(m_ui.menuCheats);
}
void MainWindow::onStartFullscreenUITriggered()
{
if (m_display_widget)
@ -1599,6 +1659,7 @@ void MainWindow::setupAdditionalUi()
m_ui.actionGridViewShowTitles->setChecked(m_game_list_widget->getShowGridCoverTitles());
updateDebugMenuVisibility();
updateCheatActionsVisibility();
for (u32 i = 0; i < static_cast<u32>(CPUExecutionMode::Count); i++)
{
@ -1723,6 +1784,7 @@ void MainWindow::updateEmulationActions(bool starting, bool running, bool cheevo
m_ui.actionPause->setDisabled(starting || !running);
m_ui.actionChangeDisc->setDisabled(starting || !running);
m_ui.actionCheats->setDisabled(starting || !running || cheevos_challenge_mode);
m_ui.actionCheatsToolbar->setDisabled(starting || !running || cheevos_challenge_mode);
m_ui.actionScreenshot->setDisabled(starting || !running);
m_ui.menuChangeDisc->setDisabled(starting || !running);
m_ui.menuCheats->setDisabled(starting || !running || cheevos_challenge_mode);
@ -1964,7 +2026,8 @@ void MainWindow::connectSignals()
connect(m_ui.menuLoadState, &QMenu::aboutToShow, this, &MainWindow::onLoadStateMenuAboutToShow);
connect(m_ui.menuSaveState, &QMenu::aboutToShow, this, &MainWindow::onSaveStateMenuAboutToShow);
connect(m_ui.menuCheats, &QMenu::aboutToShow, this, &MainWindow::onCheatsMenuAboutToShow);
connect(m_ui.actionCheats, &QAction::triggered, [this] { m_ui.menuCheats->exec(QCursor::pos()); });
connect(m_ui.actionCheats, &QAction::triggered, this, &MainWindow::onCheatsActionTriggered);
connect(m_ui.actionCheatsToolbar, &QAction::triggered, this, &MainWindow::onCheatsActionTriggered);
connect(m_ui.actionStartFullscreenUI, &QAction::triggered, this, &MainWindow::onStartFullscreenUITriggered);
connect(m_ui.actionStartFullscreenUI2, &QAction::triggered, this, &MainWindow::onStartFullscreenUITriggered);
connect(m_ui.actionRemoveDisc, &QAction::triggered, this, &MainWindow::onRemoveDiscActionTriggered);
@ -2698,6 +2761,7 @@ void MainWindow::checkForSettingChanges()
{
LogWindow::updateSettings();
updateWindowState();
updateCheatActionsVisibility();
}
std::optional<WindowInfo> MainWindow::getWindowInfo()
@ -2828,38 +2892,18 @@ void MainWindow::onToolsCoverDownloaderTriggered()
void MainWindow::onToolsCheatManagerTriggered()
{
if (!m_cheat_manager_dialog)
{
if (Host::GetBaseBoolSettingValue("UI", "DisplayCheatWarning", true))
{
QCheckBox* cb = new QCheckBox(tr("Do not show again"));
QMessageBox mb(this);
mb.setWindowTitle(tr("Cheat Manager"));
mb.setText(
tr("Using cheats can have unpredictable effects on games, causing crashes, graphical glitches, and corrupted "
"saves. By using the cheat manager, you agree that it is an unsupported configuration, and we will not "
"provide you with any assistance when games break.\n\nCheats persist through save states even after being "
"disabled, please remember to reset/reboot the game after turning off any codes.\n\nAre you sure you want "
"to continue?"));
mb.setIcon(QMessageBox::Warning);
mb.addButton(QMessageBox::Yes);
mb.addButton(QMessageBox::No);
mb.setDefaultButton(QMessageBox::No);
mb.setCheckBox(cb);
connect(cb, &QCheckBox::stateChanged, [](int state) {
Host::SetBaseBoolSettingValue("UI", "DisplayCheatWarning", (state != Qt::CheckState::Checked));
Host::CommitBaseSettingChanges();
});
if (mb.exec() == QMessageBox::No)
return;
}
m_cheat_manager_dialog = new CheatManagerDialog(this);
}
m_cheat_manager_dialog->setModal(false);
m_cheat_manager_dialog->show();
if (!m_cheat_manager_dialog->isVisible())
{
m_cheat_manager_dialog->show();
}
else
{
m_cheat_manager_dialog->raise();
m_cheat_manager_dialog->activateWindow();
m_cheat_manager_dialog->setFocus();
}
}
void MainWindow::openCPUDebugger()

View File

@ -145,6 +145,7 @@ private Q_SLOTS:
void onChangeDiscMenuAboutToHide();
void onLoadStateMenuAboutToShow();
void onSaveStateMenuAboutToShow();
void onCheatsActionTriggered();
void onCheatsMenuAboutToShow();
void onStartFullscreenUITriggered();
void onFullscreenUIStateChange(bool running);
@ -205,6 +206,7 @@ private:
void updateStatusBarWidgetVisibility();
void updateWindowTitle();
void updateWindowState(bool force_visible = false);
void updateCheatActionsVisibility();
void setProgressBar(int current, int total);
void clearProgressBar();

View File

@ -91,6 +91,7 @@
<addaction name="actionPause"/>
<addaction name="menuChangeDisc"/>
<addaction name="separator"/>
<addaction name="actionCheats"/>
<addaction name="menuCheats"/>
<addaction name="actionScreenshot"/>
<addaction name="separator"/>
@ -274,7 +275,7 @@
<addaction name="actionReset"/>
<addaction name="actionPause"/>
<addaction name="actionChangeDisc"/>
<addaction name="actionCheats"/>
<addaction name="actionCheatsToolbar"/>
<addaction name="actionScreenshot"/>
<addaction name="separator"/>
<addaction name="actionLoadState"/>
@ -541,6 +542,15 @@
<string>Cheats...</string>
</property>
</action>
<action name="actionCheatsToolbar">
<property name="icon">
<iconset theme="cheats-line">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Cheats</string>
</property>
</action>
<action name="actionAudioSettings">
<property name="icon">
<iconset theme="volume-up-line">

View File

@ -1086,17 +1086,6 @@ void EmuThread::changeDiscFromPlaylist(quint32 index)
Host::ReportFormattedErrorAsync("Error", "Failed to switch to subimage %u", index);
}
void EmuThread::loadCheatList(const QString& filename)
{
if (!isOnThread())
{
QMetaObject::invokeMethod(this, "loadCheatList", Qt::QueuedConnection, Q_ARG(const QString&, filename));
return;
}
System::LoadCheatList(filename.toUtf8().constData());
}
void EmuThread::setCheatEnabled(quint32 index, bool enabled)
{
if (!isOnThread())
@ -1106,7 +1095,7 @@ void EmuThread::setCheatEnabled(quint32 index, bool enabled)
return;
}
System::SetCheatCodeState(index, enabled, g_settings.auto_load_cheats);
System::SetCheatCodeState(index, enabled);
emit cheatEnabled(index, enabled);
}

View File

@ -192,7 +192,6 @@ public Q_SLOTS:
void setFullscreen(bool fullscreen, bool allow_render_to_main);
void setSurfaceless(bool surfaceless);
void requestDisplaySize(float scale);
void loadCheatList(const QString& filename);
void setCheatEnabled(quint32 index, bool enabled);
void applyCheat(quint32 index);
void reloadPostProcessingShaders();

View File

@ -129,8 +129,12 @@ void SettingsWindow::addPages()
{
QString title(tr("Achievements"));
QString icon_text(QStringLiteral("trophy-line"));
QString help_text(tr("<strong>Achievement Settings</strong><hr>These options control RetroAchievements. Mouse over "
"an option for additional information, and Shift+Wheel to scroll this panel."));
QString help_text(
tr("<strong>Achievement Settings</strong><hr>DuckStation uses RetroAchievements as an achievement database and "
"for tracking progress. To use achievements, please sign up for an account at retroachievements.org. To view "
"the achievement list in-game, press the hotkey for <strong>Open Pause Menu</strong> and select "
"<strong>Achievements</strong> from the menu. Mouse over an option for additional information, and "
"Shift+Wheel to scroll this panel."));
if (!Achievements::IsUsingRAIntegration())
{
@ -578,3 +582,18 @@ void SettingsWindow::closeGamePropertiesDialogs()
dialog->deleteLater();
}
}
bool SettingsWindow::setGameSettingsBoolForSerial(const std::string& serial, const char* section, const char* key,
bool value)
{
std::string ini_filename = System::GetGameSettingsPath(serial);
if (ini_filename.empty())
return false;
INISettingsInterface sif(std::move(ini_filename));
if (FileSystem::FileExists(sif.GetFileName().c_str()))
sif.Load();
sif.SetBoolValue(section, key, value);
return sif.Save();
}

View File

@ -47,6 +47,9 @@ public:
static void openGamePropertiesDialog(const std::string& path, const std::string& serial, DiscRegion region);
static void closeGamePropertiesDialogs();
// Helper for externally setting fields in game settings ini.
static bool setGameSettingsBoolForSerial(const std::string& serial, const char* section, const char* key, bool value);
ALWAYS_INLINE bool isPerGameSettings() const { return static_cast<bool>(m_sif); }
ALWAYS_INLINE SettingsInterface* getSettingsInterface() const { return m_sif.get(); }