From a7b09413f9aa8a76c06f3371ca692ccac173f974 Mon Sep 17 00:00:00 2001 From: LillyJadeKatrin Date: Mon, 22 May 2023 22:21:56 -0400 Subject: [PATCH] Added Notification Popup for Achievement Unlocked Added an OnScreenDisplay message to HandleAchievementTriggeredEvent to display a message when a player has unlocked an achievement. The message includes the title of the achievement and its point value based on the game data. To match RetroAchievements' website interface, the message is blue if the unlock is casual and gold for challenge. --- Source/Core/Core/AchievementManager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index 9c8b3d1a4a..bcd275b10c 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -5,6 +5,8 @@ #include "Core/AchievementManager.h" +#include + #include #include "Common/HttpRequest.h" @@ -14,6 +16,7 @@ #include "Core/PowerPC/MMU.h" #include "Core/System.h" #include "DiscIO/Volume.h" +#include "VideoCommon/OnScreenDisplay.h" #include "VideoCommon/VideoEvents.h" static constexpr bool hardcore_mode_enabled = false; @@ -506,6 +509,11 @@ void AchievementManager::HandleAchievementTriggeredEvent(const rc_runtime_event_ return; it->second.session_unlock_count++; m_queue.EmplaceItem([this, runtime_event] { AwardAchievement(runtime_event->id); }); + AchievementId game_data_index = it->second.game_data_index; + OSD::AddMessage(fmt::format("Unlocked: {} ({})", m_game_data.achievements[game_data_index].title, + m_game_data.achievements[game_data_index].points), + OSD::Duration::VERY_LONG, + (hardcore_mode_enabled) ? OSD::Color::YELLOW : OSD::Color::CYAN); ActivateDeactivateAchievement(runtime_event->id, Config::Get(Config::RA_ACHIEVEMENTS_ENABLED), Config::Get(Config::RA_UNOFFICIAL_ENABLED), Config::Get(Config::RA_ENCORE_ENABLED));