diff --git a/extension/extension.cpp b/extension/extension.cpp index 9e0e91d..4428a32 100644 --- a/extension/extension.cpp +++ b/extension/extension.cpp @@ -190,7 +190,7 @@ EBeginAuthSessionResult Hook_BeginAuthSession(const void *pAuthTicket, int cbAut { 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); } g_bSuppressBeginAuthSession = false; @@ -200,11 +200,11 @@ EBeginAuthSessionResult Hook_BeginAuthSession(const void *pAuthTicket, int cbAut && g_lastcbAuthTicket == cbAuthTicket) { // 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); } - //g_pSM->LogMessage(myself, "inside Hook_ BeginAuthSession 3"); + g_pSM->LogMessage(myself, "inside Hook_ BeginAuthSession 3"); 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); } + g_pSM->LogMessage(myself, "entered MEMBER9"); + if (g_pSteam3Server->m_pSteamGameServer != g_pLastHookedSteamGameServer) { //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. - //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) { // 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)) { + g_pSM->LogMessage(myself, "entered has clientstorage"); ExistingSteamid = true; g_ConnectClientStorage.remove(aSteamID); 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 if (Storage.iClientChallenge == iClientChallenge) { + g_pSM->LogMessage(myself, "entered async retry"); AsyncWaiting = true; //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 { //client did a manual retry, + g_pSM->LogMessage(myself, "entered manual retry"); if (Storage.SteamAuthFailed) { //its a nosteamer so dont use the clientstorage ticket @@ -395,13 +400,16 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in } else { + g_pSM->LogMessage(myself, "in client storage about to do new storage"); //create a new client storage for the steamplayer. Storage = ConnectClientStorage(address, nProtocol, iChallenge, iClientChallenge, nAuthProtocol, pchName, pchPassword, pCookie, cbCookie); //use the ticket from the new clientstorage. g_lastcbAuthTicket = Storage.cbTicket; 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); + 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 //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. + g_pSM->LogMessage(myself, "without client storage about to do beginauth session"); result = g_pBeginAuthSession(steamGameServer, pvTicket, cbTicket, g_lastClientSteamID); + g_pSM->LogMessage(myself, "without client storage after beginauth session"); } 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. } @@ -444,6 +455,7 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in // Reject NoSteam players if(SteamAuthFailed) { + g_pSM->LogMessage(myself, "about to do rejectconnection 1"); g_pRejectConnectionFunc((CBaseServer*)this, address, iClientChallenge, "Steam ID already in use."); return NULL; } @@ -451,10 +463,12 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in // Kick existing player if(Storage.pClient) { + g_pSM->LogMessage(myself, "about to do disconnect"); Storage.pClient->Disconnect("Same Steam ID connected."); } else { + g_pSM->LogMessage(myself, "about to do rejectconnection 2"); g_pRejectConnectionFunc((CBaseServer*)this, address, iClientChallenge, "Please try again later."); return NULL; } @@ -513,10 +527,12 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, in } // k_OnClientPreConnectEx_Accept - + g_pSM->LogMessage(myself, "about to do DETOUR_MEMBER_CALL"); g_bSuppressBeginAuthSession = true; 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_pSM->LogMessage(myself, "finished DETOUR_MEMBER_CALL"); Storage.pClient = client; 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_eAuthSessionResponse = k_EAuthSessionResponseAuthTicketInvalid; //nosteamer monkeys Response.m_OwnerSteamID = Response.m_SteamID; + g_pSM->LogMessage(myself, "about to do OnValidateAuthTicketResponse"); DETOUR_MEMBER_MCALL_CALLBACK(CSteam3Server__OnValidateAuthTicketResponse, g_pSteam3Server)(&Response); } + g_pSM->LogMessage(myself, "MEMBER 9 end."); return client; } - bool Connect::SDK_OnLoad(char *error, size_t maxlen, bool late) { char conf_error[255] = "";