From e2024f6175201d9a2c9b44daf8294dc54c81214c Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 3 Mar 2024 13:43:04 +1000 Subject: [PATCH] System: Change "Auto Load Cheats" to "Enable Cheats" --- src/core/fullscreen_ui.cpp | 69 +++++----- src/core/settings.cpp | 6 +- src/core/settings.h | 6 +- src/core/system.cpp | 43 +++--- src/core/system.h | 7 +- .../achievementsettingswidget.ui | 21 +-- src/duckstation-qt/advancedsettingswidget.cpp | 15 ++- src/duckstation-qt/cheatmanagerdialog.cpp | 2 +- src/duckstation-qt/consolesettingswidget.cpp | 4 +- src/duckstation-qt/consolesettingswidget.ui | 22 ++-- .../interfacesettingswidget.cpp | 12 -- src/duckstation-qt/interfacesettingswidget.ui | 33 +---- src/duckstation-qt/mainwindow.cpp | 124 ++++++++++++------ src/duckstation-qt/mainwindow.h | 2 + src/duckstation-qt/mainwindow.ui | 12 +- src/duckstation-qt/qthost.cpp | 13 +- src/duckstation-qt/qthost.h | 1 - src/duckstation-qt/settingswindow.cpp | 23 +++- src/duckstation-qt/settingswindow.h | 3 + src/util/imgui_manager.cpp | 27 ++-- 20 files changed, 235 insertions(+), 210 deletions(-) diff --git a/src/core/fullscreen_ui.cpp b/src/core/fullscreen_ui.cpp index c756d9236..d32218d90 100644 --- a/src/core/fullscreen_ui.cpp +++ b/src/core/fullscreen_ui.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin +// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) #define IMGUI_DEFINE_MATH_OPERATORS @@ -1033,7 +1033,7 @@ void FullscreenUI::DoCheatsMenu() if (cc.activation == CheatCode::Activation::Manual) cl->ApplyCode(static_cast(index)); else - System::SetCheatCodeState(static_cast(index), checked, true); + System::SetCheatCodeState(static_cast(index), checked); }; OpenChoiceDialog(FSUI_ICONSTR(ICON_FA_FROWN, "Cheat List"), true, std::move(options), std::move(callback)); } @@ -2709,16 +2709,10 @@ void FullscreenUI::DrawInterfaceSettingsPage() bsi, FSUI_ICONSTR(ICON_FA_MAGIC, "Inhibit Screensaver"), FSUI_CSTR("Prevents the screen saver from activating and the host from sleeping while emulation is running."), "Main", "InhibitScreensaver", true); - DrawToggleSetting( - bsi, FSUI_ICONSTR(ICON_FA_GAMEPAD, "Load Devices From Save States"), - FSUI_CSTR("When enabled, memory cards and controllers will be overwritten when save states are loaded."), "Main", - "LoadDevicesFromSaveStates", false); DrawToggleSetting( bsi, FSUI_ICONSTR(ICON_FA_COGS, "Apply Per-Game Settings"), FSUI_CSTR("When enabled, per-game settings will be applied, and incompatible enhancements will be disabled."), "Main", "ApplyGameSettings", true); - DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_FROWN, "Automatically Load Cheats"), - FSUI_CSTR("Automatically loads and applies cheats on game start."), "Main", "AutoLoadCheats", true); if (DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_PAINT_BRUSH, "Use Light Theme"), FSUI_CSTR("Uses a light coloured theme instead of the default dark theme."), "Main", "UseLightFullscreenUITheme", false)) @@ -2903,22 +2897,30 @@ void FullscreenUI::DrawConsoleSettingsPage() MenuHeading(FSUI_CSTR("Console Settings")); - DrawEnumSetting(bsi, FSUI_CSTR("Region"), FSUI_CSTR("Determines the emulated hardware type."), "Console", "Region", - Settings::DEFAULT_CONSOLE_REGION, &Settings::ParseConsoleRegionName, &Settings::GetConsoleRegionName, - &Settings::GetConsoleRegionDisplayName, ConsoleRegion::Count); + DrawEnumSetting(bsi, FSUI_ICONSTR(ICON_FA_GLOBE, "Region"), FSUI_CSTR("Determines the emulated hardware type."), + "Console", "Region", Settings::DEFAULT_CONSOLE_REGION, &Settings::ParseConsoleRegionName, + &Settings::GetConsoleRegionName, &Settings::GetConsoleRegionDisplayName, ConsoleRegion::Count); DrawToggleSetting( - bsi, FSUI_CSTR("Enable 8MB RAM"), + bsi, FSUI_ICONSTR(ICON_FA_MEMORY, "Enable 8MB RAM"), FSUI_CSTR("Enables an additional 6MB of RAM to obtain a total of 2+6 = 8MB, usually present on dev consoles."), "Console", "Enable8MBRAM", false); + DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_MAGIC, "Disable All Enhancements"), + FSUI_CSTR("Temporarily disables all enhancements, useful when testing."), "Main", + "DisableAllEnhancements", false); + DrawToggleSetting( + bsi, FSUI_ICONSTR(ICON_FA_FROWN, "Enable Cheats"), + FSUI_CSTR("Automatically loads and applies cheats on game start. Cheats can break games and saves."), "Console", + "EnableCheats", false); MenuHeading(FSUI_CSTR("CPU Emulation")); - DrawEnumSetting(bsi, FSUI_CSTR("Execution Mode"), FSUI_CSTR("Determines how the emulated CPU executes instructions."), - "CPU", "ExecutionMode", Settings::DEFAULT_CPU_EXECUTION_MODE, &Settings::ParseCPUExecutionMode, + DrawEnumSetting(bsi, FSUI_ICONSTR(ICON_FA_BOLT, "Execution Mode"), + FSUI_CSTR("Determines how the emulated CPU executes instructions."), "CPU", "ExecutionMode", + Settings::DEFAULT_CPU_EXECUTION_MODE, &Settings::ParseCPUExecutionMode, &Settings::GetCPUExecutionModeName, &Settings::GetCPUExecutionModeDisplayName, CPUExecutionMode::Count); - DrawToggleSetting(bsi, FSUI_CSTR("Enable Overclocking"), + DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_TACHOMETER_ALT, "Enable Overclocking"), FSUI_CSTR("When this option is chosen, the clock speed set below will be used."), "CPU", "OverclockEnable", false); @@ -2939,37 +2941,34 @@ void FullscreenUI::DrawConsoleSettingsPage() } } - DrawToggleSetting(bsi, FSUI_CSTR("Enable Recompiler ICache"), + DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_MICROCHIP, "Enable Recompiler ICache"), FSUI_CSTR("Makes games run closer to their console framerate, at a small cost to performance."), "CPU", "RecompilerICache", false); MenuHeading(FSUI_CSTR("CD-ROM Emulation")); DrawIntListSetting( - bsi, FSUI_CSTR("Read Speedup"), + bsi, FSUI_ICONSTR(ICON_FA_COMPACT_DISC, "Read Speedup"), FSUI_CSTR( "Speeds up CD-ROM reads by the specified factor. May improve loading speeds in some games, and break others."), "CDROM", "ReadSpeedup", 1, cdrom_read_speeds.data(), cdrom_read_speeds.size(), true, 1); DrawIntListSetting( - bsi, FSUI_CSTR("Seek Speedup"), + bsi, FSUI_ICONSTR(ICON_FA_SEARCH, "Seek Speedup"), FSUI_CSTR( "Speeds up CD-ROM seeks by the specified factor. May improve loading speeds in some games, and break others."), "CDROM", "SeekSpeedup", 1, cdrom_seek_speeds.data(), cdrom_seek_speeds.size(), true); DrawIntRangeSetting( - bsi, FSUI_CSTR("Readahead Sectors"), + bsi, FSUI_ICONSTR(ICON_FA_FAST_FORWARD, "Readahead Sectors"), FSUI_CSTR("Reduces hitches in emulation by reading/decompressing CD data asynchronously on a worker thread."), "CDROM", "ReadaheadSectors", Settings::DEFAULT_CDROM_READAHEAD_SECTORS, 0, 32, "%d sectors"); - DrawToggleSetting(bsi, FSUI_CSTR("Enable Region Check"), - FSUI_CSTR("Simulates the region check present in original, unmodified consoles."), "CDROM", - "RegionCheck", false); DrawToggleSetting( - bsi, FSUI_CSTR("Preload Images to RAM"), + bsi, FSUI_ICONSTR(ICON_FA_DOWNLOAD, "Preload Images to RAM"), FSUI_CSTR("Loads the game image into RAM. Useful for network paths that may become unreliable during gameplay."), "CDROM", "LoadImageToRAM", false); DrawToggleSetting( - bsi, FSUI_CSTR("Apply Image Patches"), + bsi, FSUI_ICONSTR(ICON_FA_VEST_PATCHES, "Apply Image Patches"), FSUI_CSTR("Automatically applies patches to disc images when they are present, currently only PPF is supported."), "CDROM", "LoadImagePatches", false); @@ -4654,10 +4653,6 @@ void FullscreenUI::DrawAdvancedSettingsPage() MenuHeading(FSUI_CSTR("Debugging Settings")); - DrawToggleSetting(bsi, FSUI_CSTR("Disable All Enhancements"), - FSUI_CSTR("Temporarily disables all enhancements, useful when testing."), "Main", - "DisableAllEnhancements", false); - DrawToggleSetting(bsi, FSUI_CSTR("Use Debug GPU Device"), FSUI_CSTR("Enable debugging when supported by the host's renderer API. Only for developer use."), "GPU", "UseDebugDevice", false); @@ -4675,6 +4670,10 @@ void FullscreenUI::DrawAdvancedSettingsPage() DrawToggleSetting(bsi, FSUI_CSTR("Create Save State Backups"), FSUI_CSTR("Renames existing save states when saving to a backup file."), "Main", "CreateSaveStateBackups", false); + DrawToggleSetting( + bsi, FSUI_ICONSTR(ICON_FA_GAMEPAD, "Load Devices From Save States"), + FSUI_CSTR("When enabled, memory cards and controllers will be overwritten when save states are loaded."), "Main", + "LoadDevicesFromSaveStates", false); MenuHeading(FSUI_CSTR("Display Settings")); DrawToggleSetting(bsi, FSUI_CSTR("Show Status Indicators"), @@ -4740,6 +4739,12 @@ void FullscreenUI::DrawAdvancedSettingsPage() "FastmemMode", Settings::DEFAULT_CPU_FASTMEM_MODE, &Settings::ParseCPUFastmemMode, &Settings::GetCPUFastmemModeName, &Settings::GetCPUFastmemModeDisplayName, CPUFastmemMode::Count); + MenuHeading(FSUI_CSTR("CD-ROM Emulation")); + + DrawToggleSetting(bsi, FSUI_CSTR("Enable Region Check"), + FSUI_CSTR("Simulates the region check present in original, unmodified consoles."), "CDROM", + "RegionCheck", false); + EndMenuButtons(); } @@ -4891,7 +4896,7 @@ void FullscreenUI::DrawPauseMenu() } if (ActiveButton(FSUI_ICONSTR(ICON_FA_FROWN_OPEN, "Cheat List"), false, - !System::GetGameSerial().empty() && !Achievements::IsHardcoreModeActive())) + !System::GetGameSerial().empty() && g_settings.enable_cheats)) { s_current_main_window = MainWindowType::None; DoCheatsMenu(); @@ -6575,9 +6580,8 @@ TRANSLATE_NOOP("FullscreenUI", "Automatic based on window size"); TRANSLATE_NOOP("FullscreenUI", "Automatic mapping completed for {}."); TRANSLATE_NOOP("FullscreenUI", "Automatic mapping failed for {}."); TRANSLATE_NOOP("FullscreenUI", "Automatic mapping failed, no devices are available."); -TRANSLATE_NOOP("FullscreenUI", "Automatically Load Cheats"); TRANSLATE_NOOP("FullscreenUI", "Automatically applies patches to disc images when they are present, currently only PPF is supported."); -TRANSLATE_NOOP("FullscreenUI", "Automatically loads and applies cheats on game start."); +TRANSLATE_NOOP("FullscreenUI", "Automatically loads and applies cheats on game start. Cheats can break games and saves."); TRANSLATE_NOOP("FullscreenUI", "Automatically saves the emulator state when powering down or exiting. You can then resume directly from where you left off next time."); TRANSLATE_NOOP("FullscreenUI", "Automatically switches to fullscreen mode when the program is started."); TRANSLATE_NOOP("FullscreenUI", "Avoids calls to C++ code, significantly speeding up the recompiler."); @@ -6691,6 +6695,7 @@ TRANSLATE_NOOP("FullscreenUI", "Emulation Settings"); TRANSLATE_NOOP("FullscreenUI", "Emulation Speed"); TRANSLATE_NOOP("FullscreenUI", "Enable 8MB RAM"); TRANSLATE_NOOP("FullscreenUI", "Enable Achievements"); +TRANSLATE_NOOP("FullscreenUI", "Enable Cheats"); TRANSLATE_NOOP("FullscreenUI", "Enable Discord Presence"); TRANSLATE_NOOP("FullscreenUI", "Enable Fast Boot"); TRANSLATE_NOOP("FullscreenUI", "Enable In-Game Overlays"); @@ -6706,7 +6711,6 @@ TRANSLATE_NOOP("FullscreenUI", "Enable SDL Input Source"); TRANSLATE_NOOP("FullscreenUI", "Enable Subdirectory Scanning"); TRANSLATE_NOOP("FullscreenUI", "Enable TTY Logging"); TRANSLATE_NOOP("FullscreenUI", "Enable VRAM Write Texture Replacement"); -TRANSLATE_NOOP("FullscreenUI", "Enable VSync"); TRANSLATE_NOOP("FullscreenUI", "Enable XInput Input Source"); TRANSLATE_NOOP("FullscreenUI", "Enable debugging when supported by the host's renderer API. Only for developer use."); TRANSLATE_NOOP("FullscreenUI", "Enables alignment and bus exceptions. Not needed for any known games."); @@ -7075,6 +7079,7 @@ TRANSLATE_NOOP("FullscreenUI", "Uses game-specific settings for controllers for TRANSLATE_NOOP("FullscreenUI", "Uses perspective-correct interpolation for colors, which can improve visuals in some games."); TRANSLATE_NOOP("FullscreenUI", "Uses perspective-correct interpolation for texture coordinates, straightening out warped textures."); TRANSLATE_NOOP("FullscreenUI", "Uses screen positions to resolve PGXP data. May improve visuals in some games."); +TRANSLATE_NOOP("FullscreenUI", "VSync"); TRANSLATE_NOOP("FullscreenUI", "Value: {} | Default: {} | Minimum: {} | Maximum: {}"); TRANSLATE_NOOP("FullscreenUI", "When enabled and logged in, DuckStation will scan for achievements on startup."); TRANSLATE_NOOP("FullscreenUI", "When enabled, DuckStation will assume all achievements are locked and not send any unlock notifications to the server."); diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 6b722cd23..4bfaf687e 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -151,7 +151,7 @@ void Settings::Load(SettingsInterface& si) load_devices_from_save_states = si.GetBoolValue("Main", "LoadDevicesFromSaveStates", false); apply_compatibility_settings = si.GetBoolValue("Main", "ApplyCompatibilitySettings", true); apply_game_settings = si.GetBoolValue("Main", "ApplyGameSettings", true); - auto_load_cheats = si.GetBoolValue("Main", "AutoLoadCheats", true); + enable_cheats = si.GetBoolValue("Console", "EnableCheats", false); disable_all_enhancements = si.GetBoolValue("Main", "DisableAllEnhancements", false); enable_discord_presence = si.GetBoolValue("Main", "EnableDiscordPresence", false); rewind_enable = si.GetBoolValue("Main", "RewindEnable", false); @@ -444,7 +444,7 @@ void Settings::Save(SettingsInterface& si) const si.SetBoolValue("Main", "LoadDevicesFromSaveStates", load_devices_from_save_states); si.SetBoolValue("Main", "ApplyCompatibilitySettings", apply_compatibility_settings); si.SetBoolValue("Main", "ApplyGameSettings", apply_game_settings); - si.SetBoolValue("Main", "AutoLoadCheats", auto_load_cheats); + si.SetBoolValue("Console", "EnableCheats", enable_cheats); si.SetBoolValue("Main", "DisableAllEnhancements", disable_all_enhancements); si.SetBoolValue("Main", "EnableDiscordPresence", enable_discord_presence); si.SetBoolValue("Main", "RewindEnable", rewind_enable); @@ -728,7 +728,7 @@ void Settings::FixIncompatibleSettings(bool display_osd_messages) (g_settings.fast_forward_speed != 0.0f) ? std::max(g_settings.fast_forward_speed, 1.0f) : 0.0f; g_settings.turbo_speed = (g_settings.turbo_speed != 0.0f) ? std::max(g_settings.turbo_speed, 1.0f) : 0.0f; g_settings.rewind_enable = false; - g_settings.auto_load_cheats = false; + g_settings.enable_cheats = false; if (g_settings.cpu_overclock_enable && g_settings.GetCPUOverclockPercent() < 100) { g_settings.cpu_overclock_enable = false; diff --git a/src/core/settings.h b/src/core/settings.h index 34cca1e18..706096fe6 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -87,7 +87,7 @@ struct Settings bool load_devices_from_save_states : 1 = false; bool apply_compatibility_settings : 1 = true; bool apply_game_settings : 1 = true; - bool auto_load_cheats : 1 = true; + bool enable_cheats : 1 = true; bool disable_all_enhancements : 1 = false; bool enable_discord_presence : 1 = false; @@ -518,6 +518,8 @@ struct Settings #endif static constexpr AudioStretchMode DEFAULT_AUDIO_STRETCH_MODE = AudioStretchMode::TimeStretch; + static constexpr bool DEFAULT_SAVE_STATE_COMPRESSION = true; + // Enable console logging by default on Linux platforms. #if defined(__linux__) && !defined(__ANDROID__) static constexpr bool DEFAULT_LOG_TO_CONSOLE = true; @@ -527,12 +529,10 @@ struct Settings // Android doesn't create settings until they're first opened, so we have to override the defaults here. #ifndef __ANDROID__ - static constexpr bool DEFAULT_SAVE_STATE_COMPRESSION = true; static constexpr bool DEFAULT_SAVE_STATE_BACKUPS = true; static constexpr bool DEFAULT_FAST_BOOT_VALUE = false; static constexpr float DEFAULT_DISPLAY_MAX_FPS = 0.0f; #else - static constexpr bool DEFAULT_SAVE_STATE_COMPRESSION = true; static constexpr bool DEFAULT_SAVE_STATE_BACKUPS = false; static constexpr bool DEFAULT_FAST_BOOT_VALUE = true; static constexpr float DEFAULT_DISPLAY_MAX_FPS = 60.0f; diff --git a/src/core/system.cpp b/src/core/system.cpp index 6bd992795..a4583d0c8 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -3400,8 +3400,8 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting) ApplySettings(true); s_cheat_list.reset(); - if (g_settings.auto_load_cheats && !Achievements::IsHardcoreModeActive()) - LoadCheatListFromGameTitle(); + if (g_settings.enable_cheats) + LoadCheatList(); if (s_running_game_serial != prev_serial) UpdateSessionTime(prev_serial); @@ -3655,6 +3655,14 @@ void System::CheckForSettingsChanges(const Settings& old_settings) CPU::ClearICache(); } + if (g_settings.enable_cheats != old_settings.enable_cheats) + { + if (g_settings.enable_cheats) + LoadCheatList(); + else + s_cheat_list.reset(); + } + SPU::GetOutputStream()->SetOutputVolume(GetAudioOutputVolume()); if (g_settings.gpu_resolution_scale != old_settings.gpu_resolution_scale || @@ -4534,15 +4542,20 @@ std::string System::GetCheatFileName() return ret; } -bool System::LoadCheatList(const char* filename) +bool System::LoadCheatList() { - if (System::IsShutdown()) + // Called when booting, needs to test for shutdown. + if (IsShutdown() || !g_settings.enable_cheats) + return false; + + const std::string filename(GetCheatFileName()); + if (filename.empty() || !FileSystem::FileExists(filename.c_str())) return false; std::unique_ptr cl = std::make_unique(); - if (!cl->LoadFromFile(filename, CheatList::Format::Autodetect)) + if (!cl->LoadFromFile(filename.c_str(), CheatList::Format::Autodetect)) { - Host::AddFormattedOSDMessage(15.0f, TRANSLATE("OSDMessage", "Failed to load cheats from '%s'."), filename); + Host::AddFormattedOSDMessage(15.0f, TRANSLATE("OSDMessage", "Failed to load cheats from '%s'."), filename.c_str()); return false; } @@ -4558,19 +4571,6 @@ bool System::LoadCheatList(const char* filename) return true; } -bool System::LoadCheatListFromGameTitle() -{ - // Called when booting, needs to test for shutdown. - if (IsShutdown() || Achievements::IsHardcoreModeActive()) - return false; - - const std::string filename(GetCheatFileName()); - if (filename.empty() || !FileSystem::FileExists(filename.c_str())) - return false; - - return LoadCheatList(filename.c_str()); -} - bool System::LoadCheatListFromDatabase() { if (IsShutdown() || s_running_game_serial.empty() || Achievements::IsHardcoreModeActive()) @@ -4650,7 +4650,7 @@ void System::ClearCheatList(bool save_to_file) SaveCheatList(); } -void System::SetCheatCodeState(u32 index, bool enabled, bool save_to_file) +void System::SetCheatCodeState(u32 index, bool enabled) { if (!System::IsValid() || !System::HasCheatList()) return; @@ -4676,8 +4676,7 @@ void System::SetCheatCodeState(u32 index, bool enabled, bool save_to_file) Host::AddFormattedOSDMessage(5.0f, TRANSLATE("OSDMessage", "Cheat '%s' disabled."), cc.description.c_str()); } - if (save_to_file) - SaveCheatList(); + SaveCheatList(); } void System::ApplyCheatCode(u32 index) diff --git a/src/core/system.h b/src/core/system.h index a0495bc73..3ef7ee23f 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -421,11 +421,8 @@ bool SaveScreenshot(const char* filename = nullptr, DisplayScreenshotMode mode = DisplayScreenshotFormat format = g_settings.display_screenshot_format, u8 quality = g_settings.display_screenshot_quality, bool compress_on_thread = true); -/// Loads the cheat list from the specified file. -bool LoadCheatList(const char* filename); - /// Loads the cheat list for the current game title from the user directory. -bool LoadCheatListFromGameTitle(); +bool LoadCheatList(); /// Loads the cheat list for the current game code from the built-in code database. bool LoadCheatListFromDatabase(); @@ -443,7 +440,7 @@ bool DeleteCheatList(); void ClearCheatList(bool save_to_file); /// Enables/disabled the specified cheat code. -void SetCheatCodeState(u32 index, bool enabled, bool save_to_file); +void SetCheatCodeState(u32 index, bool enabled); /// Immediately applies the specified cheat code. void ApplyCheatCode(u32 index); diff --git a/src/duckstation-qt/achievementsettingswidget.ui b/src/duckstation-qt/achievementsettingswidget.ui index f6ea500a1..dfab93e19 100644 --- a/src/duckstation-qt/achievementsettingswidget.ui +++ b/src/duckstation-qt/achievementsettingswidget.ui @@ -7,7 +7,7 @@ 0 0 674 - 481 + 420 @@ -249,25 +249,6 @@ Login token generated at: - - - - <html><head/><body><p align="justify">DuckStation uses RetroAchievements as an achievement database and for tracking progress. To use achievements, please sign up for an account at <a href="https://retroachievements.org/"><span style=" text-decoration: underline; color:#0000ff;">retroachievements.org</span></a>.</p><p align="justify">To view the achievement list in-game, press the hotkey for <span style=" font-weight:600;">Open Pause Menu</span> and select <span style=" font-weight:600;">Achievements</span> from the menu.</p></body></html> - - - Qt::RichText - - - true - - - 8 - - - true - - - diff --git a/src/duckstation-qt/advancedsettingswidget.cpp b/src/duckstation-qt/advancedsettingswidget.cpp index f1f95568f..1a35e48a1 100644 --- a/src/duckstation-qt/advancedsettingswidget.cpp +++ b/src/duckstation-qt/advancedsettingswidget.cpp @@ -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(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(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"); diff --git a/src/duckstation-qt/cheatmanagerdialog.cpp b/src/duckstation-qt/cheatmanagerdialog.cpp index 366f73e0c..80d208561 100644 --- a/src/duckstation-qt/cheatmanagerdialog.cpp +++ b/src/duckstation-qt/cheatmanagerdialog.cpp @@ -344,7 +344,7 @@ CheatList* CheatManagerDialog::getCheatList() const CheatList* list = System::GetCheatList(); if (!list) { - System::LoadCheatListFromGameTitle(); + System::LoadCheatList(); list = System::GetCheatList(); } if (!list) diff --git a/src/duckstation-qt/consolesettingswidget.cpp b/src/duckstation-qt/consolesettingswidget.cpp index 08adb8b74..4ae09113e 100644 --- a/src/duckstation-qt/consolesettingswidget.cpp +++ b/src/duckstation-qt/consolesettingswidget.cpp @@ -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 " diff --git a/src/duckstation-qt/consolesettingswidget.ui b/src/duckstation-qt/consolesettingswidget.ui index eac5327ce..b1e0bbbcc 100644 --- a/src/duckstation-qt/consolesettingswidget.ui +++ b/src/duckstation-qt/consolesettingswidget.ui @@ -41,6 +41,13 @@ + + + + Disable All Enhancements + + + @@ -48,10 +55,10 @@ - - + + - Disable All Enhancements + Enable Cheats @@ -287,13 +294,6 @@ - - - - Enable Region Check - - - @@ -301,7 +301,7 @@ - + Apply Image Patches diff --git a/src/duckstation-qt/interfacesettingswidget.cpp b/src/duckstation-qt/interfacesettingswidget.cpp index ef01a77ea..c304e5832 100644 --- a/src/duckstation-qt/interfacesettingswidget.cpp +++ b/src/duckstation-qt/interfacesettingswidget.cpp @@ -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.")); diff --git a/src/duckstation-qt/interfacesettingswidget.ui b/src/duckstation-qt/interfacesettingswidget.ui index c6a18d85e..3e4900dd5 100644 --- a/src/duckstation-qt/interfacesettingswidget.ui +++ b/src/duckstation-qt/interfacesettingswidget.ui @@ -29,20 +29,6 @@ Behaviour - - - - Automatically Load Cheats - - - - - - - Confirm Power Off - - - @@ -78,31 +64,24 @@ - - - - Load Devices From Save States - - - - + Pause On Start - - + + - Enable Discord Presence + Confirm Power Off - + - Compress Save States + Enable Discord Presence diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 021e57012..53170d13d 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -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(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 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() diff --git a/src/duckstation-qt/mainwindow.h b/src/duckstation-qt/mainwindow.h index 760e9c708..b3740b91d 100644 --- a/src/duckstation-qt/mainwindow.h +++ b/src/duckstation-qt/mainwindow.h @@ -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(); diff --git a/src/duckstation-qt/mainwindow.ui b/src/duckstation-qt/mainwindow.ui index d1c521be9..30d889977 100644 --- a/src/duckstation-qt/mainwindow.ui +++ b/src/duckstation-qt/mainwindow.ui @@ -91,6 +91,7 @@ + @@ -274,7 +275,7 @@ - + @@ -541,6 +542,15 @@ Cheats... + + + + .. + + + Cheats + + diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index b768d70dd..8c851507d 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -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); } diff --git a/src/duckstation-qt/qthost.h b/src/duckstation-qt/qthost.h index 907d390a9..31166f2aa 100644 --- a/src/duckstation-qt/qthost.h +++ b/src/duckstation-qt/qthost.h @@ -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(); diff --git a/src/duckstation-qt/settingswindow.cpp b/src/duckstation-qt/settingswindow.cpp index 51721cdfb..98f19efc3 100644 --- a/src/duckstation-qt/settingswindow.cpp +++ b/src/duckstation-qt/settingswindow.cpp @@ -129,8 +129,12 @@ void SettingsWindow::addPages() { QString title(tr("Achievements")); QString icon_text(QStringLiteral("trophy-line")); - QString help_text(tr("Achievement Settings
These options control RetroAchievements. Mouse over " - "an option for additional information, and Shift+Wheel to scroll this panel.")); + QString help_text( + tr("Achievement Settings
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 Open Pause Menu and select " + "Achievements 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(); +} diff --git a/src/duckstation-qt/settingswindow.h b/src/duckstation-qt/settingswindow.h index bfb1f718e..591f98060 100644 --- a/src/duckstation-qt/settingswindow.h +++ b/src/duckstation-qt/settingswindow.h @@ -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(m_sif); } ALWAYS_INLINE SettingsInterface* getSettingsInterface() const { return m_sif.get(); } diff --git a/src/util/imgui_manager.cpp b/src/util/imgui_manager.cpp index 0d90bf49d..bf5d4c993 100644 --- a/src/util/imgui_manager.cpp +++ b/src/util/imgui_manager.cpp @@ -560,19 +560,20 @@ ImFont* ImGuiManager::AddFixedFont(float size) bool ImGuiManager::AddIconFonts(float size) { static constexpr ImWchar range_fa[] = { - 0xf002, 0xf002, 0xf005, 0xf005, 0xf007, 0xf007, 0xf00c, 0xf00e, 0xf011, 0xf011, 0xf013, 0xf013, 0xf017, 0xf017, - 0xf019, 0xf019, 0xf01c, 0xf01c, 0xf021, 0xf021, 0xf023, 0xf023, 0xf025, 0xf025, 0xf027, 0xf028, 0xf02e, 0xf02e, - 0xf030, 0xf030, 0xf03a, 0xf03a, 0xf03d, 0xf03d, 0xf049, 0xf04c, 0xf050, 0xf050, 0xf059, 0xf059, 0xf05e, 0xf05e, - 0xf062, 0xf063, 0xf065, 0xf065, 0xf067, 0xf067, 0xf071, 0xf071, 0xf075, 0xf075, 0xf077, 0xf078, 0xf07b, 0xf07c, - 0xf084, 0xf085, 0xf091, 0xf091, 0xf0a0, 0xf0a0, 0xf0ac, 0xf0ad, 0xf0c5, 0xf0c5, 0xf0c7, 0xf0c9, 0xf0cb, 0xf0cb, - 0xf0d0, 0xf0d0, 0xf0dc, 0xf0dc, 0xf0e2, 0xf0e2, 0xf0eb, 0xf0eb, 0xf0f1, 0xf0f1, 0xf0f3, 0xf0f3, 0xf0fe, 0xf0fe, - 0xf110, 0xf110, 0xf119, 0xf119, 0xf11b, 0xf11c, 0xf140, 0xf140, 0xf144, 0xf144, 0xf14a, 0xf14a, 0xf15b, 0xf15b, - 0xf15d, 0xf15d, 0xf188, 0xf188, 0xf191, 0xf192, 0xf1ab, 0xf1ab, 0xf1dd, 0xf1de, 0xf1e6, 0xf1e6, 0xf1eb, 0xf1eb, - 0xf1f8, 0xf1f8, 0xf1fc, 0xf1fc, 0xf242, 0xf242, 0xf245, 0xf245, 0xf26c, 0xf26c, 0xf279, 0xf279, 0xf2d0, 0xf2d0, - 0xf2db, 0xf2db, 0xf2f2, 0xf2f2, 0xf2f5, 0xf2f5, 0xf3c1, 0xf3c1, 0xf410, 0xf410, 0xf466, 0xf466, 0xf500, 0xf500, - 0xf51f, 0xf51f, 0xf545, 0xf545, 0xf547, 0xf548, 0xf552, 0xf552, 0xf57a, 0xf57a, 0xf5a2, 0xf5a2, 0xf5aa, 0xf5aa, - 0xf5e7, 0xf5e7, 0xf65d, 0xf65e, 0xf6a9, 0xf6a9, 0xf6cf, 0xf6cf, 0xf794, 0xf794, 0xf7c2, 0xf7c2, 0xf807, 0xf807, - 0xf815, 0xf815, 0xf818, 0xf818, 0xf84c, 0xf84c, 0xf8cc, 0xf8cc, 0x0, 0x0}; + 0xe086, 0xe086, 0xf002, 0xf002, 0xf005, 0xf005, 0xf007, 0xf007, 0xf00c, 0xf00e, 0xf011, 0xf011, 0xf013, 0xf013, + 0xf017, 0xf017, 0xf019, 0xf019, 0xf01c, 0xf01c, 0xf021, 0xf021, 0xf023, 0xf023, 0xf025, 0xf025, 0xf027, 0xf028, + 0xf02e, 0xf02e, 0xf030, 0xf030, 0xf03a, 0xf03a, 0xf03d, 0xf03d, 0xf049, 0xf04c, 0xf050, 0xf050, 0xf059, 0xf059, + 0xf05e, 0xf05e, 0xf062, 0xf063, 0xf065, 0xf065, 0xf067, 0xf067, 0xf071, 0xf071, 0xf075, 0xf075, 0xf077, 0xf078, + 0xf07b, 0xf07c, 0xf084, 0xf085, 0xf091, 0xf091, 0xf0a0, 0xf0a0, 0xf0ac, 0xf0ad, 0xf0c5, 0xf0c5, 0xf0c7, 0xf0c9, + 0xf0cb, 0xf0cb, 0xf0d0, 0xf0d0, 0xf0dc, 0xf0dc, 0xf0e2, 0xf0e2, 0xf0e7, 0xf0e7, 0xf0eb, 0xf0eb, 0xf0f1, 0xf0f1, + 0xf0f3, 0xf0f3, 0xf0fe, 0xf0fe, 0xf110, 0xf110, 0xf119, 0xf119, 0xf11b, 0xf11c, 0xf140, 0xf140, 0xf144, 0xf144, + 0xf14a, 0xf14a, 0xf15b, 0xf15b, 0xf15d, 0xf15d, 0xf188, 0xf188, 0xf191, 0xf192, 0xf1ab, 0xf1ab, 0xf1dd, 0xf1de, + 0xf1e6, 0xf1e6, 0xf1eb, 0xf1eb, 0xf1f8, 0xf1f8, 0xf1fc, 0xf1fc, 0xf242, 0xf242, 0xf245, 0xf245, 0xf26c, 0xf26c, + 0xf279, 0xf279, 0xf2d0, 0xf2d0, 0xf2db, 0xf2db, 0xf2f2, 0xf2f2, 0xf2f5, 0xf2f5, 0xf3c1, 0xf3c1, 0xf3fd, 0xf3fd, + 0xf410, 0xf410, 0xf466, 0xf466, 0xf500, 0xf500, 0xf51f, 0xf51f, 0xf538, 0xf538, 0xf545, 0xf545, 0xf547, 0xf548, + 0xf552, 0xf552, 0xf57a, 0xf57a, 0xf5a2, 0xf5a2, 0xf5aa, 0xf5aa, 0xf5e7, 0xf5e7, 0xf65d, 0xf65e, 0xf6a9, 0xf6a9, + 0xf6cf, 0xf6cf, 0xf794, 0xf794, 0xf7c2, 0xf7c2, 0xf807, 0xf807, 0xf815, 0xf815, 0xf818, 0xf818, 0xf84c, 0xf84c, + 0xf8cc, 0xf8cc, 0x0, 0x0}; static constexpr ImWchar range_pf[] = { 0x2196, 0x2199, 0x219e, 0x21a1, 0x21b0, 0x21b3, 0x21ba, 0x21c3, 0x21c7, 0x21ca, 0x21d0, 0x21d4, 0x21dc, 0x21dd, 0x21e0, 0x21e3, 0x21ed, 0x21ee, 0x21f7, 0x21f8, 0x21fa, 0x21fb, 0x227a, 0x227d, 0x235e, 0x235e, 0x2360, 0x2361,