Skip to content

Commit

Permalink
[HL25] Backport (but disabled) Steam Rich Presence commands call
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sabianroberts and JoelTroch committed Oct 28, 2024
1 parent 5081561 commit 168ceaa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cl_dll/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions cl_dll/hud_msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 168ceaa

Please sign in to comment.