steam relay networking

This commit is contained in:
2026-03-01 23:06:28 +02:00
parent 03c560c2b7
commit 468d765aa1
16 changed files with 628 additions and 101 deletions

View File

@@ -12,6 +12,7 @@
#ifdef STEAM
#include "steam/steam_api.h"
#include "steam/steam_gameserver.h"
#endif
IRenderContext *g_pRenderContext;
@@ -21,17 +22,30 @@ IGameWindowManager *g_pWindowManager;
CServerGameDLL *g_pServerGame;
CClientGameDLL *g_pClientGame;
extern "C" void __cdecl SteamAPIDebug( ESteamNetworkingSocketsDebugOutputType nType, const char *pszMsg )
{
V_printf("STEAM: %s\n", pszMsg);
}
extern "C" void FunnyMain( int argc, char **argv )
{
CommandLine()->CreateCommandLine(argc, argv);
EngineConsts_t stConstants = {};
#ifdef STEAM
if(SteamAPI_RestartAppIfNecessary(480))
{
V_printf("Mshallah we are doing reboot\n");
Plat_Exit(0);
}
stConstants.m_bIsSteam = true;
if (!SteamAPI_Init())
Plat_FatalErrorFunc("SteamAPI_Init failed lol\n");
stConstants.LaunchServer = LaunchLocalBridge;
stConstants.LaunchServer = LaunchServerAtSteamRelay;
stConstants.ConnectSteamServer = ConnectBySteamID;
//SteamNetworkingUtils()->SetDebugOutputFunction(k_ESteamNetworkingSocketsDebugOutputType_Debug, SteamAPIDebug);
#endif
stConstants.m_bIsDedicated = CommandLine()->CheckParam("-dedicated");
stConstants.LaunchLocalBridge = LaunchLocalBridge;
@@ -75,9 +89,13 @@ extern "C" void FunnyMain( int argc, char **argv )
double fPrevious = Plat_GetTime();
for (;;) {
#ifdef STEAM
SteamAPI_RunCallbacks();
#endif
double fCurrent = Plat_GetTime();
double fDelta = fCurrent-fPrevious;
fPrevious = fCurrent;
g_pServerGame->m_pBridge->Frame(fDelta);
if (!stConstants.m_bIsDedicated)