- add i_discordrpc (defaults false) to control Discord Presence

This commit is contained in:
Rachael Alexanderson 2022-03-10 14:12:19 -05:00
parent 8fe07f1449
commit add069885f
2 changed files with 16 additions and 6 deletions

View file

@ -295,6 +295,15 @@ CVAR (Bool, autoloadwidescreen, true, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOB
CVAR (Bool, r_debug_disable_vis_filter, false, 0)
CVAR(Bool, vid_fps, false, 0)
CVAR(Int, vid_showpalette, 0, 0)
CUSTOM_CVAR (Bool, i_discordrpc, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
I_UpdateWindowTitle();
}
CUSTOM_CVAR(Int, I_FriendlyWindowTitle, 1, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCALL)
{
I_UpdateWindowTitle();
}
bool hud_toggled = false;
bool wantToRestart;
@ -3777,11 +3786,6 @@ DEFINE_FIELD_X(InputEventData, event_t, data3)
DEFINE_FIELD_X(InputEventData, event_t, x)
DEFINE_FIELD_X(InputEventData, event_t, y)
CUSTOM_CVAR(Int, I_FriendlyWindowTitle, 1, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCALL)
{
I_UpdateWindowTitle();
}
void I_UpdateWindowTitle()
{
FString titlestr;
@ -3828,6 +3832,9 @@ void I_UpdateWindowTitle()
}
}
*dstp = 0;
if (i_discordrpc)
I_UpdateDiscordPresence(true, copy.Data(), GameStartupInfo.DiscordAppId.GetChars(), GameStartupInfo.SteamAppId.GetChars());
else
I_UpdateDiscordPresence(false, nullptr, nullptr, nullptr);
I_SetWindowTitle(copy.Data());
}

View file

@ -90,6 +90,9 @@ void I_UpdateDiscordPresence(bool SendPresence, const char* curstatus, const cha
if (appid && appid[0] != '\0')
curappid = appid;
if (!didInit && !SendPresence)
return; // we haven't initted, there's nothing to do here, just exit
if (!didInit)
{
didInit = true;