This commit is contained in:
chaoticgd 2025-12-15 12:43:34 +07:00 committed by GitHub
commit de61314f1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 20 deletions

View File

@ -814,9 +814,6 @@ void MainWindow::onAchievementsHardcoreModeChanged(bool enabled)
// disable debugger while hardcore mode is active // disable debugger while hardcore mode is active
m_ui.actionDebugger->setDisabled(enabled); m_ui.actionDebugger->setDisabled(enabled);
// refresh emulation actions to show/hide load state buttons based on hardcore mode
updateEmulationActions(s_vm_valid, s_vm_valid, false);
if (enabled) if (enabled)
{ {
// If PauseOnEntry is enabled, we prompt the user to disable Hardcore Mode // If PauseOnEntry is enabled, we prompt the user to disable Hardcore Mode
@ -912,7 +909,7 @@ void MainWindow::updateEmulationActions(bool starting, bool running, bool stoppi
m_ui.actionPause->setEnabled(running); m_ui.actionPause->setEnabled(running);
m_ui.actionScreenshot->setEnabled(running); m_ui.actionScreenshot->setEnabled(running);
m_ui.menuChangeDisc->setEnabled(running); m_ui.menuChangeDisc->setEnabled(running);
m_ui.menuLoadState->setEnabled(running && !Achievements::IsHardcoreModeActive()); m_ui.menuLoadState->setEnabled(running);
m_ui.menuSaveState->setEnabled(running); m_ui.menuSaveState->setEnabled(running);
m_ui.actionSaveGSDump->setEnabled(running); m_ui.actionSaveGSDump->setEnabled(running);
@ -921,7 +918,7 @@ void MainWindow::updateEmulationActions(bool starting, bool running, bool stoppi
m_ui.actionToolbarPause->setEnabled(running); m_ui.actionToolbarPause->setEnabled(running);
m_ui.actionToolbarScreenshot->setEnabled(running); m_ui.actionToolbarScreenshot->setEnabled(running);
m_ui.actionToolbarChangeDisc->setEnabled(running); m_ui.actionToolbarChangeDisc->setEnabled(running);
m_ui.actionToolbarLoadState->setEnabled(running && !Achievements::IsHardcoreModeActive()); m_ui.actionToolbarLoadState->setEnabled(running);
m_ui.actionToolbarSaveState->setEnabled(running); m_ui.actionToolbarSaveState->setEnabled(running);
m_ui.actionViewGameProperties->setEnabled(running); m_ui.actionViewGameProperties->setEnabled(running);

View File

@ -27,7 +27,7 @@ AchievementSettingsWidget::AchievementSettingsWidget(SettingsWindow* settings_di
setupTab(m_ui); setupTab(m_ui);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enable, "Achievements", "Enabled", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enable, "Achievements", "Enabled", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.hardcoreMode, "Achievements", "ChallengeMode", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.hardcoreMode, "Achievements", "ChallengeMode", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.achievementNotifications, "Achievements", "Notifications", true); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.achievementNotifications, "Achievements", "Notifications", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.leaderboardNotifications, "Achievements", "LeaderboardNotifications", true); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.leaderboardNotifications, "Achievements", "LeaderboardNotifications", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.soundEffects, "Achievements", "SoundEffects", true); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.soundEffects, "Achievements", "SoundEffects", true);
@ -49,7 +49,7 @@ AchievementSettingsWidget::AchievementSettingsWidget(SettingsWindow* settings_di
SettingWidgetBinder::BindWidgetToFileSetting(sif, m_ui.lbSoundPath, m_ui.lbSoundBrowse, m_ui.lbSoundOpen, m_ui.lbSoundReset, "Achievements", "LBSubmitSoundName", Path::Combine(EmuFolders::Resources, EmuConfig.Achievements.DEFAULT_LBSUBMIT_SOUND_NAME), qApp->translate("AchievementSettingsWidget", AUDIO_FILE_FILTER), true, false); SettingWidgetBinder::BindWidgetToFileSetting(sif, m_ui.lbSoundPath, m_ui.lbSoundBrowse, m_ui.lbSoundOpen, m_ui.lbSoundReset, "Achievements", "LBSubmitSoundName", Path::Combine(EmuFolders::Resources, EmuConfig.Achievements.DEFAULT_LBSUBMIT_SOUND_NAME), qApp->translate("AchievementSettingsWidget", AUDIO_FILE_FILTER), true, false);
dialog()->registerWidgetHelp(m_ui.enable, tr("Enable Achievements"), tr("Unchecked"), tr("When enabled and logged in, PCSX2 will scan for achievements on startup.")); dialog()->registerWidgetHelp(m_ui.enable, tr("Enable Achievements"), tr("Unchecked"), tr("When enabled and logged in, PCSX2 will scan for achievements on startup."));
dialog()->registerWidgetHelp(m_ui.hardcoreMode, tr("Enable Hardcore Mode"), tr("Unchecked"), tr("\"Challenge\" mode for achievements, including leaderboard tracking. Disables save state, cheats, and slowdown functions.")); dialog()->registerWidgetHelp(m_ui.hardcoreMode, tr("Enable Hardcore Mode"), tr("Checked"), tr("\"Challenge\" mode for achievements, including leaderboard tracking. Disables save state, cheats, and slowdown functions."));
dialog()->registerWidgetHelp(m_ui.achievementNotifications, tr("Show Achievement Notifications"), tr("Checked"), tr("Displays popup messages on events such as achievement unlocks and game completion.")); dialog()->registerWidgetHelp(m_ui.achievementNotifications, tr("Show Achievement Notifications"), tr("Checked"), tr("Displays popup messages on events such as achievement unlocks and game completion."));
dialog()->registerWidgetHelp(m_ui.leaderboardNotifications, tr("Show Leaderboard Notifications"), tr("Checked"), tr("Displays popup messages when starting, submitting, or failing a leaderboard challenge.")); dialog()->registerWidgetHelp(m_ui.leaderboardNotifications, tr("Show Leaderboard Notifications"), tr("Checked"), tr("Displays popup messages when starting, submitting, or failing a leaderboard challenge."));
dialog()->registerWidgetHelp(m_ui.soundEffects, tr("Enable Sound Effects"), tr("Checked"), tr("Plays sound effects for events such as achievement unlocks and leaderboard submissions.")); dialog()->registerWidgetHelp(m_ui.soundEffects, tr("Enable Sound Effects"), tr("Checked"), tr("Plays sound effects for events such as achievement unlocks and leaderboard submissions."));
@ -169,7 +169,7 @@ void AchievementSettingsWidget::onHardcoreModeStateChanged()
return; return;
const bool enabled = dialog()->getEffectiveBoolValue("Achievements", "Enabled", false); const bool enabled = dialog()->getEffectiveBoolValue("Achievements", "Enabled", false);
const bool challenge = dialog()->getEffectiveBoolValue("Achievements", "ChallengeMode", false); const bool challenge = dialog()->getEffectiveBoolValue("Achievements", "ChallengeMode", true);
if (!enabled || !challenge) if (!enabled || !challenge)
return; return;
@ -250,7 +250,7 @@ void AchievementSettingsWidget::onLoginLogoutPressed()
m_ui.enable->setChecked(true); m_ui.enable->setChecked(true);
updateEnableState(); updateEnableState();
} }
if (!m_ui.hardcoreMode->isChecked() && Host::GetBaseBoolSettingValue("Achievements", "ChallengeMode", false)) if (!m_ui.hardcoreMode->isChecked() && Host::GetBaseBoolSettingValue("Achievements", "ChallengeMode", true))
{ {
QSignalBlocker sb(m_ui.hardcoreMode); QSignalBlocker sb(m_ui.hardcoreMode);
m_ui.hardcoreMode->setChecked(true); m_ui.hardcoreMode->setChecked(true);

View File

@ -7007,8 +7007,7 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type)
case PauseSubMenu::None: case PauseSubMenu::None:
{ {
// NOTE: Menu close must come first, because otherwise VM destruction options will race. // NOTE: Menu close must come first, because otherwise VM destruction options will race.
const bool can_load_state = s_current_disc_crc != 0 && !Achievements::IsHardcoreModeActive(); const bool can_load_or_save_state = s_current_disc_crc != 0;
const bool can_save_state = s_current_disc_crc != 0;
if (just_focused) if (just_focused)
ImGui::SetFocusID(ImGui::GetID(FSUI_ICONSTR(ICON_FA_PLAY, "Resume Game")), ImGui::GetCurrentWindow()); ImGui::SetFocusID(ImGui::GetID(FSUI_ICONSTR(ICON_FA_PLAY, "Resume Game")), ImGui::GetCurrentWindow());
@ -7022,19 +7021,19 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type)
DoToggleFrameLimit(); DoToggleFrameLimit();
} }
if (ActiveButton(FSUI_ICONSTR(ICON_FA_ARROW_ROTATE_LEFT, "Load State"), false, can_load_state)) if (ActiveButton(FSUI_ICONSTR(ICON_FA_ARROW_ROTATE_LEFT, "Load State"), false, can_load_or_save_state))
{ {
if (OpenSaveStateSelector(true)) if (OpenSaveStateSelector(true))
s_current_main_window = MainWindowType::None; s_current_main_window = MainWindowType::None;
} }
if (ActiveButton(FSUI_ICONSTR(ICON_FA_DOWNLOAD, "Save State"), false, can_save_state)) if (ActiveButton(FSUI_ICONSTR(ICON_FA_DOWNLOAD, "Save State"), false, can_load_or_save_state))
{ {
if (OpenSaveStateSelector(false)) if (OpenSaveStateSelector(false))
s_current_main_window = MainWindowType::None; s_current_main_window = MainWindowType::None;
} }
if (ActiveButton(FSUI_ICONSTR(ICON_FA_WRENCH, "Game Properties"), false, can_save_state)) if (ActiveButton(FSUI_ICONSTR(ICON_FA_WRENCH, "Game Properties"), false, can_load_or_save_state))
{ {
SwitchToGameSettings(); SwitchToGameSettings();
} }
@ -7074,7 +7073,7 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type)
if (ActiveButton(FSUI_ICONSTR(ICON_FA_POWER_OFF, "Close Game"), false)) if (ActiveButton(FSUI_ICONSTR(ICON_FA_POWER_OFF, "Close Game"), false))
{ {
// skip submenu when we can't save anyway // skip submenu when we can't save anyway
if (!can_save_state) if (!can_load_or_save_state)
RequestShutdown(false); RequestShutdown(false);
else else
OpenPauseSubMenu(PauseSubMenu::Exit); OpenPauseSubMenu(PauseSubMenu::Exit);
@ -7399,7 +7398,7 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
if (ActiveButton( if (ActiveButton(
is_loading ? FSUI_ICONSTR(ICON_FA_FOLDER_OPEN, "Load State") : FSUI_ICONSTR(ICON_FA_FOLDER_OPEN, "Save State"), is_loading ? FSUI_ICONSTR(ICON_FA_FOLDER_OPEN, "Load State") : FSUI_ICONSTR(ICON_FA_FOLDER_OPEN, "Save State"),
false, is_loading ? !Achievements::IsHardcoreModeActive() : true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY)) false, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY))
{ {
if (is_loading) if (is_loading)
DoLoadState(std::move(entry.path), entry.slot, false); DoLoadState(std::move(entry.path), entry.slot, false);
@ -8882,7 +8881,7 @@ void FullscreenUI::DrawAchievementsLoginWindow()
}); });
} }
if (!Host::GetBaseBoolSettingValue("Achievements", "ChallengeMode", false)) if (!Host::GetBaseBoolSettingValue("Achievements", "ChallengeMode", true))
{ {
OpenConfirmMessageDialog(FSUI_STR("Enable Hardcore Mode"), OpenConfirmMessageDialog(FSUI_STR("Enable Hardcore Mode"),
FSUI_STR("Hardcore mode is not currently enabled. Enabling hardcore mode allows you to set times, scores, and " FSUI_STR("Hardcore mode is not currently enabled. Enabling hardcore mode allows you to set times, scores, and "
@ -9054,7 +9053,7 @@ void FullscreenUI::DrawAchievementsSettingsPage(std::unique_lock<std::mutex>& se
check_challenge_state |= DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_PF_DUMBELL, "Hardcore Mode"), check_challenge_state |= DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_PF_DUMBELL, "Hardcore Mode"),
FSUI_CSTR( FSUI_CSTR(
"\"Challenge\" mode for achievements, including leaderboard tracking. Disables save state, cheats, and slowdown functions."), "\"Challenge\" mode for achievements, including leaderboard tracking. Disables save state, cheats, and slowdown functions."),
"Achievements", "ChallengeMode", false, enabled); "Achievements", "ChallengeMode", true, enabled);
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_BELL, "Achievement Notifications"), DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_BELL, "Achievement Notifications"),
FSUI_CSTR("Displays popup messages on events such as achievement unlocks and leaderboard submissions."), "Achievements", FSUI_CSTR("Displays popup messages on events such as achievement unlocks and leaderboard submissions."), "Achievements",
"Notifications", true, enabled); "Notifications", true, enabled);
@ -9110,7 +9109,7 @@ void FullscreenUI::DrawAchievementsSettingsPage(std::unique_lock<std::mutex>& se
"Achievements", "UnofficialTestMode", false, enabled); "Achievements", "UnofficialTestMode", false, enabled);
// Check for challenge mode just being enabled. // Check for challenge mode just being enabled.
if (check_challenge_state && enabled && bsi->GetBoolValue("Achievements", "ChallengeMode", false) && VMManager::HasValidVM()) if (check_challenge_state && enabled && bsi->GetBoolValue("Achievements", "ChallengeMode", true) && VMManager::HasValidVM())
{ {
// don't bother prompting if the game doesn't have achievements // don't bother prompting if the game doesn't have achievements
auto lock = Achievements::GetLock(); auto lock = Achievements::GetLock();

View File

@ -1848,7 +1848,7 @@ Pcsx2Config::AchievementsOptions::AchievementsOptions()
{ {
bitset = 0; bitset = 0;
Enabled = false; Enabled = false;
HardcoreMode = false; HardcoreMode = true;
EncoreMode = false; EncoreMode = false;
SpectatorMode = false; SpectatorMode = false;
UnofficialTestMode = false; UnofficialTestMode = false;