Browse Source

Hopefully this fixes the SteamAPI_ISteamGameServer_GetPublicIP function

merge-requests/38/merge
Mr_Goldberg 4 weeks ago
parent
commit
19015c097c
No known key found for this signature in database GPG Key ID: 8597D87419DEF278
  1. 2
      dll/dll.cpp
  2. 9
      dll/flat.cpp
  3. 4
      dll/steam_client.cpp
  4. 2
      dll/steam_client.h
  5. 6
      dll/steam_gameserver.cpp
  6. 1
      dll/steam_gameserver.h

2
dll/dll.cpp

@ -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)

9
dll/flat.cpp

@ -5843,13 +5843,14 @@ STEAMAPI_API SteamAPICall_t SteamAPI_ISteamGameServer_GetServerReputation( IStea
return self->GetServerReputation();
}
STEAMAPI_API uint32 SteamAPI_ISteamGameServer_GetPublicIP( intptr_t instancePtr, void *instancePtr_possible )
STEAMAPI_API void *SteamAPI_ISteamGameServer_GetPublicIP( intptr_t instancePtr, void *instancePtr_possible )
{
//TODO: check if this actually works (ret value changed from uint32 to struct)
//abuse call convention rules to get this working.
if (steamclient_has_ipv6_functions()) {
return ((ISteamGameServer012 *)instancePtr_possible)->GetPublicIP_old();
get_steam_client()->steam_gameserver->GetPublicIP_fix((SteamIPAddress_t *)instancePtr);
return (void *)instancePtr;
} else {
return ((ISteamGameServer012 *)instancePtr)->GetPublicIP_old();
return (void *)((ISteamGameServer012 *)instancePtr)->GetPublicIP_old();
}
}

4
dll/steam_client.cpp

@ -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;
}

2
dll/steam_client.h

@ -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.

6
dll/steam_gameserver.cpp

@ -559,6 +559,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

1
dll/steam_gameserver.h

@ -278,6 +278,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

Loading…
Cancel
Save