Skip to content

Commit 858225c

Browse files
committed
Fix SteamNetworkingUtils() interface for SteamAPI dedicated server
The way we fallback to gameserver or user doesn't work anymore. SteamInternal_FindOrCreateUserInterface now crashes if called before steam is initted. P4:10716251 (cherry picked from commit f1edd32d2a6d71cfc0568112610752a28666f585)
1 parent d67d167 commit 858225c

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

include/steam/isteamnetworkingutils.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include "steamnetworkingtypes.h"
1212
#include "steam_api_common.h"
13+
#include "isteamclient.h"
1314

1415
struct SteamDatagramRelayAuthTicket;
1516
struct SteamRelayNetworkStatus_t;
@@ -368,13 +369,9 @@ class ISteamNetworkingUtils
368369
#endif
369370

370371
// Using Steamworks SDK
371-
#ifdef STEAMNETWORKINGSOCKETS_STEAMAPI
372+
#if defined( STEAMNETWORKINGSOCKETS_STEAMAPI )
372373
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamNetworkingUtils *, SteamNetworkingUtils_SteamAPI,
373-
/* Prefer user version of the interface. But if it isn't found, then use
374-
gameserver one. Yes, this is a completely terrible hack */
375-
SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ) ?
376-
SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ) :
377-
SteamInternal_FindOrCreateGameServerInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ),
374+
( (ISteamClient *)SteamInternal_CreateInterface( STEAMCLIENT_INTERFACE_VERSION ) )->GetISteamGenericInterface( 0, SteamAPI_GetHSteamPipe() ? SteamAPI_GetHSteamPipe() : SteamGameServer_GetHSteamPipe(), STEAMNETWORKINGUTILS_INTERFACE_VERSION ),
378375
"global",
379376
STEAMNETWORKINGUTILS_INTERFACE_VERSION
380377
)

0 commit comments

Comments
 (0)