1
0
Fork 0
mirror of https://gitlab.com/Mr_Goldberg/goldberg_emulator.git synced 2024-11-14 10:50:13 +01:00

Hopefully this fixes the SteamAPI_ISteamGameServer_GetPublicIP function

This commit is contained in:
Mr_Goldberg 2021-04-09 14:53:20 -04:00
parent c48526d49a
commit 19015c097c
No known key found for this signature in database
GPG key ID: 8597D87419DEF278
6 changed files with 19 additions and 5 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,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();
}
}

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

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

View file

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