Compare commits

...

2 Commits

Author SHA1 Message Date
julien bruel 4b83a7a3d5 put back source query 2021-04-09 21:32:11 +02:00
julien bruel 3ee66fb2de Revert change 2021-04-09 21:07:04 +02:00
13 changed files with 41 additions and 19 deletions

View File

@ -136,7 +136,7 @@ Steam_Client *get_steam_clientserver_old()
static bool steamclient_has_ipv6_functions_flag;
bool steamclient_has_ipv6_functions()
{
return steamclient_has_ipv6_functions_flag;
return steamclient_has_ipv6_functions_flag || get_steam_client()->gameserver_has_ipv6_functions;
}
static void *create_client_interface(const char *ver)

View File

@ -5843,9 +5843,15 @@ STEAMAPI_API SteamAPICall_t SteamAPI_ISteamGameServer_GetServerReputation( IStea
return self->GetServerReputation();
}
STEAMAPI_API SteamIPAddress_t SteamAPI_ISteamGameServer_GetPublicIP( ISteamGameServer* self )
STEAMAPI_API void *SteamAPI_ISteamGameServer_GetPublicIP( intptr_t instancePtr, void *instancePtr_possible )
{
return self->GetPublicIP();
//abuse call convention rules to get this working.
if (steamclient_has_ipv6_functions()) {
get_steam_client()->steam_gameserver->GetPublicIP_fix((SteamIPAddress_t *)instancePtr);
return (void *)instancePtr;
} else {
return (void *)((ISteamGameServer012 *)instancePtr)->GetPublicIP_old();
}
}
STEAMAPI_API bool SteamAPI_ISteamGameServer_HandleIncomingPacket( ISteamGameServer* self, const void * pData, int cbData, uint32 srcIP, uint16 srcPort )

View File

