Added INI setting for Discord Rich Presence
This commit is contained in:
parent
678f8da95b
commit
d9351a5b45
|
@ -131,6 +131,10 @@ void SConfig::SaveGeneralSettings(IniFile& ini)
|
||||||
#endif
|
#endif
|
||||||
general->Set("GDBPort", iGDBPort);
|
general->Set("GDBPort", iGDBPort);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
general->Set("UseDiscordPresence", bUseDiscordPresence);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SConfig::SaveInterfaceSettings(IniFile& ini)
|
void SConfig::SaveInterfaceSettings(IniFile& ini)
|
||||||
|
@ -416,6 +420,9 @@ void SConfig::LoadGeneralSettings(IniFile& ini)
|
||||||
|
|
||||||
general->Get("RecursiveISOPaths", &m_RecursiveISOFolder, false);
|
general->Get("RecursiveISOPaths", &m_RecursiveISOFolder, false);
|
||||||
general->Get("WirelessMac", &m_WirelessMac);
|
general->Get("WirelessMac", &m_WirelessMac);
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
general->Get("UseDiscordPresence", &bUseDiscordPresence, true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SConfig::LoadInterfaceSettings(IniFile& ini)
|
void SConfig::LoadInterfaceSettings(IniFile& ini)
|
||||||
|
|
|
@ -71,6 +71,9 @@ struct SConfig
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
std::string gdb_socket;
|
std::string gdb_socket;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
bool bUseDiscordPresence;
|
||||||
#endif
|
#endif
|
||||||
bool bAutomaticStart = false;
|
bool bAutomaticStart = false;
|
||||||
bool bBootToPause = false;
|
bool bBootToPause = false;
|
||||||
|
|
|
@ -570,7 +570,9 @@ void MainWindow::OnStopComplete()
|
||||||
m_stop_requested = false;
|
m_stop_requested = false;
|
||||||
HideRenderWidget();
|
HideRenderWidget();
|
||||||
EnableScreenSaver(true);
|
EnableScreenSaver(true);
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
Discord::UpdateDiscordPresence();
|
Discord::UpdateDiscordPresence();
|
||||||
|
#endif
|
||||||
|
|
||||||
SetFullScreenResolution(false);
|
SetFullScreenResolution(false);
|
||||||
|
|
||||||
|
@ -721,7 +723,9 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ShowRenderWidget();
|
ShowRenderWidget();
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
Discord::UpdateDiscordPresence();
|
Discord::UpdateDiscordPresence();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
// Prevents Windows from sleeping, turning off the display, or idling
|
// Prevents Windows from sleeping, turning off the display, or idling
|
||||||
|
|
|
@ -745,7 +745,9 @@ void CFrame::StartGame(std::unique_ptr<BootParameters> boot)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EnableScreenSaver(false);
|
EnableScreenSaver(false);
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
Discord::UpdateDiscordPresence();
|
Discord::UpdateDiscordPresence();
|
||||||
|
#endif
|
||||||
|
|
||||||
// We need this specifically to support setting the focus properly when using
|
// We need this specifically to support setting the focus properly when using
|
||||||
// the 'render to main window' feature on Windows
|
// the 'render to main window' feature on Windows
|
||||||
|
@ -932,7 +934,9 @@ void CFrame::OnStopped()
|
||||||
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
||||||
|
|
||||||
EnableScreenSaver(true);
|
EnableScreenSaver(true);
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
Discord::UpdateDiscordPresence();
|
Discord::UpdateDiscordPresence();
|
||||||
|
#endif
|
||||||
|
|
||||||
m_render_frame->SetTitle(StrToWxStr(Common::scm_rev_str));
|
m_render_frame->SetTitle(StrToWxStr(Common::scm_rev_str));
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,9 @@ namespace Discord
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
#ifdef USE_DISCORD_PRESENCE
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
if (!SConfig::GetInstance().bUseDiscordPresence)
|
||||||
|
return;
|
||||||
|
|
||||||
DiscordEventHandlers handlers = {};
|
DiscordEventHandlers handlers = {};
|
||||||
// The number is the client ID for Dolphin, it's used for images and the appication name
|
// The number is the client ID for Dolphin, it's used for images and the appication name
|
||||||
Discord_Initialize("450033159212630028", &handlers, 1, nullptr);
|
Discord_Initialize("450033159212630028", &handlers, 1, nullptr);
|
||||||
|
@ -28,6 +31,9 @@ void Init()
|
||||||
void UpdateDiscordPresence()
|
void UpdateDiscordPresence()
|
||||||
{
|
{
|
||||||
#ifdef USE_DISCORD_PRESENCE
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
if (!SConfig::GetInstance().bUseDiscordPresence)
|
||||||
|
return;
|
||||||
|
|
||||||
const std::string& title = SConfig::GetInstance().GetTitleDescription();
|
const std::string& title = SConfig::GetInstance().GetTitleDescription();
|
||||||
|
|
||||||
DiscordRichPresence discord_presence = {};
|
DiscordRichPresence discord_presence = {};
|
||||||
|
@ -42,6 +48,9 @@ void UpdateDiscordPresence()
|
||||||
void Shutdown()
|
void Shutdown()
|
||||||
{
|
{
|
||||||
#ifdef USE_DISCORD_PRESENCE
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
if (!SConfig::GetInstance().bUseDiscordPresence)
|
||||||
|
return;
|
||||||
|
|
||||||
Discord_Shutdown();
|
Discord_Shutdown();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue