Add support for isteamgameserver 005-011

This commit is contained in:
Mr_Goldberg 2019-05-20 12:35:55 -04:00
parent 2b1368ccac
commit 68b8e0241a
No known key found for this signature in database
GPG key ID: 8597D87419DEF278
10 changed files with 865 additions and 6 deletions

View file

@ -55,6 +55,7 @@ bool Steam_GameServer::InitGameServer( uint32 unIP, uint16 usGamePort, uint16 us
server_data.set_query_port(usQueryPort);
server_data.set_offline(false);
if (!settings->get_local_game_id().AppID()) settings->set_game_id(CGameID(nGameAppId));
//TODO: flags should be k_unServerFlag
flags = unFlags;
policy_response_called = false;
call_servers_connected = false;
@ -123,6 +124,14 @@ void Steam_GameServer::LogOn( const char *pszToken )
logged_in = true;
}
void Steam_GameServer::LogOn(
const char *pszAccountName,
const char *pszPassword
)
{
PRINT_DEBUG("LogOn %s %s\n", pszAccountName, pszPassword);
LogOn(pszAccountName);
}
/// Login to a generic, anonymous account.
///
@ -136,6 +145,11 @@ void Steam_GameServer::LogOnAnonymous()
logged_in = true;
}
void Steam_GameServer::LogOn()
{
PRINT_DEBUG("LogOn\n");
LogOnAnonymous();
}
/// Begin process of logging game server out of steam
void Steam_GameServer::LogOff()
@ -370,6 +384,78 @@ bool Steam_GameServer::BUpdateUserData( CSteamID steamIDUser, const char *pchPla
return true;
}
// You shouldn't need to call this as it is called internally by SteamGameServer_Init() and can only be called once.
//
// To update the data in this call which may change during the servers lifetime see UpdateServerStatus() below.
//
// Input: nGameAppID - The Steam assigned AppID for the game
// unServerFlags - Any applicable combination of flags (see k_unServerFlag____ constants below)
// unGameIP - The IP Address the server is listening for client connections on (might be INADDR_ANY)
// unGamePort - The port which the server is listening for client connections on
// unSpectatorPort - the port on which spectators can join to observe the server, 0 if spectating is not supported
// usQueryPort - The port which the ISteamMasterServerUpdater API should use in order to listen for matchmaking requests
// pchGameDir - A unique string identifier for your game
// pchVersion - The current version of the server as a string like 1.0.0.0
// bLanMode - Is this a LAN only server?
//
// bugbug jmccaskey - figure out how to remove this from the API and only expose via SteamGameServer_Init... or make this actually used,
// and stop calling it in SteamGameServer_Init()?
bool Steam_GameServer::BSetServerType( uint32 unServerFlags, uint32 unGameIP, uint16 unGamePort,
uint16 unSpectatorPort, uint16 usQueryPort, const char *pchGameDir, const char *pchVersion, bool bLANMode )
{
PRINT_DEBUG("BSetServerType\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex);
server_data.set_ip(unGameIP);
server_data.set_port(unGamePort);
server_data.set_query_port(usQueryPort);
server_data.set_spectator_port(unSpectatorPort);
std::string version(pchVersion);
version.erase(std::remove(version.begin(), version.end(), ' '), version.end());
version.erase(std::remove(version.begin(), version.end(), '.'), version.end());
server_data.set_version(stoi(version));
//TODO?
return true;
}
// Updates server status values which shows up in the server browser and matchmaking APIs
void Steam_GameServer::UpdateServerStatus( int cPlayers, int cPlayersMax, int cBotPlayers,
const char *pchServerName, const char *pSpectatorServerName,
const char *pchMapName )
{
PRINT_DEBUG("UpdateServerStatus\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex);
server_data.set_num_players(cPlayers);
server_data.set_max_player_count(cPlayersMax);
server_data.set_bot_player_count(cBotPlayers);
server_data.set_server_name(pchServerName);
server_data.set_spectator_server_name(pSpectatorServerName);
server_data.set_map_name(pchMapName);
}
// This can be called if spectator goes away or comes back (passing 0 means there is no spectator server now).
void Steam_GameServer::UpdateSpectatorPort( uint16 unSpectatorPort )
{
PRINT_DEBUG("UpdateSpectatorPort\n");
SetSpectatorPort(unSpectatorPort);
}
// Sets a string defining the "gametype" for this server, this is optional, but if it is set
// it allows users to filter in the matchmaking/server-browser interfaces based on the value
void Steam_GameServer::SetGameType( const char *pchGameType )
{
PRINT_DEBUG("SetGameType\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex);
}
// Ask if a user has a specific achievement for this game, will get a callback on reply
bool Steam_GameServer::BGetUserAchievementStatus( CSteamID steamID, const char *pchAchievementName )
{
PRINT_DEBUG("BGetUserAchievementStatus\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return false;
}
// New auth system APIs - do not mix with the old auth system APIs.
// ----------------------------------------------------------------