to hell with it, committing the log messages

This commit is contained in:
jenz 2026-01-27 23:27:50 +00:00
parent aa115c645e
commit 00c4ee1521

View File

@ -190,7 +190,7 @@ EBeginAuthSessionResult Hook_BeginAuthSession(const void *pAuthTicket, int cbAut
{ {
if (!g_bSuppressBeginAuthSession) if (!g_bSuppressBeginAuthSession)
{ {
//g_pSM->LogMessage(myself, "inside Hook_ BeginAuthSession 1"); g_pSM->LogMessage(myself, "inside Hook_ BeginAuthSession 1");
RETURN_META_VALUE(MRES_IGNORED, k_EBeginAuthSessionResultOK); RETURN_META_VALUE(MRES_IGNORED, k_EBeginAuthSessionResultOK);
} }
g_bSuppressBeginAuthSession = false; g_bSuppressBeginAuthSession = false;
@ -200,11 +200,11 @@ EBeginAuthSessionResult Hook_BeginAuthSession(const void *pAuthTicket, int cbAut
&& g_lastcbAuthTicket == cbAuthTicket) && g_lastcbAuthTicket == cbAuthTicket)
{ {
// Let the server know everything is fine // Let the server know everything is fine
//g_pSM->LogMessage(myself, "inside Hook_ BeginAuthSession 2"); g_pSM->LogMessage(myself, "inside Hook_ BeginAuthSession 2");
RETURN_META_VALUE(MRES_SUPERCEDE, k_EBeginAuthSessionResultOK); RETURN_META_VALUE(MRES_SUPERCEDE, k_EBeginAuthSessionResultOK);
} }
//g_pSM->LogMessage(myself, "inside Hook_ BeginAuthSession 3"); g_pSM->LogMessage(myself, "inside Hook_ BeginAuthSession 3");
RETURN_META_VALUE(MRES_IGNORED, k_EBeginAuthSessionResultDuplicateRequest); RETURN_META_VALUE(MRES_IGNORED, k_EBeginAuthSessionResultDuplicateRequest);
} }
@ -307,11 +307,13 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in
return DETOUR_MEMBER_CALL(CBaseServer__ConnectClient)(address, nProtocol, iChallenge, iClientChallenge, nAuthProtocol, pchName, pchPassword, pCookie, cbCookie); return DETOUR_MEMBER_CALL(CBaseServer__ConnectClient)(address, nProtocol, iChallenge, iClientChallenge, nAuthProtocol, pchName, pchPassword, pCookie, cbCookie);
} }
g_pSM->LogMessage(myself, "entered MEMBER9");
if (g_pSteam3Server->m_pSteamGameServer != g_pLastHookedSteamGameServer) if (g_pSteam3Server->m_pSteamGameServer != g_pLastHookedSteamGameServer)
{ {
//the hook tends to die, hence its reapplied whenever needed. thats probably very dumb. //the hook tends to die, hence its reapplied whenever needed. thats probably very dumb.
//does however seem to stop "S3: Client connected with invalid ticket:" for nosteamers. //does however seem to stop "S3: Client connected with invalid ticket:" for nosteamers.
//g_pSM->LogMessage(myself, "Steam GameServer pointer changed! Old: %p, New: %p", g_pLastHookedSteamGameServer, g_pSteam3Server->m_pSteamGameServer); g_pSM->LogMessage(myself, "Steam GameServer pointer changed! Old: %p, New: %p", g_pLastHookedSteamGameServer, g_pSteam3Server->m_pSteamGameServer);
if (g_pLastHookedSteamGameServer != NULL) if (g_pLastHookedSteamGameServer != NULL)
{ {
// Remove old hook if it exists // Remove old hook if it exists
@ -356,6 +358,7 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in
if (g_ConnectClientStorage.retrieve(aSteamID, &Storage)) if (g_ConnectClientStorage.retrieve(aSteamID, &Storage))
{ {
g_pSM->LogMessage(myself, "entered has clientstorage");
ExistingSteamid = true; ExistingSteamid = true;
g_ConnectClientStorage.remove(aSteamID); g_ConnectClientStorage.remove(aSteamID);
if (!Storage.SteamAuthFailed) if (!Storage.SteamAuthFailed)
@ -368,6 +371,7 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in
// Don't want to leave the client waiting forever if something breaks in the async forward // Don't want to leave the client waiting forever if something breaks in the async forward
if (Storage.iClientChallenge == iClientChallenge) if (Storage.iClientChallenge == iClientChallenge)
{ {
g_pSM->LogMessage(myself, "entered async retry");
AsyncWaiting = true; AsyncWaiting = true;
//reject async nosteamers (althought this statement is not reached even as async nosteamers are rejected with invalid ticket) //reject async nosteamers (althought this statement is not reached even as async nosteamers are rejected with invalid ticket)
@ -385,6 +389,7 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in
else else
{ {
//client did a manual retry, //client did a manual retry,
g_pSM->LogMessage(myself, "entered manual retry");
if (Storage.SteamAuthFailed) if (Storage.SteamAuthFailed)
{ {
//its a nosteamer so dont use the clientstorage ticket //its a nosteamer so dont use the clientstorage ticket
@ -395,13 +400,16 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in
} }
else else
{ {
g_pSM->LogMessage(myself, "in client storage about to do new storage");
//create a new client storage for the steamplayer. //create a new client storage for the steamplayer.
Storage = ConnectClientStorage(address, nProtocol, iChallenge, iClientChallenge, nAuthProtocol, pchName, pchPassword, pCookie, cbCookie); Storage = ConnectClientStorage(address, nProtocol, iChallenge, iClientChallenge, nAuthProtocol, pchName, pchPassword, pCookie, cbCookie);
//use the ticket from the new clientstorage. //use the ticket from the new clientstorage.
g_lastcbAuthTicket = Storage.cbTicket; g_lastcbAuthTicket = Storage.cbTicket;
g_lastAuthTicket = Storage.pvTicket; g_lastAuthTicket = Storage.pvTicket;
g_pSM->LogMessage(myself, "in client storage about to do beginauthsession");
result = g_pBeginAuthSession(steamGameServer, Storage.pvTicket, Storage.cbTicket, g_lastClientSteamID); result = g_pBeginAuthSession(steamGameServer, Storage.pvTicket, Storage.cbTicket, g_lastClientSteamID);
g_pSM->LogMessage(myself, "in client storage after beginauthsession");
} }
} }
} }
@ -415,10 +423,13 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in
//however if the first connecting client instead is in k_OnClientPreConnectEx_Accept then the after following //however if the first connecting client instead is in k_OnClientPreConnectEx_Accept then the after following
//k_OnClientPreConnectEx_Reject will work fine. Ex_Accept is always used until the server is full, hence should Ex_Reject //k_OnClientPreConnectEx_Reject will work fine. Ex_Accept is always used until the server is full, hence should Ex_Reject
//never be the first to connect on a new map. //never be the first to connect on a new map.
g_pSM->LogMessage(myself, "without client storage about to do beginauth session");
result = g_pBeginAuthSession(steamGameServer, pvTicket, cbTicket, g_lastClientSteamID); result = g_pBeginAuthSession(steamGameServer, pvTicket, cbTicket, g_lastClientSteamID);
g_pSM->LogMessage(myself, "without client storage after beginauth session");
} }
if (!SkipEndAuthSession) if (!SkipEndAuthSession)
{ {
g_pSM->LogMessage(myself, "about to do endAuthSession");
g_pEndAuthSession(steamGameServer, g_lastClientSteamID); //xen said engine might start its own authsession, so end ours here. g_pEndAuthSession(steamGameServer, g_lastClientSteamID); //xen said engine might start its own authsession, so end ours here.
} }
@ -444,6 +455,7 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in
// Reject NoSteam players // Reject NoSteam players
if(SteamAuthFailed) if(SteamAuthFailed)
{ {
g_pSM->LogMessage(myself, "about to do rejectconnection 1");
g_pRejectConnectionFunc((CBaseServer*)this, address, iClientChallenge, "Steam ID already in use."); g_pRejectConnectionFunc((CBaseServer*)this, address, iClientChallenge, "Steam ID already in use.");
return NULL; return NULL;
} }
@ -451,10 +463,12 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in
// Kick existing player // Kick existing player
if(Storage.pClient) if(Storage.pClient)
{ {
g_pSM->LogMessage(myself, "about to do disconnect");
Storage.pClient->Disconnect("Same Steam ID connected."); Storage.pClient->Disconnect("Same Steam ID connected.");
} }
else else
{ {
g_pSM->LogMessage(myself, "about to do rejectconnection 2");
g_pRejectConnectionFunc((CBaseServer*)this, address, iClientChallenge, "Please try again later."); g_pRejectConnectionFunc((CBaseServer*)this, address, iClientChallenge, "Please try again later.");
return NULL; return NULL;
} }
@ -513,10 +527,12 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in
} }
// k_OnClientPreConnectEx_Accept // k_OnClientPreConnectEx_Accept
g_pSM->LogMessage(myself, "about to do DETOUR_MEMBER_CALL");
g_bSuppressBeginAuthSession = true; g_bSuppressBeginAuthSession = true;
auto client = DETOUR_MEMBER_CALL(CBaseServer__ConnectClient)(address, nProtocol, iChallenge, iClientChallenge, nAuthProtocol, pchName, pchPassword, pCookie, cbCookie); auto client = DETOUR_MEMBER_CALL(CBaseServer__ConnectClient)(address, nProtocol, iChallenge, iClientChallenge, nAuthProtocol, pchName, pchPassword, pCookie, cbCookie);
//auto client = DETOUR_MEMBER_MCALL_ORIGINAL(CBaseServer__ConnectClient, this)(address, nProtocol, iChallenge, iClientChallenge, nAuthProtocol, pchName, pchPassword, pCookie, cbCookie);
g_bSuppressBeginAuthSession = false; g_bSuppressBeginAuthSession = false;
g_pSM->LogMessage(myself, "finished DETOUR_MEMBER_CALL");
Storage.pClient = client; Storage.pClient = client;
g_ConnectClientStorage.replace(aSteamID, Storage); g_ConnectClientStorage.replace(aSteamID, Storage);
@ -527,12 +543,13 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in
Response.m_SteamID = g_lastClientSteamID; Response.m_SteamID = g_lastClientSteamID;
Response.m_eAuthSessionResponse = k_EAuthSessionResponseAuthTicketInvalid; //nosteamer monkeys Response.m_eAuthSessionResponse = k_EAuthSessionResponseAuthTicketInvalid; //nosteamer monkeys
Response.m_OwnerSteamID = Response.m_SteamID; Response.m_OwnerSteamID = Response.m_SteamID;
g_pSM->LogMessage(myself, "about to do OnValidateAuthTicketResponse");
DETOUR_MEMBER_MCALL_CALLBACK(CSteam3Server__OnValidateAuthTicketResponse, g_pSteam3Server)(&Response); DETOUR_MEMBER_MCALL_CALLBACK(CSteam3Server__OnValidateAuthTicketResponse, g_pSteam3Server)(&Response);
} }
g_pSM->LogMessage(myself, "MEMBER 9 end.");
return client; return client;
} }
bool Connect::SDK_OnLoad(char *error, size_t maxlen, bool late) bool Connect::SDK_OnLoad(char *error, size_t maxlen, bool late)
{ {
char conf_error[255] = ""; char conf_error[255] = "";