Merge pull request #12953 from LillyJadeKatrin/retroachievements-fail-messaging
Achievements Fail Messaging
This commit is contained in:
commit
122bce08de
|
@ -749,6 +749,7 @@ void AchievementManager::LoginCallback(int result, const char* error_message, rc
|
||||||
{
|
{
|
||||||
WARN_LOG_FMT(ACHIEVEMENTS, "Failed to login {} to RetroAchievements server.",
|
WARN_LOG_FMT(ACHIEVEMENTS, "Failed to login {} to RetroAchievements server.",
|
||||||
Config::Get(Config::RA_USERNAME));
|
Config::Get(Config::RA_USERNAME));
|
||||||
|
AchievementManager::GetInstance().m_update_callback({.failed_login_code = result});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,6 +761,7 @@ void AchievementManager::LoginCallback(int result, const char* error_message, rc
|
||||||
if (!user)
|
if (!user)
|
||||||
{
|
{
|
||||||
WARN_LOG_FMT(ACHIEVEMENTS, "Failed to retrieve user information from client.");
|
WARN_LOG_FMT(ACHIEVEMENTS, "Failed to retrieve user information from client.");
|
||||||
|
AchievementManager::GetInstance().m_update_callback({.failed_login_code = RC_INVALID_STATE});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,6 +780,7 @@ void AchievementManager::LoginCallback(int result, const char* error_message, rc
|
||||||
INFO_LOG_FMT(ACHIEVEMENTS, "Attempted to login prior user {}; current user is {}.",
|
INFO_LOG_FMT(ACHIEVEMENTS, "Attempted to login prior user {}; current user is {}.",
|
||||||
user->username, Config::Get(Config::RA_USERNAME));
|
user->username, Config::Get(Config::RA_USERNAME));
|
||||||
rc_client_logout(client);
|
rc_client_logout(client);
|
||||||
|
AchievementManager::GetInstance().m_update_callback({.failed_login_code = RC_INVALID_STATE});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -830,6 +833,15 @@ void AchievementManager::LoadGameCallback(int result, const char* error_message,
|
||||||
rc_client_t* client, void* userdata)
|
rc_client_t* client, void* userdata)
|
||||||
{
|
{
|
||||||
AchievementManager::GetInstance().m_loading_volume.reset(nullptr);
|
AchievementManager::GetInstance().m_loading_volume.reset(nullptr);
|
||||||
|
if (result == RC_API_FAILURE)
|
||||||
|
{
|
||||||
|
WARN_LOG_FMT(ACHIEVEMENTS, "Load data request rejected for old Dolphin version.");
|
||||||
|
OSD::AddMessage("RetroAchievements no longer supports this version of Dolphin.",
|
||||||
|
OSD::Duration::VERY_LONG, OSD::Color::RED);
|
||||||
|
OSD::AddMessage("Please update Dolphin to a newer version.", OSD::Duration::VERY_LONG,
|
||||||
|
OSD::Color::RED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (result != RC_OK)
|
if (result != RC_OK)
|
||||||
{
|
{
|
||||||
WARN_LOG_FMT(ACHIEVEMENTS, "Failed to load data for current game.");
|
WARN_LOG_FMT(ACHIEVEMENTS, "Failed to load data for current game.");
|
||||||
|
|
|
@ -98,6 +98,7 @@ public:
|
||||||
bool all_leaderboards = false;
|
bool all_leaderboards = false;
|
||||||
std::set<AchievementId> leaderboards{};
|
std::set<AchievementId> leaderboards{};
|
||||||
bool rich_presence = false;
|
bool rich_presence = false;
|
||||||
|
int failed_login_code = 0;
|
||||||
};
|
};
|
||||||
using UpdateCallback = std::function<void(const UpdatedItems&)>;
|
using UpdateCallback = std::function<void(const UpdatedItems&)>;
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,24 @@ AchievementSettingsWidget::AchievementSettingsWidget(QWidget* parent) : QWidget(
|
||||||
ToggleHardcore();
|
ToggleHardcore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AchievementSettingsWidget::UpdateData()
|
void AchievementSettingsWidget::UpdateData(int login_failed_code)
|
||||||
{
|
{
|
||||||
|
if (login_failed_code != RC_OK)
|
||||||
|
{
|
||||||
|
switch (login_failed_code)
|
||||||
|
{
|
||||||
|
case RC_INVALID_CREDENTIALS:
|
||||||
|
m_common_login_failed->setText(tr("Login Failed - Invalid Username/Password"));
|
||||||
|
break;
|
||||||
|
case RC_NO_RESPONSE:
|
||||||
|
m_common_login_failed->setText(tr("Login Failed - No Internet Connection"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_common_login_failed->setText(tr("Login Failed - Server Error"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_common_login_failed->setVisible(true);
|
||||||
|
}
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,6 +272,7 @@ void AchievementSettingsWidget::ToggleRAIntegration()
|
||||||
|
|
||||||
void AchievementSettingsWidget::Login()
|
void AchievementSettingsWidget::Login()
|
||||||
{
|
{
|
||||||
|
m_common_login_failed->setVisible(false);
|
||||||
Config::SetBaseOrCurrent(Config::RA_USERNAME, m_common_username_input->text().toStdString());
|
Config::SetBaseOrCurrent(Config::RA_USERNAME, m_common_username_input->text().toStdString());
|
||||||
AchievementManager::GetInstance().Login(m_common_password_input->text().toStdString());
|
AchievementManager::GetInstance().Login(m_common_password_input->text().toStdString());
|
||||||
m_common_password_input->setText(QString());
|
m_common_password_input->setText(QString());
|
||||||
|
|
|
@ -18,7 +18,7 @@ class AchievementSettingsWidget final : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AchievementSettingsWidget(QWidget* parent);
|
explicit AchievementSettingsWidget(QWidget* parent);
|
||||||
void UpdateData();
|
void UpdateData(int login_failed_code);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnControllerInterfaceConfigure();
|
void OnControllerInterfaceConfigure();
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
#include <rcheevos/include/rc_error.h>
|
||||||
|
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
@ -36,7 +38,7 @@ AchievementsWindow::AchievementsWindow(QWidget* parent) : QDialog(parent)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
|
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
|
||||||
[this] { m_settings_widget->UpdateData(); });
|
[this] { m_settings_widget->UpdateData(RC_OK); });
|
||||||
connect(&Settings::Instance(), &Settings::HardcoreStateChanged, this,
|
connect(&Settings::Instance(), &Settings::HardcoreStateChanged, this,
|
||||||
[this] { AchievementsWindow::UpdateData({.all = true}); });
|
[this] { AchievementsWindow::UpdateData({.all = true}); });
|
||||||
}
|
}
|
||||||
|
@ -79,7 +81,7 @@ void AchievementsWindow::ConnectWidgets()
|
||||||
|
|
||||||
void AchievementsWindow::UpdateData(AchievementManager::UpdatedItems updated_items)
|
void AchievementsWindow::UpdateData(AchievementManager::UpdatedItems updated_items)
|
||||||
{
|
{
|
||||||
m_settings_widget->UpdateData();
|
m_settings_widget->UpdateData(updated_items.failed_login_code);
|
||||||
if (updated_items.all)
|
if (updated_items.all)
|
||||||
{
|
{
|
||||||
m_header_widget->UpdateData();
|
m_header_widget->UpdateData();
|
||||||
|
|
Loading…
Reference in New Issue