More accurate behavior.

merge-requests/6/head
Mr_Goldberg 2019-05-11 14:44:06 -04:00
parent 7938d1f5c9
commit c20944ca0a
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
3 changed files with 43 additions and 9 deletions

View File

@ -107,6 +107,7 @@ static void load_old_interface_versions()
S_API HSteamUser SteamAPI_GetHSteamUser()
{
PRINT_DEBUG("SteamAPI_GetHSteamUser\n");
if (!get_steam_client()->user_logged_in) return 0;
return CLIENT_HSTEAMUSER;
}
@ -379,8 +380,8 @@ S_API void Steam_RegisterInterfaceFuncs( void *hModule )
S_API HSteamUser Steam_GetHSteamUserCurrent()
{
PRINT_DEBUG("Steam_GetHSteamUserCurrent\n");
//TODO?
return CLIENT_HSTEAMUSER;
//TODO
return SteamAPI_GetHSteamUser();
}
// returns the filename path of the current running Steam process, used if you need to load an explicit steam dll by name.
@ -399,6 +400,7 @@ S_API const char *SteamAPI_GetSteamInstallPath()
S_API HSteamPipe SteamAPI_GetHSteamPipe()
{
PRINT_DEBUG("SteamAPI_GetHSteamPipe\n");
if (!get_steam_client()->user_logged_in) return 0;
return CLIENT_STEAM_PIPE;
}
@ -412,13 +414,13 @@ S_API void SteamAPI_SetTryCatchCallbacks( bool bTryCatchCallbacks )
S_API HSteamPipe GetHSteamPipe()
{
PRINT_DEBUG("GetHSteamPipe\n");
return CLIENT_STEAM_PIPE;
return SteamAPI_GetHSteamPipe();
}
S_API HSteamUser GetHSteamUser()
{
PRINT_DEBUG("GetHSteamUser\n");
return CLIENT_HSTEAMUSER;
return SteamAPI_GetHSteamUser();
}
@ -469,12 +471,14 @@ S_API void * S_CALLTYPE SteamGameServerInternal_CreateInterface( const char *ver
S_API HSteamPipe S_CALLTYPE SteamGameServer_GetHSteamPipe()
{
PRINT_DEBUG("SteamGameServer_GetHSteamPipe\n");
if (!get_steam_client()->server_init) return 0;
return SERVER_STEAM_PIPE;
}
S_API HSteamUser S_CALLTYPE SteamGameServer_GetHSteamUser()
{
PRINT_DEBUG("SteamGameServer_GetHSteamUser\n");
if (!get_steam_client()->server_init) return 0;
return SERVER_HSTEAMUSER;
}
@ -488,7 +492,7 @@ S_API bool S_CALLTYPE SteamInternal_GameServer_Init( uint32 unIP, uint16 usPort,
PRINT_DEBUG("SteamInternal_GameServer_Init %u %hu %hu %hu %u %s\n", unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString);
SteamGameServerClient();
get_steam_client()->serverInit();
return get_steam_client()->GetISteamGameServer(SERVER_HSTEAMUSER, SERVER_STEAM_PIPE, /* TODO: figure out right interface version */old_gameserver)->InitGameServer(unIP, usGamePort, usQueryPort, eServerMode, 0, pchVersionString);
return get_steam_client()->steam_gameserver->InitGameServer(unIP, usGamePort, usQueryPort, eServerMode, 0, pchVersionString);
}
S_API bool SteamGameServer_Init( uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString )
@ -511,15 +515,13 @@ S_API void SteamGameServer_RunCallbacks()
S_API bool SteamGameServer_BSecure()
{
PRINT_DEBUG("SteamGameServer_BSecure\n");
return true;
return get_steam_client()->steam_gameserver->BSecure();
}
S_API uint64 SteamGameServer_GetSteamID()
{
PRINT_DEBUG("SteamGameServer_GetSteamID\n");
ISteamGameServer *gs = get_steam_client()->GetISteamGameServer(SERVER_HSTEAMUSER, SERVER_STEAM_PIPE, /* TODO: figure out right interface version */old_gameserver);
if (!gs) return 0;
return gs->GetSteamID().ConvertToUint64();
return get_steam_client()->steam_gameserver->GetSteamID().ConvertToUint64();
}
S_API ISteamClient *SteamGameServerClient() {

View File

@ -437,6 +437,7 @@ void Steam_Client::ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser )
ISteamUser *Steam_Client::GetISteamUser( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamUser %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
if (!user_logged_in) return NULL;
if (strcmp(pchVersion, "SteamUser009") == 0) {
@ -474,6 +475,7 @@ ISteamUser *Steam_Client::GetISteamUser( HSteamUser hSteamUser, HSteamPipe hStea
ISteamGameServer *Steam_Client::GetISteamGameServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamGameServer %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
if (!server_init) return NULL;
return steam_gameserver;
}
@ -489,6 +491,7 @@ void Steam_Client::SetLocalIPBinding( uint32 unIP, uint16 usPort )
ISteamFriends *Steam_Client::GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamFriends %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
if (!user_logged_in) return NULL;
if (strcmp(pchVersion, "SteamFriends004") == 0) {
@ -530,6 +533,7 @@ ISteamFriends *Steam_Client::GetISteamFriends( HSteamUser hSteamUser, HSteamPipe
ISteamUtils *Steam_Client::GetISteamUtils( HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamUtils %s\n", pchVersion);
if (!hSteamPipe) return NULL;
Steam_Utils *steam_utils_temp;
@ -567,6 +571,7 @@ ISteamUtils *Steam_Client::GetISteamUtils( HSteamPipe hSteamPipe, const char *pc
ISteamMatchmaking *Steam_Client::GetISteamMatchmaking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamMatchmaking %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
if (!user_logged_in) return NULL;
if (strcmp(pchVersion, "SteamMatchMaking001") == 0) {
@ -604,6 +609,7 @@ ISteamMatchmaking *Steam_Client::GetISteamMatchmaking( HSteamUser hSteamUser, HS
ISteamMatchmakingServers *Steam_Client::GetISteamMatchmakingServers( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamMatchmakingServers %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
if (!user_logged_in) return NULL;
return steam_matchmaking_servers;
}
@ -612,6 +618,7 @@ ISteamMatchmakingServers *Steam_Client::GetISteamMatchmakingServers( HSteamUser
void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamGenericInterface %s\n", pchVersion);
if (!hSteamPipe) return NULL;
bool server = false;
if (hSteamUser == SERVER_HSTEAMUSER) {
@ -732,6 +739,7 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe
ISteamUserStats *Steam_Client::GetISteamUserStats( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamUserStats %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
if (!user_logged_in) return NULL;
if (strcmp(pchVersion, "STEAMUSERSTATS_INTERFACE_VERSION001") == 0) {
@ -769,6 +777,7 @@ ISteamUserStats *Steam_Client::GetISteamUserStats( HSteamUser hSteamUser, HSteam
ISteamGameServerStats *Steam_Client::GetISteamGameServerStats( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamGameServerStats %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
return steam_gameserverstats;
}
@ -776,6 +785,7 @@ ISteamGameServerStats *Steam_Client::GetISteamGameServerStats( HSteamUser hSteam
ISteamApps *Steam_Client::GetISteamApps( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamApps %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
if (hSteamUser == SERVER_HSTEAMUSER) {
return steam_gameserver_apps;
}
@ -788,6 +798,7 @@ ISteamApps *Steam_Client::GetISteamApps( HSteamUser hSteamUser, HSteamPipe hStea
ISteamNetworking *Steam_Client::GetISteamNetworking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamNetworking %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
Steam_Networking *steam_networking_temp;
@ -819,6 +830,7 @@ ISteamNetworking *Steam_Client::GetISteamNetworking( HSteamUser hSteamUser, HSte
ISteamRemoteStorage *Steam_Client::GetISteamRemoteStorage( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamRemoteStorage %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
if (!user_logged_in) return NULL;
if (strcmp(pchVersion, "STEAMREMOTESTORAGE_INTERFACE_VERSION001") == 0) {
@ -860,6 +872,7 @@ ISteamRemoteStorage *Steam_Client::GetISteamRemoteStorage( HSteamUser hSteamuser
ISteamScreenshots *Steam_Client::GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamScreenshots %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
if (!user_logged_in) return NULL;
return steam_screenshots;
}
@ -901,6 +914,7 @@ bool Steam_Client::BShutdownIfAllPipesClosed()
ISteamHTTP *Steam_Client::GetISteamHTTP( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamHTTP %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
if (hSteamuser == SERVER_HSTEAMUSER) {
return steam_gameserver_http;
}
@ -913,12 +927,14 @@ ISteamHTTP *Steam_Client::GetISteamHTTP( HSteamUser hSteamuser, HSteamPipe hStea
void *Steam_Client::DEPRECATED_GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("DEPRECATED_GetISteamUnifiedMessages %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
return (void *)(ISteamUnifiedMessages *)steam_unified_messages;
}
ISteamUnifiedMessages *Steam_Client::GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamUnifiedMessages %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
return steam_unified_messages;
}
@ -926,6 +942,7 @@ ISteamUnifiedMessages *Steam_Client::GetISteamUnifiedMessages( HSteamUser hSteam
ISteamController *Steam_Client::GetISteamController( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamController %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
if (!user_logged_in) return NULL;
if (strcmp(pchVersion, "STEAMCONTROLLER_INTERFACE_VERSION") == 0) {
@ -954,6 +971,7 @@ ISteamController *Steam_Client::GetISteamController( HSteamUser hSteamUser, HSte
ISteamUGC *Steam_Client::GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamUGC %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
Steam_UGC *steam_ugc_temp;
if (hSteamUser == SERVER_HSTEAMUSER) {
@ -1002,6 +1020,7 @@ ISteamUGC *Steam_Client::GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamP
ISteamAppList *Steam_Client::GetISteamAppList( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamAppList %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
if (!user_logged_in) return NULL;
return steam_applist;
}
@ -1010,6 +1029,7 @@ ISteamAppList *Steam_Client::GetISteamAppList( HSteamUser hSteamUser, HSteamPipe
ISteamMusic *Steam_Client::GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamMusic %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
if (!user_logged_in) return NULL;
return steam_music;
}
@ -1018,6 +1038,7 @@ ISteamMusic *Steam_Client::GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSt
ISteamMusicRemote *Steam_Client::GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion)
{
PRINT_DEBUG("GetISteamMusicRemote %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
if (!user_logged_in) return NULL;
return steam_musicremote;
}
@ -1026,6 +1047,7 @@ ISteamMusicRemote *Steam_Client::GetISteamMusicRemote(HSteamUser hSteamuser, HSt
ISteamHTMLSurface *Steam_Client::GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion)
{
PRINT_DEBUG("GetISteamHTMLSurface %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
if (!user_logged_in) return NULL;
if (strcmp(pchVersion, "STEAMHTMLSURFACE_INTERFACE_VERSION_001") == 0) {
@ -1075,6 +1097,7 @@ void Steam_Client::Remove_SteamAPI_CPostAPIResultInProcess( SteamAPI_PostAPIResu
ISteamInventory *Steam_Client::GetISteamInventory( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamInventory %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
Steam_Inventory *steam_inventory_temp;
Settings *settings_temp;
SteamCallBacks *callbacks_temp;
@ -1104,6 +1127,7 @@ ISteamInventory *Steam_Client::GetISteamInventory( HSteamUser hSteamuser, HSteam
ISteamVideo *Steam_Client::GetISteamVideo( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamVideo %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
if (!user_logged_in) return NULL;
return steam_video;
}
@ -1112,6 +1136,7 @@ ISteamVideo *Steam_Client::GetISteamVideo( HSteamUser hSteamuser, HSteamPipe hSt
ISteamParentalSettings *Steam_Client::GetISteamParentalSettings( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamParentalSettings %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
if (!user_logged_in) return NULL;
return steam_parental;
}
@ -1119,12 +1144,14 @@ ISteamParentalSettings *Steam_Client::GetISteamParentalSettings( HSteamUser hSte
ISteamMasterServerUpdater *Steam_Client::GetISteamMasterServerUpdater( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamMasterServerUpdater %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
return steam_masterserver_updater;
}
ISteamContentServer *Steam_Client::GetISteamContentServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamContentServer %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
return NULL;
}
@ -1132,6 +1159,7 @@ ISteamContentServer *Steam_Client::GetISteamContentServer( HSteamUser hSteamUser
ISteamGameSearch *Steam_Client::GetISteamGameSearch( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamGameSearch %s\n", pchVersion);
if (!hSteamPipe || !hSteamuser) return NULL;
if (!user_logged_in) return NULL;
return steam_game_search;
@ -1141,6 +1169,7 @@ ISteamGameSearch *Steam_Client::GetISteamGameSearch( HSteamUser hSteamuser, HSte
ISteamInput *Steam_Client::GetISteamInput( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamInput %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
if (!user_logged_in) return NULL;
return steam_controller;
@ -1150,6 +1179,7 @@ ISteamInput *Steam_Client::GetISteamInput( HSteamUser hSteamUser, HSteamPipe hSt
ISteamParties *Steam_Client::GetISteamParties( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("GetISteamParties %s\n", pchVersion);
if (!hSteamPipe || !hSteamUser) return NULL;
if (!user_logged_in) return NULL;
return steam_parties;

View File

@ -162,6 +162,7 @@ bool Steam_GameServer::BSecure()
{
PRINT_DEBUG("BSecure\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (!policy_response_called) return false;
return flags == eServerModeAuthenticationAndSecure;
}
@ -169,6 +170,7 @@ CSteamID Steam_GameServer::GetSteamID()
{
PRINT_DEBUG("Steam_GameServer::GetSteamID\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (!logged_in) return k_steamIDNil;
return settings->get_local_steam_id();
}