fixed networking

This commit is contained in:
2025-07-20 14:07:26 +03:00
parent 69d149515a
commit 7082f28fb1
3 changed files with 11 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
#include "input.h" #include "input.h"
#include "mainmenu.h" #include "mainmenu.h"
#include "networking.h" #include "networking.h"
#include "steam/steam_api_common.h"
#include "tier0/network.h" #include "tier0/network.h"
#include "tier0/platform.h" #include "tier0/platform.h"
#include "tier1/commandline.h" #include "tier1/commandline.h"
@@ -94,6 +95,11 @@ void IEngine::Init()
#endif #endif
#ifdef STEAM_ENABLED #ifdef STEAM_ENABLED
if(SteamAPI_RestartAppIfNecessary(480))
{
Plat_Exit(0);
}
SteamErrMsg err; SteamErrMsg err;
if (SteamAPI_InitEx(&err) != k_ESteamAPIInitResult_OK) if (SteamAPI_InitEx(&err) != k_ESteamAPIInitResult_OK)
{ {
@@ -143,6 +149,9 @@ void IEngine::Init()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void IEngine::Frame(float fDelta) void IEngine::Frame(float fDelta)
{ {
#ifdef STEAM_ENABLED
SteamAPI_RunCallbacks();
#endif
IServer::Think(fDelta); IServer::Think(fDelta);
if (INetworking::IsClient()) if (INetworking::IsClient())

View File

@@ -75,6 +75,7 @@ void INetworking::Init()
#ifdef STEAMNETWORKINGSOCKETS_OPENSOURCE #ifdef STEAMNETWORKINGSOCKETS_OPENSOURCE
GameNetworkingSockets_Init(NULL, &errMsg) GameNetworkingSockets_Init(NULL, &errMsg)
#endif #endif
V_printf("Cool\n");
if (ICommandLine::CheckParam("-steamdebug")) if (ICommandLine::CheckParam("-steamdebug"))
{ {
SteamNetworkingUtils()->SetDebugOutputFunction(k_ESteamNetworkingSocketsDebugOutputType_Msg, SteamNetworkingUtils()->SetDebugOutputFunction(k_ESteamNetworkingSocketsDebugOutputType_Msg,
@@ -113,7 +114,6 @@ void INetworking::Init()
net_listenSocket = SteamGameServerNetworkingSockets()->CreateListenSocketP2P(0, 0, NULL); net_listenSocket = SteamGameServerNetworkingSockets()->CreateListenSocketP2P(0, 0, NULL);
net_bIsServer = true; net_bIsServer = true;
} else { } else {
V_printf("Cool\n");
if (ICommandLine::ParamValue("-connect")) if (ICommandLine::ParamValue("-connect"))
{ {
Console()->AddCommand(CUtlString("connect %s;", ICommandLine::ParamValue("-connect"))); Console()->AddCommand(CUtlString("connect %s;", ICommandLine::ParamValue("-connect")));
@@ -166,7 +166,6 @@ void INetworking::Frame()
} }
} }
} else { } else {
SteamNetworkingSockets()->RunCallbacks();
SteamNetworkingMessage_t *pMessages[64]; SteamNetworkingMessage_t *pMessages[64];
while (true) while (true)
{ {

View File

@@ -3,4 +3,4 @@ bind a +left;
bind d +right; bind d +right;
bind w +forward; bind w +forward;
bind s +back; bind s +back;
bind o connect 90271142097538072; bind o connect 90271429367739416;