Compare commits

...

2 Commits

Author SHA1 Message Date
Mr_Goldberg 8695ea2dce
Support achievements that are triggered automatically with stats.
The achievements config MUST be generated with the achievements_gen.py script.
2022-07-12 01:09:27 -04:00
Mr_Goldberg 3f8ce69b6d
SDK 1.54 2022-07-12 01:04:56 -04:00
16 changed files with 366 additions and 104 deletions

View File

@ -88,6 +88,8 @@ You can use https://steamdb.info/ to list items and attributes they have and put
Keep in mind that some item are not valid to have in your inventory. For example, in PayDay2 all items below item_id 50000 will make your game crash. Keep in mind that some item are not valid to have in your inventory. For example, in PayDay2 all items below item_id 50000 will make your game crash.
items.json should contain all the item definitions for the game, default_items.json is the quantity of each item that you want a user to have initially in their inventory. By default the user will have no items. items.json should contain all the item definitions for the game, default_items.json is the quantity of each item that you want a user to have initially in their inventory. By default the user will have no items.
You can use the scripts\stats_schema_achievement_gen\achievements_gen.py script in the emu source code repo to generate a achievements config from a steam: appcache\stats\UserGameStatsSchema_{appid}.bin file.
Leaderboards: Leaderboards:
By default the emulator assumes all leaderboards queried by the game (FindLeaderboard()) exist and creates them with the most common options (sort method descending, display type numeric) By default the emulator assumes all leaderboards queried by the game (FindLeaderboard()) exist and creates them with the most common options (sort method descending, display type numeric)
In some games this default behavior doesn't work and so you may need to tweak which leaderboards the game sees. In some games this default behavior doesn't work and so you may need to tweak which leaderboards the game sees.
@ -105,6 +107,8 @@ The format is: STAT_NAME=type=default value
The type can be: int, float or avgrate The type can be: int, float or avgrate
The default value is simply a number that represents the default value for the stat. The default value is simply a number that represents the default value for the stat.
You can use the scripts\stats_schema_achievement_gen\achievements_gen.py script in the emu source code repo to generate a stats config from a steam: appcache\stats\UserGameStatsSchema_{appid}.bin file.
Build id: Build id:
Add a steam_settings\build_id.txt with the build id if the game doesn't show the correct build id and you want the emu to give it the correct one. Add a steam_settings\build_id.txt with the build id if the game doesn't show the correct build id and you want the emu to give it the correct one.
An example can be found in steam_settings.EXAMPLE An example can be found in steam_settings.EXAMPLE

View File

@ -9,8 +9,14 @@ if exist "%VS_Base_Path%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Bui
if exist "%VS_Base_Path%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" goto vs14 if exist "%VS_Base_Path%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" goto vs14
if exist "%VS_Base_Path%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" goto vs2019_bt if exist "%VS_Base_Path%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" goto vs2019_bt
if exist "%VS_Base_Path%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat" goto vs2017_bt if exist "%VS_Base_Path%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat" goto vs2017_bt
if exist "%VS_Base_Path%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" goto vs2022
if exist "%VS_Base_Path%\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" goto vs2022_bt
if exist ".\sdk_standalone\set_vars64.bat" goto gitlabci if exist ".\sdk_standalone\set_vars64.bat" goto gitlabci
:vs2022
call "%VS_Base_Path%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
goto batend
:vs2019 :vs2019
call "%VS_Base_Path%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" call "%VS_Base_Path%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
goto batend goto batend
@ -23,6 +29,10 @@ goto batend
call "%VS_Base_Path%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" call "%VS_Base_Path%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
goto batend goto batend
:vs2022_bt
call "%VS_Base_Path%\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
goto batend
:vs2019_bt :vs2019_bt
call "%VS_Base_Path%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" call "%VS_Base_Path%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
goto batend goto batend

View File

@ -9,8 +9,14 @@ if exist "%VS_Base_Path%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Bui
if exist "%VS_Base_Path%\Microsoft Visual Studio 14.0\VC\bin\amd64_x86\vcvarsamd64_x86.bat" goto vs14 if exist "%VS_Base_Path%\Microsoft Visual Studio 14.0\VC\bin\amd64_x86\vcvarsamd64_x86.bat" goto vs14
if exist "%VS_Base_Path%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars32.bat" goto vs2019_bt if exist "%VS_Base_Path%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars32.bat" goto vs2019_bt
if exist "%VS_Base_Path%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars32.bat" goto vs2017_bt if exist "%VS_Base_Path%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars32.bat" goto vs2017_bt
if exist "%VS_Base_Path%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" goto vs2022
if exist "%VS_Base_Path%\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars32.bat" goto vs2022_bt
if exist ".\sdk_standalone\set_vars32.bat" goto gitlabci if exist ".\sdk_standalone\set_vars32.bat" goto gitlabci
:vs2022
call "%VS_Base_Path%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat"
goto batend
:vs2019 :vs2019
call "%VS_Base_Path%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" call "%VS_Base_Path%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"
goto batend goto batend
@ -23,6 +29,10 @@ goto batend
call "%VS_Base_Path%\Microsoft Visual Studio 14.0\VC\bin\amd64_x86\vcvarsamd64_x86.bat" call "%VS_Base_Path%\Microsoft Visual Studio 14.0\VC\bin\amd64_x86\vcvarsamd64_x86.bat"
goto batend goto batend
:vs2022_bt
call "%VS_Base_Path%\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars32.bat"
goto batend
:vs2019_bt :vs2019_bt
call "%VS_Base_Path%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars32.bat" call "%VS_Base_Path%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars32.bat"
goto batend goto batend

View File

@ -165,6 +165,12 @@ inline std::wstring utf8_decode(const std::string &str)
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
inline std::string ascii_to_lowercase(std::string data) {
std::transform(data.begin(), data.end(), data.begin(),
[](unsigned char c){ return std::tolower(c); });
return data;
}
// Other libs includes // Other libs includes
#include "../json/json.hpp" #include "../json/json.hpp"
#include "../controller/gamepad.h" #include "../controller/gamepad.h"

View File

@ -772,6 +772,26 @@ STEAMAPI_API void SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialogConnectS
return (get_steam_client()->steam_friends)->ActivateGameOverlayInviteDialogConnectString(pchConnectString); return (get_steam_client()->steam_friends)->ActivateGameOverlayInviteDialogConnectString(pchConnectString);
} }
STEAMAPI_API SteamAPICall_t SteamAPI_ISteamFriends_RequestEquippedProfileItems( ISteamFriends* self, uint64_steamid steamID )
{
return (get_steam_client()->steam_friends)->RequestEquippedProfileItems(steamID);
}
STEAMAPI_API bool SteamAPI_ISteamFriends_BHasEquippedProfileItem( ISteamFriends* self, uint64_steamid steamID, ECommunityProfileItemType itemType )
{
return (get_steam_client()->steam_friends)->BHasEquippedProfileItem(steamID, itemType);
}
STEAMAPI_API const char * SteamAPI_ISteamFriends_GetProfileItemPropertyString( ISteamFriends* self, uint64_steamid steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop )
{
return (get_steam_client()->steam_friends)->GetProfileItemPropertyString(steamID, itemType, prop);
}
STEAMAPI_API uint32 SteamAPI_ISteamFriends_GetProfileItemPropertyUint( ISteamFriends* self, uint64_steamid steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop )
{
return (get_steam_client()->steam_friends)->GetProfileItemPropertyUint(steamID, itemType, prop);
}
STEAMAPI_API ISteamUtils *SteamAPI_SteamUtils_v010() STEAMAPI_API ISteamUtils *SteamAPI_SteamUtils_v010()
{ {
return get_steam_client()->GetISteamUtils(flat_hsteampipe(), "SteamUtils010"); return get_steam_client()->GetISteamUtils(flat_hsteampipe(), "SteamUtils010");

View File

@ -131,7 +131,7 @@ public:
//stats //stats
std::map<std::string, Stat_config> getStats() { return stats; } std::map<std::string, Stat_config> getStats() { return stats; }
void setStatDefiniton(std::string name, struct Stat_config stat_config) {stats[name] = stat_config; } void setStatDefiniton(std::string name, struct Stat_config stat_config) {stats[ascii_to_lowercase(name)] = stat_config; }
//subscribed lobby/group ids //subscribed lobby/group ids
std::set<uint64> subscribed_groups; std::set<uint64> subscribed_groups;

View File

@ -1014,6 +1014,33 @@ void ActivateGameOverlayInviteDialogConnectString( const char *pchConnectString
PRINT_DEBUG("Steam_Friends::ActivateGameOverlayInviteDialogConnectString\n"); PRINT_DEBUG("Steam_Friends::ActivateGameOverlayInviteDialogConnectString\n");
} }
// Steam Community items equipped by a user on their profile
// You can register for EquippedProfileItemsChanged_t to know when a friend has changed their equipped profile items
STEAM_CALL_RESULT( EquippedProfileItems_t )
SteamAPICall_t RequestEquippedProfileItems( CSteamID steamID )
{
PRINT_DEBUG("Steam_Friends::RequestEquippedProfileItems\n");
return 0;
}
bool BHasEquippedProfileItem( CSteamID steamID, ECommunityProfileItemType itemType )
{
PRINT_DEBUG("Steam_Friends::BHasEquippedProfileItem\n");
return false;
}
const char *GetProfileItemPropertyString( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop )
{
PRINT_DEBUG("Steam_Friends::GetProfileItemPropertyString\n");
return "";
}
uint32 GetProfileItemPropertyUint( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop )
{
PRINT_DEBUG("Steam_Friends::GetProfileItemPropertyUint\n");
return 0;
}
void RunCallbacks() void RunCallbacks()
{ {
PRINT_DEBUG("Steam_Friends::RunCallbacks\n"); PRINT_DEBUG("Steam_Friends::RunCallbacks\n");

View File

@ -27,6 +27,29 @@ struct Steam_Leaderboard {
ELeaderboardDisplayType display_type; ELeaderboardDisplayType display_type;
}; };
struct achievement_trigger {
std::string name;
std::string value_operation;
std::string min_value;
std::string max_value;
bool check_triggered(float stat) {
try {
if (std::stof(max_value) <= stat) return true;
} catch (...) {}
return false;
}
bool check_triggered(int32 stat) {
try {
if (std::stoi(max_value) <= stat) return true;
} catch (...) {}
return false;
}
};
class Steam_User_Stats : class Steam_User_Stats :
public ISteamUserStats003, public ISteamUserStats003,
public ISteamUserStats004, public ISteamUserStats004,
@ -58,6 +81,7 @@ private:
std::map<std::string, int32> stats_cache_int; std::map<std::string, int32> stats_cache_int;
std::map<std::string, float> stats_cache_float; std::map<std::string, float> stats_cache_float;
std::map<std::string, achievement_trigger> achievement_stat_trigger;
unsigned int find_leaderboard(std::string name) unsigned int find_leaderboard(std::string name)
{ {
@ -118,6 +142,14 @@ Steam_User_Stats(Settings *settings, Local_Storage *local_storage, class SteamCa
user_achievements[name]["earned"] = false; user_achievements[name]["earned"] = false;
user_achievements[name]["earned_time"] = static_cast<uint32>(0); user_achievements[name]["earned_time"] = static_cast<uint32>(0);
} }
achievement_trigger trig;
trig.name = name;
trig.value_operation = static_cast<std::string const&>(it["progress"]["value"]["operation"]);
std::string stat_name = ascii_to_lowercase(static_cast<std::string const&>(it["progress"]["value"]["operand1"]));
trig.min_value = static_cast<std::string const&>(it["progress"]["min_val"]);
trig.max_value = static_cast<std::string const&>(it["progress"]["max_val"]);
achievement_stat_trigger[stat_name] = trig;
} catch (...) {} } catch (...) {}
try { try {
@ -154,14 +186,16 @@ bool GetStat( const char *pchName, int32 *pData )
{ {
PRINT_DEBUG("GetStat int32 %s\n", pchName); PRINT_DEBUG("GetStat int32 %s\n", pchName);
if (!pchName || !pData) return false; if (!pchName || !pData) return false;
std::string stat_name = ascii_to_lowercase(pchName);
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
auto stats_config = settings->getStats(); auto stats_config = settings->getStats();
auto stats_data = stats_config.find(pchName); auto stats_data = stats_config.find(stat_name);
if (stats_data != stats_config.end()) { if (stats_data != stats_config.end()) {
if (stats_data->second.type != Stat_Type::STAT_TYPE_INT) return false; if (stats_data->second.type != Stat_Type::STAT_TYPE_INT) return false;
} }
int read_data = local_storage->get_data(Local_Storage::stats_storage_folder, pchName, (char* )pData, sizeof(*pData)); int read_data = local_storage->get_data(Local_Storage::stats_storage_folder, stat_name, (char* )pData, sizeof(*pData));
if (read_data == sizeof(int32)) if (read_data == sizeof(int32))
return true; return true;
@ -177,14 +211,16 @@ bool GetStat( const char *pchName, float *pData )
{ {
PRINT_DEBUG("GetStat float %s\n", pchName); PRINT_DEBUG("GetStat float %s\n", pchName);
if (!pchName || !pData) return false; if (!pchName || !pData) return false;
std::string stat_name = ascii_to_lowercase(pchName);
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
auto stats_config = settings->getStats(); auto stats_config = settings->getStats();
auto stats_data = stats_config.find(pchName); auto stats_data = stats_config.find(stat_name);
if (stats_data != stats_config.end()) { if (stats_data != stats_config.end()) {
if (stats_data->second.type == Stat_Type::STAT_TYPE_INT) return false; if (stats_data->second.type == Stat_Type::STAT_TYPE_INT) return false;
} }
int read_data = local_storage->get_data(Local_Storage::stats_storage_folder, pchName, (char* )pData, sizeof(*pData)); int read_data = local_storage->get_data(Local_Storage::stats_storage_folder, stat_name, (char* )pData, sizeof(*pData));
if (read_data == sizeof(float)) if (read_data == sizeof(float))
return true; return true;
@ -202,14 +238,23 @@ bool SetStat( const char *pchName, int32 nData )
{ {
PRINT_DEBUG("SetStat int32 %s\n", pchName); PRINT_DEBUG("SetStat int32 %s\n", pchName);
if (!pchName) return false; if (!pchName) return false;
std::string stat_name = ascii_to_lowercase(pchName);
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
auto cached_stat = stats_cache_int.find(pchName); auto cached_stat = stats_cache_int.find(stat_name);
if (cached_stat != stats_cache_int.end()) { if (cached_stat != stats_cache_int.end()) {
if (cached_stat->second == nData) return true; if (cached_stat->second == nData) return true;
} }
if (local_storage->store_data(Local_Storage::stats_storage_folder, pchName, (char* )&nData, sizeof(nData)) == sizeof(nData)) { auto stat_trigger = achievement_stat_trigger.find(stat_name);
stats_cache_int[pchName] = nData; if (stat_trigger != achievement_stat_trigger.end()) {
if (stat_trigger->second.check_triggered(nData)) {
SetAchievement(stat_trigger->second.name.c_str());
}
}
if (local_storage->store_data(Local_Storage::stats_storage_folder, stat_name, (char* )&nData, sizeof(nData)) == sizeof(nData)) {
stats_cache_int[stat_name] = nData;
return true; return true;
} }
@ -220,14 +265,23 @@ bool SetStat( const char *pchName, float fData )
{ {
PRINT_DEBUG("SetStat float %s\n", pchName); PRINT_DEBUG("SetStat float %s\n", pchName);
if (!pchName) return false; if (!pchName) return false;
std::string stat_name = ascii_to_lowercase(pchName);
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
auto cached_stat = stats_cache_float.find(pchName); auto cached_stat = stats_cache_float.find(stat_name);
if (cached_stat != stats_cache_float.end()) { if (cached_stat != stats_cache_float.end()) {
if (cached_stat->second == fData) return true; if (cached_stat->second == fData) return true;
} }
if (local_storage->store_data(Local_Storage::stats_storage_folder, pchName, (char* )&fData, sizeof(fData)) == sizeof(fData)) { auto stat_trigger = achievement_stat_trigger.find(stat_name);
stats_cache_float[pchName] = fData; if (stat_trigger != achievement_stat_trigger.end()) {
if (stat_trigger->second.check_triggered(fData)) {
SetAchievement(stat_trigger->second.name.c_str());
}
}
if (local_storage->store_data(Local_Storage::stats_storage_folder, stat_name, (char* )&fData, sizeof(fData)) == sizeof(fData)) {
stats_cache_float[stat_name] = fData;
return true; return true;
} }
@ -237,10 +291,13 @@ bool SetStat( const char *pchName, float fData )
bool UpdateAvgRateStat( const char *pchName, float flCountThisSession, double dSessionLength ) bool UpdateAvgRateStat( const char *pchName, float flCountThisSession, double dSessionLength )
{ {
PRINT_DEBUG("UpdateAvgRateStat %s\n", pchName); PRINT_DEBUG("UpdateAvgRateStat %s\n", pchName);
if (!pchName) return false;
std::string stat_name = ascii_to_lowercase(pchName);
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
char data[sizeof(float) + sizeof(float) + sizeof(double)]; char data[sizeof(float) + sizeof(float) + sizeof(double)];
int read_data = local_storage->get_data(Local_Storage::stats_storage_folder, pchName, (char* )data, sizeof(*data)); int read_data = local_storage->get_data(Local_Storage::stats_storage_folder, stat_name, (char* )data, sizeof(*data));
float oldcount = 0; float oldcount = 0;
double oldsessionlength = 0; double oldsessionlength = 0;
if (read_data == sizeof(data)) { if (read_data == sizeof(data)) {
@ -256,7 +313,7 @@ bool UpdateAvgRateStat( const char *pchName, float flCountThisSession, double dS
memcpy(data + sizeof(float), &oldcount, sizeof(oldcount)); memcpy(data + sizeof(float), &oldcount, sizeof(oldcount));
memcpy(data + sizeof(float) * 2, &oldsessionlength, sizeof(oldsessionlength)); memcpy(data + sizeof(float) * 2, &oldsessionlength, sizeof(oldsessionlength));
return local_storage->store_data(Local_Storage::stats_storage_folder, pchName, data, sizeof(data)) == sizeof(data); return local_storage->store_data(Local_Storage::stats_storage_folder, stat_name, data, sizeof(data)) == sizeof(data);
} }

View File

@ -4,14 +4,6 @@ import os
import json import json
if len(sys.argv) < 2:
print("format: {} UserGameStatsSchema_480.bin".format(sys.argv[0]))
exit(0)
with open(sys.argv[1], 'rb') as f:
schema = vdf.binary_loads(f.read())
language = 'english' language = 'english'
STAT_TYPE_INT = '1' STAT_TYPE_INT = '1'
@ -19,6 +11,8 @@ STAT_TYPE_FLOAT = '2'
STAT_TYPE_AVGRATE = '3' STAT_TYPE_AVGRATE = '3'
STAT_TYPE_BITS = '4' STAT_TYPE_BITS = '4'
def generate_stats_achievements(schema, config_directory):
schema = vdf.binary_loads(schema)
achievements_out = [] achievements_out = []
stats_out = [] stats_out = []
@ -48,6 +42,8 @@ for appid in schema:
value = '' value = ''
out[x] = value out[x] = value
out['name'] = ach['name'] out['name'] = ach['name']
if 'progress' in ach:
out['progress'] = ach['progress']
achievements_out += [out] achievements_out += [out]
else: else:
out = {} out = {}
@ -75,7 +71,6 @@ for s in stats_out:
# print(output_ach) # print(output_ach)
# print(output_stats) # print(output_stats)
config_directory = os.path.join(sys.argv[1] + "_output", "steam_settings")
if not os.path.exists(config_directory): if not os.path.exists(config_directory):
os.makedirs(config_directory) os.makedirs(config_directory)
@ -84,3 +79,16 @@ with open(os.path.join(config_directory, "achievements.json"), 'w') as f:
with open(os.path.join(config_directory, "stats.txt"), 'w') as f: with open(os.path.join(config_directory, "stats.txt"), 'w') as f:
f.write(output_stats) f.write(output_stats)
return (output_ach, output_stats)
if __name__ == '__main__':
if len(sys.argv) < 2:
print("format: {} UserGameStatsSchema_480.bin".format(sys.argv[0]))
exit(0)
with open(sys.argv[1], 'rb') as f:
schema = f.read()
generate_stats_achievements(schema, os.path.join("{}".format( "{}_output".format(sys.argv[1])), "steam_settings"))

View File

@ -168,6 +168,32 @@ enum EActivateGameOverlayToWebPageMode
// will also close. When the user closes the browser window, the overlay will automatically close. // will also close. When the user closes the browser window, the overlay will automatically close.
}; };
//-----------------------------------------------------------------------------
// Purpose: See GetProfileItemPropertyString and GetProfileItemPropertyUint
//-----------------------------------------------------------------------------
enum ECommunityProfileItemType
{
k_ECommunityProfileItemType_AnimatedAvatar = 0,
k_ECommunityProfileItemType_AvatarFrame = 1,
k_ECommunityProfileItemType_ProfileModifier = 2,
k_ECommunityProfileItemType_ProfileBackground = 3,
k_ECommunityProfileItemType_MiniProfileBackground = 4,
};
enum ECommunityProfileItemProperty
{
k_ECommunityProfileItemProperty_ImageSmall = 0, // string
k_ECommunityProfileItemProperty_ImageLarge = 1, // string
k_ECommunityProfileItemProperty_InternalName = 2, // string
k_ECommunityProfileItemProperty_Title = 3, // string
k_ECommunityProfileItemProperty_Description = 4, // string
k_ECommunityProfileItemProperty_AppID = 5, // uint32
k_ECommunityProfileItemProperty_TypeID = 6, // uint32
k_ECommunityProfileItemProperty_Class = 7, // uint32
k_ECommunityProfileItemProperty_MovieWebM = 8, // string
k_ECommunityProfileItemProperty_MovieMP4 = 9, // string
k_ECommunityProfileItemProperty_MovieWebMSmall = 10, // string
k_ECommunityProfileItemProperty_MovieMP4Small = 11, // string
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: interface to accessing information about individual users, // Purpose: interface to accessing information about individual users,
@ -433,6 +459,14 @@ public:
// Activates the game overlay to open an invite dialog that will send the provided Rich Presence connect string to selected friends // Activates the game overlay to open an invite dialog that will send the provided Rich Presence connect string to selected friends
virtual void ActivateGameOverlayInviteDialogConnectString( const char *pchConnectString ) = 0; virtual void ActivateGameOverlayInviteDialogConnectString( const char *pchConnectString ) = 0;
// Steam Community items equipped by a user on their profile
// You can register for EquippedProfileItemsChanged_t to know when a friend has changed their equipped profile items
STEAM_CALL_RESULT( EquippedProfileItems_t )
virtual SteamAPICall_t RequestEquippedProfileItems( CSteamID steamID ) = 0;
virtual bool BHasEquippedProfileItem( CSteamID steamID, ECommunityProfileItemType itemType ) = 0;
virtual const char *GetProfileItemPropertyString( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop ) = 0;
virtual uint32 GetProfileItemPropertyUint( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop ) = 0;
}; };
#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends017" #define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends017"
@ -700,6 +734,29 @@ struct OverlayBrowserProtocolNavigation_t
char rgchURI[ 1024 ]; char rgchURI[ 1024 ];
}; };
//-----------------------------------------------------------------------------
// Purpose: A user's equipped profile items have changed
//-----------------------------------------------------------------------------
struct EquippedProfileItemsChanged_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 50 };
CSteamID m_steamID;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
struct EquippedProfileItems_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 51 };
EResult m_eResult;
CSteamID m_steamID;
bool m_bHasAnimatedAvatar;
bool m_bHasAvatarFrame;
bool m_bHasProfileModifier;
bool m_bHasProfileBackground;
bool m_bHasMiniProfileBackground;
};
#pragma pack( pop ) #pragma pack( pop )

View File

@ -163,27 +163,24 @@ struct SteamNetworkingMessagesSessionFailed_t
#pragma pack(pop) #pragma pack(pop)
// Global accessors // Global accessors
// Using standalone lib // Using standalone lib
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB #ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
// Standalone lib.
static_assert( STEAMNETWORKINGMESSAGES_INTERFACE_VERSION[25] == '2', "Version mismatch" ); static_assert( STEAMNETWORKINGMESSAGES_INTERFACE_VERSION[25] == '2', "Version mismatch" );
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages *SteamNetworkingMessages_LibV2(); STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages *SteamNetworkingMessages_LibV2();
inline ISteamNetworkingMessages *SteamNetworkingMessages_Lib() { return SteamNetworkingMessages_LibV2(); } inline ISteamNetworkingMessages *SteamNetworkingMessages_Lib() { return SteamNetworkingMessages_LibV2(); }
// If running in context of steam, we also define a gameserver instance. // If running in context of steam, we also define a gameserver instance.
#ifdef STEAMNETWORKINGSOCKETS_STEAM
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages *SteamGameServerNetworkingMessages_LibV2(); STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages *SteamGameServerNetworkingMessages_LibV2();
inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages_Lib() { return SteamGameServerNetworkingMessages_LibV2(); } inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages_Lib() { return SteamGameServerNetworkingMessages_LibV2(); }
#endif
#ifndef STEAMNETWORKINGSOCKETS_STEAMAPI #ifndef STEAMNETWORKINGSOCKETS_STEAMAPI
inline ISteamNetworkingMessages *SteamNetworkingMessages() { return SteamNetworkingMessages_LibV2(); } inline ISteamNetworkingMessages *SteamNetworkingMessages() { return SteamNetworkingMessages_LibV2(); }
#ifdef STEAMNETWORKINGSOCKETS_STEAM
inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages() { return SteamGameServerNetworkingMessages_LibV2(); } inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages() { return SteamGameServerNetworkingMessages_LibV2(); }
#endif #endif
#endif #endif
#endif
// Using Steamworks SDK // Using Steamworks SDK
#ifdef STEAMNETWORKINGSOCKETS_STEAMAPI #ifdef STEAMNETWORKINGSOCKETS_STEAMAPI

View File

@ -923,32 +923,25 @@ protected:
#define STEAMNETWORKINGSOCKETS_INTERFACE_VERSION "SteamNetworkingSockets012" #define STEAMNETWORKINGSOCKETS_INTERFACE_VERSION "SteamNetworkingSockets012"
// Global accessors // Global accessors
// Using standalone lib // Using standalone lib
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB #ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
// Standalone lib.
static_assert( STEAMNETWORKINGSOCKETS_INTERFACE_VERSION[24] == '2', "Version mismatch" ); static_assert( STEAMNETWORKINGSOCKETS_INTERFACE_VERSION[24] == '2', "Version mismatch" );
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamNetworkingSockets_LibV12(); STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamNetworkingSockets_LibV12();
inline ISteamNetworkingSockets *SteamNetworkingSockets_Lib() { return SteamNetworkingSockets_LibV12(); } inline ISteamNetworkingSockets *SteamNetworkingSockets_Lib() { return SteamNetworkingSockets_LibV12(); }
// If running in context of steam, we also define a gameserver instance.
#ifdef STEAMNETWORKINGSOCKETS_STEAM
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamGameServerNetworkingSockets_LibV12(); STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamGameServerNetworkingSockets_LibV12();
inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets_Lib() { return SteamGameServerNetworkingSockets_LibV12(); } inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets_Lib() { return SteamGameServerNetworkingSockets_LibV12(); }
#endif
#ifndef STEAMNETWORKINGSOCKETS_STEAMAPI #ifndef STEAMNETWORKINGSOCKETS_STEAMAPI
inline ISteamNetworkingSockets *SteamNetworkingSockets() { return SteamNetworkingSockets_LibV12(); } inline ISteamNetworkingSockets *SteamNetworkingSockets() { return SteamNetworkingSockets_LibV12(); }
#ifdef STEAMNETWORKINGSOCKETS_STEAM
inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets() { return SteamGameServerNetworkingSockets_LibV12(); } inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets() { return SteamGameServerNetworkingSockets_LibV12(); }
#endif #endif
#endif #endif
#endif
// Using Steamworks SDK // Using Steamworks SDK
#ifdef STEAMNETWORKINGSOCKETS_STEAMAPI #ifdef STEAMNETWORKINGSOCKETS_STEAMAPI
// Steamworks SDK
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamNetworkingSockets *, SteamNetworkingSockets_SteamAPI, STEAMNETWORKINGSOCKETS_INTERFACE_VERSION ); STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamNetworkingSockets *, SteamNetworkingSockets_SteamAPI, STEAMNETWORKINGSOCKETS_INTERFACE_VERSION );
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamNetworkingSockets *, SteamGameServerNetworkingSockets_SteamAPI, STEAMNETWORKINGSOCKETS_INTERFACE_VERSION ); STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamNetworkingSockets *, SteamGameServerNetworkingSockets_SteamAPI, STEAMNETWORKINGSOCKETS_INTERFACE_VERSION );

View File

@ -45,8 +45,8 @@ enum EFloatingGamepadTextInputMode
{ {
k_EFloatingGamepadTextInputModeModeSingleLine = 0, // Enter dismisses the keyboard k_EFloatingGamepadTextInputModeModeSingleLine = 0, // Enter dismisses the keyboard
k_EFloatingGamepadTextInputModeModeMultipleLines = 1, // User needs to explictly close the keyboard k_EFloatingGamepadTextInputModeModeMultipleLines = 1, // User needs to explictly close the keyboard
k_EFloatingGamepadTextInputModeModeEmail = 2, k_EFloatingGamepadTextInputModeModeEmail = 2, // Keyboard layout is email, enter dismisses the keyboard
k_EFloatingGamepadTextInputModeModeNumeric = 3, k_EFloatingGamepadTextInputModeModeNumeric = 3, // Keyboard layout is numeric, enter dismisses the keyboard
}; };

View File

@ -171,6 +171,10 @@ STEAMAPI_API int SteamAPI_ISteamFriends_GetNumChatsWithUnreadPriorityMessages( I
STEAMAPI_API void SteamAPI_ISteamFriends_ActivateGameOverlayRemotePlayTogetherInviteDialog( ISteamFriends* self, uint64_steamid steamIDLobby ); STEAMAPI_API void SteamAPI_ISteamFriends_ActivateGameOverlayRemotePlayTogetherInviteDialog( ISteamFriends* self, uint64_steamid steamIDLobby );
STEAMAPI_API steam_bool SteamAPI_ISteamFriends_RegisterProtocolInOverlayBrowser( ISteamFriends* self, const char * pchProtocol ); STEAMAPI_API steam_bool SteamAPI_ISteamFriends_RegisterProtocolInOverlayBrowser( ISteamFriends* self, const char * pchProtocol );
STEAMAPI_API void SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialogConnectString( ISteamFriends* self, const char * pchConnectString ); STEAMAPI_API void SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialogConnectString( ISteamFriends* self, const char * pchConnectString );
STEAMAPI_API SteamAPICall_t SteamAPI_ISteamFriends_RequestEquippedProfileItems( ISteamFriends* self, uint64_steamid steamID );
STEAMAPI_API bool SteamAPI_ISteamFriends_BHasEquippedProfileItem( ISteamFriends* self, uint64_steamid steamID, ECommunityProfileItemType itemType );
STEAMAPI_API const char * SteamAPI_ISteamFriends_GetProfileItemPropertyString( ISteamFriends* self, uint64_steamid steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop );
STEAMAPI_API uint32 SteamAPI_ISteamFriends_GetProfileItemPropertyUint( ISteamFriends* self, uint64_steamid steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop );
// ISteamUtils // ISteamUtils
STEAMAPI_API ISteamUtils *SteamAPI_SteamUtils_v010(); STEAMAPI_API ISteamUtils *SteamAPI_SteamUtils_v010();

View File

@ -149,6 +149,9 @@ enum EResult
k_EResultInvalidSignature = 121, // signature check did not match k_EResultInvalidSignature = 121, // signature check did not match
k_EResultParseFailure = 122, // Failed to parse input k_EResultParseFailure = 122, // Failed to parse input
k_EResultNoVerifiedPhone = 123, // account does not have a verified phone number k_EResultNoVerifiedPhone = 123, // account does not have a verified phone number
k_EResultInsufficientBattery = 124, // user device doesn't have enough battery charge currently to complete the action
k_EResultChargerRequired = 125, // The operation requires a charger to be plugged in, which wasn't present
k_EResultCachedCredentialInvalid = 126, // Cached credential was invalid - user must reauthenticate
}; };
// Error codes for use with the voice functions // Error codes for use with the voice functions
@ -1137,6 +1140,41 @@ inline bool CSteamID::IsValid() const
return true; return true;
} }
#if defined( INCLUDED_STEAM2_USERID_STRUCTS )
//-----------------------------------------------------------------------------
// Purpose: Initializes a steam ID from a Steam2 ID structure
// Input: pTSteamGlobalUserID - Steam2 ID to convert
// eUniverse - universe this ID belongs to
//-----------------------------------------------------------------------------
inline CSteamID SteamIDFromSteam2UserID( TSteamGlobalUserID *pTSteamGlobalUserID, EUniverse eUniverse )
{
uint32 unAccountID = pTSteamGlobalUserID->m_SteamLocalUserID.Split.Low32bits * 2 +
pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits;
return CSteamID( unAccountID, k_unSteamUserDefaultInstance, eUniverse, k_EAccountTypeIndividual );
}
bool SteamIDFromSteam2String( const char *pchSteam2ID, EUniverse eUniverse, CSteamID *pSteamIDOut );
//-----------------------------------------------------------------------------
// Purpose: Fills out a Steam2 ID structure
// Input: pTSteamGlobalUserID - Steam2 ID to write to
//-----------------------------------------------------------------------------
inline TSteamGlobalUserID SteamIDToSteam2UserID( CSteamID steamID )
{
TSteamGlobalUserID steamGlobalUserID;
steamGlobalUserID.m_SteamInstanceID = 0;
steamGlobalUserID.m_SteamLocalUserID.Split.High32bits = steamID.GetAccountID() % 2;
steamGlobalUserID.m_SteamLocalUserID.Split.Low32bits = steamID.GetAccountID() / 2;
return steamGlobalUserID;
}
#endif
// generic invalid CSteamID // generic invalid CSteamID
#define k_steamIDNil CSteamID() #define k_steamIDNil CSteamID()

