Partially revert "Revert "Audit uses of IsRunning and GetState""
This reverts the revert commitbc67fc97c3, except for the changes in BaseConfigLoader.cpp, which caused the bug that made us revert72cf2bdb87. PR 12917 contains an improved change to BaseConfigLoader.cpp, which can be merged (or rejected) independently. A few changes have also been made based on review comments.
This commit is contained in:
@@ -177,6 +177,8 @@ void AchievementSettingsWidget::OnControllerInterfaceConfigure()
|
||||
|
||||
void AchievementSettingsWidget::LoadSettings()
|
||||
{
|
||||
Core::System& system = Core::System::GetInstance();
|
||||
|
||||
bool enabled = Config::Get(Config::RA_ENABLED);
|
||||
bool hardcore_enabled = Config::Get(Config::RA_HARDCORE_ENABLED);
|
||||
bool logged_out = Config::Get(Config::RA_API_TOKEN).empty();
|
||||
@@ -192,27 +194,20 @@ void AchievementSettingsWidget::LoadSettings()
|
||||
SignalBlocking(m_common_password_input)->setVisible(logged_out);
|
||||
SignalBlocking(m_common_password_input)->setEnabled(enabled);
|
||||
SignalBlocking(m_common_login_button)->setVisible(logged_out);
|
||||
SignalBlocking(m_common_login_button)
|
||||
->setEnabled(enabled && !Core::IsRunning(Core::System::GetInstance()));
|
||||
if (enabled && Core::IsRunning(Core::System::GetInstance()))
|
||||
{
|
||||
SignalBlocking(m_common_login_button)->setText(tr("To log in, stop the current emulation."));
|
||||
}
|
||||
else
|
||||
{
|
||||
SignalBlocking(m_common_login_button)->setEnabled(enabled && Core::IsUninitialized(system));
|
||||
if (!enabled || Core::IsUninitialized(system))
|
||||
SignalBlocking(m_common_login_button)->setText(tr("Log In"));
|
||||
}
|
||||
else
|
||||
SignalBlocking(m_common_login_button)->setText(tr("To log in, stop the current emulation."));
|
||||
|
||||
SignalBlocking(m_common_logout_button)->setVisible(!logged_out);
|
||||
SignalBlocking(m_common_logout_button)->setEnabled(enabled);
|
||||
|
||||
SignalBlocking(m_common_hardcore_enabled_input)
|
||||
->setChecked(Config::Get(Config::RA_HARDCORE_ENABLED));
|
||||
auto& system = Core::System::GetInstance();
|
||||
SignalBlocking(m_common_hardcore_enabled_input)
|
||||
->setEnabled(enabled &&
|
||||
(hardcore_enabled || (Core::GetState(system) == Core::State::Uninitialized &&
|
||||
!system.GetMovie().IsPlayingInput())));
|
||||
->setEnabled(enabled && (hardcore_enabled || (Core::IsUninitialized(system) &&
|
||||
!system.GetMovie().IsPlayingInput())));
|
||||
|
||||
SignalBlocking(m_common_unofficial_enabled_input)
|
||||
->setChecked(Config::Get(Config::RA_UNOFFICIAL_ENABLED));
|
||||
|
||||
Reference in New Issue
Block a user