Achievements: Display an error when trying to load a state in hardcore

This commit is contained in:
chaoticgd 2025-11-28 15:36:21 +00:00
parent 65e209b0f0
commit bc4c908a18
No known key found for this signature in database
GPG Key ID: FFFC3F38B3A0E6D8
2 changed files with 8 additions and 12 deletions

View File

@ -813,9 +813,6 @@ void MainWindow::onAchievementsHardcoreModeChanged(bool enabled)
// disable debugger while hardcore mode is active
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 PauseOnEntry is enabled, we prompt the user to disable Hardcore Mode
@ -911,7 +908,7 @@ void MainWindow::updateEmulationActions(bool starting, bool running, bool stoppi
m_ui.actionPause->setEnabled(running);
m_ui.actionScreenshot->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.actionSaveGSDump->setEnabled(running);
@ -920,7 +917,7 @@ void MainWindow::updateEmulationActions(bool starting, bool running, bool stoppi
m_ui.actionToolbarPause->setEnabled(running);
m_ui.actionToolbarScreenshot->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.actionViewGameProperties->setEnabled(running);

View File

@ -6948,8 +6948,7 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type)
case PauseSubMenu::None:
{
// 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_save_state = s_current_disc_crc != 0;
const bool can_load_or_save_state = s_current_disc_crc != 0;
if (just_focused)
ImGui::SetFocusID(ImGui::GetID(FSUI_ICONSTR(ICON_FA_PLAY, "Resume Game")), ImGui::GetCurrentWindow());
@ -6963,19 +6962,19 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type)
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))
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))
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();
}
@ -7015,7 +7014,7 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type)
if (ActiveButton(FSUI_ICONSTR(ICON_FA_POWER_OFF, "Close Game"), false))
{
// skip submenu when we can't save anyway
if (!can_save_state)
if (!can_load_or_save_state)
RequestShutdown(false);
else
OpenPauseSubMenu(PauseSubMenu::Exit);
@ -7340,7 +7339,7 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
if (ActiveButton(
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)
DoLoadState(std::move(entry.path));