AchievementManager: Use HookableEvent instead of std::function callbacks

The callback mechanism AchievementManager had until now only supported
one caller registering a callback, and it didn't have any
synchronization. This isn't a problem for DolphinQt, but the PR to add
Android support for RetroAchievements exposes these problems. Let's
replace it with HookableEvent, which can handle all of this.
This commit is contained in:
JosJuice
2025-08-22 21:02:25 +02:00
parent 0c7fe651bb
commit de98c3b96f
6 changed files with 39 additions and 44 deletions

View File

@@ -294,8 +294,8 @@ void MenuBar::AddToolsMenu()
tools_menu->addAction(tr("Achievements"), this, [this] { emit ShowAchievementsWindow(); });
#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION
m_achievements_dev_menu = tools_menu->addMenu(tr("RetroAchievements Development"));
AchievementManager::GetInstance().SetDevMenuUpdateCallback(
[this] { QueueOnObject(this, [this] { this->UpdateAchievementDevelopmentMenu(); }); });
m_raintegration_event_hook = AchievementManager::DevMenuUpdateEvent::Register(
[this] { QueueOnObject(this, [this] { UpdateAchievementDevelopmentMenu(); }); }, "MenuBar");
m_achievements_dev_menu->menuAction()->setVisible(false);
#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION
tools_menu->addSeparator();