mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 23:11:14 +01:00
Migrate Hardcore Toggle Code to Achievement Manager
AchievementManager::SetHardcoreMode now handles the (non-Qt) settings disabled by hardcore mode, instead of doing this on the Qt layer. Also ensured Init/Enable Achievements paths run this code, fixing the bug wherein the player can manipulate things when achievements are disabled that persist when turned back on.
This commit is contained in:
parent
5fe9e2f6ed
commit
415fa3c6a5
@ -24,6 +24,8 @@
|
|||||||
#include "Common/Version.h"
|
#include "Common/Version.h"
|
||||||
#include "Common/WorkQueueThread.h"
|
#include "Common/WorkQueueThread.h"
|
||||||
#include "Core/Config/AchievementSettings.h"
|
#include "Core/Config/AchievementSettings.h"
|
||||||
|
#include "Core/Config/FreeLookSettings.h"
|
||||||
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/HW/VideoInterface.h"
|
#include "Core/HW/VideoInterface.h"
|
||||||
@ -62,7 +64,7 @@ void AchievementManager::Init()
|
|||||||
[](const char* message, const rc_client_t* client) {
|
[](const char* message, const rc_client_t* client) {
|
||||||
INFO_LOG_FMT(ACHIEVEMENTS, "{}", message);
|
INFO_LOG_FMT(ACHIEVEMENTS, "{}", message);
|
||||||
});
|
});
|
||||||
rc_client_set_hardcore_enabled(m_client, Config::Get(Config::RA_HARDCORE_ENABLED));
|
SetHardcoreMode();
|
||||||
m_queue.Reset("AchievementManagerQueue", [](const std::function<void()>& func) { func(); });
|
m_queue.Reset("AchievementManagerQueue", [](const std::function<void()>& func) { func(); });
|
||||||
m_image_queue.Reset("AchievementManagerImageQueue",
|
m_image_queue.Reset("AchievementManagerImageQueue",
|
||||||
[](const std::function<void()>& func) { func(); });
|
[](const std::function<void()>& func) { func(); });
|
||||||
@ -345,6 +347,13 @@ std::recursive_mutex& AchievementManager::GetLock()
|
|||||||
void AchievementManager::SetHardcoreMode()
|
void AchievementManager::SetHardcoreMode()
|
||||||
{
|
{
|
||||||
rc_client_set_hardcore_enabled(m_client, Config::Get(Config::RA_HARDCORE_ENABLED));
|
rc_client_set_hardcore_enabled(m_client, Config::Get(Config::RA_HARDCORE_ENABLED));
|
||||||
|
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
||||||
|
{
|
||||||
|
if (Config::Get(Config::MAIN_EMULATION_SPEED) < 1.0f)
|
||||||
|
Config::SetBaseOrCurrent(Config::MAIN_EMULATION_SPEED, 1.0f);
|
||||||
|
Config::SetBaseOrCurrent(Config::FREE_LOOK_ENABLED, false);
|
||||||
|
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AchievementManager::IsHardcoreModeActive() const
|
bool AchievementManager::IsHardcoreModeActive() const
|
||||||
|
@ -247,11 +247,7 @@ void AchievementSettingsWidget::ToggleRAIntegration()
|
|||||||
instance.Init();
|
instance.Init();
|
||||||
else
|
else
|
||||||
instance.Shutdown();
|
instance.Shutdown();
|
||||||
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
UpdateHardcoreMode();
|
||||||
{
|
|
||||||
emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance()));
|
|
||||||
emit Settings::Instance().HardcoreStateChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AchievementSettingsWidget::Login()
|
void AchievementSettingsWidget::Login()
|
||||||
@ -271,17 +267,7 @@ void AchievementSettingsWidget::Logout()
|
|||||||
void AchievementSettingsWidget::ToggleHardcore()
|
void AchievementSettingsWidget::ToggleHardcore()
|
||||||
{
|
{
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
AchievementManager::GetInstance().SetHardcoreMode();
|
UpdateHardcoreMode();
|
||||||
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
|
||||||
{
|
|
||||||
if (Config::Get(Config::MAIN_EMULATION_SPEED) < 1.0f)
|
|
||||||
Config::SetBaseOrCurrent(Config::MAIN_EMULATION_SPEED, 1.0f);
|
|
||||||
Config::SetBaseOrCurrent(Config::FREE_LOOK_ENABLED, false);
|
|
||||||
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, false);
|
|
||||||
Settings::Instance().SetDebugModeEnabled(false);
|
|
||||||
}
|
|
||||||
emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance()));
|
|
||||||
emit Settings::Instance().HardcoreStateChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AchievementSettingsWidget::ToggleUnofficial()
|
void AchievementSettingsWidget::ToggleUnofficial()
|
||||||
@ -311,4 +297,15 @@ void AchievementSettingsWidget::ToggleProgress()
|
|||||||
SaveSettings();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AchievementSettingsWidget::UpdateHardcoreMode()
|
||||||
|
{
|
||||||
|
AchievementManager::GetInstance().SetHardcoreMode();
|
||||||
|
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
||||||
|
{
|
||||||
|
Settings::Instance().SetDebugModeEnabled(false);
|
||||||
|
}
|
||||||
|
emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance()));
|
||||||
|
emit Settings::Instance().HardcoreStateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
#endif // USE_RETRO_ACHIEVEMENTS
|
||||||
|
@ -39,6 +39,8 @@ private:
|
|||||||
void ToggleDiscordPresence();
|
void ToggleDiscordPresence();
|
||||||
void ToggleProgress();
|
void ToggleProgress();
|
||||||
|
|
||||||
|
void UpdateHardcoreMode();
|
||||||
|
|
||||||
QGroupBox* m_common_box;
|
QGroupBox* m_common_box;
|
||||||
QVBoxLayout* m_common_layout;
|
QVBoxLayout* m_common_layout;
|
||||||
ToolTipCheckBox* m_common_integration_enabled_input;
|
ToolTipCheckBox* m_common_integration_enabled_input;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user