mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-25 01:01:37 -05:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user