From 168ceaa3ffbfddccd3579fb0c0514d73dc089856 Mon Sep 17 00:00:00 2001 From: Sabian Roberts <31491602+sabianroberts@users.noreply.github.com> Date: Mon, 28 Oct 2024 23:17:18 +0000 Subject: [PATCH] [HL25] Backport (but disabled) Steam Rich Presence commands call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The primary reason for disabling this is because these console commands have no effect when running a mod (started through Steam at least, not tested when launched directly from command-line). Mods that are hosted on Steamworks might be able to make use of those by doing the necessary back-end setup and compiling their client project with the "STEAM_RICH_PRESENCE" pre-processor define. Co-Authored-By: Joël Troch --- cl_dll/hud.cpp | 6 ++++++ cl_dll/hud_msg.cpp | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index 3f5fbed9..6a2f7510 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -695,6 +695,12 @@ void CHud :: Init( void ) ServersInit(); MsgFunc_ResetHUD(0, 0, NULL ); + +#ifdef STEAM_RICH_PRESENCE + gEngfuncs.pfnClientCmd("richpresence_gamemode\n"); // reset + + gEngfuncs.pfnClientCmd("richpresence_update\n"); +#endif } // CHud destructor diff --git a/cl_dll/hud_msg.cpp b/cl_dll/hud_msg.cpp index d52730d2..0ab2b8a2 100644 --- a/cl_dll/hud_msg.cpp +++ b/cl_dll/hud_msg.cpp @@ -119,6 +119,15 @@ int CHud :: MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf ) BEGIN_READ( pbuf, iSize ); m_Teamplay = READ_BYTE(); +#ifdef STEAM_RICH_PRESENCE + if (m_Teamplay) + gEngfuncs.pfnClientCmd("richpresence_gamemode Teamplay\n"); + else + gEngfuncs.pfnClientCmd("richpresence_gamemode\n"); // reset + + gEngfuncs.pfnClientCmd("richpresence_update\n"); +#endif + return 1; }