mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 12:19:12 +00:00
Use new config system for Discord Rich Presence option
This doesn't feel like a mirror change to me.
This commit is contained in:
parent
f25d833dbd
commit
57bd13a0ce
9 changed files with 42 additions and 47 deletions
|
@ -13,12 +13,15 @@
|
|||
|
||||
#endif
|
||||
|
||||
const Config::ConfigInfo<bool> MAIN_USE_DISCORD_PRESENCE{
|
||||
{Config::System::Main, "General", "UseDiscordPresence"}, true};
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
void Init()
|
||||
{
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
if (!SConfig::GetInstance().bUseDiscordPresence)
|
||||
if (!Config::Get(MAIN_USE_DISCORD_PRESENCE))
|
||||
return;
|
||||
|
||||
DiscordEventHandlers handlers = {};
|
||||
|
@ -31,7 +34,7 @@ void Init()
|
|||
void UpdateDiscordPresence()
|
||||
{
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
if (!SConfig::GetInstance().bUseDiscordPresence)
|
||||
if (!Config::Get(MAIN_USE_DISCORD_PRESENCE))
|
||||
return;
|
||||
|
||||
const std::string& title = SConfig::GetInstance().GetTitleDescription();
|
||||
|
@ -48,11 +51,26 @@ void UpdateDiscordPresence()
|
|||
void Shutdown()
|
||||
{
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
if (!SConfig::GetInstance().bUseDiscordPresence)
|
||||
if (!Config::Get(MAIN_USE_DISCORD_PRESENCE))
|
||||
return;
|
||||
|
||||
Discord_ClearPresence();
|
||||
Discord_Shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetDiscordPresenceEnabled(bool enabled)
|
||||
{
|
||||
if (Config::Get(MAIN_USE_DISCORD_PRESENCE) == enabled)
|
||||
return;
|
||||
|
||||
if (Config::Get(MAIN_USE_DISCORD_PRESENCE))
|
||||
Discord::Shutdown();
|
||||
|
||||
Config::SetBase(MAIN_USE_DISCORD_PRESENCE, enabled);
|
||||
|
||||
if (Config::Get(MAIN_USE_DISCORD_PRESENCE))
|
||||
Discord::Init();
|
||||
}
|
||||
|
||||
} // namespace Discord
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue