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:
parent
c48526d49a
commit
19015c097c
6 changed files with 19 additions and 5 deletions
|
@ -136,7 +136,7 @@ Steam_Client *get_steam_clientserver_old()
|
||||||
static bool steamclient_has_ipv6_functions_flag;
|
static bool steamclient_has_ipv6_functions_flag;
|
||||||
bool steamclient_has_ipv6_functions()
|
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)
|
static void *create_client_interface(const char *ver)
|
||||||
|
|
|
@ -5843,13 +5843,14 @@ STEAMAPI_API SteamAPICall_t SteamAPI_ISteamGameServer_GetServerReputation( IStea
|
||||||
return self->GetServerReputation();
|
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()) {
|
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 {
|
} else {
|
||||||
return ((ISteamGameServer012 *)instancePtr)->GetPublicIP_old();
|
return (void *)((ISteamGameServer012 *)instancePtr)->GetPublicIP_old();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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_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);
|
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;
|
last_cb_run = 0;
|
||||||
PRINT_DEBUG("client init end\n");
|
PRINT_DEBUG("client init end\n");
|
||||||
}
|
}
|
||||||
|
@ -303,8 +305,10 @@ ISteamGameServer *Steam_Client::GetISteamGameServer( HSteamUser hSteamUser, HSte
|
||||||
} else if (strcmp(pchVersion, "SteamGameServer012") == 0) {
|
} else if (strcmp(pchVersion, "SteamGameServer012") == 0) {
|
||||||
return (ISteamGameServer *)(void *)(ISteamGameServer012 *)steam_gameserver;
|
return (ISteamGameServer *)(void *)(ISteamGameServer012 *)steam_gameserver;
|
||||||
} else if (strcmp(pchVersion, STEAMGAMESERVER_INTERFACE_VERSION) == 0) {
|
} else if (strcmp(pchVersion, STEAMGAMESERVER_INTERFACE_VERSION) == 0) {
|
||||||
|
gameserver_has_ipv6_functions = true;
|
||||||
return (ISteamGameServer *)(void *)(ISteamGameServer *)steam_gameserver;
|
return (ISteamGameServer *)(void *)(ISteamGameServer *)steam_gameserver;
|
||||||
} else {
|
} else {
|
||||||
|
gameserver_has_ipv6_functions = true;
|
||||||
return (ISteamGameServer *)(void *)(ISteamGameServer *)steam_gameserver;
|
return (ISteamGameServer *)(void *)(ISteamGameServer *)steam_gameserver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,8 @@ public:
|
||||||
unsigned steam_pipe_counter = 1;
|
unsigned steam_pipe_counter = 1;
|
||||||
std::map<HSteamPipe, enum Steam_Pipe> steam_pipes;
|
std::map<HSteamPipe, enum Steam_Pipe> steam_pipes;
|
||||||
|
|
||||||
|
bool gameserver_has_ipv6_functions;
|
||||||
|
|
||||||
Steam_Client();
|
Steam_Client();
|
||||||
~Steam_Client();
|
~Steam_Client();
|
||||||
// Creates a communication pipe to the Steam client.
|
// Creates a communication pipe to the Steam client.
|
||||||
|
|
|
@ -559,6 +559,12 @@ SteamIPAddress_t Steam_GameServer::GetPublicIP()
|
||||||
return ip;
|
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
|
// 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
|
// 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
|
// back and forth. This prevents us from requiring server ops to open up yet another port
|
||||||
|
|
|
@ -278,6 +278,7 @@ public:
|
||||||
// connect to
|
// connect to
|
||||||
uint32 GetPublicIP_old();
|
uint32 GetPublicIP_old();
|
||||||
SteamIPAddress_t GetPublicIP();
|
SteamIPAddress_t GetPublicIP();
|
||||||
|
void GetPublicIP_fix(SteamIPAddress_t *out);
|
||||||
|
|
||||||
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
|
// 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
|
// socket to talk to the master server on, it lets the game use its socket to forward messages
|
||||||
|
|
Loading…
Reference in a new issue