diff --git a/Core/RetroAchievements.cpp b/Core/RetroAchievements.cpp index 9a52842afb..3a4a053679 100644 --- a/Core/RetroAchievements.cpp +++ b/Core/RetroAchievements.cpp @@ -388,6 +388,7 @@ void Initialize() { } static void login_password_callback(int result, const char *error_message, rc_client_t *client, void *userdata) { + auto di = GetI18NCategory(I18NCat::DIALOG); switch (result) { case RC_OK: { @@ -396,16 +397,20 @@ static void login_password_callback(int result, const char *error_message, rc_cl g_Config.sAchievementsUserName = user->username; NativeSaveSecret(RA_TOKEN_SECRET_NAME, std::string(user->token)); OnAchievementsLoginStateChange(); + g_OSD.Show(OSDType::MESSAGE_SUCCESS, di->T("Logged in!")); break; } case RC_INVALID_STATE: case RC_API_FAILURE: case RC_MISSING_VALUE: case RC_INVALID_JSON: - ERROR_LOG(ACHIEVEMENTS, "Failure logging in via token: %d, %s", result, error_message); + { + ERROR_LOG(ACHIEVEMENTS, "Failure logging in via password: %d, %s", result, error_message); + g_OSD.Show(OSDType::MESSAGE_WARNING, di->T("Failed to log in, check your username and password.")); OnAchievementsLoginStateChange(); break; } + } OSDCloseBackgroundProgressDialog("cheevos_async_login"); } diff --git a/UI/RetroAchievementScreens.cpp b/UI/RetroAchievementScreens.cpp index d6c1f29dba..860464cedf 100644 --- a/UI/RetroAchievementScreens.cpp +++ b/UI/RetroAchievementScreens.cpp @@ -227,7 +227,6 @@ void RetroAchievementsSettingsScreen::CreateAccountTab(UI::ViewGroup *viewGroup) return UI::EVENT_DONE; }); } else { - // TODO: Add UI for platforms that don't support System_AskUsernamePassword. if (System_GetPropertyBool(SYSPROP_HAS_LOGIN_DIALOG)) { viewGroup->Add(new Choice(ac->T("Log in")))->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn { System_AskUsernamePassword(ac->T("Log in"), [](const std::string &value, int) { @@ -242,13 +241,18 @@ void RetroAchievementsSettingsScreen::CreateAccountTab(UI::ViewGroup *viewGroup) } else { // Hack up a temporary quick login-form-ish-thing viewGroup->Add(new PopupTextInputChoice(&username_, di->T("Username"), "", 128, screenManager())); - viewGroup->Add(new PopupTextInputChoice(&password_, di->T("Password"), "", 128, screenManager())); - viewGroup->Add(new Choice(di->T("Log in")))->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn { + viewGroup->Add(new PopupTextInputChoice(&password_, di->T("Password"), "", 128, screenManager()))->SetPasswordDisplay(); + Choice *loginButton = viewGroup->Add(new Choice(di->T("Log in"))); + loginButton->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn { if (!username_.empty() && !password_.empty()) { Achievements::LoginAsync(username_.c_str(), password_.c_str()); + password_.clear(); } return UI::EVENT_DONE; }); + loginButton->SetEnabledFunc([&]() { + return !username_.empty() && !password_.empty(); + }); } viewGroup->Add(new Choice(ac->T("Register on www.retroachievements.org")))->OnClick.Add([&](UI::EventParams &) -> UI::EventReturn { System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://retroachievements.org/createaccount.php"); @@ -358,6 +362,7 @@ void RenderAchievement(UIContext &dc, const rc_client_achievement_t *achievement float iconSpace = bounds.h - padding * 2.0f; dc.Flush(); dc.RebindTexture(); + dc.PushScissor(bounds); dc.Begin(); @@ -423,6 +428,9 @@ void RenderAchievement(UIContext &dc, const rc_client_achievement_t *achievement dc.Flush(); dc.RebindTexture(); } + + dc.Flush(); + dc.PopScissor(); } void RenderGameAchievementSummary(UIContext &dc, const Bounds &bounds, float alpha) { diff --git a/assets/lang/en_US.ini b/assets/lang/en_US.ini index d60b5193c8..f6e1a19f7b 100644 --- a/assets/lang/en_US.ini +++ b/assets/lang/en_US.ini @@ -360,6 +360,7 @@ Edit = Edit Enable All = Enable all Enabled = Enabled Enter = Enter +Failed to log in, check your username and password. = Failed to log in, check your username and password. Filter = Filter Finish = Finish GE Frame Dumps = GE Frame Dumps @@ -372,6 +373,7 @@ Loading = Loading\nPlease Wait... LoadingFailed = Unable to load data. Log in = Log in Log out = Log out +Logged in! = Logged in! Move = Move Move Up = Move Up Move Down = Move Down diff --git a/assets/lang/sv_SE.ini b/assets/lang/sv_SE.ini index 1f4b993d26..6c86083670 100644 --- a/assets/lang/sv_SE.ini +++ b/assets/lang/sv_SE.ini @@ -8,6 +8,7 @@ Achievements = Achievements Challenge Mode = Utmanings-läge Challenge Mode (no savestates) = Utmanings-läge (inga sparade state) Earned = Du har tjänat %d av %d achievements, och %d of %d poäng +Failed to log in, check your username and password. = Misslyckades att logga in, kontrollera ditt användarnamn och lösenord. How to use RetroAchievements = Hur man använder RetroAchievements Leaderboard submission is enabled = Skickar in poäng till ledartabeller Leaderboards = Leaderboards