Achievements: Don't turn HC off on login fail if we reauth

This commit is contained in:
Stenzek
2023-09-24 01:57:37 +10:00
parent 30fdffae03
commit 4266f42257
3 changed files with 34 additions and 7 deletions

View File

@ -11,7 +11,7 @@
#include <QtWidgets/QMessageBox>
AchievementLoginDialog::AchievementLoginDialog(QWidget* parent, Achievements::LoginRequestReason reason)
: QDialog(parent)
: QDialog(parent), m_reason(reason)
{
m_ui.setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
@ -51,6 +51,15 @@ void AchievementLoginDialog::loginClicked()
void AchievementLoginDialog::cancelClicked()
{
// Disable hardcore mode if we cancelled reauthentication.
if (m_reason == Achievements::LoginRequestReason::TokenInvalid && QtHost::IsSystemValid())
{
Host::RunOnCPUThread([]() {
if (System::IsValid() && !Achievements::HasActiveGame())
Achievements::DisableHardcoreMode();
});
}
done(1);
}

View File

@ -30,4 +30,5 @@ private:
Ui::AchievementLoginDialog m_ui;
QPushButton* m_login;
Achievements::LoginRequestReason m_reason;
};