View File

@ -15,13 +15,11 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// SteamNetworkingSockets config. // SteamNetworkingSockets config.
//#define STEAMNETWORKINGSOCKETS_STANDALONELIB // Comment this in to support compiling/linking with the standalone library / gamenetworkingsockets opensource #if !defined(STEAMNETWORKINGSOCKETS_STANDALONELIB) && !defined(STEAMNETWORKINGSOCKETS_STEAMAPI)
#define STEAMNETWORKINGSOCKETS_STEAMAPI // Compiling/link with steam_api.h and Steamworks SDK #define STEAMNETWORKINGSOCKETS_STEAMAPI
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#if !defined( STEAMNETWORKINGSOCKETS_OPENSOURCE ) && !defined( STEAMNETWORKINGSOCKETS_STREAMINGCLIENT )
#define STEAMNETWORKINGSOCKETS_STEAM
#endif
#ifdef NN_NINTENDO_SDK // We always static link on Nintendo #ifdef NN_NINTENDO_SDK // We always static link on Nintendo
#define STEAMNETWORKINGSOCKETS_STATIC_LINK #define STEAMNETWORKINGSOCKETS_STATIC_LINK
#endif #endif
@ -143,6 +141,12 @@ enum ESteamNetworkingIdentityType
// Basic platform-specific identifiers. // Basic platform-specific identifiers.
// //
k_ESteamNetworkingIdentityType_SteamID = 16, // 64-bit CSteamID k_ESteamNetworkingIdentityType_SteamID = 16, // 64-bit CSteamID
k_ESteamNetworkingIdentityType_XboxPairwiseID = 17, // Publisher-specific user identity, as string
k_ESteamNetworkingIdentityType_SonyPSN = 18, // 64-bit ID
k_ESteamNetworkingIdentityType_GoogleStadia = 19, // 64-bit ID
//k_ESteamNetworkingIdentityType_NintendoNetworkServiceAccount,
//k_ESteamNetworkingIdentityType_EpicGameStore
//k_ESteamNetworkingIdentityType_WeGame
// //
// Special identifiers. // Special identifiers.
@ -271,6 +275,15 @@ struct SteamNetworkingIdentity
void SetSteamID64( uint64 steamID ); // Takes SteamID as raw 64-bit number void SetSteamID64( uint64 steamID ); // Takes SteamID as raw 64-bit number
uint64 GetSteamID64() const; // Returns 0 if identity is not SteamID uint64 GetSteamID64() const; // Returns 0 if identity is not SteamID
bool SetXboxPairwiseID( const char *pszString ); // Returns false if invalid length
const char *GetXboxPairwiseID() const; // Returns nullptr if not Xbox ID
void SetPSNID( uint64 id );
uint64 GetPSNID() const; // Returns 0 if not PSN
void SetStadiaID( uint64 id );
uint64 GetStadiaID() const; // Returns 0 if not Stadia
void SetIPAddr( const SteamNetworkingIPAddr &addr ); // Set to specified IP:port void SetIPAddr( const SteamNetworkingIPAddr &addr ); // Set to specified IP:port
const SteamNetworkingIPAddr *GetIPAddr() const; // returns null if we are not an IP address. const SteamNetworkingIPAddr *GetIPAddr() const; // returns null if we are not an IP address.
void SetIPv4Addr( uint32 nIPv4, uint16 nPort ); // Set to specified IPv4:port void SetIPv4Addr( uint32 nIPv4, uint16 nPort ); // Set to specified IPv4:port
@ -312,6 +325,7 @@ struct SteamNetworkingIdentity
enum { enum {
k_cchMaxString = 128, // Max length of the buffer needed to hold any identity, formatted in string format by ToString k_cchMaxString = 128, // Max length of the buffer needed to hold any identity, formatted in string format by ToString
k_cchMaxGenericString = 32, // Max length of the string for generic string identities. Including terminating '\0' k_cchMaxGenericString = 32, // Max length of the string for generic string identities. Including terminating '\0'
k_cchMaxXboxPairwiseID = 33, // Including terminating '\0'
k_cbMaxGenericBytes = 32, k_cbMaxGenericBytes = 32,
}; };
@ -324,7 +338,10 @@ struct SteamNetworkingIdentity
int m_cbSize; int m_cbSize;
union { union {
uint64 m_steamID64; uint64 m_steamID64;
uint64 m_PSNID;
uint64 m_stadiaID;
char m_szGenericString[ k_cchMaxGenericString ]; char m_szGenericString[ k_cchMaxGenericString ];
char m_szXboxPairwiseID[ k_cchMaxXboxPairwiseID ];
uint8 m_genericBytes[ k_cbMaxGenericBytes ]; uint8 m_genericBytes[ k_cbMaxGenericBytes ];
char m_szUnknownRawString[ k_cchMaxString ]; char m_szUnknownRawString[ k_cchMaxString ];
SteamNetworkingIPAddr m_ip; SteamNetworkingIPAddr m_ip;
@ -1481,7 +1498,11 @@ enum ESteamNetworkingConfigValue
/// route ping time and is then adjusted.) /// route ping time and is then adjusted.)
k_ESteamNetworkingConfig_P2P_Transport_ICE_Penalty = 105, k_ESteamNetworkingConfig_P2P_Transport_ICE_Penalty = 105,
k_ESteamNetworkingConfig_P2P_Transport_SDR_Penalty = 106, k_ESteamNetworkingConfig_P2P_Transport_SDR_Penalty = 106,
k_ESteamNetworkingConfig_P2P_TURN_ServerList = 107,
k_ESteamNetworkingConfig_P2P_TURN_UserList = 108,
k_ESteamNetworkingConfig_P2P_TURN_PassList = 109,
//k_ESteamNetworkingConfig_P2P_Transport_LANBeacon_Penalty = 107, //k_ESteamNetworkingConfig_P2P_Transport_LANBeacon_Penalty = 107,
k_ESteamNetworkingConfig_P2P_Transport_ICE_Implementation = 110,
// //
// Settings for SDR relayed connections // Settings for SDR relayed connections
@ -1746,8 +1767,18 @@ inline void SteamNetworkingIdentity::SetSteamID( CSteamID steamID ) { SetSteamID
inline CSteamID SteamNetworkingIdentity::GetSteamID() const { return CSteamID( GetSteamID64() ); } inline CSteamID SteamNetworkingIdentity::GetSteamID() const { return CSteamID( GetSteamID64() ); }
inline void SteamNetworkingIdentity::SetSteamID64( uint64 steamID ) { m_eType = k_ESteamNetworkingIdentityType_SteamID; m_cbSize = sizeof( m_steamID64 ); m_steamID64 = steamID; } inline void SteamNetworkingIdentity::SetSteamID64( uint64 steamID ) { m_eType = k_ESteamNetworkingIdentityType_SteamID; m_cbSize = sizeof( m_steamID64 ); m_steamID64 = steamID; }
inline uint64 SteamNetworkingIdentity::GetSteamID64() const { return m_eType == k_ESteamNetworkingIdentityType_SteamID ? m_steamID64 : 0; } inline uint64 SteamNetworkingIdentity::GetSteamID64() const { return m_eType == k_ESteamNetworkingIdentityType_SteamID ? m_steamID64 : 0; }
inline bool SteamNetworkingIdentity::SetXboxPairwiseID( const char *pszString ) { size_t l = strlen( pszString ); if ( l < 1 || l >= sizeof(m_szXboxPairwiseID) ) return false;
m_eType = k_ESteamNetworkingIdentityType_XboxPairwiseID; m_cbSize = int(l+1); memcpy( m_szXboxPairwiseID, pszString, m_cbSize ); return true; }
inline const char *SteamNetworkingIdentity::GetXboxPairwiseID() const { return m_eType == k_ESteamNetworkingIdentityType_XboxPairwiseID ? m_szXboxPairwiseID : NULL; }
inline void SteamNetworkingIdentity::SetPSNID( uint64 id ) { m_eType = k_ESteamNetworkingIdentityType_SonyPSN; m_cbSize = sizeof( m_PSNID ); m_PSNID = id; }
inline uint64 SteamNetworkingIdentity::GetPSNID() const { return m_eType == k_ESteamNetworkingIdentityType_SonyPSN ? m_PSNID : 0; }
inline void SteamNetworkingIdentity::SetStadiaID( uint64 id ) { m_eType = k_ESteamNetworkingIdentityType_GoogleStadia; m_cbSize = sizeof( m_stadiaID ); m_stadiaID = id; }
inline uint64 SteamNetworkingIdentity::GetStadiaID() const { return m_eType == k_ESteamNetworkingIdentityType_GoogleStadia ? m_stadiaID : 0; }
inline void SteamNetworkingIdentity::SetIPAddr( const SteamNetworkingIPAddr &addr ) { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip = addr; } inline void SteamNetworkingIdentity::SetIPAddr( const SteamNetworkingIPAddr &addr ) { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip = addr; }
inline const SteamNetworkingIPAddr *SteamNetworkingIdentity::GetIPAddr() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress ? &m_ip : NULL; } inline const SteamNetworkingIPAddr *SteamNetworkingIdentity::GetIPAddr() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress ? &m_ip : NULL; }
inline void SteamNetworkingIdentity::SetIPv4Addr( uint32 nIPv4, uint16 nPort ) { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip.SetIPv4( nIPv4, nPort ); }
inline uint32 SteamNetworkingIdentity::GetIPv4() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress ? m_ip.GetIPv4() : 0; }
inline ESteamNetworkingFakeIPType SteamNetworkingIdentity::GetFakeIPType() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress ? m_ip.GetFakeIPType() : k_ESteamNetworkingFakeIPType_Invalid; }
inline void SteamNetworkingIdentity::SetLocalHost() { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip.SetIPv6LocalHost(); } inline void SteamNetworkingIdentity::SetLocalHost() { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip.SetIPv6LocalHost(); }
inline bool SteamNetworkingIdentity::IsLocalHost() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress && m_ip.IsLocalHost(); } inline bool SteamNetworkingIdentity::IsLocalHost() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress && m_ip.IsLocalHost(); }
inline bool SteamNetworkingIdentity::SetGenericString( const char *pszString ) { size_t l = strlen( pszString ); if ( l >= sizeof(m_szGenericString) ) return false; inline bool SteamNetworkingIdentity::SetGenericString( const char *pszString ) { size_t l = strlen( pszString ); if ( l >= sizeof(m_szGenericString) ) return false;