@ -232,10 +232,10 @@ static void kill_socket(sock_t sock)
static void kill_tcp_socket(struct TCP_Socket &socket)
{
kill_socket(socket.sock);
socket = TCP_Socket();
}
static bool initialed;
static void run_at_startup()
{
static bool initialed = false;
@ -1271,7 +1271,6 @@ bool Networking::isAlive()
return alive;
}
void Networking::startQuery(IP_PORT ip_port)
{
if (ip_port.port <= 1024)

View File

@ -86,8 +86,8 @@ struct Connection {
class Networking {
bool enabled = false;
bool query_alive;
bool alive;
bool query_alive;
std::chrono::high_resolution_clock::time_point last_run;
sock_t query_socket, udp_socket, tcp_socket;
uint16 udp_port, tcp_port;

View File

@ -109,6 +109,8 @@ Steam_Client::Steam_Client()
steam_gameserver_game_coordinator = new Steam_Game_Coordinator(settings_server, network, callback_results_server, callbacks_server, run_every_runcb);
steam_masterserver_updater = new Steam_Masterserver_Updater(settings_server, network, callback_results_server, callbacks_server, run_every_runcb);
gameserver_has_ipv6_functions = false;
last_cb_run = 0;
PRINT_DEBUG("client init end\n");
}
@ -303,8 +305,10 @@ ISteamGameServer *Steam_Client::GetISteamGameServer( HSteamUser hSteamUser, HSte
} else if (strcmp(pchVersion, "SteamGameServer012") == 0) {
return (ISteamGameServer *)(void *)(ISteamGameServer012 *)steam_gameserver;
} else if (strcmp(pchVersion, STEAMGAMESERVER_INTERFACE_VERSION) == 0) {
gameserver_has_ipv6_functions = true;
return (ISteamGameServer *)(void *)(ISteamGameServer *)steam_gameserver;
} else {
gameserver_has_ipv6_functions = true;
return (ISteamGameServer *)(void *)(ISteamGameServer *)steam_gameserver;
}

View File

@ -139,6 +139,8 @@ public:
unsigned steam_pipe_counter = 1;
std::map<HSteamPipe, enum Steam_Pipe> steam_pipes;
bool gameserver_has_ipv6_functions;
Steam_Client();
~Steam_Client();
// Creates a communication pipe to the Steam client.

View File

@ -81,7 +81,7 @@ void Steam_GameServer::SetProduct( const char *pszProduct )
{
PRINT_DEBUG("SetProduct\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex);
server_data.set_product(pszProduct);
server_data.set_product(pszProduct);// Set product to game name if this is empty
}
@ -617,6 +617,12 @@ SteamIPAddress_t Steam_GameServer::GetPublicIP()
return ip;
}
void Steam_GameServer::GetPublicIP_fix(SteamIPAddress_t *out)
{
PRINT_DEBUG("GetPublicIP_fix\n");
if (out) *out = GetPublicIP();
}
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
// socket to talk to the master server on, it lets the game use its socket to forward messages
// back and forth. This prevents us from requiring server ops to open up yet another port

View File

@ -291,6 +291,7 @@ public:
// connect to
uint32 GetPublicIP_old();
SteamIPAddress_t GetPublicIP();
void GetPublicIP_fix(SteamIPAddress_t *out);
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
// socket to talk to the master server on, it lets the game use its socket to forward messages

View File

@ -239,6 +239,7 @@ bool GetAchievement( const char *pchName, bool *pbAchieved )
try {
auto it = defined_achievements_find(pchName);
if (it == defined_achievements.end()) return false;
std::string pch_name = it->value("name", std::string());
auto ach = user_achievements.find(pch_name);
@ -261,6 +262,7 @@ bool SetAchievement( const char *pchName )
try {
auto it = defined_achievements_find(pchName);
if (it == defined_achievements.end()) return false;
std::string pch_name = it->value("name", std::string());
if (it != defined_achievements.end()) {
@ -288,6 +290,7 @@ bool ClearAchievement( const char *pchName )
try {
auto it = defined_achievements_find(pchName);
if (it == defined_achievements.end()) return false;
std::string pch_name = it->value("name", std::string());
if (it != defined_achievements.end()) {
@ -313,6 +316,7 @@ bool GetAchievementAndUnlockTime( const char *pchName, bool *pbAchieved, uint32
try {
auto it = defined_achievements_find(pchName);
if (it == defined_achievements.end()) return false;
std::string pch_name = it->value("name", std::string());
auto ach = user_achievements.find(pch_name);
@ -417,6 +421,8 @@ bool IndicateAchievementProgress( const char *pchName, uint32 nCurProgress, uint
try {
auto it = defined_achievements_find(pchName);
if (it == defined_achievements.end()) return false;
std::string pch_name = it->value("name", std::string());
auto ach = user_achievements.find(pch_name);

View File

@ -190,8 +190,6 @@ public:
// connect to
virtual uint32 GetPublicIP_old() = 0;
virtual SteamIPAddress_t GetPublicIP() = 0;
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
// socket to talk to the master server on, it lets the game use its socket to forward messages
// back and forth. This prevents us from requiring server ops to open up yet another port

View File

@ -1011,7 +1011,7 @@ STEAMAPI_API EUserHasLicenseForAppResult SteamAPI_ISteamGameServer_UserHasLicens
STEAMAPI_API bool SteamAPI_ISteamGameServer_RequestUserGroupStatus( ISteamGameServer* self, uint64_steamid steamIDUser, uint64_steamid steamIDGroup );
STEAMAPI_API void SteamAPI_ISteamGameServer_GetGameplayStats( ISteamGameServer* self );
STEAMAPI_API SteamAPICall_t SteamAPI_ISteamGameServer_GetServerReputation( ISteamGameServer* self );
STEAMAPI_API SteamIPAddress_t SteamAPI_ISteamGameServer_GetPublicIP( ISteamGameServer* self );
//STEAMAPI_API SteamIPAddress_t SteamAPI_ISteamGameServer_GetPublicIP( ISteamGameServer* self );
STEAMAPI_API bool SteamAPI_ISteamGameServer_HandleIncomingPacket( ISteamGameServer* self, const void * pData, int cbData, uint32 srcIP, uint16 srcPort );
STEAMAPI_API int SteamAPI_ISteamGameServer_GetNextOutgoingPacket( ISteamGameServer* self, void * pOut, int cbMaxOut, uint32 * pNetAdr, uint16 * pPort );
STEAMAPI_API void SteamAPI_ISteamGameServer_EnableHeartbeats( ISteamGameServer* self, bool bActive );

BIN
steamclient.dll Normal file

Binary file not shown.

BIN
steamclient64.dll Normal file

Binary file not shown.