mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-26 07:39:45 -06:00
Use a stub AchivementManager when USE_RETRO_ACHIEVEMENTS isn't defined
This lets us reduce the number of USE_RETRO_ACHIEVEMENTS ifdefs in the code base, reducing visual clutter. In particular, needing an ifdef for each call to IsHardcodeModeActive was annoying to me. This also reduces the risk that someone writes code that accidentally fails to compile with USE_RETRO_ACHIEVEMENTS disabled. We could cut down on ifdefs even further by making HardcodeWarningWidget always exist, but that would result in non-trivial code ending up in the binary even with USE_RETRO_ACHIEVEMENTS disabled, so I'm leaving it out of this PR. It's not a lot of code though, so I might end up revisiting it at some point.
This commit is contained in:
@ -589,15 +589,12 @@ void HotkeyScheduler::Run()
|
||||
{
|
||||
const bool new_value = !Config::Get(Config::FREE_LOOK_ENABLED);
|
||||
Config::SetCurrent(Config::FREE_LOOK_ENABLED, new_value);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||
if (hardcore)
|
||||
OSD::AddMessage("Free Look is Disabled in Hardcore Mode");
|
||||
else
|
||||
OSD::AddMessage(fmt::format("Free Look: {}", new_value ? "Enabled" : "Disabled"));
|
||||
#else // USE_RETRO_ACHIEVEMENTS
|
||||
OSD::AddMessage(fmt::format("Free Look: {}", new_value ? "Enabled" : "Disabled"));
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
}
|
||||
|
||||
// Savestates
|
||||
|
@ -127,14 +127,9 @@ void MenuBar::OnEmulationStateChanged(Core::State state)
|
||||
m_screenshot_action->setEnabled(running);
|
||||
m_state_save_menu->setEnabled(running);
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||
m_state_load_menu->setEnabled(running && !hardcore);
|
||||
m_frame_advance_action->setEnabled(running && !hardcore);
|
||||
#else // USE_RETRO_ACHIEVEMENTS
|
||||
m_state_load_menu->setEnabled(running);
|
||||
m_frame_advance_action->setEnabled(running);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
// Movie
|
||||
m_recording_read_only->setEnabled(running);
|
||||
@ -144,11 +139,7 @@ void MenuBar::OnEmulationStateChanged(Core::State state)
|
||||
m_recording_export->setEnabled(false);
|
||||
}
|
||||
m_recording_play->setEnabled(m_game_selected && !running);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
m_recording_play->setEnabled(m_game_selected && !running && !hardcore);
|
||||
#else // USE_RETRO_ACHIEVEMENTS
|
||||
m_recording_play->setEnabled(m_game_selected && !running);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
m_recording_start->setEnabled((m_game_selected || running) &&
|
||||
!Core::System::GetInstance().GetMovie().IsPlayingInput());
|
||||
|
||||
|
@ -550,10 +550,8 @@ void Settings::SetCheatsEnabled(bool enabled)
|
||||
|
||||
void Settings::SetDebugModeEnabled(bool enabled)
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||
enabled = false;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
if (IsDebugModeEnabled() != enabled)
|
||||
{
|
||||
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_DEBUGGING, enabled);
|
||||
|
@ -84,14 +84,10 @@ void GeneralPane::CreateLayout()
|
||||
void GeneralPane::OnEmulationStateChanged(Core::State state)
|
||||
{
|
||||
const bool running = state != Core::State::Uninitialized;
|
||||
const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||
|
||||
m_checkbox_dualcore->setEnabled(!running);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||
m_checkbox_cheats->setEnabled(!running && !hardcore);
|
||||
#else // USE_RETRO_ACHIEVEMENTS
|
||||
m_checkbox_cheats->setEnabled(!running);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
m_checkbox_override_region_settings->setEnabled(!running);
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
m_checkbox_discord_presence->setEnabled(!running);
|
||||
|
@ -268,7 +268,6 @@ void InterfacePane::UpdateShowDebuggingCheckbox()
|
||||
static constexpr char TR_DISABLED_IN_HARDCORE_DESCRIPTION[] =
|
||||
QT_TR_NOOP("<dolphin_emphasis>Disabled in Hardcore Mode.</dolphin_emphasis>");
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||
SignalBlocking(m_checkbox_show_debugging_ui)->setEnabled(!hardcore);
|
||||
if (hardcore)
|
||||
@ -281,9 +280,6 @@ void InterfacePane::UpdateShowDebuggingCheckbox()
|
||||
{
|
||||
m_checkbox_show_debugging_ui->SetDescription(tr(TR_SHOW_DEBUGGING_UI_DESCRIPTION));
|
||||
}
|
||||
#else
|
||||
m_checkbox_show_debugging_ui->SetDescription(tr(TR_SHOW_DEBUGGING_UI_DESCRIPTION));
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
}
|
||||
|
||||
void InterfacePane::LoadUserStyle()
|
||||
|
Reference in New Issue
Block a user