mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-30 14:25:36 +08:00
remove functions names prefixes in debug logs
This commit is contained in:
parent
28cdb2c74e
commit
8576d149d3
@ -26,7 +26,7 @@ static uint32_t get_ticket_count() {
|
|||||||
|
|
||||||
static void steam_auth_manager_ticket_callback(void *object, Common_Message *msg)
|
static void steam_auth_manager_ticket_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("steam_auth_manager_ticket_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Auth_Manager *auth_manager = (Auth_Manager *)object;
|
Auth_Manager *auth_manager = (Auth_Manager *)object;
|
||||||
auth_manager->Callback(msg);
|
auth_manager->Callback(msg);
|
||||||
@ -301,7 +301,7 @@ void Auth_Manager::Callback(Common_Message *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg->low_level().type() == Low_Level::DISCONNECT) {
|
if (msg->low_level().type() == Low_Level::DISCONNECT) {
|
||||||
PRINT_DEBUG("TICKET DISCONNECT\n");
|
PRINT_DEBUG("TICKET DISCONNECT");
|
||||||
auto t = std::begin(inbound);
|
auto t = std::begin(inbound);
|
||||||
while (t != std::end(inbound)) {
|
while (t != std::end(inbound)) {
|
||||||
if (t->id.ConvertToUint64() == msg->source_id()) {
|
if (t->id.ConvertToUint64() == msg->source_id()) {
|
||||||
@ -316,12 +316,12 @@ void Auth_Manager::Callback(Common_Message *msg)
|
|||||||
|
|
||||||
if (msg->has_auth_ticket()) {
|
if (msg->has_auth_ticket()) {
|
||||||
if (msg->auth_ticket().type() == Auth_Ticket::CANCEL) {
|
if (msg->auth_ticket().type() == Auth_Ticket::CANCEL) {
|
||||||
PRINT_DEBUG("TICKET CANCEL " "%" PRIu64 "\n", msg->source_id());
|
PRINT_DEBUG("TICKET CANCEL " "%" PRIu64, msg->source_id());
|
||||||
uint32 number = msg->auth_ticket().number();
|
uint32 number = msg->auth_ticket().number();
|
||||||
auto t = std::begin(inbound);
|
auto t = std::begin(inbound);
|
||||||
while (t != std::end(inbound)) {
|
while (t != std::end(inbound)) {
|
||||||
if (t->id.ConvertToUint64() == msg->source_id() && t->number == number) {
|
if (t->id.ConvertToUint64() == msg->source_id() && t->number == number) {
|
||||||
PRINT_DEBUG("TICKET CANCELED\n");
|
PRINT_DEBUG("TICKET CANCELED");
|
||||||
launch_callback(t->id, k_EAuthSessionResponseAuthTicketCanceled);
|
launch_callback(t->id, k_EAuthSessionResponseAuthTicketCanceled);
|
||||||
t = inbound.erase(t);
|
t = inbound.erase(t);
|
||||||
} else {
|
} else {
|
||||||
|
45
dll/base.cpp
45
dll/base.cpp
@ -23,7 +23,7 @@ void randombytes(char *buf, size_t size)
|
|||||||
{
|
{
|
||||||
// NT_SUCCESS is: return value >= 0, including Ntdef.h causes so many errors
|
// NT_SUCCESS is: return value >= 0, including Ntdef.h causes so many errors
|
||||||
while (BCryptGenRandom(NULL, (PUCHAR) buf, (ULONG) size, BCRYPT_USE_SYSTEM_PREFERRED_RNG) < 0) {
|
while (BCryptGenRandom(NULL, (PUCHAR) buf, (ULONG) size, BCRYPT_USE_SYSTEM_PREFERRED_RNG) < 0) {
|
||||||
PRINT_DEBUG("BCryptGenRandom ERROR\n");
|
PRINT_DEBUG("ERROR");
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,13 +313,13 @@ void set_whitelist_ips(uint32_t *from, uint32_t *to, unsigned num_ips)
|
|||||||
whitelist_ips.clear();
|
whitelist_ips.clear();
|
||||||
for (unsigned i = 0; i < num_ips; ++i) {
|
for (unsigned i = 0; i < num_ips; ++i) {
|
||||||
struct ips_test ip_a;
|
struct ips_test ip_a;
|
||||||
PRINT_DEBUG("from: %hhu.%hhu.%hhu.%hhu\n", ((unsigned char *)&from[i])[0], ((unsigned char *)&from[i])[1], ((unsigned char *)&from[i])[2], ((unsigned char *)&from[i])[3]);
|
PRINT_DEBUG("from: %hhu.%hhu.%hhu.%hhu", ((unsigned char *)&from[i])[0], ((unsigned char *)&from[i])[1], ((unsigned char *)&from[i])[2], ((unsigned char *)&from[i])[3]);
|
||||||
PRINT_DEBUG("to: %hhu.%hhu.%hhu.%hhu\n", ((unsigned char *)&to[i])[0], ((unsigned char *)&to[i])[1], ((unsigned char *)&to[i])[2], ((unsigned char *)&to[i])[3]);
|
PRINT_DEBUG("to: %hhu.%hhu.%hhu.%hhu", ((unsigned char *)&to[i])[0], ((unsigned char *)&to[i])[1], ((unsigned char *)&to[i])[2], ((unsigned char *)&to[i])[3]);
|
||||||
ip_a.ip_from = ntohl(from[i]);
|
ip_a.ip_from = ntohl(from[i]);
|
||||||
ip_a.ip_to = ntohl(to[i]);
|
ip_a.ip_to = ntohl(to[i]);
|
||||||
if (ip_a.ip_to < ip_a.ip_from) continue;
|
if (ip_a.ip_to < ip_a.ip_from) continue;
|
||||||
if ((ip_a.ip_to - ip_a.ip_from) > (1 << 25)) continue;
|
if ((ip_a.ip_to - ip_a.ip_from) > (1 << 25)) continue;
|
||||||
PRINT_DEBUG("added\n");
|
PRINT_DEBUG("added ip to whitelist");
|
||||||
whitelist_ips.push_back(ip_a);
|
whitelist_ips.push_back(ip_a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ static bool is_whitelist_ip(unsigned char *ip)
|
|||||||
|
|
||||||
for (auto &i : whitelist_ips) {
|
for (auto &i : whitelist_ips) {
|
||||||
if (i.ip_from <= ip_temp && ip_temp <= i.ip_to) {
|
if (i.ip_from <= ip_temp && ip_temp <= i.ip_to) {
|
||||||
PRINT_DEBUG("WHITELISTED IP %hhu.%hhu.%hhu.%hhu\n", ip[0], ip[1], ip[2], ip[3]);
|
PRINT_DEBUG("IP IS WHITELISTED %hhu.%hhu.%hhu.%hhu", ip[0], ip[1], ip[2], ip[3]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -342,7 +342,7 @@ static bool is_whitelist_ip(unsigned char *ip)
|
|||||||
|
|
||||||
static bool is_lan_ipv4(unsigned char *ip)
|
static bool is_lan_ipv4(unsigned char *ip)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("CHECK LAN IP %hhu.%hhu.%hhu.%hhu\n", ip[0], ip[1], ip[2], ip[3]);
|
PRINT_DEBUG("CHECK LAN IP %hhu.%hhu.%hhu.%hhu", ip[0], ip[1], ip[2], ip[3]);
|
||||||
if (is_whitelist_ip(ip)) return true;
|
if (is_whitelist_ip(ip)) return true;
|
||||||
if (ip[0] == 127) return true;
|
if (ip[0] == 127) return true;
|
||||||
if (ip[0] == 10) return true;
|
if (ip[0] == 10) return true;
|
||||||
@ -371,7 +371,7 @@ static bool is_lan_ip(const sockaddr *addr, int namelen)
|
|||||||
unsigned char ip[16];
|
unsigned char ip[16];
|
||||||
unsigned char zeroes[16] = {};
|
unsigned char zeroes[16] = {};
|
||||||
memcpy(ip, &addr_in6->sin6_addr, sizeof(ip));
|
memcpy(ip, &addr_in6->sin6_addr, sizeof(ip));
|
||||||
PRINT_DEBUG("CHECK LAN IP6 %hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu\n", ip[0], ip[1], ip[2], ip[3], ip[4], ip[5], ip[6], ip[7], ip[8], ip[9], ip[10], ip[11], ip[12], ip[13], ip[14], ip[15]);
|
PRINT_DEBUG("CHECK LAN IP6 %hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu", ip[0], ip[1], ip[2], ip[3], ip[4], ip[5], ip[6], ip[7], ip[8], ip[9], ip[10], ip[11], ip[12], ip[13], ip[14], ip[15]);
|
||||||
if (((ip[0] == 0xFF) && (ip[1] < 3) && (ip[15] == 1)) ||
|
if (((ip[0] == 0xFF) && (ip[1] < 3) && (ip[15] == 1)) ||
|
||||||
((ip[0] == 0xFE) && ((ip[1] & 0xC0) == 0x80))) return true;
|
((ip[0] == 0xFE) && ((ip[1] & 0xC0) == 0x80))) return true;
|
||||||
if (memcmp(zeroes, ip, sizeof(ip)) == 0) return true;
|
if (memcmp(zeroes, ip, sizeof(ip)) == 0) return true;
|
||||||
@ -388,7 +388,7 @@ static bool is_lan_ip(const sockaddr *addr, int namelen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("NOT LAN IP\n");
|
PRINT_DEBUG("NOT LAN IP");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,8 +396,9 @@ int ( WINAPI *Real_SendTo )( SOCKET s, const char *buf, int len, int flags, cons
|
|||||||
int ( WINAPI *Real_Connect )( SOCKET s, const sockaddr *addr, int namelen ) = connect;
|
int ( WINAPI *Real_Connect )( SOCKET s, const sockaddr *addr, int namelen ) = connect;
|
||||||
int ( WINAPI *Real_WSAConnect )( SOCKET s, const sockaddr *addr, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS) = WSAConnect;
|
int ( WINAPI *Real_WSAConnect )( SOCKET s, const sockaddr *addr, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS) = WSAConnect;
|
||||||
|
|
||||||
static int WINAPI Mine_SendTo( SOCKET s, const char *buf, int len, int flags, const sockaddr *to, int tolen) {
|
static int WINAPI Mine_SendTo( SOCKET s, const char *buf, int len, int flags, const sockaddr *to, int tolen)
|
||||||
PRINT_DEBUG("Mine_SendTo\n");
|
{
|
||||||
|
PRINT_DEBUG_ENTRY();
|
||||||
if (is_lan_ip(to, tolen)) {
|
if (is_lan_ip(to, tolen)) {
|
||||||
return Real_SendTo( s, buf, len, flags, to, tolen );
|
return Real_SendTo( s, buf, len, flags, to, tolen );
|
||||||
} else {
|
} else {
|
||||||
@ -407,7 +408,7 @@ static int WINAPI Mine_SendTo( SOCKET s, const char *buf, int len, int flags, co
|
|||||||
|
|
||||||
static int WINAPI Mine_Connect( SOCKET s, const sockaddr *addr, int namelen )
|
static int WINAPI Mine_Connect( SOCKET s, const sockaddr *addr, int namelen )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Mine_Connect\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (is_lan_ip(addr, namelen)) {
|
if (is_lan_ip(addr, namelen)) {
|
||||||
return Real_Connect(s, addr, namelen);
|
return Real_Connect(s, addr, namelen);
|
||||||
} else {
|
} else {
|
||||||
@ -418,7 +419,7 @@ static int WINAPI Mine_Connect( SOCKET s, const sockaddr *addr, int namelen )
|
|||||||
|
|
||||||
static int WINAPI Mine_WSAConnect( SOCKET s, const sockaddr *addr, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS)
|
static int WINAPI Mine_WSAConnect( SOCKET s, const sockaddr *addr, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Mine_WSAConnect\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (is_lan_ip(addr, namelen)) {
|
if (is_lan_ip(addr, namelen)) {
|
||||||
return Real_WSAConnect(s, addr, namelen, lpCallerData, lpCalleeData, lpSQOS, lpGQOS);
|
return Real_WSAConnect(s, addr, namelen, lpCallerData, lpCalleeData, lpSQOS, lpGQOS);
|
||||||
} else {
|
} else {
|
||||||
@ -441,7 +442,7 @@ inline bool file_exists (const std::string& name) {
|
|||||||
HMODULE (WINAPI *Real_GetModuleHandleA)(LPCSTR lpModuleName) = GetModuleHandleA;
|
HMODULE (WINAPI *Real_GetModuleHandleA)(LPCSTR lpModuleName) = GetModuleHandleA;
|
||||||
HMODULE WINAPI Mine_GetModuleHandleA(LPCSTR lpModuleName)
|
HMODULE WINAPI Mine_GetModuleHandleA(LPCSTR lpModuleName)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Mine_GetModuleHandleA %s\n", lpModuleName);
|
PRINT_DEBUG("%s", lpModuleName);
|
||||||
if (!lpModuleName) return Real_GetModuleHandleA(lpModuleName);
|
if (!lpModuleName) return Real_GetModuleHandleA(lpModuleName);
|
||||||
std::string in(lpModuleName);
|
std::string in(lpModuleName);
|
||||||
if (in == std::string(DLL_NAME)) {
|
if (in == std::string(DLL_NAME)) {
|
||||||
@ -474,12 +475,12 @@ static void load_dll()
|
|||||||
path += "crack";
|
path += "crack";
|
||||||
//path += PATH_SEPARATOR;
|
//path += PATH_SEPARATOR;
|
||||||
path += DLL_NAME;
|
path += DLL_NAME;
|
||||||
PRINT_DEBUG("Crack file %s\n", path.c_str());
|
PRINT_DEBUG("Crack file %s", path.c_str());
|
||||||
if (file_exists(path)) {
|
if (file_exists(path)) {
|
||||||
redirect_crackdll();
|
redirect_crackdll();
|
||||||
crack_dll_handle = LoadLibraryW(utf8_decode(path).c_str());
|
crack_dll_handle = LoadLibraryW(utf8_decode(path).c_str());
|
||||||
unredirect_crackdll();
|
unredirect_crackdll();
|
||||||
PRINT_DEBUG("Loaded crack file\n");
|
PRINT_DEBUG("Loaded crack file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,9 +501,9 @@ static void load_dlls()
|
|||||||
if (std::toupper(full_path[length - 3]) != 'D') continue;
|
if (std::toupper(full_path[length - 3]) != 'D') continue;
|
||||||
if (full_path[length - 4] != '.') continue;
|
if (full_path[length - 4] != '.') continue;
|
||||||
|
|
||||||
PRINT_DEBUG("Trying to load %s\n", full_path.c_str());
|
PRINT_DEBUG("Trying to load %s", full_path.c_str());
|
||||||
if (LoadLibraryW(utf8_decode(full_path).c_str())) {
|
if (LoadLibraryW(utf8_decode(full_path).c_str())) {
|
||||||
PRINT_DEBUG("LOADED %s\n", full_path.c_str());
|
PRINT_DEBUG("LOADED %s", full_path.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -514,7 +515,7 @@ bool crack_SteamAPI_RestartAppIfNecessary(uint32 unOwnAppID)
|
|||||||
if (crack_dll_handle) {
|
if (crack_dll_handle) {
|
||||||
bool (__stdcall* restart_app)(uint32) = (bool (__stdcall *)(uint32))GetProcAddress(crack_dll_handle, "SteamAPI_RestartAppIfNecessary");
|
bool (__stdcall* restart_app)(uint32) = (bool (__stdcall *)(uint32))GetProcAddress(crack_dll_handle, "SteamAPI_RestartAppIfNecessary");
|
||||||
if (restart_app) {
|
if (restart_app) {
|
||||||
PRINT_DEBUG("Call crack SteamAPI_RestartAppIfNecessary\n");
|
PRINT_DEBUG("Calling crack SteamAPI_RestartAppIfNecessary");
|
||||||
redirect_crackdll();
|
redirect_crackdll();
|
||||||
bool ret = restart_app(unOwnAppID);
|
bool ret = restart_app(unOwnAppID);
|
||||||
unredirect_crackdll();
|
unredirect_crackdll();
|
||||||
@ -531,7 +532,7 @@ bool crack_SteamAPI_Init()
|
|||||||
if (crack_dll_handle) {
|
if (crack_dll_handle) {
|
||||||
bool (__stdcall* init_app)() = (bool (__stdcall *)())GetProcAddress(crack_dll_handle, "SteamAPI_Init");
|
bool (__stdcall* init_app)() = (bool (__stdcall *)())GetProcAddress(crack_dll_handle, "SteamAPI_Init");
|
||||||
if (init_app) {
|
if (init_app) {
|
||||||
PRINT_DEBUG("Call crack SteamAPI_Init\n");
|
PRINT_DEBUG("Calling crack SteamAPI_Init");
|
||||||
redirect_crackdll();
|
redirect_crackdll();
|
||||||
bool ret = init_app();
|
bool ret = init_app();
|
||||||
unredirect_crackdll();
|
unredirect_crackdll();
|
||||||
@ -555,7 +556,7 @@ HINTERNET WINAPI Mine_WinHttpConnect(
|
|||||||
IN INTERNET_PORT nServerPort,
|
IN INTERNET_PORT nServerPort,
|
||||||
IN DWORD dwReserved
|
IN DWORD dwReserved
|
||||||
) {
|
) {
|
||||||
PRINT_DEBUG("Mine_WinHttpConnect %ls %u\n", pswzServerName, nServerPort);
|
PRINT_DEBUG("%ls %u", pswzServerName, nServerPort);
|
||||||
struct sockaddr_in ip4;
|
struct sockaddr_in ip4;
|
||||||
struct sockaddr_in6 ip6;
|
struct sockaddr_in6 ip6;
|
||||||
ip4.sin_family = AF_INET;
|
ip4.sin_family = AF_INET;
|
||||||
@ -587,7 +588,7 @@ HINTERNET WINAPI Mine_WinHttpOpenRequest(
|
|||||||
IN LPCWSTR *ppwszAcceptTypes,
|
IN LPCWSTR *ppwszAcceptTypes,
|
||||||
IN DWORD dwFlags
|
IN DWORD dwFlags
|
||||||
) {
|
) {
|
||||||
PRINT_DEBUG("Mine_WinHttpOpenRequest %ls %ls %ls %ls %i\n", pwszVerb, pwszObjectName, pwszVersion, pwszReferrer, dwFlags);
|
PRINT_DEBUG("%ls %ls %ls %ls %i", pwszVerb, pwszObjectName, pwszVersion, pwszReferrer, dwFlags);
|
||||||
if (dwFlags & WINHTTP_FLAG_SECURE) {
|
if (dwFlags & WINHTTP_FLAG_SECURE) {
|
||||||
dwFlags ^= WINHTTP_FLAG_SECURE;
|
dwFlags ^= WINHTTP_FLAG_SECURE;
|
||||||
}
|
}
|
||||||
@ -602,7 +603,7 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD dwReason, LPVOID ) {
|
|||||||
switch ( dwReason ) {
|
switch ( dwReason ) {
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
if (!file_exists(get_full_program_path() + "disable_lan_only.txt") && !file_exists(get_full_program_path() + "\\steam_settings\\disable_lan_only.txt")) {
|
if (!file_exists(get_full_program_path() + "disable_lan_only.txt") && !file_exists(get_full_program_path() + "\\steam_settings\\disable_lan_only.txt")) {
|
||||||
PRINT_DEBUG("Hooking lan only functions\n");
|
PRINT_DEBUG("Hooking lan only functions");
|
||||||
DetourTransactionBegin();
|
DetourTransactionBegin();
|
||||||
DetourUpdateThread( GetCurrentThread() );
|
DetourUpdateThread( GetCurrentThread() );
|
||||||
DetourAttach( &(PVOID &)Real_SendTo, Mine_SendTo );
|
DetourAttach( &(PVOID &)Real_SendTo, Mine_SendTo );
|
||||||
|
495
dll/dll.cpp
495
dll/dll.cpp
File diff suppressed because it is too large
Load Diff
@ -337,7 +337,7 @@ public:
|
|||||||
|
|
||||||
virtual uint32 GetAppOwnershipTicketData( uint32 nAppID, void *pvBuffer, uint32 cbBufferLength, uint32 *piAppId, uint32 *piSteamId, uint32 *piSignature, uint32 *pcbSignature )
|
virtual uint32 GetAppOwnershipTicketData( uint32 nAppID, void *pvBuffer, uint32 cbBufferLength, uint32 *piAppId, uint32 *piSteamId, uint32 *piSignature, uint32 *pcbSignature )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO GetAppOwnershipTicketData: %u, %p, %u, %p, %p, %p, %p\n", nAppID, pvBuffer, cbBufferLength, piAppId, piSteamId, piSignature, pcbSignature);
|
PRINT_DEBUG("TODO %u, %p, %u, %p, %p, %p, %p", nAppID, pvBuffer, cbBufferLength, piAppId, piSteamId, piSignature, pcbSignature);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -52,7 +52,7 @@ static std::vector<uint8_t> sign_auth_data(const std::string &private_key_conten
|
|||||||
// we nedd a live object until the printf does its job, hence this special handling
|
// we nedd a live object until the printf does its job, hence this special handling
|
||||||
std::string err_msg(256, 0);
|
std::string err_msg(256, 0);
|
||||||
mbedtls_strerror(result, &err_msg[0], err_msg.size());
|
mbedtls_strerror(result, &err_msg[0], err_msg.size());
|
||||||
PRINT_DEBUG("sign_auth_data failed to hash the data via SHA1: %s\n", err_msg.c_str());
|
PRINT_DEBUG("failed to hash the data via SHA1: %s", err_msg.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return signature;
|
return signature;
|
||||||
@ -75,7 +75,7 @@ static std::vector<uint8_t> sign_auth_data(const std::string &private_key_conten
|
|||||||
// we nedd a live object until the printf does its job, hence this special handling
|
// we nedd a live object until the printf does its job, hence this special handling
|
||||||
std::string err_msg(256, 0);
|
std::string err_msg(256, 0);
|
||||||
mbedtls_strerror(result, &err_msg[0], err_msg.size());
|
mbedtls_strerror(result, &err_msg[0], err_msg.size());
|
||||||
PRINT_DEBUG("sign_auth_data failed to seed the CTR-DRBG context: %s\n", err_msg.c_str());
|
PRINT_DEBUG("failed to seed the CTR-DRBG context: %s", err_msg.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return signature;
|
return signature;
|
||||||
@ -102,7 +102,7 @@ static std::vector<uint8_t> sign_auth_data(const std::string &private_key_conten
|
|||||||
// we nedd a live object until the printf does its job, hence this special handling
|
// we nedd a live object until the printf does its job, hence this special handling
|
||||||
std::string err_msg(256, 0);
|
std::string err_msg(256, 0);
|
||||||
mbedtls_strerror(result, &err_msg[0], err_msg.size());
|
mbedtls_strerror(result, &err_msg[0], err_msg.size());
|
||||||
PRINT_DEBUG("sign_auth_data failed to parse private key: %s\n", err_msg.c_str());
|
PRINT_DEBUG("failed to parse private key: %s", err_msg.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return signature;
|
return signature;
|
||||||
@ -116,7 +116,7 @@ static std::vector<uint8_t> sign_auth_data(const std::string &private_key_conten
|
|||||||
mbedtls_ctr_drbg_free(&ctr_drbg_ctx);
|
mbedtls_ctr_drbg_free(&ctr_drbg_ctx);
|
||||||
mbedtls_entropy_free(&entropy_ctx);
|
mbedtls_entropy_free(&entropy_ctx);
|
||||||
|
|
||||||
PRINT_DEBUG("sign_auth_data parsed key is not a valid RSA private key\n");
|
PRINT_DEBUG("parsed key is not a valid RSA private key");
|
||||||
return signature;
|
return signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,11 +131,11 @@ static std::vector<uint8_t> sign_auth_data(const std::string &private_key_conten
|
|||||||
mbedtls_ctr_drbg_free(&ctr_drbg_ctx);
|
mbedtls_ctr_drbg_free(&ctr_drbg_ctx);
|
||||||
mbedtls_entropy_free(&entropy_ctx);
|
mbedtls_entropy_free(&entropy_ctx);
|
||||||
|
|
||||||
PRINT_DEBUG("sign_auth_data failed to get private key (final buffer) length\n");
|
PRINT_DEBUG("failed to get private key (final buffer) length");
|
||||||
return signature;
|
return signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("sign_auth_data computed private key (final buffer) length = %zu\n", private_key_len);
|
PRINT_DEBUG("computed private key (final buffer) length = %zu", private_key_len);
|
||||||
signature.resize(private_key_len);
|
signature.resize(private_key_len);
|
||||||
|
|
||||||
// finally sign the computed hash using RSA and PKCS#1 padding
|
// finally sign the computed hash using RSA and PKCS#1 padding
|
||||||
@ -159,14 +159,14 @@ static std::vector<uint8_t> sign_auth_data(const std::string &private_key_conten
|
|||||||
// we nedd a live object until the printf does its job, hence this special handling
|
// we nedd a live object until the printf does its job, hence this special handling
|
||||||
std::string err_msg(256, 0);
|
std::string err_msg(256, 0);
|
||||||
mbedtls_strerror(result, &err_msg[0], err_msg.size());
|
mbedtls_strerror(result, &err_msg[0], err_msg.size());
|
||||||
PRINT_DEBUG("sign_auth_data RSA signing failed: %s\n", err_msg.c_str());
|
PRINT_DEBUG("RSA signing failed: %s", err_msg.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef EMU_RELEASE_BUILD
|
#ifndef EMU_RELEASE_BUILD
|
||||||
// we nedd a live object until the printf does its job, hence this special handling
|
// we nedd a live object until the printf does its job, hence this special handling
|
||||||
auto str = common_helpers::uint8_vector_to_hex_string(signature);
|
auto str = common_helpers::uint8_vector_to_hex_string(signature);
|
||||||
PRINT_DEBUG("sign_auth_data final signature [%zu bytes]:\n %s\n", signature.size(), str.c_str());
|
PRINT_DEBUG("final signature [%zu bytes]:\n %s", signature.size(), str.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return signature;
|
return signature;
|
||||||
@ -179,7 +179,7 @@ struct DLC {
|
|||||||
|
|
||||||
std::vector<uint8_t> Serialize()
|
std::vector<uint8_t> Serialize()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("AUTH::DLC::SER AppId = %u, Licenses count = %zu\n", AppId, Licenses.size());
|
PRINT_DEBUG("AppId = %u, Licenses count = %zu", AppId, Licenses.size());
|
||||||
|
|
||||||
// we need this variable because we depend on the sizeof, must be 2 bytes
|
// we need this variable because we depend on the sizeof, must be 2 bytes
|
||||||
const uint16_t dlcs_licenses_count = (uint16_t)Licenses.size();
|
const uint16_t dlcs_licenses_count = (uint16_t)Licenses.size();
|
||||||
@ -209,7 +209,7 @@ struct DLC {
|
|||||||
|
|
||||||
#undef SER_VAR
|
#undef SER_VAR
|
||||||
|
|
||||||
PRINT_DEBUG("AUTH::DLC::SER final size = %zu\n", buffer.size());
|
PRINT_DEBUG("final size = %zu", buffer.size());
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -255,13 +255,12 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG(
|
||||||
"AUTH::AppTicketGC::SER Token:\n"
|
|
||||||
" GCToken: " "%" PRIu64 "\n"
|
" GCToken: " "%" PRIu64 "\n"
|
||||||
" user steam_id: " "%" PRIu64 "\n"
|
" user steam_id: " "%" PRIu64 "\n"
|
||||||
" ticketGenDate: %u\n"
|
" ticketGenDate: %u\n"
|
||||||
" ExternalIP: 0x%08X, InternalIP: 0x%08X\n"
|
" ExternalIP: 0x%08X, InternalIP: 0x%08X\n"
|
||||||
" TimeSinceStartup: %u, TicketGeneratedCount: %u\n"
|
" TimeSinceStartup: %u, TicketGeneratedCount: %u\n"
|
||||||
" SER size = %zu\n",
|
" SER size = %zu",
|
||||||
|
|
||||||
GCToken,
|
GCToken,
|
||||||
steam_id,
|
steam_id,
|
||||||
@ -297,7 +296,7 @@ public:
|
|||||||
#ifndef EMU_RELEASE_BUILD
|
#ifndef EMU_RELEASE_BUILD
|
||||||
// we nedd a live object until the printf does its job, hence this special handling
|
// we nedd a live object until the printf does its job, hence this special handling
|
||||||
auto str = common_helpers::uint8_vector_to_hex_string(buffer);
|
auto str = common_helpers::uint8_vector_to_hex_string(buffer);
|
||||||
PRINT_DEBUG("AUTH::AppTicketGC::SER final data [%zu bytes]:\n %s\n", buffer.size(), str.c_str());
|
PRINT_DEBUG("final data [%zu bytes]:\n %s", buffer.size(), str.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
@ -321,7 +320,6 @@ struct AppTicket {
|
|||||||
const uint64_t steam_id = id.ConvertToUint64();
|
const uint64_t steam_id = id.ConvertToUint64();
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG(
|
||||||
"AUTH::AppTicket::SER:\n"
|
|
||||||
" Version: %u\n"
|
" Version: %u\n"
|
||||||
" user steam_id: " "%" PRIu64 "\n"
|
" user steam_id: " "%" PRIu64 "\n"
|
||||||
" AppId: %u\n"
|
" AppId: %u\n"
|
||||||
@ -385,7 +383,7 @@ struct AppTicket {
|
|||||||
licenses_total_size +
|
licenses_total_size +
|
||||||
dlcs_total_size;
|
dlcs_total_size;
|
||||||
|
|
||||||
PRINT_DEBUG("AUTH::AppTicket::SER final size = %zu\n", total_size);
|
PRINT_DEBUG("final size = %zu", total_size);
|
||||||
|
|
||||||
std::vector<uint8_t> buffer;
|
std::vector<uint8_t> buffer;
|
||||||
buffer.resize(total_size);
|
buffer.resize(total_size);
|
||||||
@ -408,7 +406,7 @@ struct AppTicket {
|
|||||||
{
|
{
|
||||||
// we nedd a live object until the printf does its job, hence this special handling
|
// we nedd a live object until the printf does its job, hence this special handling
|
||||||
auto str = common_helpers::uint8_vector_to_hex_string(buffer);
|
auto str = common_helpers::uint8_vector_to_hex_string(buffer);
|
||||||
PRINT_DEBUG("AUTH::AppTicket::SER (before licenses + DLCs):\n %s\n", str.c_str());
|
PRINT_DEBUG("(before licenses + DLCs):\n %s", str.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -461,7 +459,7 @@ struct AppTicket {
|
|||||||
{
|
{
|
||||||
// we nedd a live object until the printf does its job, hence this special handling
|
// we nedd a live object until the printf does its job, hence this special handling
|
||||||
auto str = common_helpers::uint8_vector_to_hex_string(buffer);
|
auto str = common_helpers::uint8_vector_to_hex_string(buffer);
|
||||||
PRINT_DEBUG("AUTH::AppTicket::SER final data [%zu bytes]:\n %s\n", buffer.size(), str.c_str());
|
PRINT_DEBUG("final data [%zu bytes]:\n %s", buffer.size(), str.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -512,7 +510,6 @@ struct Auth_Data {
|
|||||||
const uint64_t steam_id = id.ConvertToUint64();
|
const uint64_t steam_id = id.ConvertToUint64();
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG(
|
||||||
"AUTH::Auth_Data::SER:\n"
|
|
||||||
" HasGC: %u\n"
|
" HasGC: %u\n"
|
||||||
" user steam_id: " "%" PRIu64 "\n"
|
" user steam_id: " "%" PRIu64 "\n"
|
||||||
" number: " "%" PRIu64 "\n",
|
" number: " "%" PRIu64 "\n",
|
||||||
@ -563,8 +560,7 @@ struct Auth_Data {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const size_t final_buffer_size = total_size_without_siglen + STEAM_APPTICKET_SIGLEN;
|
const size_t final_buffer_size = total_size_without_siglen + STEAM_APPTICKET_SIGLEN;
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("size without sig len = %zu, size with sig len (final size) = %zu",
|
||||||
"AUTH::Auth_Data::SER size without sig len = %zu, size with sig len (final size) = %zu\n",
|
|
||||||
total_size_without_siglen,
|
total_size_without_siglen,
|
||||||
final_buffer_size
|
final_buffer_size
|
||||||
);
|
);
|
||||||
@ -603,7 +599,7 @@ struct Auth_Data {
|
|||||||
{
|
{
|
||||||
// we nedd a live object until the printf does its job, hence this special handling
|
// we nedd a live object until the printf does its job, hence this special handling
|
||||||
auto str = common_helpers::uint8_vector_to_hex_string(buffer);
|
auto str = common_helpers::uint8_vector_to_hex_string(buffer);
|
||||||
PRINT_DEBUG("AUTH::Auth_Data::SER final data (before signature) [%zu bytes]:\n %s\n", buffer.size(), str.c_str());
|
PRINT_DEBUG("final data (before signature) [%zu bytes]:\n %s", buffer.size(), str.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -616,12 +612,12 @@ struct Auth_Data {
|
|||||||
{
|
{
|
||||||
// we nedd a live object until the printf does its job, hence this special handling
|
// we nedd a live object until the printf does its job, hence this special handling
|
||||||
auto str = common_helpers::uint8_vector_to_hex_string(buffer);
|
auto str = common_helpers::uint8_vector_to_hex_string(buffer);
|
||||||
PRINT_DEBUG("AUTH::Auth_Data::SER final data (after signature) [%zu bytes]:\n %s\n", buffer.size(), str.c_str());
|
PRINT_DEBUG("final data (after signature) [%zu bytes]:\n %s", buffer.size(), str.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("AUTH::Auth_Data::SER signature size [%zu] is invalid\n", signature.size());
|
PRINT_DEBUG("signature size [%zu] is invalid", signature.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef SER_VAR
|
#undef SER_VAR
|
||||||
|
@ -186,7 +186,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
SteamAPICall_t addCallResult(SteamAPICall_t api_call, int iCallback, void *result, unsigned int size, double timeout=DEFAULT_CB_TIMEOUT, bool run_call_completed_cb=true) {
|
SteamAPICall_t addCallResult(SteamAPICall_t api_call, int iCallback, void *result, unsigned int size, double timeout=DEFAULT_CB_TIMEOUT, bool run_call_completed_cb=true) {
|
||||||
PRINT_DEBUG("addCallResult %i\n", iCallback);
|
PRINT_DEBUG("%i", iCallback);
|
||||||
auto cb_result = std::find_if(callresults.begin(), callresults.end(), [api_call](struct Steam_Call_Result const& item) { return item.api_call == api_call; });
|
auto cb_result = std::find_if(callresults.begin(), callresults.end(), [api_call](struct Steam_Call_Result const& item) { return item.api_call == api_call; });
|
||||||
if (cb_result != callresults.end()) {
|
if (cb_result != callresults.end()) {
|
||||||
if (cb_result->reserved) {
|
if (cb_result->reserved) {
|
||||||
@ -203,7 +203,7 @@ public:
|
|||||||
return callresults.back().api_call;
|
return callresults.back().api_call;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("addCallResult ERROR\n");
|
PRINT_DEBUG("ERROR");
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ public:
|
|||||||
if (callresults[index].has_cb()) {
|
if (callresults[index].has_cb()) {
|
||||||
std::vector<class CCallbackBase *> temp_cbs = callresults[index].callbacks;
|
std::vector<class CCallbackBase *> temp_cbs = callresults[index].callbacks;
|
||||||
for (auto & cb : temp_cbs) {
|
for (auto & cb : temp_cbs) {
|
||||||
PRINT_DEBUG("Calling callresult %p %i\n", cb, cb->GetICallback());
|
PRINT_DEBUG("Calling callresult %p %i", cb, cb->GetICallback());
|
||||||
global_mutex.unlock();
|
global_mutex.unlock();
|
||||||
//TODO: unlock relock doesn't work if mutex was locked more than once.
|
//TODO: unlock relock doesn't work if mutex was locked more than once.
|
||||||
if (run_call_completed_cb) { //run the right function depending on if it's a callback or a call result.
|
if (run_call_completed_cb) { //run the right function depending on if it's a callback or a call result.
|
||||||
@ -251,7 +251,7 @@ public:
|
|||||||
}
|
}
|
||||||
//COULD BE DELETED SO DON'T TOUCH CB
|
//COULD BE DELETED SO DON'T TOUCH CB
|
||||||
global_mutex.lock();
|
global_mutex.lock();
|
||||||
PRINT_DEBUG("callresult done\n");
|
PRINT_DEBUG("callresult done");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ public:
|
|||||||
data.m_cubParam = result.size();
|
data.m_cubParam = result.size();
|
||||||
|
|
||||||
for (auto & cb: callbacks) {
|
for (auto & cb: callbacks) {
|
||||||
PRINT_DEBUG("Call complete cb %i %p %llu\n", iCallback, cb, api_call);
|
PRINT_DEBUG("Call complete cb %i %p %llu", iCallback, cb, api_call);
|
||||||
//TODO: check if this is a problem or not.
|
//TODO: check if this is a problem or not.
|
||||||
SteamAPICallCompleted_t temp = data;
|
SteamAPICallCompleted_t temp = data;
|
||||||
global_mutex.unlock();
|
global_mutex.unlock();
|
||||||
@ -291,12 +291,12 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("runCallResults erase to_delete\n");
|
PRINT_DEBUG("erase to_delete");
|
||||||
auto c = std::begin(callresults);
|
auto c = std::begin(callresults);
|
||||||
while (c != std::end(callresults)) {
|
while (c != std::end(callresults)) {
|
||||||
if (c->to_delete) {
|
if (c->to_delete) {
|
||||||
if (c->timed_out()) {
|
if (c->timed_out()) {
|
||||||
PRINT_DEBUG("runCallResults removed callresult %i\n", c->iCallback);
|
PRINT_DEBUG("removed callresult %i", c->iCallback);
|
||||||
c = callresults.erase(c);
|
c = callresults.erase(c);
|
||||||
} else {
|
} else {
|
||||||
++c;
|
++c;
|
||||||
@ -322,7 +322,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addCallBack(int iCallback, class CCallbackBase *cb) {
|
void addCallBack(int iCallback, class CCallbackBase *cb) {
|
||||||
PRINT_DEBUG("addCallBack %i\n", iCallback);
|
PRINT_DEBUG("%i", iCallback);
|
||||||
if (iCallback == SteamAPICallCompleted_t::k_iCallback) {
|
if (iCallback == SteamAPICallCompleted_t::k_iCallback) {
|
||||||
results->addCallCompleted(cb);
|
results->addCallCompleted(cb);
|
||||||
CCallbackMgr::SetRegister(cb, iCallback);
|
CCallbackMgr::SetRegister(cb, iCallback);
|
||||||
|
@ -41,13 +41,15 @@ Steam_HTMLsurface(class Settings *settings, class Networking *network, class Ste
|
|||||||
// Must call init and shutdown when starting/ending use of the interface
|
// Must call init and shutdown when starting/ending use of the interface
|
||||||
bool Init()
|
bool Init()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::Init\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Shutdown()
|
bool Shutdown()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::Shutdown\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +70,7 @@ bool Shutdown()
|
|||||||
STEAM_CALL_RESULT( HTML_BrowserReady_t )
|
STEAM_CALL_RESULT( HTML_BrowserReady_t )
|
||||||
SteamAPICall_t CreateBrowser( const char *pchUserAgent, const char *pchUserCSS )
|
SteamAPICall_t CreateBrowser( const char *pchUserAgent, const char *pchUserCSS )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::CreateBrowser\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
HTML_BrowserReady_t data;
|
HTML_BrowserReady_t data;
|
||||||
data.unBrowserHandle = 1234869;
|
data.unBrowserHandle = 1234869;
|
||||||
@ -80,14 +82,15 @@ SteamAPICall_t CreateBrowser( const char *pchUserAgent, const char *pchUserCSS )
|
|||||||
// Call this when you are done with a html surface, this lets us free the resources being used by it
|
// Call this when you are done with a html surface, this lets us free the resources being used by it
|
||||||
void RemoveBrowser( HHTMLBrowser unBrowserHandle )
|
void RemoveBrowser( HHTMLBrowser unBrowserHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::RemoveBrowser\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Navigate to this URL, results in a HTML_StartRequest_t as the request commences
|
// Navigate to this URL, results in a HTML_StartRequest_t as the request commences
|
||||||
void LoadURL( HHTMLBrowser unBrowserHandle, const char *pchURL, const char *pchPostData )
|
void LoadURL( HHTMLBrowser unBrowserHandle, const char *pchURL, const char *pchPostData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::LoadURL %s %s\n", pchURL, pchPostData);
|
PRINT_DEBUG("TODO %s %s", pchURL, pchPostData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
static char url[256];
|
static char url[256];
|
||||||
strncpy(url, pchURL, sizeof(url));
|
strncpy(url, pchURL, sizeof(url));
|
||||||
@ -118,169 +121,196 @@ void LoadURL( HHTMLBrowser unBrowserHandle, const char *pchURL, const char *pchP
|
|||||||
// Tells the surface the size in pixels to display the surface
|
// Tells the surface the size in pixels to display the surface
|
||||||
void SetSize( HHTMLBrowser unBrowserHandle, uint32 unWidth, uint32 unHeight )
|
void SetSize( HHTMLBrowser unBrowserHandle, uint32 unWidth, uint32 unHeight )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::SetSize\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Stop the load of the current html page
|
// Stop the load of the current html page
|
||||||
void StopLoad( HHTMLBrowser unBrowserHandle )
|
void StopLoad( HHTMLBrowser unBrowserHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::StopLoad\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reload (most likely from local cache) the current page
|
// Reload (most likely from local cache) the current page
|
||||||
void Reload( HHTMLBrowser unBrowserHandle )
|
void Reload( HHTMLBrowser unBrowserHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::Reload\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// navigate back in the page history
|
// navigate back in the page history
|
||||||
void GoBack( HHTMLBrowser unBrowserHandle )
|
void GoBack( HHTMLBrowser unBrowserHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::GoBack\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// navigate forward in the page history
|
// navigate forward in the page history
|
||||||
void GoForward( HHTMLBrowser unBrowserHandle )
|
void GoForward( HHTMLBrowser unBrowserHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::GoForward\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// add this header to any url requests from this browser
|
// add this header to any url requests from this browser
|
||||||
void AddHeader( HHTMLBrowser unBrowserHandle, const char *pchKey, const char *pchValue )
|
void AddHeader( HHTMLBrowser unBrowserHandle, const char *pchKey, const char *pchValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::AddHeader\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// run this javascript script in the currently loaded page
|
// run this javascript script in the currently loaded page
|
||||||
void ExecuteJavascript( HHTMLBrowser unBrowserHandle, const char *pchScript )
|
void ExecuteJavascript( HHTMLBrowser unBrowserHandle, const char *pchScript )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::ExecuteJavascript\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mouse click and mouse movement commands
|
// Mouse click and mouse movement commands
|
||||||
void MouseUp( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton )
|
void MouseUp( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::MouseUp\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MouseDown( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton )
|
void MouseDown( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::MouseDown\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MouseDoubleClick( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton )
|
void MouseDoubleClick( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::MouseDoubleClick\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// x and y are relative to the HTML bounds
|
// x and y are relative to the HTML bounds
|
||||||
void MouseMove( HHTMLBrowser unBrowserHandle, int x, int y )
|
void MouseMove( HHTMLBrowser unBrowserHandle, int x, int y )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::MouseMove\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// nDelta is pixels of scroll
|
// nDelta is pixels of scroll
|
||||||
void MouseWheel( HHTMLBrowser unBrowserHandle, int32 nDelta )
|
void MouseWheel( HHTMLBrowser unBrowserHandle, int32 nDelta )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::MouseWheel\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// keyboard interactions, native keycode is the key code value from your OS
|
// keyboard interactions, native keycode is the key code value from your OS
|
||||||
void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers, bool bIsSystemKey = false )
|
void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers, bool bIsSystemKey = false )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::KeyDown\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
|
void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::KeyDown old\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
KeyDown(unBrowserHandle, nNativeKeyCode, eHTMLKeyModifiers, false);
|
KeyDown(unBrowserHandle, nNativeKeyCode, eHTMLKeyModifiers, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KeyUp( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers )
|
void KeyUp( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::KeyUp\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press)
|
// cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press)
|
||||||
void KeyChar( HHTMLBrowser unBrowserHandle, uint32 cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers )
|
void KeyChar( HHTMLBrowser unBrowserHandle, uint32 cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::KeyChar\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// programmatically scroll this many pixels on the page
|
// programmatically scroll this many pixels on the page
|
||||||
void SetHorizontalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll )
|
void SetHorizontalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::SetHorizontalScroll\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVerticalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll )
|
void SetVerticalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::SetVerticalScroll\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// tell the html control if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things
|
// tell the html control if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things
|
||||||
void SetKeyFocus( HHTMLBrowser unBrowserHandle, bool bHasKeyFocus )
|
void SetKeyFocus( HHTMLBrowser unBrowserHandle, bool bHasKeyFocus )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::SetKeyFocus\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// open the current pages html code in the local editor of choice, used for debugging
|
// open the current pages html code in the local editor of choice, used for debugging
|
||||||
void ViewSource( HHTMLBrowser unBrowserHandle )
|
void ViewSource( HHTMLBrowser unBrowserHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::ViewSource\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the currently selected text on the html page to the local clipboard
|
// copy the currently selected text on the html page to the local clipboard
|
||||||
void CopyToClipboard( HHTMLBrowser unBrowserHandle )
|
void CopyToClipboard( HHTMLBrowser unBrowserHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::CopyToClipboard\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// paste from the local clipboard to the current html page
|
// paste from the local clipboard to the current html page
|
||||||
void PasteFromClipboard( HHTMLBrowser unBrowserHandle )
|
void PasteFromClipboard( HHTMLBrowser unBrowserHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::PasteFromClipboard\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// find this string in the browser, if bCurrentlyInFind is true then instead cycle to the next matching element
|
// find this string in the browser, if bCurrentlyInFind is true then instead cycle to the next matching element
|
||||||
void Find( HHTMLBrowser unBrowserHandle, const char *pchSearchStr, bool bCurrentlyInFind, bool bReverse )
|
void Find( HHTMLBrowser unBrowserHandle, const char *pchSearchStr, bool bCurrentlyInFind, bool bReverse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::Find\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// cancel a currently running find
|
// cancel a currently running find
|
||||||
void StopFind( HHTMLBrowser unBrowserHandle )
|
void StopFind( HHTMLBrowser unBrowserHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::StopFind\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// return details about the link at position x,y on the current page
|
// return details about the link at position x,y on the current page
|
||||||
void GetLinkAtPosition( HHTMLBrowser unBrowserHandle, int x, int y )
|
void GetLinkAtPosition( HHTMLBrowser unBrowserHandle, int x, int y )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::GetLinkAtPosition\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// set a webcookie for the hostname in question
|
// set a webcookie for the hostname in question
|
||||||
void SetCookie( const char *pchHostname, const char *pchKey, const char *pchValue, const char *pchPath, RTime32 nExpires, bool bSecure, bool bHTTPOnly )
|
void SetCookie( const char *pchHostname, const char *pchKey, const char *pchValue, const char *pchPath, RTime32 nExpires, bool bSecure, bool bHTTPOnly )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::SetCookie\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Zoom the current page by flZoom ( from 0.0 to 2.0, so to zoom to 120% use 1.2 ), zooming around point X,Y in the page (use 0,0 if you don't care)
|
// Zoom the current page by flZoom ( from 0.0 to 2.0, so to zoom to 120% use 1.2 ), zooming around point X,Y in the page (use 0,0 if you don't care)
|
||||||
void SetPageScaleFactor( HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY )
|
void SetPageScaleFactor( HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::SetPageScaleFactor\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -290,7 +320,8 @@ void SetPageScaleFactor( HHTMLBrowser unBrowserHandle, float flZoom, int nPointX
|
|||||||
// When background mode is disabled, any video or audio objects with that property will resume with ".play()".
|
// When background mode is disabled, any video or audio objects with that property will resume with ".play()".
|
||||||
void SetBackgroundMode( HHTMLBrowser unBrowserHandle, bool bBackgroundMode )
|
void SetBackgroundMode( HHTMLBrowser unBrowserHandle, bool bBackgroundMode )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::SetBackgroundMode\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -298,12 +329,14 @@ void SetBackgroundMode( HHTMLBrowser unBrowserHandle, bool bBackgroundMode )
|
|||||||
// Specifies the ratio between physical and logical pixels.
|
// Specifies the ratio between physical and logical pixels.
|
||||||
void SetDPIScalingFactor( HHTMLBrowser unBrowserHandle, float flDPIScaling )
|
void SetDPIScalingFactor( HHTMLBrowser unBrowserHandle, float flDPIScaling )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::SetDPIScalingFactor\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenDeveloperTools( HHTMLBrowser unBrowserHandle )
|
void OpenDeveloperTools( HHTMLBrowser unBrowserHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::OpenDeveloperTools\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CALLBACKS
|
// CALLBACKS
|
||||||
@ -317,7 +350,8 @@ void OpenDeveloperTools( HHTMLBrowser unBrowserHandle )
|
|||||||
// allowed in your HTML surface.
|
// allowed in your HTML surface.
|
||||||
void AllowStartRequest( HHTMLBrowser unBrowserHandle, bool bAllowed )
|
void AllowStartRequest( HHTMLBrowser unBrowserHandle, bool bAllowed )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::AllowStartRequest\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -325,7 +359,8 @@ void AllowStartRequest( HHTMLBrowser unBrowserHandle, bool bAllowed )
|
|||||||
// Set bResult to true for the OK option of a confirm, use false otherwise
|
// Set bResult to true for the OK option of a confirm, use false otherwise
|
||||||
void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult )
|
void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::JSDialogResponse\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -333,7 +368,8 @@ void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult )
|
|||||||
STEAM_IGNOREATTR()
|
STEAM_IGNOREATTR()
|
||||||
void FileLoadDialogResponse( HHTMLBrowser unBrowserHandle, const char **pchSelectedFiles )
|
void FileLoadDialogResponse( HHTMLBrowser unBrowserHandle, const char **pchSelectedFiles )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTMLsurface::FileLoadDialogResponse\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -219,7 +219,7 @@ public ISteamInput
|
|||||||
controller_maps[action_handle_num].active_analog[analog_handle_num].second = source_mode;
|
controller_maps[action_handle_num].active_analog[analog_handle_num].second = source_mode;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("Did not recognize controller button %s\n", button_string.c_str());
|
PRINT_DEBUG("Did not recognize controller button %s", button_string.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ static void background_rumble(Rumble_Thread_Data *data)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_controller_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Controller *steam_controller = (Steam_Controller *)object;
|
Steam_Controller *steam_controller = (Steam_Controller *)object;
|
||||||
steam_controller->RunCallbacks();
|
steam_controller->RunCallbacks();
|
||||||
@ -299,7 +299,7 @@ Steam_Controller(class Settings *settings, class SteamCallResults *callback_resu
|
|||||||
// Init and Shutdown must be called when starting/ending use of this interface
|
// Init and Shutdown must be called when starting/ending use of this interface
|
||||||
bool Init(bool bExplicitlyCallRunFrame)
|
bool Init(bool bExplicitlyCallRunFrame)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::Init() %u\n", bExplicitlyCallRunFrame);
|
PRINT_DEBUG("%u", bExplicitlyCallRunFrame);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (disabled || initialized) {
|
if (disabled || initialized) {
|
||||||
return true;
|
return true;
|
||||||
@ -329,7 +329,7 @@ bool Init(bool bExplicitlyCallRunFrame)
|
|||||||
|
|
||||||
bool Init( const char *pchAbsolutePathToControllerConfigVDF )
|
bool Init( const char *pchAbsolutePathToControllerConfigVDF )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::Init() old\n");
|
PRINT_DEBUG("old");
|
||||||
return Init();
|
return Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ bool Init()
|
|||||||
|
|
||||||
bool Shutdown()
|
bool Shutdown()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::Shutdown()\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (disabled || !initialized) {
|
if (disabled || !initialized) {
|
||||||
return true;
|
return true;
|
||||||
@ -360,7 +360,7 @@ bool Shutdown()
|
|||||||
|
|
||||||
void SetOverrideMode( const char *pchMode )
|
void SetOverrideMode( const char *pchMode )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::SetOverrideMode\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the absolute path to the Input Action Manifest file containing the in-game actions
|
// Set the absolute path to the Input Action Manifest file containing the in-game actions
|
||||||
@ -368,14 +368,14 @@ void SetOverrideMode( const char *pchMode )
|
|||||||
// configurations inside of the game depot instead of using the Steam Workshop
|
// configurations inside of the game depot instead of using the Steam Workshop
|
||||||
bool SetInputActionManifestFilePath( const char *pchInputActionManifestAbsolutePath )
|
bool SetInputActionManifestFilePath( const char *pchInputActionManifestAbsolutePath )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
//TODO SteamInput005
|
//TODO SteamInput005
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BWaitForData( bool bWaitForever, uint32 unTimeout )
|
bool BWaitForData( bool bWaitForever, uint32 unTimeout )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
//TODO SteamInput005
|
//TODO SteamInput005
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -385,7 +385,7 @@ bool BWaitForData( bool bWaitForever, uint32 unTimeout )
|
|||||||
// SteamInput()->RunFrame() or SteamAPI_RunCallbacks() before this to update the data stream
|
// SteamInput()->RunFrame() or SteamAPI_RunCallbacks() before this to update the data stream
|
||||||
bool BNewDataAvailable()
|
bool BNewDataAvailable()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
//TODO SteamInput005
|
//TODO SteamInput005
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -395,7 +395,7 @@ bool BNewDataAvailable()
|
|||||||
// callback when you enable them
|
// callback when you enable them
|
||||||
void EnableDeviceCallbacks()
|
void EnableDeviceCallbacks()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
//TODO SteamInput005
|
//TODO SteamInput005
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -405,7 +405,7 @@ void EnableDeviceCallbacks()
|
|||||||
// Note: this is called within either SteamInput()->RunFrame or by SteamAPI_RunCallbacks
|
// Note: this is called within either SteamInput()->RunFrame or by SteamAPI_RunCallbacks
|
||||||
void EnableActionEventCallbacks( SteamInputActionEventCallbackPointer pCallback )
|
void EnableActionEventCallbacks( SteamInputActionEventCallbackPointer pCallback )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
//TODO SteamInput005
|
//TODO SteamInput005
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -415,7 +415,7 @@ void EnableActionEventCallbacks( SteamInputActionEventCallbackPointer pCallback
|
|||||||
// possible latency, you call this directly before reading controller state.
|
// possible latency, you call this directly before reading controller state.
|
||||||
void RunFrame(bool bReservedValue)
|
void RunFrame(bool bReservedValue)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_Controller::RunFrame()\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (disabled || !initialized) {
|
if (disabled || !initialized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -430,7 +430,7 @@ void RunFrame()
|
|||||||
|
|
||||||
bool GetControllerState( uint32 unControllerIndex, SteamControllerState001_t *pState )
|
bool GetControllerState( uint32 unControllerIndex, SteamControllerState001_t *pState )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetControllerState()\n");
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ bool GetControllerState( uint32 unControllerIndex, SteamControllerState001_t *pS
|
|||||||
// Returns the number of handles written to handlesOut
|
// Returns the number of handles written to handlesOut
|
||||||
int GetConnectedControllers( ControllerHandle_t *handlesOut )
|
int GetConnectedControllers( ControllerHandle_t *handlesOut )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetConnectedControllers\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (!handlesOut) return 0;
|
if (!handlesOut) return 0;
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -451,7 +451,7 @@ int GetConnectedControllers( ControllerHandle_t *handlesOut )
|
|||||||
if (GamepadIsConnected(GAMEPAD_2)) {*handlesOut = GAMEPAD_2 + 1; ++handlesOut; ++count;};
|
if (GamepadIsConnected(GAMEPAD_2)) {*handlesOut = GAMEPAD_2 + 1; ++handlesOut; ++count;};
|
||||||
if (GamepadIsConnected(GAMEPAD_3)) {*handlesOut = GAMEPAD_3 + 1; ++handlesOut; ++count;};
|
if (GamepadIsConnected(GAMEPAD_3)) {*handlesOut = GAMEPAD_3 + 1; ++handlesOut; ++count;};
|
||||||
|
|
||||||
PRINT_DEBUG("returned %i connected controllers\n", count);
|
PRINT_DEBUG("returned %i connected controllers", count);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,7 +460,7 @@ int GetConnectedControllers( ControllerHandle_t *handlesOut )
|
|||||||
// Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode
|
// Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode
|
||||||
bool ShowBindingPanel( ControllerHandle_t controllerHandle )
|
bool ShowBindingPanel( ControllerHandle_t controllerHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::ShowBindingPanel\n");
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ bool ShowBindingPanel( ControllerHandle_t controllerHandle )
|
|||||||
// Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.
|
// Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.
|
||||||
ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName )
|
ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetActionSetHandle %s\n", pszActionSetName);
|
PRINT_DEBUG("%s", pszActionSetName);
|
||||||
if (!pszActionSetName) return 0;
|
if (!pszActionSetName) return 0;
|
||||||
std::string upper_action_name(pszActionSetName);
|
std::string upper_action_name(pszActionSetName);
|
||||||
std::transform(upper_action_name.begin(), upper_action_name.end(), upper_action_name.begin(),[](unsigned char c){ return std::toupper(c); });
|
std::transform(upper_action_name.begin(), upper_action_name.end(), upper_action_name.begin(),[](unsigned char c){ return std::toupper(c); });
|
||||||
@ -477,7 +477,7 @@ ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName )
|
|||||||
auto set_handle = action_handles.find(upper_action_name);
|
auto set_handle = action_handles.find(upper_action_name);
|
||||||
if (set_handle == action_handles.end()) return 0;
|
if (set_handle == action_handles.end()) return 0;
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Controller::GetActionSetHandle %s ret %llu\n", pszActionSetName, set_handle->second);
|
PRINT_DEBUG("%s ret %llu", pszActionSetName, set_handle->second);
|
||||||
return set_handle->second;
|
return set_handle->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName )
|
|||||||
// your state loops, instead of trying to place it in all of your state transitions.
|
// your state loops, instead of trying to place it in all of your state transitions.
|
||||||
void ActivateActionSet( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle )
|
void ActivateActionSet( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::ActivateActionSet %llu %llu\n", controllerHandle, actionSetHandle);
|
PRINT_DEBUG("%llu %llu", controllerHandle, actionSetHandle);
|
||||||
if (controllerHandle == STEAM_CONTROLLER_HANDLE_ALL_CONTROLLERS) {
|
if (controllerHandle == STEAM_CONTROLLER_HANDLE_ALL_CONTROLLERS) {
|
||||||
for (auto & c: controllers) {
|
for (auto & c: controllers) {
|
||||||
c.second.activate_action_set(actionSetHandle, controller_maps);
|
c.second.activate_action_set(actionSetHandle, controller_maps);
|
||||||
@ -503,7 +503,7 @@ void ActivateActionSet( ControllerHandle_t controllerHandle, ControllerActionSet
|
|||||||
ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle )
|
ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle )
|
||||||
{
|
{
|
||||||
//TODO: should return zero if no action set specifically activated with ActivateActionSet
|
//TODO: should return zero if no action set specifically activated with ActivateActionSet
|
||||||
PRINT_DEBUG("Steam_Controller::GetCurrentActionSet %llu\n", controllerHandle);
|
PRINT_DEBUG("%llu", controllerHandle);
|
||||||
auto controller = controllers.find(controllerHandle);
|
auto controller = controllers.find(controllerHandle);
|
||||||
if (controller == controllers.end()) return 0;
|
if (controller == controllers.end()) return 0;
|
||||||
|
|
||||||
@ -513,22 +513,22 @@ ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHa
|
|||||||
|
|
||||||
void ActivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle )
|
void ActivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::ActivateActionSetLayer\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeactivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle )
|
void DeactivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::DeactivateActionSetLayer\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeactivateAllActionSetLayers( ControllerHandle_t controllerHandle )
|
void DeactivateAllActionSetLayers( ControllerHandle_t controllerHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::DeactivateAllActionSetLayers\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetActiveActionSetLayers( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t *handlesOut )
|
int GetActiveActionSetLayers( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t *handlesOut )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetActiveActionSetLayers\n");
|
PRINT_DEBUG_TODO();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ int GetActiveActionSetLayers( ControllerHandle_t controllerHandle, ControllerAct
|
|||||||
// Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls.
|
// Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls.
|
||||||
ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName )
|
ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetDigitalActionHandle %s\n", pszActionName);
|
PRINT_DEBUG("%s", pszActionName);
|
||||||
if (!pszActionName) return 0;
|
if (!pszActionName) return 0;
|
||||||
std::string upper_action_name(pszActionName);
|
std::string upper_action_name(pszActionName);
|
||||||
std::transform(upper_action_name.begin(), upper_action_name.end(), upper_action_name.begin(),[](unsigned char c){ return std::toupper(c); });
|
std::transform(upper_action_name.begin(), upper_action_name.end(), upper_action_name.begin(),[](unsigned char c){ return std::toupper(c); });
|
||||||
@ -550,7 +550,7 @@ ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionNam
|
|||||||
if (handle == analog_action_handles.end()) return 0;
|
if (handle == analog_action_handles.end()) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Controller::GetDigitalActionHandle %s ret %llu\n", pszActionName, handle->second);
|
PRINT_DEBUG("%s ret %llu", pszActionName, handle->second);
|
||||||
return handle->second;
|
return handle->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,7 +558,7 @@ ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionNam
|
|||||||
// Returns the current state of the supplied digital game action
|
// Returns the current state of the supplied digital game action
|
||||||
ControllerDigitalActionData_t GetDigitalActionData( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle )
|
ControllerDigitalActionData_t GetDigitalActionData( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetDigitalActionData %llu %llu\n", controllerHandle, digitalActionHandle);
|
PRINT_DEBUG("%llu %llu", controllerHandle, digitalActionHandle);
|
||||||
ControllerDigitalActionData_t digitalData;
|
ControllerDigitalActionData_t digitalData;
|
||||||
digitalData.bActive = false;
|
digitalData.bActive = false;
|
||||||
digitalData.bState = false;
|
digitalData.bState = false;
|
||||||
@ -631,7 +631,7 @@ ControllerDigitalActionData_t GetDigitalActionData( ControllerHandle_t controlle
|
|||||||
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles
|
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles
|
||||||
int GetDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin *originsOut )
|
int GetDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin *originsOut )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetDigitalActionOrigins\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
EInputActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS];
|
EInputActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS];
|
||||||
int ret = GetDigitalActionOrigins(controllerHandle, actionSetHandle, digitalActionHandle, origins );
|
int ret = GetDigitalActionOrigins(controllerHandle, actionSetHandle, digitalActionHandle, origins );
|
||||||
for (int i = 0; i < ret; ++i) {
|
for (int i = 0; i < ret; ++i) {
|
||||||
@ -643,7 +643,7 @@ int GetDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerActi
|
|||||||
|
|
||||||
int GetDigitalActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, EInputActionOrigin *originsOut )
|
int GetDigitalActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, EInputActionOrigin *originsOut )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetDigitalActionOrigins steaminput\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
auto controller = controllers.find(inputHandle);
|
auto controller = controllers.find(inputHandle);
|
||||||
if (controller == controllers.end()) return 0;
|
if (controller == controllers.end()) return 0;
|
||||||
|
|
||||||
@ -749,7 +749,7 @@ int GetDigitalActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t a
|
|||||||
// Returns a localized string (from Steam's language setting) for the user-facing action name corresponding to the specified handle
|
// Returns a localized string (from Steam's language setting) for the user-facing action name corresponding to the specified handle
|
||||||
const char *GetStringForDigitalActionName( InputDigitalActionHandle_t eActionHandle )
|
const char *GetStringForDigitalActionName( InputDigitalActionHandle_t eActionHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
//TODO SteamInput005
|
//TODO SteamInput005
|
||||||
return "Button String";
|
return "Button String";
|
||||||
}
|
}
|
||||||
@ -757,7 +757,7 @@ const char *GetStringForDigitalActionName( InputDigitalActionHandle_t eActionHan
|
|||||||
// Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls.
|
// Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls.
|
||||||
ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName )
|
ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetAnalogActionHandle %s\n", pszActionName);
|
PRINT_DEBUG("%s", pszActionName);
|
||||||
if (!pszActionName) return 0;
|
if (!pszActionName) return 0;
|
||||||
std::string upper_action_name(pszActionName);
|
std::string upper_action_name(pszActionName);
|
||||||
std::transform(upper_action_name.begin(), upper_action_name.end(), upper_action_name.begin(),[](unsigned char c){ return std::toupper(c); });
|
std::transform(upper_action_name.begin(), upper_action_name.end(), upper_action_name.begin(),[](unsigned char c){ return std::toupper(c); });
|
||||||
@ -772,7 +772,7 @@ ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName
|
|||||||
// Returns the current state of these supplied analog game action
|
// Returns the current state of these supplied analog game action
|
||||||
ControllerAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle )
|
ControllerAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetAnalogActionData %llu %llu\n", controllerHandle, analogActionHandle);
|
PRINT_DEBUG("%llu %llu", controllerHandle, analogActionHandle);
|
||||||
GAMEPAD_DEVICE device = (GAMEPAD_DEVICE)(controllerHandle - 1);
|
GAMEPAD_DEVICE device = (GAMEPAD_DEVICE)(controllerHandle - 1);
|
||||||
|
|
||||||
ControllerAnalogActionData_t data;
|
ControllerAnalogActionData_t data;
|
||||||
@ -825,7 +825,7 @@ ControllerAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerH
|
|||||||
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles
|
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles
|
||||||
int GetAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin *originsOut )
|
int GetAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin *originsOut )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetAnalogActionOrigins\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
EInputActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS];
|
EInputActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS];
|
||||||
int ret = GetAnalogActionOrigins(controllerHandle, actionSetHandle, analogActionHandle, origins );
|
int ret = GetAnalogActionOrigins(controllerHandle, actionSetHandle, analogActionHandle, origins );
|
||||||
for (int i = 0; i < ret; ++i) {
|
for (int i = 0; i < ret; ++i) {
|
||||||
@ -837,7 +837,7 @@ int GetAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerActio
|
|||||||
|
|
||||||
int GetAnalogActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, EInputActionOrigin *originsOut )
|
int GetAnalogActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, EInputActionOrigin *originsOut )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetAnalogActionOrigins steaminput\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
auto controller = controllers.find(inputHandle);
|
auto controller = controllers.find(inputHandle);
|
||||||
if (controller == controllers.end()) return 0;
|
if (controller == controllers.end()) return 0;
|
||||||
|
|
||||||
@ -882,26 +882,26 @@ int GetAnalogActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t ac
|
|||||||
|
|
||||||
void StopAnalogActionMomentum( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction )
|
void StopAnalogActionMomentum( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::StopAnalogActionMomentum %llu %llu\n", controllerHandle, eAction);
|
PRINT_DEBUG("%llu %llu", controllerHandle, eAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Trigger a haptic pulse on a controller
|
// Trigger a haptic pulse on a controller
|
||||||
void TriggerHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec )
|
void TriggerHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::TriggerHapticPulse\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger a haptic pulse on a controller
|
// Trigger a haptic pulse on a controller
|
||||||
void Legacy_TriggerHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec )
|
void Legacy_TriggerHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
TriggerHapticPulse(inputHandle, eTargetPad, usDurationMicroSec );
|
TriggerHapticPulse(inputHandle, eTargetPad, usDurationMicroSec );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerHapticPulse( uint32 unControllerIndex, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec )
|
void TriggerHapticPulse( uint32 unControllerIndex, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::TriggerHapticPulse old\n");
|
PRINT_DEBUG("old");
|
||||||
TriggerHapticPulse(unControllerIndex, eTargetPad, usDurationMicroSec );
|
TriggerHapticPulse(unControllerIndex, eTargetPad, usDurationMicroSec );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -909,12 +909,12 @@ void TriggerHapticPulse( uint32 unControllerIndex, ESteamControllerPad eTargetPa
|
|||||||
// nFlags is currently unused and reserved for future use.
|
// nFlags is currently unused and reserved for future use.
|
||||||
void TriggerRepeatedHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags )
|
void TriggerRepeatedHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::TriggerRepeatedHapticPulse\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Legacy_TriggerRepeatedHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags )
|
void Legacy_TriggerRepeatedHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
TriggerRepeatedHapticPulse(inputHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags);
|
TriggerRepeatedHapticPulse(inputHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -922,13 +922,13 @@ void Legacy_TriggerRepeatedHapticPulse( InputHandle_t inputHandle, ESteamControl
|
|||||||
// Send a haptic pulse, works on Steam Deck and Steam Controller devices
|
// Send a haptic pulse, works on Steam Deck and Steam Controller devices
|
||||||
void TriggerSimpleHapticEvent( InputHandle_t inputHandle, EControllerHapticLocation eHapticLocation, uint8 nIntensity, char nGainDB, uint8 nOtherIntensity, char nOtherGainDB )
|
void TriggerSimpleHapticEvent( InputHandle_t inputHandle, EControllerHapticLocation eHapticLocation, uint8 nIntensity, char nGainDB, uint8 nOtherIntensity, char nOtherGainDB )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tigger a vibration event on supported controllers.
|
// Tigger a vibration event on supported controllers.
|
||||||
void TriggerVibration( ControllerHandle_t controllerHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed )
|
void TriggerVibration( ControllerHandle_t controllerHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::TriggerVibration %hu %hu\n", usLeftSpeed, usRightSpeed);
|
PRINT_DEBUG("%hu %hu", usLeftSpeed, usRightSpeed);
|
||||||
auto controller = controllers.find(controllerHandle);
|
auto controller = controllers.find(controllerHandle);
|
||||||
if (controller == controllers.end()) return;
|
if (controller == controllers.end()) return;
|
||||||
|
|
||||||
@ -952,7 +952,7 @@ void TriggerVibration( ControllerHandle_t controllerHandle, unsigned short usLef
|
|||||||
// Trigger a vibration event on supported controllers including Xbox trigger impulse rumble - Steam will translate these commands into haptic pulses for Steam Controllers
|
// Trigger a vibration event on supported controllers including Xbox trigger impulse rumble - Steam will translate these commands into haptic pulses for Steam Controllers
|
||||||
void TriggerVibrationExtended( InputHandle_t inputHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed, unsigned short usLeftTriggerSpeed, unsigned short usRightTriggerSpeed )
|
void TriggerVibrationExtended( InputHandle_t inputHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed, unsigned short usLeftTriggerSpeed, unsigned short usRightTriggerSpeed )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
TriggerVibration(inputHandle, usLeftSpeed, usRightSpeed);
|
TriggerVibration(inputHandle, usLeftSpeed, usRightSpeed);
|
||||||
//TODO trigger impulse rumbles
|
//TODO trigger impulse rumbles
|
||||||
}
|
}
|
||||||
@ -960,14 +960,14 @@ void TriggerVibrationExtended( InputHandle_t inputHandle, unsigned short usLeftS
|
|||||||
// Set the controller LED color on supported controllers.
|
// Set the controller LED color on supported controllers.
|
||||||
void SetLEDColor( ControllerHandle_t controllerHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags )
|
void SetLEDColor( ControllerHandle_t controllerHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::SetLEDColor\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns the associated gamepad index for the specified controller, if emulating a gamepad
|
// Returns the associated gamepad index for the specified controller, if emulating a gamepad
|
||||||
int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle )
|
int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetGamepadIndexForController\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
auto controller = controllers.find(ulControllerHandle);
|
auto controller = controllers.find(ulControllerHandle);
|
||||||
if (controller == controllers.end()) return -1;
|
if (controller == controllers.end()) return -1;
|
||||||
|
|
||||||
@ -978,7 +978,7 @@ int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle )
|
|||||||
// Returns the associated controller handle for the specified emulated gamepad
|
// Returns the associated controller handle for the specified emulated gamepad
|
||||||
ControllerHandle_t GetControllerForGamepadIndex( int nIndex )
|
ControllerHandle_t GetControllerForGamepadIndex( int nIndex )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetControllerForGamepadIndex %i\n", nIndex);
|
PRINT_DEBUG("%i", nIndex);
|
||||||
ControllerHandle_t out = nIndex + 1;
|
ControllerHandle_t out = nIndex + 1;
|
||||||
auto controller = controllers.find(out);
|
auto controller = controllers.find(out);
|
||||||
if (controller == controllers.end()) return 0;
|
if (controller == controllers.end()) return 0;
|
||||||
@ -989,7 +989,7 @@ ControllerHandle_t GetControllerForGamepadIndex( int nIndex )
|
|||||||
// Returns raw motion data from the specified controller
|
// Returns raw motion data from the specified controller
|
||||||
ControllerMotionData_t GetMotionData( ControllerHandle_t controllerHandle )
|
ControllerMotionData_t GetMotionData( ControllerHandle_t controllerHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetMotionData\n");
|
PRINT_DEBUG_TODO();
|
||||||
ControllerMotionData_t data = {};
|
ControllerMotionData_t data = {};
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -999,13 +999,13 @@ ControllerMotionData_t GetMotionData( ControllerHandle_t controllerHandle )
|
|||||||
// Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode
|
// Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode
|
||||||
bool ShowDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle, float flScale, float flXPosition, float flYPosition )
|
bool ShowDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle, float flScale, float flXPosition, float flYPosition )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::ShowDigitalActionOrigins\n");
|
PRINT_DEBUG_TODO();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShowAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle, float flScale, float flXPosition, float flYPosition )
|
bool ShowAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle, float flScale, float flXPosition, float flYPosition )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::ShowAnalogActionOrigins\n");
|
PRINT_DEBUG_TODO();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1013,20 +1013,20 @@ bool ShowAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerAna
|
|||||||
// Returns a localized string (from Steam's language setting) for the specified origin
|
// Returns a localized string (from Steam's language setting) for the specified origin
|
||||||
const char *GetStringForActionOrigin( EControllerActionOrigin eOrigin )
|
const char *GetStringForActionOrigin( EControllerActionOrigin eOrigin )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetStringForActionOrigin\n");
|
PRINT_DEBUG_TODO();
|
||||||
return "Button String";
|
return "Button String";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GetStringForActionOrigin( EInputActionOrigin eOrigin )
|
const char *GetStringForActionOrigin( EInputActionOrigin eOrigin )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetStringForActionOrigin steaminput\n");
|
PRINT_DEBUG_TODO();
|
||||||
return "Button String";
|
return "Button String";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a localized string (from Steam's language setting) for the user-facing action name corresponding to the specified handle
|
// Returns a localized string (from Steam's language setting) for the user-facing action name corresponding to the specified handle
|
||||||
const char *GetStringForAnalogActionName( InputAnalogActionHandle_t eActionHandle )
|
const char *GetStringForAnalogActionName( InputAnalogActionHandle_t eActionHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
//TODO SteamInput005
|
//TODO SteamInput005
|
||||||
return "Button String";
|
return "Button String";
|
||||||
}
|
}
|
||||||
@ -1034,7 +1034,7 @@ const char *GetStringForAnalogActionName( InputAnalogActionHandle_t eActionHandl
|
|||||||
// Get a local path to art for on-screen glyph for a particular origin
|
// Get a local path to art for on-screen glyph for a particular origin
|
||||||
const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin )
|
const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin %i\n", eOrigin);
|
PRINT_DEBUG("%i", eOrigin);
|
||||||
|
|
||||||
if (steamcontroller_glyphs.empty()) {
|
if (steamcontroller_glyphs.empty()) {
|
||||||
std::string dir = settings->glyphs_directory;
|
std::string dir = settings->glyphs_directory;
|
||||||
@ -1076,7 +1076,7 @@ const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin )
|
|||||||
|
|
||||||
const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin )
|
const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin steaminput %i\n", eOrigin);
|
PRINT_DEBUG("steaminput %i", eOrigin);
|
||||||
if (steaminput_glyphs.empty()) {
|
if (steaminput_glyphs.empty()) {
|
||||||
std::string dir = settings->glyphs_directory;
|
std::string dir = settings->glyphs_directory;
|
||||||
steaminput_glyphs[k_EInputActionOrigin_XBox360_A] = dir + "button_a.png";
|
steaminput_glyphs[k_EInputActionOrigin_XBox360_A] = dir + "button_a.png";
|
||||||
@ -1119,7 +1119,7 @@ const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin )
|
|||||||
// Get a local path to a PNG file for the provided origin's glyph.
|
// Get a local path to a PNG file for the provided origin's glyph.
|
||||||
const char *GetGlyphPNGForActionOrigin( EInputActionOrigin eOrigin, ESteamInputGlyphSize eSize, uint32 unFlags )
|
const char *GetGlyphPNGForActionOrigin( EInputActionOrigin eOrigin, ESteamInputGlyphSize eSize, uint32 unFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
//TODO SteamInput005
|
//TODO SteamInput005
|
||||||
return GetGlyphForActionOrigin(eOrigin);
|
return GetGlyphForActionOrigin(eOrigin);
|
||||||
}
|
}
|
||||||
@ -1127,7 +1127,7 @@ const char *GetGlyphPNGForActionOrigin( EInputActionOrigin eOrigin, ESteamInputG
|
|||||||
// Get a local path to a SVG file for the provided origin's glyph.
|
// Get a local path to a SVG file for the provided origin's glyph.
|
||||||
const char *GetGlyphSVGForActionOrigin( EInputActionOrigin eOrigin, uint32 unFlags )
|
const char *GetGlyphSVGForActionOrigin( EInputActionOrigin eOrigin, uint32 unFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
//TODO SteamInput005
|
//TODO SteamInput005
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -1135,14 +1135,14 @@ const char *GetGlyphSVGForActionOrigin( EInputActionOrigin eOrigin, uint32 unFla
|
|||||||
// Get a local path to an older, Big Picture Mode-style PNG file for a particular origin
|
// Get a local path to an older, Big Picture Mode-style PNG file for a particular origin
|
||||||
const char *GetGlyphForActionOrigin_Legacy( EInputActionOrigin eOrigin )
|
const char *GetGlyphForActionOrigin_Legacy( EInputActionOrigin eOrigin )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("%s\n", __FUNCTION__);
|
PRINT_DEBUG_ENTRY();
|
||||||
return GetGlyphForActionOrigin(eOrigin);
|
return GetGlyphForActionOrigin(eOrigin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the input type for a particular handle
|
// Returns the input type for a particular handle
|
||||||
ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle )
|
ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetInputTypeForHandle %llu\n", controllerHandle);
|
PRINT_DEBUG("%llu", controllerHandle);
|
||||||
auto controller = controllers.find(controllerHandle);
|
auto controller = controllers.find(controllerHandle);
|
||||||
if (controller == controllers.end()) return k_ESteamInputType_Unknown;
|
if (controller == controllers.end()) return k_ESteamInputType_Unknown;
|
||||||
return k_ESteamInputType_XBox360Controller;
|
return k_ESteamInputType_XBox360Controller;
|
||||||
@ -1150,37 +1150,37 @@ ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle )
|
|||||||
|
|
||||||
const char *GetStringForXboxOrigin( EXboxOrigin eOrigin )
|
const char *GetStringForXboxOrigin( EXboxOrigin eOrigin )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetStringForXboxOrigin\n");
|
PRINT_DEBUG_TODO();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GetGlyphForXboxOrigin( EXboxOrigin eOrigin )
|
const char *GetGlyphForXboxOrigin( EXboxOrigin eOrigin )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetGlyphForXboxOrigin\n");
|
PRINT_DEBUG_TODO();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
EControllerActionOrigin GetActionOriginFromXboxOrigin_( ControllerHandle_t controllerHandle, EXboxOrigin eOrigin )
|
EControllerActionOrigin GetActionOriginFromXboxOrigin_( ControllerHandle_t controllerHandle, EXboxOrigin eOrigin )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetActionOriginFromXboxOrigin\n");
|
PRINT_DEBUG_TODO();
|
||||||
return k_EControllerActionOrigin_None;
|
return k_EControllerActionOrigin_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
EInputActionOrigin GetActionOriginFromXboxOrigin( InputHandle_t inputHandle, EXboxOrigin eOrigin )
|
EInputActionOrigin GetActionOriginFromXboxOrigin( InputHandle_t inputHandle, EXboxOrigin eOrigin )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetActionOriginFromXboxOrigin steaminput\n");
|
PRINT_DEBUG_TODO();
|
||||||
return k_EInputActionOrigin_None;
|
return k_EInputActionOrigin_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
EControllerActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, EControllerActionOrigin eSourceOrigin )
|
EControllerActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, EControllerActionOrigin eSourceOrigin )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::TranslateActionOrigin\n");
|
PRINT_DEBUG_TODO();
|
||||||
return k_EControllerActionOrigin_None;
|
return k_EControllerActionOrigin_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
EInputActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, EInputActionOrigin eSourceOrigin )
|
EInputActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, EInputActionOrigin eSourceOrigin )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::TranslateActionOrigin steaminput destinationinputtype %d sourceorigin %d\n", eDestinationInputType, eSourceOrigin );
|
PRINT_DEBUG("steaminput destinationinputtype %d sourceorigin %d", eDestinationInputType, eSourceOrigin );
|
||||||
|
|
||||||
if (eDestinationInputType == k_ESteamInputType_XBox360Controller)
|
if (eDestinationInputType == k_ESteamInputType_XBox360Controller)
|
||||||
return eSourceOrigin;
|
return eSourceOrigin;
|
||||||
@ -1190,19 +1190,19 @@ EInputActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType,
|
|||||||
|
|
||||||
bool GetControllerBindingRevision( ControllerHandle_t controllerHandle, int *pMajor, int *pMinor )
|
bool GetControllerBindingRevision( ControllerHandle_t controllerHandle, int *pMajor, int *pMinor )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetControllerBindingRevision\n");
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetDeviceBindingRevision( InputHandle_t inputHandle, int *pMajor, int *pMinor )
|
bool GetDeviceBindingRevision( InputHandle_t inputHandle, int *pMajor, int *pMinor )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetDeviceBindingRevision\n");
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GetRemotePlaySessionID( InputHandle_t inputHandle )
|
uint32 GetRemotePlaySessionID( InputHandle_t inputHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Controller::GetRemotePlaySessionID\n");
|
PRINT_DEBUG_TODO();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1210,14 +1210,14 @@ uint32 GetRemotePlaySessionID( InputHandle_t inputHandle )
|
|||||||
// Note: user can override the settings from the Steamworks Partner site so the returned values may not exactly match your default configuration
|
// Note: user can override the settings from the Steamworks Partner site so the returned values may not exactly match your default configuration
|
||||||
uint16 GetSessionInputConfigurationSettings()
|
uint16 GetSessionInputConfigurationSettings()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the trigger effect for a DualSense controller
|
// Set the trigger effect for a DualSense controller
|
||||||
void SetDualSenseTriggerEffect( InputHandle_t inputHandle, const ScePadTriggerEffectParam *pParam )
|
void SetDualSenseTriggerEffect( InputHandle_t inputHandle, const ScePadTriggerEffectParam *pParam )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunCallbacks()
|
void RunCallbacks()
|
||||||
|
@ -202,7 +202,7 @@ struct Avatar_Numbers add_friend_avatars(CSteamID id)
|
|||||||
public:
|
public:
|
||||||
static void steam_friends_callback(void *object, Common_Message *msg)
|
static void steam_friends_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_Friends::steam_friends_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Friends *steam_friends = (Steam_Friends *)object;
|
Steam_Friends *steam_friends = (Steam_Friends *)object;
|
||||||
steam_friends->Callback(msg);
|
steam_friends->Callback(msg);
|
||||||
@ -210,7 +210,7 @@ static void steam_friends_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_friends_run_every_runcb(void *object)
|
static void steam_friends_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_Friends::steam_friends_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Friends *steam_friends = (Steam_Friends *)object;
|
Steam_Friends *steam_friends = (Steam_Friends *)object;
|
||||||
steam_friends->RunCallbacks();
|
steam_friends->RunCallbacks();
|
||||||
@ -258,7 +258,7 @@ static bool ok_friend_flags(int iFriendFlags)
|
|||||||
// off; it will eventually be free'd or re-allocated
|
// off; it will eventually be free'd or re-allocated
|
||||||
const char *GetPersonaName()
|
const char *GetPersonaName()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetPersonaName\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
const char *local_name = settings->get_local_name();
|
const char *local_name = settings->get_local_name();
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ const char *GetPersonaName()
|
|||||||
STEAM_CALL_RESULT( SetPersonaNameResponse_t )
|
STEAM_CALL_RESULT( SetPersonaNameResponse_t )
|
||||||
SteamAPICall_t SetPersonaName( const char *pchPersonaName )
|
SteamAPICall_t SetPersonaName( const char *pchPersonaName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::SetPersonaName\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
SetPersonaNameResponse_t data;
|
SetPersonaNameResponse_t data;
|
||||||
data.m_bSuccess = true;
|
data.m_bSuccess = true;
|
||||||
@ -288,14 +288,16 @@ SteamAPICall_t SetPersonaName( const char *pchPersonaName )
|
|||||||
|
|
||||||
void SetPersonaName_old( const char *pchPersonaName )
|
void SetPersonaName_old( const char *pchPersonaName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::SetPersonaName old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
SetPersonaName(pchPersonaName);
|
SetPersonaName(pchPersonaName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets the status of the current user
|
// gets the status of the current user
|
||||||
EPersonaState GetPersonaState()
|
EPersonaState GetPersonaState()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetPersonaState\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EPersonaStateOnline;
|
return k_EPersonaStateOnline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,17 +307,18 @@ EPersonaState GetPersonaState()
|
|||||||
// then GetFriendByIndex() can then be used to return the id's of each of those users
|
// then GetFriendByIndex() can then be used to return the id's of each of those users
|
||||||
int GetFriendCount( int iFriendFlags )
|
int GetFriendCount( int iFriendFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendCount %i\n", iFriendFlags);
|
PRINT_DEBUG("%i", iFriendFlags);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (ok_friend_flags(iFriendFlags)) count = friends.size();
|
if (ok_friend_flags(iFriendFlags)) count = friends.size();
|
||||||
PRINT_DEBUG("count %i\n", count);
|
PRINT_DEBUG("count %i", count);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetFriendCount( EFriendFlags eFriendFlags )
|
int GetFriendCount( EFriendFlags eFriendFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendCount old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return GetFriendCount((int)eFriendFlags);
|
return GetFriendCount((int)eFriendFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +328,7 @@ int GetFriendCount( EFriendFlags eFriendFlags )
|
|||||||
// the returned CSteamID can then be used by all the functions below to access details about the user
|
// the returned CSteamID can then be used by all the functions below to access details about the user
|
||||||
CSteamID GetFriendByIndex( int iFriend, int iFriendFlags )
|
CSteamID GetFriendByIndex( int iFriend, int iFriendFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendByIndex\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
CSteamID id = k_steamIDNil;
|
CSteamID id = k_steamIDNil;
|
||||||
if (ok_friend_flags(iFriendFlags)) if (iFriend < friends.size()) id = CSteamID((uint64)friends[iFriend].id());
|
if (ok_friend_flags(iFriendFlags)) if (iFriend < friends.size()) id = CSteamID((uint64)friends[iFriend].id());
|
||||||
@ -335,14 +338,15 @@ CSteamID GetFriendByIndex( int iFriend, int iFriendFlags )
|
|||||||
|
|
||||||
CSteamID GetFriendByIndex( int iFriend, EFriendFlags eFriendFlags )
|
CSteamID GetFriendByIndex( int iFriend, EFriendFlags eFriendFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendByIndex old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return GetFriendByIndex(iFriend, (int)eFriendFlags );
|
return GetFriendByIndex(iFriend, (int)eFriendFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns a relationship to a user
|
// returns a relationship to a user
|
||||||
EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend )
|
EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendRelationship %llu\n", steamIDFriend.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDFriend.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (steamIDFriend == settings->get_local_steam_id()) return k_EFriendRelationshipNone; //Real steam behavior
|
if (steamIDFriend == settings->get_local_steam_id()) return k_EFriendRelationshipNone; //Real steam behavior
|
||||||
if (find_friend(steamIDFriend)) return k_EFriendRelationshipFriend;
|
if (find_friend(steamIDFriend)) return k_EFriendRelationshipFriend;
|
||||||
@ -355,7 +359,7 @@ EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend )
|
|||||||
// this will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user
|
// this will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user
|
||||||
EPersonaState GetFriendPersonaState( CSteamID steamIDFriend )
|
EPersonaState GetFriendPersonaState( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendPersonaState %llu\n", steamIDFriend.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDFriend.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
EPersonaState state = k_EPersonaStateOffline;
|
EPersonaState state = k_EPersonaStateOffline;
|
||||||
if (steamIDFriend == settings->get_local_steam_id() || find_friend(steamIDFriend)) {
|
if (steamIDFriend == settings->get_local_steam_id() || find_friend(steamIDFriend)) {
|
||||||
@ -373,7 +377,7 @@ EPersonaState GetFriendPersonaState( CSteamID steamIDFriend )
|
|||||||
//
|
//
|
||||||
const char *GetFriendPersonaName( CSteamID steamIDFriend )
|
const char *GetFriendPersonaName( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendPersonaName %llu\n", steamIDFriend.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDFriend.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
const char *name = "Unknown User";
|
const char *name = "Unknown User";
|
||||||
if (steamIDFriend == settings->get_local_steam_id()) {
|
if (steamIDFriend == settings->get_local_steam_id()) {
|
||||||
@ -383,7 +387,7 @@ const char *GetFriendPersonaName( CSteamID steamIDFriend )
|
|||||||
if (f) name = f->name().c_str();
|
if (f) name = f->name().c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendPersonaName returned '%s'\n", name);
|
PRINT_DEBUG("returned '%s'", name);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,12 +395,12 @@ const char *GetFriendPersonaName( CSteamID steamIDFriend )
|
|||||||
// returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details
|
// returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details
|
||||||
bool GetFriendGamePlayed( CSteamID steamIDFriend, STEAM_OUT_STRUCT() FriendGameInfo_t *pFriendGameInfo )
|
bool GetFriendGamePlayed( CSteamID steamIDFriend, STEAM_OUT_STRUCT() FriendGameInfo_t *pFriendGameInfo )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendGamePlayed %llu %p\n", steamIDFriend.ConvertToUint64(), pFriendGameInfo);
|
PRINT_DEBUG("%llu %p", steamIDFriend.ConvertToUint64(), pFriendGameInfo);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
if (steamIDFriend == settings->get_local_steam_id()) {
|
if (steamIDFriend == settings->get_local_steam_id()) {
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendGamePlayed found myself! %llu %llu\n", settings->get_local_game_id().ToUint64(), settings->get_lobby().ConvertToUint64());
|
PRINT_DEBUG("found myself! %llu %llu", settings->get_local_game_id().ToUint64(), settings->get_lobby().ConvertToUint64());
|
||||||
if (pFriendGameInfo) {
|
if (pFriendGameInfo) {
|
||||||
pFriendGameInfo->m_gameID = settings->get_local_game_id();
|
pFriendGameInfo->m_gameID = settings->get_local_game_id();
|
||||||
pFriendGameInfo->m_unGameIP = 0;
|
pFriendGameInfo->m_unGameIP = 0;
|
||||||
@ -409,7 +413,7 @@ bool GetFriendGamePlayed( CSteamID steamIDFriend, STEAM_OUT_STRUCT() FriendGameI
|
|||||||
} else {
|
} else {
|
||||||
Friend *f = find_friend(steamIDFriend);
|
Friend *f = find_friend(steamIDFriend);
|
||||||
if (f) {
|
if (f) {
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendGamePlayed found someone %u " "%" PRIu64 "\n", f->appid(), f->lobby_id());
|
PRINT_DEBUG("found someone %u " "%" PRIu64 "", f->appid(), f->lobby_id());
|
||||||
if (pFriendGameInfo) {
|
if (pFriendGameInfo) {
|
||||||
pFriendGameInfo->m_gameID = CGameID(f->appid());
|
pFriendGameInfo->m_gameID = CGameID(f->appid());
|
||||||
pFriendGameInfo->m_unGameIP = 0;
|
pFriendGameInfo->m_unGameIP = 0;
|
||||||
@ -427,7 +431,7 @@ bool GetFriendGamePlayed( CSteamID steamIDFriend, STEAM_OUT_STRUCT() FriendGameI
|
|||||||
|
|
||||||
bool GetFriendGamePlayed( CSteamID steamIDFriend, uint64 *pulGameID, uint32 *punGameIP, uint16 *pusGamePort, uint16 *pusQueryPort )
|
bool GetFriendGamePlayed( CSteamID steamIDFriend, uint64 *pulGameID, uint32 *punGameIP, uint16 *pusGamePort, uint16 *pusQueryPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendGamePlayed old\n");
|
PRINT_DEBUG("old");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
FriendGameInfo_t info;
|
FriendGameInfo_t info;
|
||||||
bool ret = GetFriendGamePlayed(steamIDFriend, &info);
|
bool ret = GetFriendGamePlayed(steamIDFriend, &info);
|
||||||
@ -444,7 +448,7 @@ bool GetFriendGamePlayed( CSteamID steamIDFriend, uint64 *pulGameID, uint32 *pun
|
|||||||
// accesses old friends names - returns an empty string when their are no more items in the history
|
// accesses old friends names - returns an empty string when their are no more items in the history
|
||||||
const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName )
|
const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendPersonaNameHistory\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
const char *ret = "";
|
const char *ret = "";
|
||||||
if (iPersonaName == 0) ret = GetFriendPersonaName(steamIDFriend);
|
if (iPersonaName == 0) ret = GetFriendPersonaName(steamIDFriend);
|
||||||
@ -456,7 +460,8 @@ const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaNam
|
|||||||
// friends steam level
|
// friends steam level
|
||||||
int GetFriendSteamLevel( CSteamID steamIDFriend )
|
int GetFriendSteamLevel( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendSteamLevel\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +469,8 @@ int GetFriendSteamLevel( CSteamID steamIDFriend )
|
|||||||
// Returns nickname the current user has set for the specified player. Returns NULL if the no nickname has been set for that player.
|
// Returns nickname the current user has set for the specified player. Returns NULL if the no nickname has been set for that player.
|
||||||
const char *GetPlayerNickname( CSteamID steamIDPlayer )
|
const char *GetPlayerNickname( CSteamID steamIDPlayer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetPlayerNickname\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,35 +479,40 @@ const char *GetPlayerNickname( CSteamID steamIDPlayer )
|
|||||||
// returns the number of friends groups
|
// returns the number of friends groups
|
||||||
int GetFriendsGroupCount()
|
int GetFriendsGroupCount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendsGroupCount\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the friends group ID for the given index (invalid indices return k_FriendsGroupID_Invalid)
|
// returns the friends group ID for the given index (invalid indices return k_FriendsGroupID_Invalid)
|
||||||
FriendsGroupID_t GetFriendsGroupIDByIndex( int iFG )
|
FriendsGroupID_t GetFriendsGroupIDByIndex( int iFG )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendsGroupIDByIndex\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_FriendsGroupID_Invalid;
|
return k_FriendsGroupID_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the name for the given friends group (NULL in the case of invalid friends group IDs)
|
// returns the name for the given friends group (NULL in the case of invalid friends group IDs)
|
||||||
const char *GetFriendsGroupName( FriendsGroupID_t friendsGroupID )
|
const char *GetFriendsGroupName( FriendsGroupID_t friendsGroupID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendsGroupName\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the number of members in a given friends group
|
// returns the number of members in a given friends group
|
||||||
int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID )
|
int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendsGroupMembersCount\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets up to nMembersCount members of the given friends group, if fewer exist than requested those positions' SteamIDs will be invalid
|
// gets up to nMembersCount members of the given friends group, if fewer exist than requested those positions' SteamIDs will be invalid
|
||||||
void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, STEAM_OUT_ARRAY_CALL(nMembersCount, GetFriendsGroupMembersCount, friendsGroupID ) CSteamID *pOutSteamIDMembers, int nMembersCount )
|
void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, STEAM_OUT_ARRAY_CALL(nMembersCount, GetFriendsGroupMembersCount, friendsGroupID ) CSteamID *pOutSteamIDMembers, int nMembersCount )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendsGroupMembersList\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -509,9 +520,9 @@ void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, STEAM_OUT_ARRA
|
|||||||
// iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values
|
// iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values
|
||||||
bool HasFriend( CSteamID steamIDFriend, int iFriendFlags )
|
bool HasFriend( CSteamID steamIDFriend, int iFriendFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::HasFriend\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
bool ret = false;
|
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
bool ret = false;
|
||||||
if (ok_friend_flags(iFriendFlags)) if (find_friend(steamIDFriend)) ret = true;
|
if (ok_friend_flags(iFriendFlags)) if (find_friend(steamIDFriend)) ret = true;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -519,14 +530,16 @@ bool HasFriend( CSteamID steamIDFriend, int iFriendFlags )
|
|||||||
|
|
||||||
bool HasFriend( CSteamID steamIDFriend, EFriendFlags eFriendFlags )
|
bool HasFriend( CSteamID steamIDFriend, EFriendFlags eFriendFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::HasFriend old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return HasFriend(steamIDFriend, (int)eFriendFlags );
|
return HasFriend(steamIDFriend, (int)eFriendFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
// clan (group) iteration and access functions
|
// clan (group) iteration and access functions
|
||||||
int GetClanCount()
|
int GetClanCount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetClanCount\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (auto &c : settings->subscribed_groups_clans) counter++;
|
for (auto &c : settings->subscribed_groups_clans) counter++;
|
||||||
return counter;
|
return counter;
|
||||||
@ -534,7 +547,8 @@ int GetClanCount()
|
|||||||
|
|
||||||
CSteamID GetClanByIndex( int iClan )
|
CSteamID GetClanByIndex( int iClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetClanByIndex\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (auto &c : settings->subscribed_groups_clans) {
|
for (auto &c : settings->subscribed_groups_clans) {
|
||||||
if (counter == iClan) return c.id;
|
if (counter == iClan) return c.id;
|
||||||
@ -545,7 +559,8 @@ CSteamID GetClanByIndex( int iClan )
|
|||||||
|
|
||||||
const char *GetClanName( CSteamID steamIDClan )
|
const char *GetClanName( CSteamID steamIDClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetClanName\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
for (auto &c : settings->subscribed_groups_clans) {
|
for (auto &c : settings->subscribed_groups_clans) {
|
||||||
if (c.id.ConvertToUint64() == steamIDClan.ConvertToUint64()) return c.name.c_str();
|
if (c.id.ConvertToUint64() == steamIDClan.ConvertToUint64()) return c.name.c_str();
|
||||||
}
|
}
|
||||||
@ -554,7 +569,8 @@ const char *GetClanName( CSteamID steamIDClan )
|
|||||||
|
|
||||||
const char *GetClanTag( CSteamID steamIDClan )
|
const char *GetClanTag( CSteamID steamIDClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetClanTag\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
for (auto &c : settings->subscribed_groups_clans) {
|
for (auto &c : settings->subscribed_groups_clans) {
|
||||||
if (c.id.ConvertToUint64() == steamIDClan.ConvertToUint64()) return c.tag.c_str();
|
if (c.id.ConvertToUint64() == steamIDClan.ConvertToUint64()) return c.tag.c_str();
|
||||||
}
|
}
|
||||||
@ -564,14 +580,16 @@ const char *GetClanTag( CSteamID steamIDClan )
|
|||||||
// returns the most recent information we have about what's happening in a clan
|
// returns the most recent information we have about what's happening in a clan
|
||||||
bool GetClanActivityCounts( CSteamID steamIDClan, int *pnOnline, int *pnInGame, int *pnChatting )
|
bool GetClanActivityCounts( CSteamID steamIDClan, int *pnOnline, int *pnInGame, int *pnChatting )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetClanActivityCounts %llu\n", steamIDClan.ConvertToUint64());
|
PRINT_DEBUG("TODO %llu", steamIDClan.ConvertToUint64());
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for clans a user is a member of, they will have reasonably up-to-date information, but for others you'll have to download the info to have the latest
|
// for clans a user is a member of, they will have reasonably up-to-date information, but for others you'll have to download the info to have the latest
|
||||||
SteamAPICall_t DownloadClanActivityCounts( STEAM_ARRAY_COUNT(cClansToRequest) CSteamID *psteamIDClans, int cClansToRequest )
|
SteamAPICall_t DownloadClanActivityCounts( STEAM_ARRAY_COUNT(cClansToRequest) CSteamID *psteamIDClans, int cClansToRequest )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::DownloadClanActivityCounts\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,14 +600,16 @@ SteamAPICall_t DownloadClanActivityCounts( STEAM_ARRAY_COUNT(cClansToRequest) CS
|
|||||||
// steamIDSource can be the steamID of a group, game server, lobby or chat room
|
// steamIDSource can be the steamID of a group, game server, lobby or chat room
|
||||||
int GetFriendCountFromSource( CSteamID steamIDSource )
|
int GetFriendCountFromSource( CSteamID steamIDSource )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendCountFromSource %llu\n", steamIDSource.ConvertToUint64());
|
PRINT_DEBUG("TODO %llu", steamIDSource.ConvertToUint64());
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend )
|
CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendFromSourceByIndex\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_steamIDNil;
|
return k_steamIDNil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,7 +617,7 @@ CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend )
|
|||||||
// returns true if the local user can see that steamIDUser is a member or in steamIDSource
|
// returns true if the local user can see that steamIDUser is a member or in steamIDSource
|
||||||
bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource )
|
bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::IsUserInSource %llu %llu\n", steamIDUser.ConvertToUint64(), steamIDSource.ConvertToUint64());
|
PRINT_DEBUG("%llu %llu", steamIDUser.ConvertToUint64(), steamIDSource.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (steamIDUser == settings->get_local_steam_id()) {
|
if (steamIDUser == settings->get_local_steam_id()) {
|
||||||
if (settings->get_lobby() == steamIDSource) {
|
if (settings->get_lobby() == steamIDSource) {
|
||||||
@ -620,7 +640,8 @@ bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource )
|
|||||||
// User is in a game pressing the talk button (will suppress the microphone for all voice comms from the Steam friends UI)
|
// User is in a game pressing the talk button (will suppress the microphone for all voice comms from the Steam friends UI)
|
||||||
void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking )
|
void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::SetInGameVoiceSpeaking\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -628,7 +649,8 @@ void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking )
|
|||||||
// valid options are "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements"
|
// valid options are "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements"
|
||||||
void ActivateGameOverlay( const char *pchDialog )
|
void ActivateGameOverlay( const char *pchDialog )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::ActivateGameOverlay %s\n", pchDialog);
|
PRINT_DEBUG("%s", pchDialog);
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
overlay->OpenOverlay(pchDialog);
|
overlay->OpenOverlay(pchDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -646,7 +668,8 @@ void ActivateGameOverlay( const char *pchDialog )
|
|||||||
// "friendrequestignore" - opens the overlay in minimal mode prompting the user to ignore an incoming friend invite
|
// "friendrequestignore" - opens the overlay in minimal mode prompting the user to ignore an incoming friend invite
|
||||||
void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID )
|
void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::ActivateGameOverlayToUser %s %llu\n", pchDialog, steamID.ConvertToUint64());
|
PRINT_DEBUG("TODO %s %llu", pchDialog, steamID.ConvertToUint64());
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -654,46 +677,52 @@ void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID )
|
|||||||
// full address with protocol type is required, e.g. http://www.steamgames.com/
|
// full address with protocol type is required, e.g. http://www.steamgames.com/
|
||||||
void ActivateGameOverlayToWebPage( const char *pchURL, EActivateGameOverlayToWebPageMode eMode = k_EActivateGameOverlayToWebPageMode_Default )
|
void ActivateGameOverlayToWebPage( const char *pchURL, EActivateGameOverlayToWebPageMode eMode = k_EActivateGameOverlayToWebPageMode_Default )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::ActivateGameOverlayToWebPage %s %u\n", pchURL, eMode);
|
PRINT_DEBUG("TODO %s %u", pchURL, eMode);
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
overlay->OpenOverlayWebpage(pchURL);
|
overlay->OpenOverlayWebpage(pchURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivateGameOverlayToWebPage( const char *pchURL )
|
void ActivateGameOverlayToWebPage( const char *pchURL )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::ActivateGameOverlayToWebPage old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
ActivateGameOverlayToWebPage( pchURL, k_EActivateGameOverlayToWebPageMode_Default );
|
ActivateGameOverlayToWebPage( pchURL, k_EActivateGameOverlayToWebPageMode_Default );
|
||||||
}
|
}
|
||||||
|
|
||||||
// activates game overlay to store page for app
|
// activates game overlay to store page for app
|
||||||
void ActivateGameOverlayToStore( AppId_t nAppID, EOverlayToStoreFlag eFlag )
|
void ActivateGameOverlayToStore( AppId_t nAppID, EOverlayToStoreFlag eFlag )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::ActivateGameOverlayToStore\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivateGameOverlayToStore( AppId_t nAppID)
|
void ActivateGameOverlayToStore( AppId_t nAppID)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::ActivateGameOverlayToStore old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark a target user as 'played with'. This is a client-side only feature that requires that the calling user is
|
// Mark a target user as 'played with'. This is a client-side only feature that requires that the calling user is
|
||||||
// in game
|
// in game
|
||||||
void SetPlayedWith( CSteamID steamIDUserPlayedWith )
|
void SetPlayedWith( CSteamID steamIDUserPlayedWith )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::SetPlayedWith\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// activates game overlay to open the invite dialog. Invitations will be sent for the provided lobby.
|
// activates game overlay to open the invite dialog. Invitations will be sent for the provided lobby.
|
||||||
void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby )
|
void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::ActivateGameOverlayInviteDialog\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
overlay->OpenOverlayInvite(steamIDLobby);
|
overlay->OpenOverlayInvite(steamIDLobby);
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets the small (32x32) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
|
// gets the small (32x32) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
|
||||||
int GetSmallFriendAvatar( CSteamID steamIDFriend )
|
int GetSmallFriendAvatar( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetSmallFriendAvatar\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
//IMPORTANT NOTE: don't change friend avatar numbers for the same friend or else some games endlessly allocate stuff.
|
//IMPORTANT NOTE: don't change friend avatar numbers for the same friend or else some games endlessly allocate stuff.
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Avatar_Numbers numbers = add_friend_avatars(steamIDFriend);
|
struct Avatar_Numbers numbers = add_friend_avatars(steamIDFriend);
|
||||||
@ -704,7 +733,7 @@ int GetSmallFriendAvatar( CSteamID steamIDFriend )
|
|||||||
// gets the medium (64x64) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
|
// gets the medium (64x64) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
|
||||||
int GetMediumFriendAvatar( CSteamID steamIDFriend )
|
int GetMediumFriendAvatar( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetMediumFriendAvatar\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Avatar_Numbers numbers = add_friend_avatars(steamIDFriend);
|
struct Avatar_Numbers numbers = add_friend_avatars(steamIDFriend);
|
||||||
return numbers.medium;
|
return numbers.medium;
|
||||||
@ -715,7 +744,7 @@ int GetMediumFriendAvatar( CSteamID steamIDFriend )
|
|||||||
// returns -1 if this image has yet to be loaded, in this case wait for a AvatarImageLoaded_t callback and then call this again
|
// returns -1 if this image has yet to be loaded, in this case wait for a AvatarImageLoaded_t callback and then call this again
|
||||||
int GetLargeFriendAvatar( CSteamID steamIDFriend )
|
int GetLargeFriendAvatar( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetLargeFriendAvatar\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Avatar_Numbers numbers = add_friend_avatars(steamIDFriend);
|
struct Avatar_Numbers numbers = add_friend_avatars(steamIDFriend);
|
||||||
return numbers.large;
|
return numbers.large;
|
||||||
@ -723,7 +752,8 @@ int GetLargeFriendAvatar( CSteamID steamIDFriend )
|
|||||||
|
|
||||||
int GetFriendAvatar( CSteamID steamIDFriend, int eAvatarSize )
|
int GetFriendAvatar( CSteamID steamIDFriend, int eAvatarSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendAvatar\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (eAvatarSize == k_EAvatarSize32x32) {
|
if (eAvatarSize == k_EAvatarSize32x32) {
|
||||||
return GetSmallFriendAvatar(steamIDFriend);
|
return GetSmallFriendAvatar(steamIDFriend);
|
||||||
} else if (eAvatarSize == k_EAvatarSize64x64) {
|
} else if (eAvatarSize == k_EAvatarSize64x64) {
|
||||||
@ -737,7 +767,8 @@ int GetFriendAvatar( CSteamID steamIDFriend, int eAvatarSize )
|
|||||||
|
|
||||||
int GetFriendAvatar(CSteamID steamIDFriend)
|
int GetFriendAvatar(CSteamID steamIDFriend)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendAvatar old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return GetFriendAvatar(steamIDFriend, k_EAvatarSize32x32);
|
return GetFriendAvatar(steamIDFriend, k_EAvatarSize32x32);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -748,7 +779,7 @@ int GetFriendAvatar(CSteamID steamIDFriend)
|
|||||||
// if returns false, it means that we already have all the details about that user, and functions can be called immediately
|
// if returns false, it means that we already have all the details about that user, and functions can be called immediately
|
||||||
bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly )
|
bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::RequestUserInformation\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//persona_change(steamIDUser, k_EPersonaChangeName);
|
//persona_change(steamIDUser, k_EPersonaChangeName);
|
||||||
//We already know everything
|
//We already know everything
|
||||||
@ -765,7 +796,8 @@ bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly )
|
|||||||
STEAM_CALL_RESULT( ClanOfficerListResponse_t )
|
STEAM_CALL_RESULT( ClanOfficerListResponse_t )
|
||||||
SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan )
|
SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::RequestClanOfficerList\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -775,21 +807,24 @@ SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan )
|
|||||||
// returns the steamID of the clan owner
|
// returns the steamID of the clan owner
|
||||||
CSteamID GetClanOwner( CSteamID steamIDClan )
|
CSteamID GetClanOwner( CSteamID steamIDClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetClanOwner\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_steamIDNil;
|
return k_steamIDNil;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the number of officers in a clan (including the owner)
|
// returns the number of officers in a clan (including the owner)
|
||||||
int GetClanOfficerCount( CSteamID steamIDClan )
|
int GetClanOfficerCount( CSteamID steamIDClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetClanOfficerCount\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount)
|
// returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount)
|
||||||
CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer )
|
CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetClanOfficerByIndex\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_steamIDNil;
|
return k_steamIDNil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,13 +833,15 @@ CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer )
|
|||||||
// a chat restricted user can't add friends or join any groups.
|
// a chat restricted user can't add friends or join any groups.
|
||||||
uint32 GetUserRestrictions()
|
uint32 GetUserRestrictions()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetUserRestrictions\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_nUserRestrictionNone;
|
return k_nUserRestrictionNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
EUserRestriction GetUserRestrictions_old()
|
EUserRestriction GetUserRestrictions_old()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetUserRestrictions old\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_nUserRestrictionNone;
|
return k_nUserRestrictionNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -820,7 +857,7 @@ EUserRestriction GetUserRestrictions_old()
|
|||||||
// and GetFriendRichPresenceKeyByIndex() (typically only used for debugging)
|
// and GetFriendRichPresenceKeyByIndex() (typically only used for debugging)
|
||||||
bool SetRichPresence( const char *pchKey, const char *pchValue )
|
bool SetRichPresence( const char *pchKey, const char *pchValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::SetRichPresence %s %s\n", pchKey, pchValue ? pchValue : "NULL");
|
PRINT_DEBUG("%s %s", pchKey, pchValue ? pchValue : "NULL");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (pchValue) {
|
if (pchValue) {
|
||||||
auto prev_value = (*us.mutable_rich_presence()).find(pchKey);
|
auto prev_value = (*us.mutable_rich_presence()).find(pchKey);
|
||||||
@ -841,7 +878,7 @@ bool SetRichPresence( const char *pchKey, const char *pchValue )
|
|||||||
|
|
||||||
void ClearRichPresence()
|
void ClearRichPresence()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::ClearRichPresence\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
us.mutable_rich_presence()->clear();
|
us.mutable_rich_presence()->clear();
|
||||||
resend_friend_data();
|
resend_friend_data();
|
||||||
@ -850,7 +887,7 @@ void ClearRichPresence()
|
|||||||
|
|
||||||
const char *GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey )
|
const char *GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendRichPresence %llu '%s'\n", steamIDFriend.ConvertToUint64(), pchKey);
|
PRINT_DEBUG("%llu '%s'", steamIDFriend.ConvertToUint64(), pchKey);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
const char *value = "";
|
const char *value = "";
|
||||||
|
|
||||||
@ -866,13 +903,13 @@ const char *GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey )
|
|||||||
if (result != f->rich_presence().end()) value = result->second.c_str();
|
if (result != f->rich_presence().end()) value = result->second.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendRichPresence returned '%s'\n", value);
|
PRINT_DEBUG("returned '%s'", value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend )
|
int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendRichPresenceKeyCount\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
|
||||||
@ -890,7 +927,7 @@ int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend )
|
|||||||
|
|
||||||
const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey )
|
const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendRichPresenceKeyByIndex\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
const char *key = "";
|
const char *key = "";
|
||||||
|
|
||||||
@ -914,7 +951,7 @@ const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey )
|
|||||||
// Requests rich presence for a specific user.
|
// Requests rich presence for a specific user.
|
||||||
void RequestFriendRichPresence( CSteamID steamIDFriend )
|
void RequestFriendRichPresence( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::RequestFriendRichPresence\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Friend *f = find_friend(steamIDFriend);
|
Friend *f = find_friend(steamIDFriend);
|
||||||
if (f) rich_presence_updated(steamIDFriend, settings->get_local_game_id().AppID());
|
if (f) rich_presence_updated(steamIDFriend, settings->get_local_game_id().AppID());
|
||||||
@ -928,7 +965,7 @@ void RequestFriendRichPresence( CSteamID steamIDFriend )
|
|||||||
// invites can only be sent to friends
|
// invites can only be sent to friends
|
||||||
bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString )
|
bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::InviteUserToGame\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Friend *f = find_friend(steamIDFriend);
|
Friend *f = find_friend(steamIDFriend);
|
||||||
if (!f) return false;
|
if (!f) return false;
|
||||||
@ -949,25 +986,29 @@ bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString )
|
|||||||
// GetFriendCoplayTime() returns as a unix time
|
// GetFriendCoplayTime() returns as a unix time
|
||||||
int GetCoplayFriendCount()
|
int GetCoplayFriendCount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetCoplayFriendCount\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSteamID GetCoplayFriend( int iCoplayFriend )
|
CSteamID GetCoplayFriend( int iCoplayFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetCoplayFriend\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_steamIDNil;
|
return k_steamIDNil;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetFriendCoplayTime( CSteamID steamIDFriend )
|
int GetFriendCoplayTime( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendCoplayTime\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppId_t GetFriendCoplayGame( CSteamID steamIDFriend )
|
AppId_t GetFriendCoplayGame( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendCoplayGame\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -979,7 +1020,7 @@ AppId_t GetFriendCoplayGame( CSteamID steamIDFriend )
|
|||||||
STEAM_CALL_RESULT( JoinClanChatRoomCompletionResult_t )
|
STEAM_CALL_RESULT( JoinClanChatRoomCompletionResult_t )
|
||||||
SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan )
|
SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::JoinClanChatRoom %llu\n", steamIDClan.ConvertToUint64());
|
PRINT_DEBUG("TODO %llu", steamIDClan.ConvertToUint64());
|
||||||
//TODO actually join a room
|
//TODO actually join a room
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
JoinClanChatRoomCompletionResult_t data;
|
JoinClanChatRoomCompletionResult_t data;
|
||||||
@ -990,37 +1031,43 @@ SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan )
|
|||||||
|
|
||||||
bool LeaveClanChatRoom( CSteamID steamIDClan )
|
bool LeaveClanChatRoom( CSteamID steamIDClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::LeaveClanChatRoom\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetClanChatMemberCount( CSteamID steamIDClan )
|
int GetClanChatMemberCount( CSteamID steamIDClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetClanChatMemberCount\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser )
|
CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetChatMemberByIndex\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_steamIDNil;
|
return k_steamIDNil;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText )
|
bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::SendClanChatMessage\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, STEAM_OUT_STRUCT() CSteamID *psteamidChatter )
|
int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, STEAM_OUT_STRUCT() CSteamID *psteamidChatter )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetClanChatMessage\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser )
|
bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::IsClanChatAdmin\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1028,19 +1075,22 @@ bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser )
|
|||||||
// interact with the Steam (game overlay / desktop)
|
// interact with the Steam (game overlay / desktop)
|
||||||
bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat )
|
bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::IsClanChatWindowOpenInSteam\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat )
|
bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::OpenClanChatWindowInSteam\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat )
|
bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::CloseClanChatWindowInSteam\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1049,19 +1099,22 @@ bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat )
|
|||||||
// this is so you can show P2P chats inline in the game
|
// this is so you can show P2P chats inline in the game
|
||||||
bool SetListenForFriendsMessages( bool bInterceptEnabled )
|
bool SetListenForFriendsMessages( bool bInterceptEnabled )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::SetListenForFriendsMessages\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReplyToFriendMessage( CSteamID steamIDFriend, const char *pchMsgToSend )
|
bool ReplyToFriendMessage( CSteamID steamIDFriend, const char *pchMsgToSend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::ReplyToFriendMessage\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType )
|
int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendMessage\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1070,46 +1123,52 @@ int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int
|
|||||||
STEAM_CALL_RESULT( FriendsGetFollowerCount_t )
|
STEAM_CALL_RESULT( FriendsGetFollowerCount_t )
|
||||||
SteamAPICall_t GetFollowerCount( CSteamID steamID )
|
SteamAPICall_t GetFollowerCount( CSteamID steamID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFollowerCount\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
STEAM_CALL_RESULT( FriendsIsFollowing_t )
|
STEAM_CALL_RESULT( FriendsIsFollowing_t )
|
||||||
SteamAPICall_t IsFollowing( CSteamID steamID )
|
SteamAPICall_t IsFollowing( CSteamID steamID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::IsFollowing\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
STEAM_CALL_RESULT( FriendsEnumerateFollowingList_t )
|
STEAM_CALL_RESULT( FriendsEnumerateFollowingList_t )
|
||||||
SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex )
|
SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::EnumerateFollowingList\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool IsClanPublic( CSteamID steamIDClan )
|
bool IsClanPublic( CSteamID steamIDClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::IsClanPublic\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsClanOfficialGameGroup( CSteamID steamIDClan )
|
bool IsClanOfficialGameGroup( CSteamID steamIDClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::IsClanOfficialGameGroup\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetNumChatsWithUnreadPriorityMessages()
|
int GetNumChatsWithUnreadPriorityMessages()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetNumChatsWithUnreadPriorityMessages\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivateGameOverlayRemotePlayTogetherInviteDialog( CSteamID steamIDLobby )
|
void ActivateGameOverlayRemotePlayTogetherInviteDialog( CSteamID steamIDLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::ActivateGameOverlayRemotePlayTogetherInviteDialog\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call this before calling ActivateGameOverlayToWebPage() to have the Steam Overlay Browser block navigations
|
// Call this before calling ActivateGameOverlayToWebPage() to have the Steam Overlay Browser block navigations
|
||||||
@ -1117,14 +1176,16 @@ void ActivateGameOverlayRemotePlayTogetherInviteDialog( CSteamID steamIDLobby )
|
|||||||
// ActivateGameOverlayToWebPage() must have been called with k_EActivateGameOverlayToWebPageMode_Modal
|
// ActivateGameOverlayToWebPage() must have been called with k_EActivateGameOverlayToWebPageMode_Modal
|
||||||
bool RegisterProtocolInOverlayBrowser( const char *pchProtocol )
|
bool RegisterProtocolInOverlayBrowser( const char *pchProtocol )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::RegisterProtocolInOverlayBrowser\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
void ActivateGameOverlayInviteDialogConnectString( const char *pchConnectString )
|
void ActivateGameOverlayInviteDialogConnectString( const char *pchConnectString )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::ActivateGameOverlayInviteDialogConnectString\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Steam Community items equipped by a user on their profile
|
// Steam Community items equipped by a user on their profile
|
||||||
@ -1132,38 +1193,42 @@ void ActivateGameOverlayInviteDialogConnectString( const char *pchConnectString
|
|||||||
STEAM_CALL_RESULT( EquippedProfileItems_t )
|
STEAM_CALL_RESULT( EquippedProfileItems_t )
|
||||||
SteamAPICall_t RequestEquippedProfileItems( CSteamID steamID )
|
SteamAPICall_t RequestEquippedProfileItems( CSteamID steamID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::RequestEquippedProfileItems\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BHasEquippedProfileItem( CSteamID steamID, ECommunityProfileItemType itemType )
|
bool BHasEquippedProfileItem( CSteamID steamID, ECommunityProfileItemType itemType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::BHasEquippedProfileItem\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GetProfileItemPropertyString( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop )
|
const char *GetProfileItemPropertyString( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetProfileItemPropertyString\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GetProfileItemPropertyUint( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop )
|
uint32 GetProfileItemPropertyUint( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetProfileItemPropertyUint\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunCallbacks()
|
void RunCallbacks()
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_Friends::RunCallbacks\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
if (settings->get_lobby() != lobby_id) {
|
if (settings->get_lobby() != lobby_id) {
|
||||||
lobby_id = settings->get_lobby();
|
lobby_id = settings->get_lobby();
|
||||||
resend_friend_data();
|
resend_friend_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modified) {
|
if (modified) {
|
||||||
PRINT_DEBUG("Steam_Friends::RunCallbacks sending modified data\n");
|
PRINT_DEBUG("sending modified data");
|
||||||
Common_Message msg;
|
Common_Message msg;
|
||||||
msg.set_source_id(settings->get_local_steam_id().ConvertToUint64());
|
msg.set_source_id(settings->get_local_steam_id().ConvertToUint64());
|
||||||
Friend *f = new Friend(us);
|
Friend *f = new Friend(us);
|
||||||
@ -1182,7 +1247,7 @@ void Callback(Common_Message *msg)
|
|||||||
{
|
{
|
||||||
if (msg->has_low_level()) {
|
if (msg->has_low_level()) {
|
||||||
if (msg->low_level().type() == Low_Level::DISCONNECT) {
|
if (msg->low_level().type() == Low_Level::DISCONNECT) {
|
||||||
PRINT_DEBUG("Steam_Friends Disconnect\n");
|
PRINT_DEBUG("Disconnect");
|
||||||
uint64 id = msg->source_id();
|
uint64 id = msg->source_id();
|
||||||
auto f = std::find_if(friends.begin(), friends.end(), [&id](Friend const& item) { return item.id() == id; });
|
auto f = std::find_if(friends.begin(), friends.end(), [&id](Friend const& item) { return item.id() == id; });
|
||||||
if (friends.end() != f) {
|
if (friends.end() != f) {
|
||||||
@ -1193,7 +1258,7 @@ void Callback(Common_Message *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg->low_level().type() == Low_Level::CONNECT) {
|
if (msg->low_level().type() == Low_Level::CONNECT) {
|
||||||
PRINT_DEBUG("Steam_Friends Connect\n");
|
PRINT_DEBUG("Connect %llu", (uint64)msg->source_id());
|
||||||
Common_Message msg_;
|
Common_Message msg_;
|
||||||
msg_.set_source_id(settings->get_local_steam_id().ConvertToUint64());
|
msg_.set_source_id(settings->get_local_steam_id().ConvertToUint64());
|
||||||
msg_.set_dest_id(msg->source_id());
|
msg_.set_dest_id(msg->source_id());
|
||||||
@ -1211,7 +1276,7 @@ void Callback(Common_Message *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_friend_()) {
|
if (msg->has_friend_()) {
|
||||||
PRINT_DEBUG("Steam_Friends Friend " "%" PRIu64 " " "%" PRIu64 "\n", msg->friend_().id(), msg->friend_().lobby_id());
|
PRINT_DEBUG("Friend " "%" PRIu64 " " "%" PRIu64 "", msg->friend_().id(), msg->friend_().lobby_id());
|
||||||
Friend *f = find_friend((uint64)msg->friend_().id());
|
Friend *f = find_friend((uint64)msg->friend_().id());
|
||||||
if (!f) {
|
if (!f) {
|
||||||
if (msg->friend_().id() != settings->get_local_steam_id().ConvertToUint64()) {
|
if (msg->friend_().id() != settings->get_local_steam_id().ConvertToUint64()) {
|
||||||
@ -1237,7 +1302,7 @@ void Callback(Common_Message *msg)
|
|||||||
|
|
||||||
if (msg->has_friend_messages()) {
|
if (msg->has_friend_messages()) {
|
||||||
if (msg->friend_messages().type() == Friend_Messages::LOBBY_INVITE) {
|
if (msg->friend_messages().type() == Friend_Messages::LOBBY_INVITE) {
|
||||||
PRINT_DEBUG("Steam_Friends Got Lobby Invite\n");
|
PRINT_DEBUG("Got Lobby Invite");
|
||||||
Friend *f = find_friend((uint64)msg->source_id());
|
Friend *f = find_friend((uint64)msg->source_id());
|
||||||
if (f) {
|
if (f) {
|
||||||
LobbyInvite_t data;
|
LobbyInvite_t data;
|
||||||
@ -1263,7 +1328,7 @@ void Callback(Common_Message *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg->friend_messages().type() == Friend_Messages::GAME_INVITE) {
|
if (msg->friend_messages().type() == Friend_Messages::GAME_INVITE) {
|
||||||
PRINT_DEBUG("Steam_Friends Got Game Invite\n");
|
PRINT_DEBUG("Got Game Invite");
|
||||||
//TODO: I'm pretty sure that the user should accept the invite before this is posted but we do like above
|
//TODO: I'm pretty sure that the user should accept the invite before this is posted but we do like above
|
||||||
if (overlay->Ready() && !settings->hasOverlayAutoAcceptInviteFromFriend(msg->source_id()))
|
if (overlay->Ready() && !settings->hasOverlayAutoAcceptInviteFromFriend(msg->source_id()))
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ void push_incoming(std::string message)
|
|||||||
public:
|
public:
|
||||||
static void steam_callback(void *object, Common_Message *msg)
|
static void steam_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_gamecoordinator_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Game_Coordinator *steam_gamecoordinator = (Steam_Game_Coordinator *)object;
|
Steam_Game_Coordinator *steam_gamecoordinator = (Steam_Game_Coordinator *)object;
|
||||||
steam_gamecoordinator->Callback(msg);
|
steam_gamecoordinator->Callback(msg);
|
||||||
@ -49,7 +49,7 @@ static void steam_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_gamecoordinator_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Game_Coordinator *steam_gamecoordinator = (Steam_Game_Coordinator *)object;
|
Steam_Game_Coordinator *steam_gamecoordinator = (Steam_Game_Coordinator *)object;
|
||||||
steam_gamecoordinator->RunCallbacks();
|
steam_gamecoordinator->RunCallbacks();
|
||||||
@ -76,7 +76,8 @@ Steam_Game_Coordinator(class Settings *settings, class Networking *network, clas
|
|||||||
// sends a message to the Game Coordinator
|
// sends a message to the Game Coordinator
|
||||||
EGCResults SendMessage_( uint32 unMsgType, const void *pubData, uint32 cubData )
|
EGCResults SendMessage_( uint32 unMsgType, const void *pubData, uint32 cubData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Coordinator::SendMessage %X %u len %u\n", unMsgType, (~protobuf_mask) & unMsgType, cubData);
|
PRINT_DEBUG("%X %u len %u", unMsgType, (~protobuf_mask) & unMsgType, cubData);
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (protobuf_mask & unMsgType) {
|
if (protobuf_mask & unMsgType) {
|
||||||
uint32 message_type = (~protobuf_mask) & unMsgType;
|
uint32 message_type = (~protobuf_mask) & unMsgType;
|
||||||
if (message_type == 4006) { //client hello
|
if (message_type == 4006) { //client hello
|
||||||
@ -95,7 +96,8 @@ EGCResults SendMessage_( uint32 unMsgType, const void *pubData, uint32 cubData )
|
|||||||
// returns true if there is a message waiting from the game coordinator
|
// returns true if there is a message waiting from the game coordinator
|
||||||
bool IsMessageAvailable( uint32 *pcubMsgSize )
|
bool IsMessageAvailable( uint32 *pcubMsgSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Coordinator::IsMessageAvailable\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (outgoing_messages.size()) {
|
if (outgoing_messages.size()) {
|
||||||
if (pcubMsgSize) *pcubMsgSize = outgoing_messages.front().size();
|
if (pcubMsgSize) *pcubMsgSize = outgoing_messages.front().size();
|
||||||
return true;
|
return true;
|
||||||
@ -110,7 +112,8 @@ bool IsMessageAvailable( uint32 *pcubMsgSize )
|
|||||||
// and the message remains at the head of the queue.
|
// and the message remains at the head of the queue.
|
||||||
EGCResults RetrieveMessage( uint32 *punMsgType, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize )
|
EGCResults RetrieveMessage( uint32 *punMsgType, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Coordinator::RetrieveMessage\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (outgoing_messages.size()) {
|
if (outgoing_messages.size()) {
|
||||||
if (outgoing_messages.front().size() > cubDest) {
|
if (outgoing_messages.front().size() > cubDest) {
|
||||||
return k_EGCResultBufferTooSmall;
|
return k_EGCResultBufferTooSmall;
|
||||||
|
@ -31,7 +31,7 @@ public ISteamGameSearch
|
|||||||
public:
|
public:
|
||||||
static void steam_callback(void *object, Common_Message *msg)
|
static void steam_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_gamesearch_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Game_Search *steam_gamesearch = (Steam_Game_Search *)object;
|
Steam_Game_Search *steam_gamesearch = (Steam_Game_Search *)object;
|
||||||
steam_gamesearch->Callback(msg);
|
steam_gamesearch->Callback(msg);
|
||||||
@ -39,7 +39,7 @@ static void steam_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_gamesearch_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Game_Search *steam_gamesearch = (Steam_Game_Search *)object;
|
Steam_Game_Search *steam_gamesearch = (Steam_Game_Search *)object;
|
||||||
steam_gamesearch->RunCallbacks();
|
steam_gamesearch->RunCallbacks();
|
||||||
@ -70,7 +70,8 @@ Steam_Game_Search(class Settings *settings, class Networking *network, class Ste
|
|||||||
// fails if a search is currently in progress
|
// fails if a search is currently in progress
|
||||||
EGameSearchErrorCode_t AddGameSearchParams( const char *pchKeyToFind, const char *pchValuesToFind )
|
EGameSearchErrorCode_t AddGameSearchParams( const char *pchKeyToFind, const char *pchValuesToFind )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::AddGameSearchParams\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +81,8 @@ EGameSearchErrorCode_t AddGameSearchParams( const char *pchKeyToFind, const char
|
|||||||
// periodic callbacks will be sent as queue time estimates change
|
// periodic callbacks will be sent as queue time estimates change
|
||||||
EGameSearchErrorCode_t SearchForGameWithLobby( CSteamID steamIDLobby, int nPlayerMin, int nPlayerMax )
|
EGameSearchErrorCode_t SearchForGameWithLobby( CSteamID steamIDLobby, int nPlayerMin, int nPlayerMax )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::SearchForGameWithLobby\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +91,8 @@ EGameSearchErrorCode_t SearchForGameWithLobby( CSteamID steamIDLobby, int nPlaye
|
|||||||
// periodic callbacks will be sent as queue time estimates change
|
// periodic callbacks will be sent as queue time estimates change
|
||||||
EGameSearchErrorCode_t SearchForGameSolo( int nPlayerMin, int nPlayerMax )
|
EGameSearchErrorCode_t SearchForGameSolo( int nPlayerMin, int nPlayerMax )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::SearchForGameSolo\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,13 +101,15 @@ EGameSearchErrorCode_t SearchForGameSolo( int nPlayerMin, int nPlayerMax )
|
|||||||
// multiple SearchForGameResultCallback_t will follow as players accept game until the host starts or cancels the game
|
// multiple SearchForGameResultCallback_t will follow as players accept game until the host starts or cancels the game
|
||||||
EGameSearchErrorCode_t AcceptGame()
|
EGameSearchErrorCode_t AcceptGame()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::AcceptGame\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGameSearchErrorCode_t DeclineGame()
|
EGameSearchErrorCode_t DeclineGame()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::DeclineGame\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +117,8 @@ EGameSearchErrorCode_t DeclineGame()
|
|||||||
// after receiving GameStartedByHostCallback_t get connection details to server
|
// after receiving GameStartedByHostCallback_t get connection details to server
|
||||||
EGameSearchErrorCode_t RetrieveConnectionDetails( CSteamID steamIDHost, char *pchConnectionDetails, int cubConnectionDetails )
|
EGameSearchErrorCode_t RetrieveConnectionDetails( CSteamID steamIDHost, char *pchConnectionDetails, int cubConnectionDetails )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::RetrieveConnectionDetails\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +126,8 @@ EGameSearchErrorCode_t RetrieveConnectionDetails( CSteamID steamIDHost, char *pc
|
|||||||
// leaves queue if still waiting
|
// leaves queue if still waiting
|
||||||
EGameSearchErrorCode_t EndGameSearch()
|
EGameSearchErrorCode_t EndGameSearch()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::EndGameSearch\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +138,8 @@ EGameSearchErrorCode_t EndGameSearch()
|
|||||||
// a keyname and a list of comma separated values: all the values you allow
|
// a keyname and a list of comma separated values: all the values you allow
|
||||||
EGameSearchErrorCode_t SetGameHostParams( const char *pchKey, const char *pchValue )
|
EGameSearchErrorCode_t SetGameHostParams( const char *pchKey, const char *pchValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::SetGameHostParams\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +147,8 @@ EGameSearchErrorCode_t SetGameHostParams( const char *pchKey, const char *pchVal
|
|||||||
// set connection details for players once game is found so they can connect to this server
|
// set connection details for players once game is found so they can connect to this server
|
||||||
EGameSearchErrorCode_t SetConnectionDetails( const char *pchConnectionDetails, int cubConnectionDetails )
|
EGameSearchErrorCode_t SetConnectionDetails( const char *pchConnectionDetails, int cubConnectionDetails )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::SetConnectionDetails\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +160,8 @@ EGameSearchErrorCode_t SetConnectionDetails( const char *pchConnectionDetails, i
|
|||||||
// multple RequestPlayersForGameResultCallback_t callbacks will follow when players are found
|
// multple RequestPlayersForGameResultCallback_t callbacks will follow when players are found
|
||||||
EGameSearchErrorCode_t RequestPlayersForGame( int nPlayerMin, int nPlayerMax, int nMaxTeamSize )
|
EGameSearchErrorCode_t RequestPlayersForGame( int nPlayerMin, int nPlayerMax, int nMaxTeamSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::RequestPlayersForGame\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +171,8 @@ EGameSearchErrorCode_t RequestPlayersForGame( int nPlayerMin, int nPlayerMax, in
|
|||||||
// ( allows host to accept after all players confirm, some confirm, or none confirm. decision is entirely up to the host )
|
// ( allows host to accept after all players confirm, some confirm, or none confirm. decision is entirely up to the host )
|
||||||
EGameSearchErrorCode_t HostConfirmGameStart( uint64 ullUniqueGameID )
|
EGameSearchErrorCode_t HostConfirmGameStart( uint64 ullUniqueGameID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::HostConfirmGameStart\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +181,8 @@ EGameSearchErrorCode_t HostConfirmGameStart( uint64 ullUniqueGameID )
|
|||||||
// if a set of players has already been sent to host, all players will receive SearchForGameHostFailedToConfirm_t
|
// if a set of players has already been sent to host, all players will receive SearchForGameHostFailedToConfirm_t
|
||||||
EGameSearchErrorCode_t CancelRequestPlayersForGame()
|
EGameSearchErrorCode_t CancelRequestPlayersForGame()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::CancelRequestPlayersForGame\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +190,8 @@ EGameSearchErrorCode_t CancelRequestPlayersForGame()
|
|||||||
// submit a result for one player. does not end the game. ullUniqueGameID continues to describe this game
|
// submit a result for one player. does not end the game. ullUniqueGameID continues to describe this game
|
||||||
EGameSearchErrorCode_t SubmitPlayerResult( uint64 ullUniqueGameID, CSteamID steamIDPlayer, EPlayerResult_t EPlayerResult )
|
EGameSearchErrorCode_t SubmitPlayerResult( uint64 ullUniqueGameID, CSteamID steamIDPlayer, EPlayerResult_t EPlayerResult )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::SubmitPlayerResult\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +200,8 @@ EGameSearchErrorCode_t SubmitPlayerResult( uint64 ullUniqueGameID, CSteamID stea
|
|||||||
// any future requests will provide a new ullUniqueGameID
|
// any future requests will provide a new ullUniqueGameID
|
||||||
EGameSearchErrorCode_t EndGame( uint64 ullUniqueGameID )
|
EGameSearchErrorCode_t EndGame( uint64 ullUniqueGameID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Game_Search::EndGame\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EGameSearchErrorCode_Failed_Offline;
|
return k_EGameSearchErrorCode_Failed_Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ struct Steam_Inventory_Requests *get_inventory_result(SteamInventoryResult_t res
|
|||||||
void read_items_db()
|
void read_items_db()
|
||||||
{
|
{
|
||||||
std::string items_db_path = Local_Storage::get_game_settings_path() + items_user_file;
|
std::string items_db_path = Local_Storage::get_game_settings_path() + items_user_file;
|
||||||
PRINT_DEBUG("Steam_Inventory::Items file path: %s\n", items_db_path.c_str());
|
PRINT_DEBUG("file path: %s", items_db_path.c_str());
|
||||||
local_storage->load_json(items_db_path, defined_items);
|
local_storage->load_json(items_db_path, defined_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ void read_inventory_db()
|
|||||||
{
|
{
|
||||||
// Try to load a default one
|
// Try to load a default one
|
||||||
std::string items_db_path = Local_Storage::get_game_settings_path() + items_default_file;
|
std::string items_db_path = Local_Storage::get_game_settings_path() + items_default_file;
|
||||||
PRINT_DEBUG("Steam_Inventory::Default items file path: %s\n", items_db_path.c_str());
|
PRINT_DEBUG("items file path: %s", items_db_path.c_str());
|
||||||
local_storage->load_json(items_db_path, user_items);
|
local_storage->load_json(items_db_path, user_items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ public:
|
|||||||
|
|
||||||
static void run_every_runcb_cb(void *object)
|
static void run_every_runcb_cb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_Inventory::run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Inventory *obj = (Steam_Inventory *)object;
|
Steam_Inventory *obj = (Steam_Inventory *)object;
|
||||||
obj->RunCallbacks();
|
obj->RunCallbacks();
|
||||||
@ -156,7 +156,7 @@ Steam_Inventory(class Settings *settings, class SteamCallResults *callback_resul
|
|||||||
STEAM_METHOD_DESC(Find out the status of an asynchronous inventory result handle.)
|
STEAM_METHOD_DESC(Find out the status of an asynchronous inventory result handle.)
|
||||||
EResult GetResultStatus( SteamInventoryResult_t resultHandle )
|
EResult GetResultStatus( SteamInventoryResult_t resultHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetResultStatus\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Steam_Inventory_Requests *request = get_inventory_result(resultHandle);
|
struct Steam_Inventory_Requests *request = get_inventory_result(resultHandle);
|
||||||
if (!request) return k_EResultInvalidParam;
|
if (!request) return k_EResultInvalidParam;
|
||||||
@ -172,7 +172,7 @@ bool GetResultItems( SteamInventoryResult_t resultHandle,
|
|||||||
STEAM_OUT_ARRAY_COUNT( punOutItemsArraySize,Output array) SteamItemDetails_t *pOutItemsArray,
|
STEAM_OUT_ARRAY_COUNT( punOutItemsArraySize,Output array) SteamItemDetails_t *pOutItemsArray,
|
||||||
uint32 *punOutItemsArraySize )
|
uint32 *punOutItemsArraySize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetResultItems\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Steam_Inventory_Requests *request = get_inventory_result(resultHandle);
|
struct Steam_Inventory_Requests *request = get_inventory_result(resultHandle);
|
||||||
if (!request) return false;
|
if (!request) return false;
|
||||||
@ -235,7 +235,7 @@ bool GetResultItems( SteamInventoryResult_t resultHandle,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Inventory::GetResultItems good\n");
|
PRINT_DEBUG("good");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +257,8 @@ bool GetResultItemProperty( SteamInventoryResult_t resultHandle,
|
|||||||
const char *pchPropertyName,
|
const char *pchPropertyName,
|
||||||
STEAM_OUT_STRING_COUNT( punValueBufferSizeOut ) char *pchValueBuffer, uint32 *punValueBufferSizeOut )
|
STEAM_OUT_STRING_COUNT( punValueBufferSizeOut ) char *pchValueBuffer, uint32 *punValueBufferSizeOut )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetResultItemProperty\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO
|
//TODO
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -268,7 +269,7 @@ bool GetResultItemProperty( SteamInventoryResult_t resultHandle,
|
|||||||
STEAM_METHOD_DESC(Returns the server time at which the result was generated. Compare against the value of IClientUtils::GetServerRealTime() to determine age.)
|
STEAM_METHOD_DESC(Returns the server time at which the result was generated. Compare against the value of IClientUtils::GetServerRealTime() to determine age.)
|
||||||
uint32 GetResultTimestamp( SteamInventoryResult_t resultHandle )
|
uint32 GetResultTimestamp( SteamInventoryResult_t resultHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetResultTimestamp\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Steam_Inventory_Requests *request = get_inventory_result(resultHandle);
|
struct Steam_Inventory_Requests *request = get_inventory_result(resultHandle);
|
||||||
if (!request || !request->result_done()) return 0;
|
if (!request || !request->result_done()) return 0;
|
||||||
@ -282,7 +283,8 @@ uint32 GetResultTimestamp( SteamInventoryResult_t resultHandle )
|
|||||||
STEAM_METHOD_DESC(Returns true if the result belongs to the target steam ID or false if the result does not. This is important when using DeserializeResult to verify that a remote player is not pretending to have a different users inventory.)
|
STEAM_METHOD_DESC(Returns true if the result belongs to the target steam ID or false if the result does not. This is important when using DeserializeResult to verify that a remote player is not pretending to have a different users inventory.)
|
||||||
bool CheckResultSteamID( SteamInventoryResult_t resultHandle, CSteamID steamIDExpected )
|
bool CheckResultSteamID( SteamInventoryResult_t resultHandle, CSteamID steamIDExpected )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::CheckResultSteamID %llu\n", steamIDExpected.ConvertToUint64());
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO
|
//TODO
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -292,7 +294,7 @@ bool CheckResultSteamID( SteamInventoryResult_t resultHandle, CSteamID steamIDEx
|
|||||||
STEAM_METHOD_DESC(Destroys a result handle and frees all associated memory.)
|
STEAM_METHOD_DESC(Destroys a result handle and frees all associated memory.)
|
||||||
void DestroyResult( SteamInventoryResult_t resultHandle )
|
void DestroyResult( SteamInventoryResult_t resultHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::DestroyResult\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto request = std::find_if(inventory_requests.begin(), inventory_requests.end(), [&resultHandle](struct Steam_Inventory_Requests const& item) { return item.inventory_result == resultHandle; });
|
auto request = std::find_if(inventory_requests.begin(), inventory_requests.end(), [&resultHandle](struct Steam_Inventory_Requests const& item) { return item.inventory_result == resultHandle; });
|
||||||
if (inventory_requests.end() == request)
|
if (inventory_requests.end() == request)
|
||||||
@ -316,7 +318,7 @@ void DestroyResult( SteamInventoryResult_t resultHandle )
|
|||||||
STEAM_METHOD_DESC(Captures the entire state of the current users Steam inventory.)
|
STEAM_METHOD_DESC(Captures the entire state of the current users Steam inventory.)
|
||||||
bool GetAllItems( SteamInventoryResult_t *pResultHandle )
|
bool GetAllItems( SteamInventoryResult_t *pResultHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetAllItems\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Steam_Inventory_Requests* request = new_inventory_result();
|
struct Steam_Inventory_Requests* request = new_inventory_result();
|
||||||
|
|
||||||
@ -338,7 +340,7 @@ bool GetAllItems( SteamInventoryResult_t *pResultHandle )
|
|||||||
STEAM_METHOD_DESC(Captures the state of a subset of the current users Steam inventory identified by an array of item instance IDs.)
|
STEAM_METHOD_DESC(Captures the state of a subset of the current users Steam inventory identified by an array of item instance IDs.)
|
||||||
bool GetItemsByID( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT( unCountInstanceIDs ) const SteamItemInstanceID_t *pInstanceIDs, uint32 unCountInstanceIDs )
|
bool GetItemsByID( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT( unCountInstanceIDs ) const SteamItemInstanceID_t *pInstanceIDs, uint32 unCountInstanceIDs )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetItemsByID\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (pResultHandle) {
|
if (pResultHandle) {
|
||||||
struct Steam_Inventory_Requests *request = new_inventory_result(false, pInstanceIDs, unCountInstanceIDs);
|
struct Steam_Inventory_Requests *request = new_inventory_result(false, pInstanceIDs, unCountInstanceIDs);
|
||||||
@ -368,7 +370,7 @@ bool GetItemsByID( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT( unC
|
|||||||
// an hour has elapsed. See DeserializeResult for expiration handling.
|
// an hour has elapsed. See DeserializeResult for expiration handling.
|
||||||
bool SerializeResult( SteamInventoryResult_t resultHandle, STEAM_OUT_BUFFER_COUNT(punOutBufferSize) void *pOutBuffer, uint32 *punOutBufferSize )
|
bool SerializeResult( SteamInventoryResult_t resultHandle, STEAM_OUT_BUFFER_COUNT(punOutBufferSize) void *pOutBuffer, uint32 *punOutBufferSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::SerializeResult %i\n", resultHandle);
|
PRINT_DEBUG("%i", resultHandle);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO
|
//TODO
|
||||||
struct Steam_Inventory_Requests *request = get_inventory_result(resultHandle);
|
struct Steam_Inventory_Requests *request = get_inventory_result(resultHandle);
|
||||||
@ -379,7 +381,7 @@ bool SerializeResult( SteamInventoryResult_t resultHandle, STEAM_OUT_BUFFER_COUN
|
|||||||
memset(buffer, 0x5F, sizeof(buffer));
|
memset(buffer, 0x5F, sizeof(buffer));
|
||||||
|
|
||||||
if (!punOutBufferSize) return false;
|
if (!punOutBufferSize) return false;
|
||||||
PRINT_DEBUG(" Size %u\n", *punOutBufferSize);
|
PRINT_DEBUG(" Size %u", *punOutBufferSize);
|
||||||
if (!pOutBuffer) {
|
if (!pOutBuffer) {
|
||||||
*punOutBufferSize = sizeof(buffer);
|
*punOutBufferSize = sizeof(buffer);
|
||||||
return true;
|
return true;
|
||||||
@ -414,7 +416,7 @@ bool SerializeResult( SteamInventoryResult_t resultHandle, STEAM_OUT_BUFFER_COUN
|
|||||||
// could challenge the player with expired data to send an updated result set.
|
// could challenge the player with expired data to send an updated result set.
|
||||||
bool DeserializeResult( SteamInventoryResult_t *pOutResultHandle, STEAM_BUFFER_COUNT(punOutBufferSize) const void *pBuffer, uint32 unBufferSize, bool bRESERVED_MUST_BE_FALSE)
|
bool DeserializeResult( SteamInventoryResult_t *pOutResultHandle, STEAM_BUFFER_COUNT(punOutBufferSize) const void *pBuffer, uint32 unBufferSize, bool bRESERVED_MUST_BE_FALSE)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::DeserializeResult\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO
|
//TODO
|
||||||
if (pOutResultHandle) {
|
if (pOutResultHandle) {
|
||||||
@ -439,7 +441,8 @@ bool DeserializeResult( SteamInventoryResult_t *pOutResultHandle, STEAM_BUFFER_C
|
|||||||
// describe the quantity of each item to generate.
|
// describe the quantity of each item to generate.
|
||||||
bool GenerateItems( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, STEAM_ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength )
|
bool GenerateItems( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, STEAM_ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GenerateItems\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +454,7 @@ bool GenerateItems( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT(unA
|
|||||||
STEAM_METHOD_DESC(GrantPromoItems() checks the list of promotional items for which the user may be eligible and grants the items (one time only).)
|
STEAM_METHOD_DESC(GrantPromoItems() checks the list of promotional items for which the user may be eligible and grants the items (one time only).)
|
||||||
bool GrantPromoItems( SteamInventoryResult_t *pResultHandle )
|
bool GrantPromoItems( SteamInventoryResult_t *pResultHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GrantPromoItems\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Steam_Inventory_Requests* request = new_inventory_result(false);
|
struct Steam_Inventory_Requests* request = new_inventory_result(false);
|
||||||
|
|
||||||
@ -467,7 +470,7 @@ bool GrantPromoItems( SteamInventoryResult_t *pResultHandle )
|
|||||||
// showing a specific promo item to the user.
|
// showing a specific promo item to the user.
|
||||||
bool AddPromoItem( SteamInventoryResult_t *pResultHandle, SteamItemDef_t itemDef )
|
bool AddPromoItem( SteamInventoryResult_t *pResultHandle, SteamItemDef_t itemDef )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::AddPromoItem\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
//TODO
|
//TODO
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Steam_Inventory_Requests* request = new_inventory_result(false);
|
struct Steam_Inventory_Requests* request = new_inventory_result(false);
|
||||||
@ -479,7 +482,7 @@ bool AddPromoItem( SteamInventoryResult_t *pResultHandle, SteamItemDef_t itemDef
|
|||||||
|
|
||||||
bool AddPromoItems( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, uint32 unArrayLength )
|
bool AddPromoItems( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, uint32 unArrayLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::AddPromoItems\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
//TODO
|
//TODO
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Steam_Inventory_Requests* request = new_inventory_result(false);
|
struct Steam_Inventory_Requests* request = new_inventory_result(false);
|
||||||
@ -496,7 +499,7 @@ bool AddPromoItems( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT(unA
|
|||||||
STEAM_METHOD_DESC(ConsumeItem() removes items from the inventory permanently.)
|
STEAM_METHOD_DESC(ConsumeItem() removes items from the inventory permanently.)
|
||||||
bool ConsumeItem( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemConsume, uint32 unQuantity )
|
bool ConsumeItem( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemConsume, uint32 unQuantity )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::ConsumeItem %llu %u\n", itemConsume, unQuantity);
|
PRINT_DEBUG("%llu %u", itemConsume, unQuantity);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto it = user_items.find(std::to_string(itemConsume));
|
auto it = user_items.find(std::to_string(itemConsume));
|
||||||
@ -504,7 +507,7 @@ bool ConsumeItem( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t i
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
uint32 current = it->get<int>();
|
uint32 current = it->get<int>();
|
||||||
PRINT_DEBUG("Steam_Inventory::ConsumeItem previous %u\n", current);
|
PRINT_DEBUG("previous %u", current);
|
||||||
if (current < unQuantity) unQuantity = current;
|
if (current < unQuantity) unQuantity = current;
|
||||||
uint32 result = current - unQuantity;
|
uint32 result = current - unQuantity;
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
@ -540,7 +543,8 @@ bool ExchangeItems( SteamInventoryResult_t *pResultHandle,
|
|||||||
STEAM_ARRAY_COUNT(unArrayGenerateLength) const SteamItemDef_t *pArrayGenerate, STEAM_ARRAY_COUNT(unArrayGenerateLength) const uint32 *punArrayGenerateQuantity, uint32 unArrayGenerateLength,
|
STEAM_ARRAY_COUNT(unArrayGenerateLength) const SteamItemDef_t *pArrayGenerate, STEAM_ARRAY_COUNT(unArrayGenerateLength) const uint32 *punArrayGenerateQuantity, uint32 unArrayGenerateLength,
|
||||||
STEAM_ARRAY_COUNT(unArrayDestroyLength) const SteamItemInstanceID_t *pArrayDestroy, STEAM_ARRAY_COUNT(unArrayDestroyLength) const uint32 *punArrayDestroyQuantity, uint32 unArrayDestroyLength )
|
STEAM_ARRAY_COUNT(unArrayDestroyLength) const SteamItemInstanceID_t *pArrayDestroy, STEAM_ARRAY_COUNT(unArrayDestroyLength) const uint32 *punArrayDestroyQuantity, uint32 unArrayDestroyLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::ExchangeItems\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,7 +556,8 @@ bool ExchangeItems( SteamInventoryResult_t *pResultHandle,
|
|||||||
// two, pass k_SteamItemInstanceIDInvalid for itemIdDest and a new item will be generated.
|
// two, pass k_SteamItemInstanceIDInvalid for itemIdDest and a new item will be generated.
|
||||||
bool TransferItemQuantity( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemIdSource, uint32 unQuantity, SteamItemInstanceID_t itemIdDest )
|
bool TransferItemQuantity( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemIdSource, uint32 unQuantity, SteamItemInstanceID_t itemIdDest )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::TransferItemQuantity\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,7 +570,8 @@ bool TransferItemQuantity( SteamInventoryResult_t *pResultHandle, SteamItemInsta
|
|||||||
STEAM_METHOD_DESC( Deprecated method. Playtime accounting is performed on the Steam servers. )
|
STEAM_METHOD_DESC( Deprecated method. Playtime accounting is performed on the Steam servers. )
|
||||||
void SendItemDropHeartbeat()
|
void SendItemDropHeartbeat()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::SendItemDropHeartbeat\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -581,7 +587,7 @@ void SendItemDropHeartbeat()
|
|||||||
STEAM_METHOD_DESC(Playtime credit must be consumed and turned into item drops by your game.)
|
STEAM_METHOD_DESC(Playtime credit must be consumed and turned into item drops by your game.)
|
||||||
bool TriggerItemDrop( SteamInventoryResult_t *pResultHandle, SteamItemDef_t dropListDefinition )
|
bool TriggerItemDrop( SteamInventoryResult_t *pResultHandle, SteamItemDef_t dropListDefinition )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::TriggerItemDrop %p %i\n", pResultHandle, dropListDefinition);
|
PRINT_DEBUG("%p %i", pResultHandle, dropListDefinition);
|
||||||
//TODO: if gameserver return false
|
//TODO: if gameserver return false
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Steam_Inventory_Requests* request = new_inventory_result(false);
|
struct Steam_Inventory_Requests* request = new_inventory_result(false);
|
||||||
@ -598,7 +604,8 @@ bool TradeItems( SteamInventoryResult_t *pResultHandle, CSteamID steamIDTradePar
|
|||||||
STEAM_ARRAY_COUNT(nArrayGiveLength) const SteamItemInstanceID_t *pArrayGive, STEAM_ARRAY_COUNT(nArrayGiveLength) const uint32 *pArrayGiveQuantity, uint32 nArrayGiveLength,
|
STEAM_ARRAY_COUNT(nArrayGiveLength) const SteamItemInstanceID_t *pArrayGive, STEAM_ARRAY_COUNT(nArrayGiveLength) const uint32 *pArrayGiveQuantity, uint32 nArrayGiveLength,
|
||||||
STEAM_ARRAY_COUNT(nArrayGetLength) const SteamItemInstanceID_t *pArrayGet, STEAM_ARRAY_COUNT(nArrayGetLength) const uint32 *pArrayGetQuantity, uint32 nArrayGetLength )
|
STEAM_ARRAY_COUNT(nArrayGetLength) const SteamItemInstanceID_t *pArrayGet, STEAM_ARRAY_COUNT(nArrayGetLength) const uint32 *pArrayGetQuantity, uint32 nArrayGetLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::TradeItems\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,7 +628,7 @@ bool TradeItems( SteamInventoryResult_t *pResultHandle, CSteamID steamIDTradePar
|
|||||||
STEAM_METHOD_DESC(LoadItemDefinitions triggers the automatic load and refresh of item definitions.)
|
STEAM_METHOD_DESC(LoadItemDefinitions triggers the automatic load and refresh of item definitions.)
|
||||||
bool LoadItemDefinitions()
|
bool LoadItemDefinitions()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::LoadItemDefinitions\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!item_definitions_loaded) {
|
if (!item_definitions_loaded) {
|
||||||
@ -643,12 +650,12 @@ bool GetItemDefinitionIDs(
|
|||||||
STEAM_OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
|
STEAM_OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
|
||||||
STEAM_DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize )
|
STEAM_DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetItemDefinitionIDs %p\n", pItemDefIDs);
|
PRINT_DEBUG("%p", pItemDefIDs);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!punItemDefIDsArraySize)
|
if (!punItemDefIDsArraySize)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PRINT_DEBUG(" array_size %u\n", *punItemDefIDsArraySize);
|
PRINT_DEBUG(" array_size %u", *punItemDefIDsArraySize);
|
||||||
|
|
||||||
if (!item_definitions_loaded)
|
if (!item_definitions_loaded)
|
||||||
return false;
|
return false;
|
||||||
@ -681,7 +688,7 @@ bool GetItemDefinitionIDs(
|
|||||||
bool GetItemDefinitionProperty( SteamItemDef_t iDefinition, const char *pchPropertyName,
|
bool GetItemDefinitionProperty( SteamItemDef_t iDefinition, const char *pchPropertyName,
|
||||||
STEAM_OUT_STRING_COUNT(punValueBufferSizeOut) char *pchValueBuffer, uint32 *punValueBufferSizeOut )
|
STEAM_OUT_STRING_COUNT(punValueBufferSizeOut) char *pchValueBuffer, uint32 *punValueBufferSizeOut )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetItemDefinitionProperty %i %s\n", iDefinition, pchPropertyName);
|
PRINT_DEBUG("%i %s", iDefinition, pchPropertyName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto item = defined_items.find(std::to_string(iDefinition));
|
auto item = defined_items.find(std::to_string(iDefinition));
|
||||||
@ -728,7 +735,7 @@ bool GetItemDefinitionProperty( SteamItemDef_t iDefinition, const char *pchPrope
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
*punValueBufferSizeOut = 0;
|
*punValueBufferSizeOut = 0;
|
||||||
PRINT_DEBUG(" Attr %s not found for item %d\n", pchPropertyName, iDefinition);
|
PRINT_DEBUG(" Attr %s not found for item %d", pchPropertyName, iDefinition);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -779,7 +786,8 @@ bool GetItemDefinitionProperty( SteamItemDef_t iDefinition, const char *pchPrope
|
|||||||
STEAM_CALL_RESULT( SteamInventoryEligiblePromoItemDefIDs_t )
|
STEAM_CALL_RESULT( SteamInventoryEligiblePromoItemDefIDs_t )
|
||||||
SteamAPICall_t RequestEligiblePromoItemDefinitionsIDs( CSteamID steamID )
|
SteamAPICall_t RequestEligiblePromoItemDefinitionsIDs( CSteamID steamID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::RequestEligiblePromoItemDefinitionsIDs\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -792,7 +800,8 @@ bool GetEligiblePromoItemDefinitionIDs(
|
|||||||
STEAM_OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
|
STEAM_OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
|
||||||
STEAM_DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize )
|
STEAM_DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetEligiblePromoItemDefinitionIDs\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,7 +814,8 @@ bool GetEligiblePromoItemDefinitionIDs(
|
|||||||
STEAM_CALL_RESULT( SteamInventoryStartPurchaseResult_t )
|
STEAM_CALL_RESULT( SteamInventoryStartPurchaseResult_t )
|
||||||
SteamAPICall_t StartPurchase( STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, STEAM_ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength )
|
SteamAPICall_t StartPurchase( STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, STEAM_ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::StartPurchase\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,7 +824,7 @@ SteamAPICall_t StartPurchase( STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDe
|
|||||||
STEAM_CALL_RESULT( SteamInventoryRequestPricesResult_t )
|
STEAM_CALL_RESULT( SteamInventoryRequestPricesResult_t )
|
||||||
SteamAPICall_t RequestPrices()
|
SteamAPICall_t RequestPrices()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::RequestPrices\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
SteamInventoryRequestPricesResult_t data;
|
SteamInventoryRequestPricesResult_t data;
|
||||||
data.m_result = k_EResultOK;
|
data.m_result = k_EResultOK;
|
||||||
memcpy(data.m_rgchCurrency, "USD", 4);
|
memcpy(data.m_rgchCurrency, "USD", 4);
|
||||||
@ -825,7 +835,8 @@ SteamAPICall_t RequestPrices()
|
|||||||
// Returns the number of items with prices. Need to call RequestPrices() first.
|
// Returns the number of items with prices. Need to call RequestPrices() first.
|
||||||
uint32 GetNumItemsWithPrices()
|
uint32 GetNumItemsWithPrices()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetNumItemsWithPrices\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -834,7 +845,8 @@ bool GetItemsWithPrices( STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(
|
|||||||
STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(pPrices, List of prices for the given item defs) uint64 *pBasePrices,
|
STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(pPrices, List of prices for the given item defs) uint64 *pBasePrices,
|
||||||
uint32 unArrayLength )
|
uint32 unArrayLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetItemsWithPrices\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,13 +856,15 @@ bool GetItemsWithPrices( STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(
|
|||||||
STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(pPrices, List of prices for the given item defs) uint64 *pPrices,
|
STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(pPrices, List of prices for the given item defs) uint64 *pPrices,
|
||||||
uint32 unArrayLength )
|
uint32 unArrayLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetItemsWithPrices old\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return GetItemsWithPrices(pArrayItemDefs, pPrices, NULL, unArrayLength);
|
return GetItemsWithPrices(pArrayItemDefs, pPrices, NULL, unArrayLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pCurrentPrice, uint64 *pBasePrice )
|
bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pCurrentPrice, uint64 *pBasePrice )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetItemPrice\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,7 +872,8 @@ bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pCurrentPrice, uint64 *pB
|
|||||||
// Returns false if there is no price stored for the item definition.
|
// Returns false if there is no price stored for the item definition.
|
||||||
bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pPrice )
|
bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pPrice )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::GetItemPrice old\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return GetItemPrice(iDefinition, pPrice, NULL);
|
return GetItemPrice(iDefinition, pPrice, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -866,52 +881,60 @@ bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pPrice )
|
|||||||
// Create a request to update properties on items
|
// Create a request to update properties on items
|
||||||
SteamInventoryUpdateHandle_t StartUpdateProperties()
|
SteamInventoryUpdateHandle_t StartUpdateProperties()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::StartUpdateProperties\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the property on the item
|
// Remove the property on the item
|
||||||
bool RemoveProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName )
|
bool RemoveProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::RemoveProperty\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessor methods to set properties on items
|
// Accessor methods to set properties on items
|
||||||
bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, const char *pchPropertyValue )
|
bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, const char *pchPropertyValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::SetProperty\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, bool bValue )
|
bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, bool bValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::SetProperty\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, int64 nValue )
|
bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, int64 nValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::SetProperty\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, float flValue )
|
bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, float flValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::SetProperty\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit the update request by handle
|
// Submit the update request by handle
|
||||||
bool SubmitUpdateProperties( SteamInventoryUpdateHandle_t handle, SteamInventoryResult_t * pResultHandle )
|
bool SubmitUpdateProperties( SteamInventoryUpdateHandle_t handle, SteamInventoryResult_t * pResultHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::SubmitUpdateProperties\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InspectItem( SteamInventoryResult_t *pResultHandle, const char *pchItemToken )
|
bool InspectItem( SteamInventoryResult_t *pResultHandle, const char *pchItemToken )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Inventory::InspectItem\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public ISteamMasterServerUpdater
|
|||||||
public:
|
public:
|
||||||
static void steam_callback(void *object, Common_Message *msg)
|
static void steam_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_masterserverupdater_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Masterserver_Updater *steam_masterserverupdater = (Steam_Masterserver_Updater *)object;
|
Steam_Masterserver_Updater *steam_masterserverupdater = (Steam_Masterserver_Updater *)object;
|
||||||
steam_masterserverupdater->Callback(msg);
|
steam_masterserverupdater->Callback(msg);
|
||||||
@ -37,7 +37,7 @@ static void steam_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_masterserverupdater_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Masterserver_Updater *steam_masterserverupdater = (Steam_Masterserver_Updater *)object;
|
Steam_Masterserver_Updater *steam_masterserverupdater = (Steam_Masterserver_Updater *)object;
|
||||||
steam_masterserverupdater->RunCallbacks();
|
steam_masterserverupdater->RunCallbacks();
|
||||||
@ -65,7 +65,8 @@ Steam_Masterserver_Updater(class Settings *settings, class Networking *network,
|
|||||||
// you want it to be active (default: off).
|
// you want it to be active (default: off).
|
||||||
void SetActive( bool bActive )
|
void SetActive( bool bActive )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::SetActive\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -74,7 +75,8 @@ void SetActive( bool bActive )
|
|||||||
// Some mods change this.
|
// Some mods change this.
|
||||||
void SetHeartbeatInterval( int iHeartbeatInterval )
|
void SetHeartbeatInterval( int iHeartbeatInterval )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::SetHeartbeatInterval\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -96,7 +98,8 @@ void SetHeartbeatInterval( int iHeartbeatInterval )
|
|||||||
// it's for us.
|
// it's for us.
|
||||||
bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort )
|
bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::HandleIncomingPacket\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +110,8 @@ bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 s
|
|||||||
// Call this each frame until it returns 0.
|
// Call this each frame until it returns 0.
|
||||||
int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort )
|
int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::GetNextOutgoingPacket\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,21 +129,24 @@ void SetBasicServerData(
|
|||||||
bool bPasswordProtected,
|
bool bPasswordProtected,
|
||||||
const char *pGameDescription )
|
const char *pGameDescription )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::SetBasicServerData\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Call this to clear the whole list of key/values that are sent in rules queries.
|
// Call this to clear the whole list of key/values that are sent in rules queries.
|
||||||
void ClearAllKeyValues()
|
void ClearAllKeyValues()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::ClearAllKeyValues\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Call this to add/update a key/value pair.
|
// Call this to add/update a key/value pair.
|
||||||
void SetKeyValue( const char *pKey, const char *pValue )
|
void SetKeyValue( const char *pKey, const char *pValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::SetKeyValue '%s'='%s'\n", pKey, pValue);
|
PRINT_DEBUG("TODO '%s'='%s'", pKey, pValue);
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -148,7 +155,8 @@ void SetKeyValue( const char *pKey, const char *pValue )
|
|||||||
// to tell the master servers that this server is going away.
|
// to tell the master servers that this server is going away.
|
||||||
void NotifyShutdown()
|
void NotifyShutdown()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::NotifyShutdown\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -156,7 +164,8 @@ void NotifyShutdown()
|
|||||||
// Only returns true once per request.
|
// Only returns true once per request.
|
||||||
bool WasRestartRequested()
|
bool WasRestartRequested()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::WasRestartRequested\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +173,8 @@ bool WasRestartRequested()
|
|||||||
// Force it to request a heartbeat from the master servers.
|
// Force it to request a heartbeat from the master servers.
|
||||||
void ForceHeartbeat()
|
void ForceHeartbeat()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::ForceHeartbeat\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -172,20 +182,23 @@ void ForceHeartbeat()
|
|||||||
// It will provide name resolution and use the default master server port if none is provided.
|
// It will provide name resolution and use the default master server port if none is provided.
|
||||||
bool AddMasterServer( const char *pServerAddress )
|
bool AddMasterServer( const char *pServerAddress )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::AddMasterServer\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoveMasterServer( const char *pServerAddress )
|
bool RemoveMasterServer( const char *pServerAddress )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::RemoveMasterServer\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GetNumMasterServers()
|
int GetNumMasterServers()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::GetNumMasterServers\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +206,8 @@ int GetNumMasterServers()
|
|||||||
// Returns the # of bytes written to pOut.
|
// Returns the # of bytes written to pOut.
|
||||||
int GetMasterServerAddress( int iServer, char *pOut, int outBufferSize )
|
int GetMasterServerAddress( int iServer, char *pOut, int outBufferSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Masterserver_Updater::GetMasterServerAddress\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,11 +123,11 @@ Lobby *get_lobby(CSteamID id)
|
|||||||
|
|
||||||
void send_lobby_data()
|
void send_lobby_data()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::Sending lobbies %zu\n", lobbies.size());
|
PRINT_DEBUG("lobbies %zu", lobbies.size());
|
||||||
|
|
||||||
for(auto & l: lobbies) {
|
for(auto & l: lobbies) {
|
||||||
if (get_lobby_member(&l, settings->get_local_steam_id()) && l.owner() == settings->get_local_steam_id().ConvertToUint64() && !l.deleted()) {
|
if (get_lobby_member(&l, settings->get_local_steam_id()) && l.owner() == settings->get_local_steam_id().ConvertToUint64() && !l.deleted()) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking::Sending lobby " "%" PRIu64 "\n", l.room_id());
|
PRINT_DEBUG("lobby " "%" PRIu64 "", l.room_id());
|
||||||
Common_Message msg = Common_Message();
|
Common_Message msg = Common_Message();
|
||||||
msg.set_source_id(settings->get_local_steam_id().ConvertToUint64());
|
msg.set_source_id(settings->get_local_steam_id().ConvertToUint64());
|
||||||
msg.set_allocated_lobby(new Lobby(l));
|
msg.set_allocated_lobby(new Lobby(l));
|
||||||
@ -138,7 +138,7 @@ void send_lobby_data()
|
|||||||
|
|
||||||
void trigger_lobby_dataupdate(CSteamID lobby, CSteamID member, bool success, double cb_timeout=0.005, bool send_changed_lobby=true)
|
void trigger_lobby_dataupdate(CSteamID lobby, CSteamID member, bool success, double cb_timeout=0.005, bool send_changed_lobby=true)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::trigger_lobby_dataupdate %llu %llu\n", lobby.ConvertToUint64(), member.ConvertToUint64());
|
PRINT_DEBUG("%llu %llu", lobby.ConvertToUint64(), member.ConvertToUint64());
|
||||||
LobbyDataUpdate_t data{};
|
LobbyDataUpdate_t data{};
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ void trigger_lobby_dataupdate(CSteamID lobby, CSteamID member, bool success, dou
|
|||||||
Lobby *l = get_lobby(lobby);
|
Lobby *l = get_lobby(lobby);
|
||||||
if (l && l->owner() == settings->get_local_steam_id().ConvertToUint64()) {
|
if (l && l->owner() == settings->get_local_steam_id().ConvertToUint64()) {
|
||||||
if (send_changed_lobby) {
|
if (send_changed_lobby) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking::trigger_lobby_dataupdate resending new data\n");
|
PRINT_DEBUG("resending new data");
|
||||||
Common_Message msg = Common_Message();
|
Common_Message msg = Common_Message();
|
||||||
msg.set_source_id(settings->get_local_steam_id().ConvertToUint64());
|
msg.set_source_id(settings->get_local_steam_id().ConvertToUint64());
|
||||||
msg.set_allocated_lobby(new Lobby(*l));
|
msg.set_allocated_lobby(new Lobby(*l));
|
||||||
@ -265,7 +265,7 @@ void remove_lobbies()
|
|||||||
auto g = std::begin(lobbies);
|
auto g = std::begin(lobbies);
|
||||||
while (g != std::end(lobbies)) {
|
while (g != std::end(lobbies)) {
|
||||||
if (g->members().size() == 0 || (g->deleted() && (g->time_deleted() + LOBBY_DELETED_TIMEOUT < current_time))) {
|
if (g->members().size() == 0 || (g->deleted() && (g->time_deleted() + LOBBY_DELETED_TIMEOUT < current_time))) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking::REMOVING LOBBY " "%" PRIu64 "\n", g->room_id());
|
PRINT_DEBUG("LOBBY " "%" PRIu64 "", g->room_id());
|
||||||
self_lobby_member_data.erase(g->room_id());
|
self_lobby_member_data.erase(g->room_id());
|
||||||
g = lobbies.erase(g);
|
g = lobbies.erase(g);
|
||||||
} else {
|
} else {
|
||||||
@ -290,7 +290,7 @@ void on_self_enter_leave_lobby(CSteamID id, int type, bool leaving)
|
|||||||
public:
|
public:
|
||||||
static void steam_matchmaking_callback(void *object, Common_Message *msg)
|
static void steam_matchmaking_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_MatchMaking::steam_matchmaking_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Matchmaking *steam_matchmaking = (Steam_Matchmaking *)object;
|
Steam_Matchmaking *steam_matchmaking = (Steam_Matchmaking *)object;
|
||||||
steam_matchmaking->Callback(msg);
|
steam_matchmaking->Callback(msg);
|
||||||
@ -298,7 +298,7 @@ static void steam_matchmaking_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_matchmaking_run_every_runcb(void *object)
|
static void steam_matchmaking_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_MatchMaking::steam_matchmaking_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Matchmaking *steam_matchmaking = (Steam_Matchmaking *)object;
|
Steam_Matchmaking *steam_matchmaking = (Steam_Matchmaking *)object;
|
||||||
steam_matchmaking->RunCallbacks();
|
steam_matchmaking->RunCallbacks();
|
||||||
@ -344,7 +344,7 @@ static Lobby_Member *get_lobby_member(Lobby *lobby, CSteamID user_id)
|
|||||||
// returns the number of favorites servers the user has stored
|
// returns the number of favorites servers the user has stored
|
||||||
int GetFavoriteGameCount()
|
int GetFavoriteGameCount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetFavoriteGameCount\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::string file_path = Local_Storage::get_user_appdata_path() + "/7/" + Local_Storage::remote_storage_folder + "/serverbrowser_favorites.txt";
|
std::string file_path = Local_Storage::get_user_appdata_path() + "/7/" + Local_Storage::remote_storage_folder + "/serverbrowser_favorites.txt";
|
||||||
unsigned long long file_size = file_size_(file_path);
|
unsigned long long file_size = file_size_(file_path);
|
||||||
if (file_size) {
|
if (file_size) {
|
||||||
@ -366,7 +366,7 @@ int GetFavoriteGameCount()
|
|||||||
// *pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added
|
// *pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added
|
||||||
bool GetFavoriteGame( int iGame, AppId_t *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer )
|
bool GetFavoriteGame( int iGame, AppId_t *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetFavoriteGame\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ bool GetFavoriteGame( int iGame, AppId_t *pnAppID, uint32 *pnIP, uint16 *pnConnP
|
|||||||
// adds the game server to the local list; updates the time played of the server if it already exists in the list
|
// adds the game server to the local list; updates the time played of the server if it already exists in the list
|
||||||
int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer )
|
int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::AddFavoriteGame %u %u %hu %hu %u %u\n", nAppID, nIP, nConnPort, nQueryPort, unFlags, rTime32LastPlayedOnServer);
|
PRINT_DEBUG("%u %u %hu %hu %u %u", nAppID, nIP, nConnPort, nQueryPort, unFlags, rTime32LastPlayedOnServer);
|
||||||
|
|
||||||
std::string file_path;
|
std::string file_path;
|
||||||
unsigned long long file_size;
|
unsigned long long file_size;
|
||||||
@ -447,7 +447,7 @@ int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQuery
|
|||||||
// removes the game server from the local storage; returns true if one was removed
|
// removes the game server from the local storage; returns true if one was removed
|
||||||
bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags )
|
bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::RemoveFavoriteGame\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
std::string file_path;
|
std::string file_path;
|
||||||
unsigned long long file_size;
|
unsigned long long file_size;
|
||||||
@ -532,7 +532,7 @@ bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQ
|
|||||||
STEAM_CALL_RESULT( LobbyMatchList_t )
|
STEAM_CALL_RESULT( LobbyMatchList_t )
|
||||||
SteamAPICall_t RequestLobbyList()
|
SteamAPICall_t RequestLobbyList()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::RequestLobbyList\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
filtered_lobbies.clear();
|
filtered_lobbies.clear();
|
||||||
@ -561,7 +561,7 @@ void RequestLobbyList_OLD()
|
|||||||
// these are cleared on each call to RequestLobbyList()
|
// these are cleared on each call to RequestLobbyList()
|
||||||
void AddRequestLobbyListStringFilter( const char *pchKeyToMatch, const char *pchValueToMatch, ELobbyComparison eComparisonType )
|
void AddRequestLobbyListStringFilter( const char *pchKeyToMatch, const char *pchValueToMatch, ELobbyComparison eComparisonType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::AddRequestLobbyListStringFilter '%s'=='%s' %i\n", pchKeyToMatch, pchValueToMatch, eComparisonType);
|
PRINT_DEBUG("'%s'=='%s' %i", pchKeyToMatch, pchValueToMatch, eComparisonType);
|
||||||
if (!pchValueToMatch) return;
|
if (!pchValueToMatch) return;
|
||||||
|
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
@ -577,7 +577,7 @@ void AddRequestLobbyListStringFilter( const char *pchKeyToMatch, const char *pch
|
|||||||
// numerical comparison
|
// numerical comparison
|
||||||
void AddRequestLobbyListNumericalFilter( const char *pchKeyToMatch, int nValueToMatch, ELobbyComparison eComparisonType )
|
void AddRequestLobbyListNumericalFilter( const char *pchKeyToMatch, int nValueToMatch, ELobbyComparison eComparisonType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::AddRequestLobbyListNumericalFilter '%s'==%i %i\n", pchKeyToMatch, nValueToMatch, eComparisonType);
|
PRINT_DEBUG("'%s'==%i %i", pchKeyToMatch, nValueToMatch, eComparisonType);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Filter_Values fv;
|
struct Filter_Values fv;
|
||||||
fv.key = std::string(pchKeyToMatch);
|
fv.key = std::string(pchKeyToMatch);
|
||||||
@ -591,7 +591,7 @@ void AddRequestLobbyListNumericalFilter( const char *pchKeyToMatch, int nValueTo
|
|||||||
// returns results closest to the specified value. Multiple near filters can be added, with early filters taking precedence
|
// returns results closest to the specified value. Multiple near filters can be added, with early filters taking precedence
|
||||||
void AddRequestLobbyListNearValueFilter( const char *pchKeyToMatch, int nValueToBeCloseTo )
|
void AddRequestLobbyListNearValueFilter( const char *pchKeyToMatch, int nValueToBeCloseTo )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::AddRequestLobbyListNearValueFilter '%s'==%u\n", pchKeyToMatch, nValueToBeCloseTo);
|
PRINT_DEBUG("'%s'==%u", pchKeyToMatch, nValueToBeCloseTo);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
|
|
||||||
@ -600,7 +600,7 @@ void AddRequestLobbyListNearValueFilter( const char *pchKeyToMatch, int nValueTo
|
|||||||
// returns only lobbies with the specified number of slots available
|
// returns only lobbies with the specified number of slots available
|
||||||
void AddRequestLobbyListFilterSlotsAvailable( int nSlotsAvailable )
|
void AddRequestLobbyListFilterSlotsAvailable( int nSlotsAvailable )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::AddRequestLobbyListFilterSlotsAvailable %i\n", nSlotsAvailable);
|
PRINT_DEBUG("%i", nSlotsAvailable);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
|
|
||||||
@ -609,7 +609,7 @@ void AddRequestLobbyListFilterSlotsAvailable( int nSlotsAvailable )
|
|||||||
// sets the distance for which we should search for lobbies (based on users IP address to location map on the Steam backed)
|
// sets the distance for which we should search for lobbies (based on users IP address to location map on the Steam backed)
|
||||||
void AddRequestLobbyListDistanceFilter( ELobbyDistanceFilter eLobbyDistanceFilter )
|
void AddRequestLobbyListDistanceFilter( ELobbyDistanceFilter eLobbyDistanceFilter )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::AddRequestLobbyListDistanceFilter %i\n", eLobbyDistanceFilter);
|
PRINT_DEBUG("%i", eLobbyDistanceFilter);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
|
|
||||||
@ -618,7 +618,7 @@ void AddRequestLobbyListDistanceFilter( ELobbyDistanceFilter eLobbyDistanceFilte
|
|||||||
// sets how many results to return, the lower the count the faster it is to download the lobby results & details to the client
|
// sets how many results to return, the lower the count the faster it is to download the lobby results & details to the client
|
||||||
void AddRequestLobbyListResultCountFilter( int cMaxResults )
|
void AddRequestLobbyListResultCountFilter( int cMaxResults )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::AddRequestLobbyListResultCountFilter %i\n", cMaxResults);
|
PRINT_DEBUG("%i", cMaxResults);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
filter_max_results = cMaxResults;
|
filter_max_results = cMaxResults;
|
||||||
|
|
||||||
@ -627,7 +627,7 @@ void AddRequestLobbyListResultCountFilter( int cMaxResults )
|
|||||||
|
|
||||||
void AddRequestLobbyListCompatibleMembersFilter( CSteamID steamIDLobby )
|
void AddRequestLobbyListCompatibleMembersFilter( CSteamID steamIDLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::AddRequestLobbyListCompatibleMembersFilter\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
|
|
||||||
@ -645,7 +645,7 @@ void AddRequestLobbyListNumericalFilter( const char *pchKeyToMatch, int nValueTo
|
|||||||
|
|
||||||
void AddRequestLobbyListSlotsAvailableFilter()
|
void AddRequestLobbyListSlotsAvailableFilter()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MatchMaking::AddRequestLobbyListSlotsAvailableFilter\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -656,11 +656,11 @@ void AddRequestLobbyListSlotsAvailableFilter()
|
|||||||
// the returned CSteamID::IsValid() will be false if iLobby is out of range
|
// the returned CSteamID::IsValid() will be false if iLobby is out of range
|
||||||
CSteamID GetLobbyByIndex( int iLobby )
|
CSteamID GetLobbyByIndex( int iLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyByIndex %i\n", iLobby);
|
PRINT_DEBUG("%i", iLobby);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
CSteamID id = k_steamIDNil;
|
CSteamID id = k_steamIDNil;
|
||||||
if (0 <= iLobby && iLobby < filtered_lobbies.size()) id = filtered_lobbies[iLobby];
|
if (0 <= iLobby && iLobby < filtered_lobbies.size()) id = filtered_lobbies[iLobby];
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyByIndex found lobby %llu\n", id.ConvertToUint64());
|
PRINT_DEBUG("found lobby %llu", id.ConvertToUint64());
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,7 +670,7 @@ static bool enter_lobby(Lobby *lobby, CSteamID id)
|
|||||||
|
|
||||||
Lobby_Member *member = lobby->add_members();
|
Lobby_Member *member = lobby->add_members();
|
||||||
member->set_id(id.ConvertToUint64());
|
member->set_id(id.ConvertToUint64());
|
||||||
PRINT_DEBUG("Steam_MatchMaking added player %llu to lobby\n", (uint64)id.ConvertToUint64());
|
PRINT_DEBUG("added player %llu to lobby", (uint64)id.ConvertToUint64());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -747,7 +747,7 @@ void Create_pending_lobbies()
|
|||||||
STEAM_CALL_RESULT( LobbyCreated_t )
|
STEAM_CALL_RESULT( LobbyCreated_t )
|
||||||
SteamAPICall_t CreateLobby( ELobbyType eLobbyType, int cMaxMembers )
|
SteamAPICall_t CreateLobby( ELobbyType eLobbyType, int cMaxMembers )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::CreateLobby type: %i max_members: %i\n", eLobbyType, cMaxMembers);
|
PRINT_DEBUG("type: %i max_members: %i", eLobbyType, cMaxMembers);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Pending_Creates p_c;
|
struct Pending_Creates p_c;
|
||||||
p_c.api_id = callback_results->reserveCallResult();
|
p_c.api_id = callback_results->reserveCallResult();
|
||||||
@ -780,12 +780,12 @@ void CreateLobby( bool bPrivate )
|
|||||||
STEAM_CALL_RESULT( LobbyEnter_t )
|
STEAM_CALL_RESULT( LobbyEnter_t )
|
||||||
SteamAPICall_t JoinLobby( CSteamID steamIDLobby )
|
SteamAPICall_t JoinLobby( CSteamID steamIDLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::JoinLobby %llu\n", steamIDLobby.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto pj = std::find_if(pending_joins.begin(), pending_joins.end(), [&steamIDLobby](Pending_Joins const& item) {return item.lobby_id == steamIDLobby;});
|
auto pj = std::find_if(pending_joins.begin(), pending_joins.end(), [&steamIDLobby](Pending_Joins const& item) {return item.lobby_id == steamIDLobby;});
|
||||||
if (pj != pending_joins.end()) {
|
if (pj != pending_joins.end()) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking::JoinLobby already found in pending joins list\n");
|
PRINT_DEBUG("already found in pending joins list");
|
||||||
return pj->api_id;
|
return pj->api_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -799,7 +799,7 @@ SteamAPICall_t JoinLobby( CSteamID steamIDLobby )
|
|||||||
message->set_type(Lobby_Messages::JOIN);
|
message->set_type(Lobby_Messages::JOIN);
|
||||||
pending_join.message_sent = send_owner_packet(steamIDLobby, message);
|
pending_join.message_sent = send_owner_packet(steamIDLobby, message);
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_MatchMaking::JoinLobby added new entry to pending joins\n");
|
PRINT_DEBUG("added new entry to pending joins");
|
||||||
return pending_join.api_id;
|
return pending_join.api_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -812,22 +812,22 @@ void JoinLobby_OLD( CSteamID steamIDLobby )
|
|||||||
// other users in the lobby will be notified by a LobbyChatUpdate_t callback
|
// other users in the lobby will be notified by a LobbyChatUpdate_t callback
|
||||||
void LeaveLobby( CSteamID steamIDLobby )
|
void LeaveLobby( CSteamID steamIDLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::LeaveLobby\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
PRINT_DEBUG("Steam_MatchMaking::LeaveLobby pass mutex\n");
|
PRINT_DEBUG("pass mutex");
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (lobby) {
|
if (lobby) {
|
||||||
if (!lobby->deleted()) {
|
if (!lobby->deleted()) {
|
||||||
on_self_enter_leave_lobby((uint64)lobby->room_id(), lobby->type(), true);
|
on_self_enter_leave_lobby((uint64)lobby->room_id(), lobby->type(), true);
|
||||||
self_lobby_member_data.erase(lobby->room_id());
|
self_lobby_member_data.erase(lobby->room_id());
|
||||||
if (lobby->owner() != settings->get_local_steam_id().ConvertToUint64()) {
|
if (lobby->owner() != settings->get_local_steam_id().ConvertToUint64()) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking::LeaveLobby not owner\n");
|
PRINT_DEBUG("not owner");
|
||||||
leave_lobby(&(*lobby), settings->get_local_steam_id());
|
leave_lobby(&(*lobby), settings->get_local_steam_id());
|
||||||
Lobby_Messages *message = new Lobby_Messages();
|
Lobby_Messages *message = new Lobby_Messages();
|
||||||
message->set_type(Lobby_Messages::LEAVE);
|
message->set_type(Lobby_Messages::LEAVE);
|
||||||
send_owner_packet(steamIDLobby, message);
|
send_owner_packet(steamIDLobby, message);
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("Steam_MatchMaking::LeaveLobby owner\n");
|
PRINT_DEBUG("owner");
|
||||||
Lobby_Messages *message = new Lobby_Messages();
|
Lobby_Messages *message = new Lobby_Messages();
|
||||||
message->set_type(Lobby_Messages::LEAVE);
|
message->set_type(Lobby_Messages::LEAVE);
|
||||||
|
|
||||||
@ -844,7 +844,7 @@ void LeaveLobby( CSteamID steamIDLobby )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_MatchMaking::LeaveLobby Done\n");
|
PRINT_DEBUG("Done");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,7 +857,7 @@ void LeaveLobby( CSteamID steamIDLobby )
|
|||||||
// or if the game isn't running yet the game will be launched with the parameter +connect_lobby <64-bit lobby id>
|
// or if the game isn't running yet the game will be launched with the parameter +connect_lobby <64-bit lobby id>
|
||||||
bool InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee )
|
bool InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::InviteUserToLobby\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (!lobby) return false;
|
if (!lobby) return false;
|
||||||
@ -881,13 +881,13 @@ bool InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee )
|
|||||||
// returns the number of users in the specified lobby
|
// returns the number of users in the specified lobby
|
||||||
int GetNumLobbyMembers( CSteamID steamIDLobby )
|
int GetNumLobbyMembers( CSteamID steamIDLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetNumLobbyMembers %llu\n", steamIDLobby.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (lobby) ret = lobby->members().size();
|
if (lobby) ret = lobby->members().size();
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetNumLobbyMembers count=%i\n", ret);
|
PRINT_DEBUG("count=%i", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -896,12 +896,12 @@ int GetNumLobbyMembers( CSteamID steamIDLobby )
|
|||||||
// note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby
|
// note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby
|
||||||
CSteamID GetLobbyMemberByIndex( CSteamID steamIDLobby, int iMember )
|
CSteamID GetLobbyMemberByIndex( CSteamID steamIDLobby, int iMember )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyMemberByIndex %llu %i\n", steamIDLobby.ConvertToUint64(), iMember);
|
PRINT_DEBUG("%llu %i", steamIDLobby.ConvertToUint64(), iMember);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
CSteamID id = k_steamIDNil;
|
CSteamID id = k_steamIDNil;
|
||||||
if (lobby && !lobby->deleted() && lobby->members().size() > iMember && iMember >= 0) id = (uint64)lobby->members(iMember).id();
|
if (lobby && !lobby->deleted() && lobby->members().size() > iMember && iMember >= 0) id = (uint64)lobby->members(iMember).id();
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyMemberByIndex found member: %llu\n", id.ConvertToUint64());
|
PRINT_DEBUG("found member: %llu", id.ConvertToUint64());
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -911,7 +911,7 @@ CSteamID GetLobbyMemberByIndex( CSteamID steamIDLobby, int iMember )
|
|||||||
// "" will be returned if no value is set, or if steamIDLobby is invalid
|
// "" will be returned if no value is set, or if steamIDLobby is invalid
|
||||||
const char *GetLobbyData( CSteamID steamIDLobby, const char *pchKey )
|
const char *GetLobbyData( CSteamID steamIDLobby, const char *pchKey )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyData %llu '%s'\n", steamIDLobby.ConvertToUint64(), pchKey);
|
PRINT_DEBUG("%llu '%s'", steamIDLobby.ConvertToUint64(), pchKey);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchKey) return "";
|
if (!pchKey) return "";
|
||||||
|
|
||||||
@ -922,7 +922,7 @@ const char *GetLobbyData( CSteamID steamIDLobby, const char *pchKey )
|
|||||||
if (result != lobby->values().end()) ret = result->second.c_str();
|
if (result != lobby->values().end()) ret = result->second.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyData returned '%s'\n", ret);
|
PRINT_DEBUG("returned '%s'", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -933,7 +933,7 @@ const char *GetLobbyData( CSteamID steamIDLobby, const char *pchKey )
|
|||||||
// other users in the lobby will receive notification of the lobby data change via a LobbyDataUpdate_t callback
|
// other users in the lobby will receive notification of the lobby data change via a LobbyDataUpdate_t callback
|
||||||
bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue )
|
bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::SetLobbyData [%llu] '%s'='%s'\n", steamIDLobby.ConvertToUint64(), pchKey, pchValue);
|
PRINT_DEBUG("[%llu] '%s'='%s'", steamIDLobby.ConvertToUint64(), pchKey, pchValue);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchKey) return false;
|
if (!pchKey) return false;
|
||||||
if (!pchValue) pchValue = "";
|
if (!pchValue) pchValue = "";
|
||||||
@ -965,7 +965,7 @@ bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchVal
|
|||||||
// returns the number of metadata keys set on the specified lobby
|
// returns the number of metadata keys set on the specified lobby
|
||||||
int GetLobbyDataCount( CSteamID steamIDLobby )
|
int GetLobbyDataCount( CSteamID steamIDLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyDataCount %llu\n", steamIDLobby.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
@ -980,7 +980,7 @@ int GetLobbyDataCount( CSteamID steamIDLobby )
|
|||||||
// returns a lobby metadata key/values pair by index, of range [0, GetLobbyDataCount())
|
// returns a lobby metadata key/values pair by index, of range [0, GetLobbyDataCount())
|
||||||
bool GetLobbyDataByIndex( CSteamID steamIDLobby, int iLobbyData, char *pchKey, int cchKeyBufferSize, char *pchValue, int cchValueBufferSize )
|
bool GetLobbyDataByIndex( CSteamID steamIDLobby, int iLobbyData, char *pchKey, int cchKeyBufferSize, char *pchValue, int cchValueBufferSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyDataByIndex %llu [%i] key size=%i, value size=%i\n", steamIDLobby.ConvertToUint64(), iLobbyData, cchKeyBufferSize, cchValueBufferSize);
|
PRINT_DEBUG("%llu [%i] key size=%i, value size=%i", steamIDLobby.ConvertToUint64(), iLobbyData, cchKeyBufferSize, cchValueBufferSize);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
@ -999,7 +999,7 @@ bool GetLobbyDataByIndex( CSteamID steamIDLobby, int iLobbyData, char *pchKey, i
|
|||||||
pchValue[cchValueBufferSize - 1] = 0;
|
pchValue[cchValueBufferSize - 1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyDataByIndex ret '%s'='%s'\n", pchKey, pchValue);
|
PRINT_DEBUG("ret '%s'='%s'", pchKey, pchValue);
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1011,7 +1011,7 @@ bool GetLobbyDataByIndex( CSteamID steamIDLobby, int iLobbyData, char *pchKey, i
|
|||||||
// removes a metadata key from the lobby
|
// removes a metadata key from the lobby
|
||||||
bool DeleteLobbyData( CSteamID steamIDLobby, const char *pchKey )
|
bool DeleteLobbyData( CSteamID steamIDLobby, const char *pchKey )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::DeleteLobbyData '%s'\n", pchKey);
|
PRINT_DEBUG("'%s'", pchKey);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) {
|
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) {
|
||||||
@ -1028,7 +1028,7 @@ bool DeleteLobbyData( CSteamID steamIDLobby, const char *pchKey )
|
|||||||
// Gets per-user metadata for someone in this lobby
|
// Gets per-user metadata for someone in this lobby
|
||||||
const char *GetLobbyMemberData( CSteamID steamIDLobby, CSteamID steamIDUser, const char *pchKey )
|
const char *GetLobbyMemberData( CSteamID steamIDLobby, CSteamID steamIDUser, const char *pchKey )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyMemberData '%s' %llu %llu\n", pchKey, steamIDLobby.ConvertToUint64(), steamIDUser.ConvertToUint64());
|
PRINT_DEBUG("'%s' %llu %llu", pchKey, steamIDLobby.ConvertToUint64(), steamIDUser.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchKey) return "";
|
if (!pchKey) return "";
|
||||||
|
|
||||||
@ -1050,14 +1050,14 @@ const char *GetLobbyMemberData( CSteamID steamIDLobby, CSteamID steamIDUser, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyMemberData res '%s'\n", ret);
|
PRINT_DEBUG("res '%s'", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets per-user metadata (for the local user implicitly)
|
// Sets per-user metadata (for the local user implicitly)
|
||||||
void SetLobbyMemberData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue )
|
void SetLobbyMemberData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::SetLobbyMemberData %llu '%s'='%s'\n", steamIDLobby.ConvertToUint64(), pchKey, pchValue);
|
PRINT_DEBUG("%llu '%s'='%s'", steamIDLobby.ConvertToUint64(), pchKey, pchValue);
|
||||||
if (!pchKey) return;
|
if (!pchKey) return;
|
||||||
char empty_string[] = "";
|
char empty_string[] = "";
|
||||||
if (!pchValue) pchValue = empty_string;
|
if (!pchValue) pchValue = empty_string;
|
||||||
@ -1107,7 +1107,7 @@ void SetLobbyMemberData( CSteamID steamIDLobby, const char *pchKey, const char *
|
|||||||
// if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator
|
// if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator
|
||||||
bool SendLobbyChatMsg( CSteamID steamIDLobby, const void *pvMsgBody, int cubMsgBody )
|
bool SendLobbyChatMsg( CSteamID steamIDLobby, const void *pvMsgBody, int cubMsgBody )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::SendLobbyChatMsg %llu %i\n", steamIDLobby.ConvertToUint64(), cubMsgBody);
|
PRINT_DEBUG("%llu %i", steamIDLobby.ConvertToUint64(), cubMsgBody);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (!lobby || lobby->deleted()) return false;
|
if (!lobby || lobby->deleted()) return false;
|
||||||
@ -1125,7 +1125,7 @@ bool SendLobbyChatMsg( CSteamID steamIDLobby, const void *pvMsgBody, int cubMsgB
|
|||||||
// return value is the number of bytes written into the buffer
|
// return value is the number of bytes written into the buffer
|
||||||
int GetLobbyChatEntry( CSteamID steamIDLobby, int iChatID, STEAM_OUT_STRUCT() CSteamID *pSteamIDUser, void *pvData, int cubData, EChatEntryType *peChatEntryType )
|
int GetLobbyChatEntry( CSteamID steamIDLobby, int iChatID, STEAM_OUT_STRUCT() CSteamID *pSteamIDUser, void *pvData, int cubData, EChatEntryType *peChatEntryType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyChatEntry %llu %i %p %p %i %p\n", steamIDLobby.ConvertToUint64(), iChatID, pSteamIDUser, pvData, cubData, peChatEntryType);
|
PRINT_DEBUG("%llu %i %p %p %i %p", steamIDLobby.ConvertToUint64(), iChatID, pSteamIDUser, pvData, cubData, peChatEntryType);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (iChatID >= chat_entries.size() || iChatID < 0 || cubData < 0) return 0;
|
if (iChatID >= chat_entries.size() || iChatID < 0 || cubData < 0) return 0;
|
||||||
if (chat_entries[iChatID].lobby_id != steamIDLobby) return 0;
|
if (chat_entries[iChatID].lobby_id != steamIDLobby) return 0;
|
||||||
@ -1135,7 +1135,7 @@ int GetLobbyChatEntry( CSteamID steamIDLobby, int iChatID, STEAM_OUT_STRUCT() CS
|
|||||||
if (chat_entries[iChatID].message.size() <= cubData) {
|
if (chat_entries[iChatID].message.size() <= cubData) {
|
||||||
cubData = chat_entries[iChatID].message.size();
|
cubData = chat_entries[iChatID].message.size();
|
||||||
memcpy(pvData, chat_entries[iChatID].message.data(), cubData);
|
memcpy(pvData, chat_entries[iChatID].message.data(), cubData);
|
||||||
PRINT_DEBUG(" Returned chat of len: %i\n", cubData);
|
PRINT_DEBUG(" Returned chat of len: %i", cubData);
|
||||||
return cubData;
|
return cubData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1153,7 +1153,7 @@ int GetLobbyChatEntry( CSteamID steamIDLobby, int iChatID, STEAM_OUT_STRUCT() CS
|
|||||||
// if the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false
|
// if the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false
|
||||||
bool RequestLobbyData( CSteamID steamIDLobby )
|
bool RequestLobbyData( CSteamID steamIDLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::RequestLobbyData %llu\n", steamIDLobby.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
struct Data_Requested requested{};
|
struct Data_Requested requested{};
|
||||||
@ -1168,8 +1168,7 @@ bool RequestLobbyData( CSteamID steamIDLobby )
|
|||||||
// either the IP/Port or the steamID of the game server has to be valid, depending on how you want the clients to be able to connect
|
// either the IP/Port or the steamID of the game server has to be valid, depending on how you want the clients to be able to connect
|
||||||
void SetLobbyGameServer( CSteamID steamIDLobby, uint32 unGameServerIP, uint16 unGameServerPort, CSteamID steamIDGameServer )
|
void SetLobbyGameServer( CSteamID steamIDLobby, uint32 unGameServerIP, uint16 unGameServerPort, CSteamID steamIDGameServer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("%llu %llu %hhu.%hhu.%hhu.%hhu:%hu",
|
||||||
"Steam_MatchMaking::SetLobbyGameServer %llu %llu %hhu.%hhu.%hhu.%hhu:%hu\n",
|
|
||||||
steamIDLobby.ConvertToUint64(), steamIDGameServer.ConvertToUint64(), ((unsigned char *)&unGameServerIP)[3], ((unsigned char *)&unGameServerIP)[2], ((unsigned char *)&unGameServerIP)[1], ((unsigned char *)&unGameServerIP)[0], unGameServerPort
|
steamIDLobby.ConvertToUint64(), steamIDGameServer.ConvertToUint64(), ((unsigned char *)&unGameServerIP)[3], ((unsigned char *)&unGameServerIP)[2], ((unsigned char *)&unGameServerIP)[1], ((unsigned char *)&unGameServerIP)[0], unGameServerPort
|
||||||
);
|
);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
@ -1192,7 +1191,7 @@ void SetLobbyGameServer( CSteamID steamIDLobby, uint32 unGameServerIP, uint16 un
|
|||||||
// returns the details of a game server set in a lobby - returns false if there is no game server set, or that lobby doesn't exist
|
// returns the details of a game server set in a lobby - returns false if there is no game server set, or that lobby doesn't exist
|
||||||
bool GetLobbyGameServer( CSteamID steamIDLobby, uint32 *punGameServerIP, uint16 *punGameServerPort, STEAM_OUT_STRUCT() CSteamID *psteamIDGameServer )
|
bool GetLobbyGameServer( CSteamID steamIDLobby, uint32 *punGameServerIP, uint16 *punGameServerPort, STEAM_OUT_STRUCT() CSteamID *psteamIDGameServer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyGameServer\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (!lobby) {
|
if (!lobby) {
|
||||||
@ -1217,7 +1216,7 @@ bool GetLobbyGameServer( CSteamID steamIDLobby, uint32 *punGameServerIP, uint16
|
|||||||
// set the limit on the # of users who can join the lobby
|
// set the limit on the # of users who can join the lobby
|
||||||
bool SetLobbyMemberLimit( CSteamID steamIDLobby, int cMaxMembers )
|
bool SetLobbyMemberLimit( CSteamID steamIDLobby, int cMaxMembers )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::SetLobbyMemberLimit %llu %i\n", steamIDLobby.ConvertToUint64(), cMaxMembers);
|
PRINT_DEBUG("%llu %i", steamIDLobby.ConvertToUint64(), cMaxMembers);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) {
|
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) {
|
||||||
@ -1234,26 +1233,26 @@ bool SetLobbyMemberLimit( CSteamID steamIDLobby, int cMaxMembers )
|
|||||||
// returns the current limit on the # of users who can join the lobby; returns 0 if no limit is defined
|
// returns the current limit on the # of users who can join the lobby; returns 0 if no limit is defined
|
||||||
int GetLobbyMemberLimit( CSteamID steamIDLobby )
|
int GetLobbyMemberLimit( CSteamID steamIDLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyMemberLimit %llu\n", steamIDLobby.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
int limit = 0;
|
int limit = 0;
|
||||||
if (lobby) limit = lobby->member_limit();
|
if (lobby) limit = lobby->member_limit();
|
||||||
|
|
||||||
PRINT_DEBUG(" limit %i\n", limit);
|
PRINT_DEBUG(" limit %i", limit);
|
||||||
return limit;
|
return limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetLobbyVoiceEnabled( CSteamID steamIDLobby, bool bVoiceEnabled )
|
void SetLobbyVoiceEnabled( CSteamID steamIDLobby, bool bVoiceEnabled )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::SetLobbyVoiceEnabled\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
}
|
}
|
||||||
|
|
||||||
// updates which type of lobby it is
|
// updates which type of lobby it is
|
||||||
// only lobbies that are k_ELobbyTypePublic or k_ELobbyTypeInvisible, and are set to joinable, will be returned by RequestLobbyList() calls
|
// only lobbies that are k_ELobbyTypePublic or k_ELobbyTypeInvisible, and are set to joinable, will be returned by RequestLobbyList() calls
|
||||||
bool SetLobbyType( CSteamID steamIDLobby, ELobbyType eLobbyType )
|
bool SetLobbyType( CSteamID steamIDLobby, ELobbyType eLobbyType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::SetLobbyType %i\n", eLobbyType);
|
PRINT_DEBUG("%i", eLobbyType);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) {
|
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) {
|
||||||
@ -1277,7 +1276,7 @@ bool SetLobbyType( CSteamID steamIDLobby, ELobbyType eLobbyType )
|
|||||||
// if set to false, no user can join, even if they are a friend or have been invited
|
// if set to false, no user can join, even if they are a friend or have been invited
|
||||||
bool SetLobbyJoinable( CSteamID steamIDLobby, bool bLobbyJoinable )
|
bool SetLobbyJoinable( CSteamID steamIDLobby, bool bLobbyJoinable )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::SetLobbyJoinable %u\n", bLobbyJoinable);
|
PRINT_DEBUG("%u", bLobbyJoinable);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) {
|
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) {
|
||||||
@ -1299,7 +1298,7 @@ bool SetLobbyJoinable( CSteamID steamIDLobby, bool bLobbyJoinable )
|
|||||||
// it is possible (bur rare) to join a lobby just as the owner is leaving, thus entering a lobby with self as the owner
|
// it is possible (bur rare) to join a lobby just as the owner is leaving, thus entering a lobby with self as the owner
|
||||||
CSteamID GetLobbyOwner( CSteamID steamIDLobby )
|
CSteamID GetLobbyOwner( CSteamID steamIDLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyOwner %llu\n", steamIDLobby.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (!lobby || lobby->deleted()) return k_steamIDNil;
|
if (!lobby || lobby->deleted()) return k_steamIDNil;
|
||||||
@ -1314,7 +1313,7 @@ CSteamID GetLobbyOwner( CSteamID steamIDLobby )
|
|||||||
// filters don't apply to lobbies (currently)
|
// filters don't apply to lobbies (currently)
|
||||||
bool RequestFriendsLobbies()
|
bool RequestFriendsLobbies()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::RequestFriendsLobbies\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
RequestFriendsLobbiesResponse_t data = {};
|
RequestFriendsLobbiesResponse_t data = {};
|
||||||
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
||||||
return true;
|
return true;
|
||||||
@ -1322,7 +1321,7 @@ bool RequestFriendsLobbies()
|
|||||||
|
|
||||||
float GetLobbyDistance( CSteamID steamIDLobby )
|
float GetLobbyDistance( CSteamID steamIDLobby )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::GetLobbyDistance %llu\n", steamIDLobby.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64());
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1331,7 +1330,7 @@ float GetLobbyDistance( CSteamID steamIDLobby )
|
|||||||
// after completion, the local user will no longer be the owner
|
// after completion, the local user will no longer be the owner
|
||||||
bool SetLobbyOwner( CSteamID steamIDLobby, CSteamID steamIDNewOwner )
|
bool SetLobbyOwner( CSteamID steamIDLobby, CSteamID steamIDNewOwner )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::SetLobbyOwner\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) return false;
|
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) return false;
|
||||||
@ -1352,7 +1351,7 @@ bool SetLobbyOwner( CSteamID steamIDLobby, CSteamID steamIDNewOwner )
|
|||||||
// you must be the lobby owner of both lobbies
|
// you must be the lobby owner of both lobbies
|
||||||
bool SetLinkedLobby( CSteamID steamIDLobby, CSteamID steamIDLobbyDependent )
|
bool SetLinkedLobby( CSteamID steamIDLobby, CSteamID steamIDLobbyDependent )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_MatchMaking::SetLinkedLobby\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1372,47 +1371,47 @@ void RunCallbacks()
|
|||||||
RunBackground();
|
RunBackground();
|
||||||
|
|
||||||
if (searching) {
|
if (searching) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking::Searching for lobbies %zu\n", lobbies.size());
|
PRINT_DEBUG("for lobbies %zu", lobbies.size());
|
||||||
for(auto & l: lobbies) {
|
for(auto & l: lobbies) {
|
||||||
bool use = l.joinable() && (l.type() == k_ELobbyTypePublic || l.type() == k_ELobbyTypeInvisible || l.type() == k_ELobbyTypeFriendsOnly) && !l.deleted();
|
bool use = l.joinable() && (l.type() == k_ELobbyTypePublic || l.type() == k_ELobbyTypeInvisible || l.type() == k_ELobbyTypeFriendsOnly) && !l.deleted();
|
||||||
PRINT_DEBUG("Steam_MatchMaking use lobby: %u, filters: %zu, joinable: %u, type: %u, deleted: %u\n", use, filter_values_copy.size(), l.joinable(), l.type(), l.deleted());
|
PRINT_DEBUG("use lobby: %u, filters: %zu, joinable: %u, type: %u, deleted: %u", use, filter_values_copy.size(), l.joinable(), l.type(), l.deleted());
|
||||||
for (auto & f : filter_values_copy) {
|
for (auto & f : filter_values_copy) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking '%s':'%s'/%i %u %i\n", f.key.c_str(), f.value_string.c_str(), f.value_int, f.is_int, f.eComparisonType);
|
PRINT_DEBUG("'%s':'%s'/%i %u %i", f.key.c_str(), f.value_string.c_str(), f.value_int, f.is_int, f.eComparisonType);
|
||||||
auto value = caseinsensitive_find(l.values(), f.key);
|
auto value = caseinsensitive_find(l.values(), f.key);
|
||||||
if (value != l.values().end()) {
|
if (value != l.values().end()) {
|
||||||
//TODO: eComparisonType
|
//TODO: eComparisonType
|
||||||
if (!f.is_int) {
|
if (!f.is_int) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking Compare Values %s %s\n", value->second.c_str(), f.value_string.c_str());
|
PRINT_DEBUG("Compare Values %s %s", value->second.c_str(), f.value_string.c_str());
|
||||||
if (f.eComparisonType == k_ELobbyComparisonEqual) {
|
if (f.eComparisonType == k_ELobbyComparisonEqual) {
|
||||||
if (value->second == f.value_string) {
|
if (value->second == f.value_string) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking Equal (non-int)\n");
|
PRINT_DEBUG("Equal (non-int)");
|
||||||
//use = use;
|
//use = use;
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("Steam_MatchMaking Not Equal (non-int)\n");
|
PRINT_DEBUG("Not Equal (non-int)");
|
||||||
use = false;
|
use = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("TODO Steam_MatchMaking UNSUPPORTED compare type (non-int) %i\n", (int)f.eComparisonType);
|
PRINT_DEBUG("TODO UNSUPPORTED compare type (non-int) %i", (int)f.eComparisonType);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
PRINT_DEBUG("Steam_MatchMaking %s\n", value->second.c_str());
|
PRINT_DEBUG("%s", value->second.c_str());
|
||||||
int compare_to = 0;
|
int compare_to = 0;
|
||||||
//TODO: check if this is how real steam behaves
|
//TODO: check if this is how real steam behaves
|
||||||
if (value->second.size()) {
|
if (value->second.size()) {
|
||||||
compare_to = std::stoll(value->second, 0, 0);
|
compare_to = std::stoll(value->second, 0, 0);
|
||||||
}
|
}
|
||||||
PRINT_DEBUG("Steam_MatchMaking Compare Values %i %i\n", compare_to, f.value_int);
|
PRINT_DEBUG("Compare Values %i %i", compare_to, f.value_int);
|
||||||
if (f.eComparisonType == k_ELobbyComparisonEqual) {
|
if (f.eComparisonType == k_ELobbyComparisonEqual) {
|
||||||
if (compare_to == f.value_int) {
|
if (compare_to == f.value_int) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking Equal (int)\n");
|
PRINT_DEBUG("Equal (int)");
|
||||||
//use = use;
|
//use = use;
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("Steam_MatchMaking Not Equal (int)\n");
|
PRINT_DEBUG("Not Equal (int)");
|
||||||
use = false;
|
use = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("TODO Steam_MatchMaking UNSUPPORTED compare type (int) %i\n", (int)f.eComparisonType);
|
PRINT_DEBUG("TODO UNSUPPORTED compare type (int) %i", (int)f.eComparisonType);
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
//Same case as if the key is not in the lobby?
|
//Same case as if the key is not in the lobby?
|
||||||
@ -1421,7 +1420,7 @@ void RunCallbacks()
|
|||||||
//TODO: add more comparisons
|
//TODO: add more comparisons
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("Steam_MatchMaking Compare Key not in lobby\n");
|
PRINT_DEBUG("Compare Key not in lobby");
|
||||||
if (f.eComparisonType == k_ELobbyComparisonEqual) {
|
if (f.eComparisonType == k_ELobbyComparisonEqual) {
|
||||||
//If the key is not in the lobby do we take it into account?
|
//If the key is not in the lobby do we take it into account?
|
||||||
use = false;
|
use = false;
|
||||||
@ -1429,7 +1428,7 @@ void RunCallbacks()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_MatchMaking Lobby " "%" PRIu64 " use %u\n", l.room_id(), use);
|
PRINT_DEBUG("Lobby " "%" PRIu64 " use %u", l.room_id(), use);
|
||||||
if (use) PUSH_BACK_IF_NOT_IN(filtered_lobbies, (uint64)l.room_id());
|
if (use) PUSH_BACK_IF_NOT_IN(filtered_lobbies, (uint64)l.room_id());
|
||||||
if (filtered_lobbies.size() >= filter_max_results_copy) {
|
if (filtered_lobbies.size() >= filter_max_results_copy) {
|
||||||
searching = false;
|
searching = false;
|
||||||
@ -1443,7 +1442,7 @@ void RunCallbacks()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (searching && check_timedout(lobby_last_search, LOBBY_SEARCH_TIMEOUT)) {
|
if (searching && check_timedout(lobby_last_search, LOBBY_SEARCH_TIMEOUT)) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking LOBBY_SEARCH_TIMEOUT %zu\n", filtered_lobbies.size());
|
PRINT_DEBUG("LOBBY_SEARCH_TIMEOUT %zu", filtered_lobbies.size());
|
||||||
LobbyMatchList_t data;
|
LobbyMatchList_t data;
|
||||||
data.m_nLobbiesMatching = filtered_lobbies.size();
|
data.m_nLobbiesMatching = filtered_lobbies.size();
|
||||||
callback_results->addCallResult(search_call_api_id, data.k_iCallback, &data, sizeof(data));
|
callback_results->addCallResult(search_call_api_id, data.k_iCallback, &data, sizeof(data));
|
||||||
@ -1455,7 +1454,7 @@ void RunCallbacks()
|
|||||||
auto g = std::begin(pending_joins);
|
auto g = std::begin(pending_joins);
|
||||||
while (g != std::end(pending_joins)) {
|
while (g != std::end(pending_joins)) {
|
||||||
if (!g->message_sent) {
|
if (!g->message_sent) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking resending join lobby\n");
|
PRINT_DEBUG("resending join lobby");
|
||||||
Lobby_Messages *message = new Lobby_Messages();
|
Lobby_Messages *message = new Lobby_Messages();
|
||||||
message->set_type(Lobby_Messages::JOIN);
|
message->set_type(Lobby_Messages::JOIN);
|
||||||
g->message_sent = send_owner_packet(g->lobby_id, message);
|
g->message_sent = send_owner_packet(g->lobby_id, message);
|
||||||
@ -1463,7 +1462,7 @@ void RunCallbacks()
|
|||||||
|
|
||||||
Lobby *lobby = get_lobby(g->lobby_id);
|
Lobby *lobby = get_lobby(g->lobby_id);
|
||||||
if (lobby && lobby->deleted()) {
|
if (lobby && lobby->deleted()) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking lobby deleted %llu\n", g->lobby_id.ConvertToUint64());
|
PRINT_DEBUG("lobby deleted %llu", g->lobby_id.ConvertToUint64());
|
||||||
LobbyEnter_t data{};
|
LobbyEnter_t data{};
|
||||||
data.m_ulSteamIDLobby = lobby->room_id();
|
data.m_ulSteamIDLobby = lobby->room_id();
|
||||||
data.m_rgfChatPermissions = 0; //Unused - Always 0
|
data.m_rgfChatPermissions = 0; //Unused - Always 0
|
||||||
@ -1473,7 +1472,7 @@ void RunCallbacks()
|
|||||||
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
||||||
g = pending_joins.erase(g);
|
g = pending_joins.erase(g);
|
||||||
} else if (get_lobby_member(lobby, settings->get_local_steam_id())) {
|
} else if (get_lobby_member(lobby, settings->get_local_steam_id())) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking lobby joined %llu\n", g->lobby_id.ConvertToUint64());
|
PRINT_DEBUG("lobby joined %llu", g->lobby_id.ConvertToUint64());
|
||||||
LobbyEnter_t data{};
|
LobbyEnter_t data{};
|
||||||
data.m_ulSteamIDLobby = lobby->room_id();
|
data.m_ulSteamIDLobby = lobby->room_id();
|
||||||
data.m_rgfChatPermissions = 0; //Unused - Always 0
|
data.m_rgfChatPermissions = 0; //Unused - Always 0
|
||||||
@ -1484,7 +1483,7 @@ void RunCallbacks()
|
|||||||
g = pending_joins.erase(g);
|
g = pending_joins.erase(g);
|
||||||
trigger_lobby_dataupdate((uint64)lobby->room_id(), (uint64)lobby->room_id(), true);
|
trigger_lobby_dataupdate((uint64)lobby->room_id(), (uint64)lobby->room_id(), true);
|
||||||
} else if (check_timedout(g->joined, PENDING_JOIN_TIMEOUT)) {
|
} else if (check_timedout(g->joined, PENDING_JOIN_TIMEOUT)) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking pending join timeout %llu\n", g->lobby_id.ConvertToUint64());
|
PRINT_DEBUG("pending join timeout %llu", g->lobby_id.ConvertToUint64());
|
||||||
LobbyEnter_t data{};
|
LobbyEnter_t data{};
|
||||||
data.m_ulSteamIDLobby = g->lobby_id.ConvertToUint64();
|
data.m_ulSteamIDLobby = g->lobby_id.ConvertToUint64();
|
||||||
data.m_rgfChatPermissions = 0; //Unused - Always 0
|
data.m_rgfChatPermissions = 0; //Unused - Always 0
|
||||||
@ -1522,7 +1521,7 @@ void RunCallbacks()
|
|||||||
void Callback(Common_Message *msg)
|
void Callback(Common_Message *msg)
|
||||||
{
|
{
|
||||||
if (msg->has_lobby()) {
|
if (msg->has_lobby()) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking GOT A LOBBY appid: %u " "%" PRIu64 "\n", msg->lobby().appid(), msg->lobby().owner());
|
PRINT_DEBUG("GOT A LOBBY appid: %u " "%" PRIu64 "", msg->lobby().appid(), msg->lobby().owner());
|
||||||
if (msg->lobby().owner() != settings->get_local_steam_id().ConvertToUint64() && msg->lobby().appid() == settings->get_local_game_id().AppID()) {
|
if (msg->lobby().owner() != settings->get_local_steam_id().ConvertToUint64() && msg->lobby().appid() == settings->get_local_game_id().AppID()) {
|
||||||
Lobby *lobby = get_lobby((uint64)msg->lobby().room_id());
|
Lobby *lobby = get_lobby((uint64)msg->lobby().room_id());
|
||||||
if (!lobby) {
|
if (!lobby) {
|
||||||
@ -1609,24 +1608,24 @@ void Callback(Common_Message *msg)
|
|||||||
|
|
||||||
|
|
||||||
if (msg->has_lobby_messages()) {
|
if (msg->has_lobby_messages()) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking LOBBY MESSAGE %u " "%" PRIu64 "\n", msg->lobby_messages().type(), msg->lobby_messages().id());
|
PRINT_DEBUG("LOBBY MESSAGE %u " "%" PRIu64 "", msg->lobby_messages().type(), msg->lobby_messages().id());
|
||||||
Lobby *lobby = get_lobby((uint64)msg->lobby_messages().id());
|
Lobby *lobby = get_lobby((uint64)msg->lobby_messages().id());
|
||||||
if (lobby && !lobby->deleted()) {
|
if (lobby && !lobby->deleted()) {
|
||||||
bool we_are_in_lobby = !!get_lobby_member(lobby, settings->get_local_steam_id());
|
bool we_are_in_lobby = !!get_lobby_member(lobby, settings->get_local_steam_id());
|
||||||
if (lobby->owner() == settings->get_local_steam_id().ConvertToUint64()) {
|
if (lobby->owner() == settings->get_local_steam_id().ConvertToUint64()) {
|
||||||
if (msg->lobby_messages().type() == Lobby_Messages::JOIN) {
|
if (msg->lobby_messages().type() == Lobby_Messages::JOIN) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking LOBBY MESSAGE: JOIN, lobby=%llu from=%llu\n", (uint64)lobby->room_id(), (uint64)msg->source_id());
|
PRINT_DEBUG("LOBBY MESSAGE: JOIN, lobby=%llu from=%llu", (uint64)lobby->room_id(), (uint64)msg->source_id());
|
||||||
if (enter_lobby(lobby, (uint64)msg->source_id())) {
|
if (enter_lobby(lobby, (uint64)msg->source_id())) {
|
||||||
trigger_lobby_member_join_leave((uint64)lobby->room_id(), (uint64)msg->source_id(), false, true, 0.01);
|
trigger_lobby_member_join_leave((uint64)lobby->room_id(), (uint64)msg->source_id(), false, true, 0.01);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->lobby_messages().type() == Lobby_Messages::MEMBER_DATA) {
|
if (msg->lobby_messages().type() == Lobby_Messages::MEMBER_DATA) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking LOBBY MESSAGE: MEMBER_DATA\n");
|
PRINT_DEBUG("LOBBY MESSAGE: MEMBER_DATA");
|
||||||
Lobby_Member *member = get_lobby_member(lobby, (uint64)msg->source_id());
|
Lobby_Member *member = get_lobby_member(lobby, (uint64)msg->source_id());
|
||||||
if (member) {
|
if (member) {
|
||||||
for (auto const &p : msg->lobby_messages().map()) {
|
for (auto const &p : msg->lobby_messages().map()) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking member data %s:%s\n", p.first.c_str(), p.second.c_str());
|
PRINT_DEBUG("member data %s:%s", p.first.c_str(), p.second.c_str());
|
||||||
auto result = caseinsensitive_find(member->values(), p.first);
|
auto result = caseinsensitive_find(member->values(), p.first);
|
||||||
if (result == member->values().end()) {
|
if (result == member->values().end()) {
|
||||||
(*member->mutable_values())[p.first] = p.second;
|
(*member->mutable_values())[p.first] = p.second;
|
||||||
@ -1641,19 +1640,19 @@ void Callback(Common_Message *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg->lobby_messages().type() == Lobby_Messages::LEAVE) {
|
if (msg->lobby_messages().type() == Lobby_Messages::LEAVE) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking LOBBY MESSAGE: LEAVE " "%" PRIu64 "\n", msg->source_id());
|
PRINT_DEBUG("LOBBY MESSAGE: LEAVE " "%" PRIu64 "", msg->source_id());
|
||||||
leave_lobby(lobby, (uint64)msg->source_id());
|
leave_lobby(lobby, (uint64)msg->source_id());
|
||||||
if (we_are_in_lobby) trigger_lobby_member_join_leave((uint64)lobby->room_id(), (uint64)msg->source_id(), true, true, 0.2);
|
if (we_are_in_lobby) trigger_lobby_member_join_leave((uint64)lobby->room_id(), (uint64)msg->source_id(), true, true, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->lobby_messages().type() == Lobby_Messages::CHANGE_OWNER) {
|
if (msg->lobby_messages().type() == Lobby_Messages::CHANGE_OWNER) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking LOBBY MESSAGE: CHANGE OWNER\n");
|
PRINT_DEBUG("LOBBY MESSAGE: CHANGE OWNER");
|
||||||
lobby->set_owner(msg->lobby_messages().idata());
|
lobby->set_owner(msg->lobby_messages().idata());
|
||||||
if (we_are_in_lobby) trigger_lobby_dataupdate((uint64)lobby->room_id(), (uint64)lobby->room_id(), true);
|
if (we_are_in_lobby) trigger_lobby_dataupdate((uint64)lobby->room_id(), (uint64)lobby->room_id(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->lobby_messages().type() == Lobby_Messages::CHAT_MESSAGE) {
|
if (msg->lobby_messages().type() == Lobby_Messages::CHAT_MESSAGE) {
|
||||||
PRINT_DEBUG("Steam_MatchMaking LOBBY MESSAGE: CHAT MESSAGE\n");
|
PRINT_DEBUG("LOBBY MESSAGE: CHAT MESSAGE");
|
||||||
if (we_are_in_lobby) {
|
if (we_are_in_lobby) {
|
||||||
struct Chat_Entry entry{};
|
struct Chat_Entry entry{};
|
||||||
entry.type = k_EChatEntryTypeChatMsg;
|
entry.type = k_EChatEntryTypeChatMsg;
|
||||||
|
@ -221,7 +221,7 @@ void remove_killed_connection_sockets()
|
|||||||
public:
|
public:
|
||||||
static void steam_networking_callback(void *object, Common_Message *msg)
|
static void steam_networking_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_networking_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Networking *steam_networking = (Steam_Networking *)object;
|
Steam_Networking *steam_networking = (Steam_Networking *)object;
|
||||||
steam_networking->Callback(msg);
|
steam_networking->Callback(msg);
|
||||||
@ -229,7 +229,7 @@ static void steam_networking_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_networking_run_every_runcp(void *object)
|
static void steam_networking_run_every_runcp(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_networking_run_every_runcp\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Networking *steam_networking = (Steam_Networking *)object;
|
Steam_Networking *steam_networking = (Steam_Networking *)object;
|
||||||
steam_networking->RunCallbacks();
|
steam_networking->RunCallbacks();
|
||||||
@ -246,7 +246,7 @@ Steam_Networking(class Settings *settings, class Networking *network, class Stea
|
|||||||
|
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
|
||||||
PRINT_DEBUG("steam_networking_contructor %llu messages: %p\n", settings->get_local_steam_id().ConvertToUint64(), &messages);
|
PRINT_DEBUG("steam_networking_contructor %llu messages: %p", settings->get_local_steam_id().ConvertToUint64(), &messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
~Steam_Networking()
|
~Steam_Networking()
|
||||||
@ -271,7 +271,7 @@ Steam_Networking(class Settings *settings, class Networking *network, class Stea
|
|||||||
// using different channels to talk to the same user will still use the same underlying p2p connection, saving on resources
|
// using different channels to talk to the same user will still use the same underlying p2p connection, saving on resources
|
||||||
bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel)
|
bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::SendP2PPacket len %u sendtype: %u channel: %u to: %llu\n", cubData, eP2PSendType, nChannel, steamIDRemote.ConvertToUint64());
|
PRINT_DEBUG("len %u sendtype: %u channel: %u to: %llu", cubData, eP2PSendType, nChannel, steamIDRemote.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
bool reliable = false;
|
bool reliable = false;
|
||||||
if (eP2PSendType == k_EP2PSendReliable || eP2PSendType == k_EP2PSendReliableWithBuffering) reliable = true;
|
if (eP2PSendType == k_EP2PSendReliable || eP2PSendType == k_EP2PSendReliableWithBuffering) reliable = true;
|
||||||
@ -294,43 +294,43 @@ bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData,
|
|||||||
|
|
||||||
conn->open_channels.insert(nChannel);
|
conn->open_channels.insert(nChannel);
|
||||||
bool ret = network->sendTo(&msg, reliable);
|
bool ret = network->sendTo(&msg, reliable);
|
||||||
PRINT_DEBUG("Sent message with size: %zu %u\n", msg.network().data().size(), ret);
|
PRINT_DEBUG("Sent message with size: %zu %u", msg.network().data().size(), ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData, EP2PSend eP2PSendType ) {
|
bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData, EP2PSend eP2PSendType ) {
|
||||||
PRINT_DEBUG("Steam_Networking::SendP2PPacket old\n");
|
PRINT_DEBUG("old");
|
||||||
return SendP2PPacket(steamIDRemote, pubData, cubData, eP2PSendType, OLD_CHANNEL_NUMBER);
|
return SendP2PPacket(steamIDRemote, pubData, cubData, eP2PSendType, OLD_CHANNEL_NUMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if any data is available for read, and the amount of data that will need to be read
|
// returns true if any data is available for read, and the amount of data that will need to be read
|
||||||
bool IsP2PPacketAvailable( uint32 *pcubMsgSize, int nChannel)
|
bool IsP2PPacketAvailable( uint32 *pcubMsgSize, int nChannel)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::IsP2PPacketAvailable channel: %i\n", nChannel);
|
PRINT_DEBUG("channel: %i", nChannel);
|
||||||
std::lock_guard<std::recursive_mutex> lock(messages_mutex);
|
std::lock_guard<std::recursive_mutex> lock(messages_mutex);
|
||||||
//Not sure if this should be here because it slightly screws up games that don't like such low "pings"
|
//Not sure if this should be here because it slightly screws up games that don't like such low "pings"
|
||||||
//Commenting it out for now because it looks like it causes a bug where 20xx gets stuck in an infinite receive packet loop
|
//Commenting it out for now because it looks like it causes a bug where 20xx gets stuck in an infinite receive packet loop
|
||||||
//this->network->Run();
|
//this->network->Run();
|
||||||
//RunCallbacks();
|
//RunCallbacks();
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Networking::IsP2PPacketAvailable Messages %zu %p\n", messages.size(), &messages);
|
PRINT_DEBUG("Messages %zu %p", messages.size(), &messages);
|
||||||
for (auto &msg : messages) {
|
for (auto &msg : messages) {
|
||||||
if (connection_exists((uint64)msg.source_id()) && msg.mutable_network()->channel() == nChannel && msg.network().processed()) {
|
if (connection_exists((uint64)msg.source_id()) && msg.mutable_network()->channel() == nChannel && msg.network().processed()) {
|
||||||
uint32 size = msg.mutable_network()->data().size();
|
uint32 size = msg.mutable_network()->data().size();
|
||||||
if (pcubMsgSize) *pcubMsgSize = size;
|
if (pcubMsgSize) *pcubMsgSize = size;
|
||||||
PRINT_DEBUG("Steam_Networking::IsP2PPacketAvailable available with size: %u\n", size);
|
PRINT_DEBUG("available with size: %u", size);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Networking::IsP2PPacketAvailable (not available)\n");
|
PRINT_DEBUG("(not available)");
|
||||||
if (pcubMsgSize) *pcubMsgSize = 0;
|
if (pcubMsgSize) *pcubMsgSize = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsP2PPacketAvailable( uint32 *pcubMsgSize)
|
bool IsP2PPacketAvailable( uint32 *pcubMsgSize)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::IsP2PPacketAvailable old\n");
|
PRINT_DEBUG("old");
|
||||||
return IsP2PPacketAvailable(pcubMsgSize, OLD_CHANNEL_NUMBER);
|
return IsP2PPacketAvailable(pcubMsgSize, OLD_CHANNEL_NUMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ bool IsP2PPacketAvailable( uint32 *pcubMsgSize)
|
|||||||
// this call is not blocking, and will return false if no data is available
|
// this call is not blocking, and will return false if no data is available
|
||||||
bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID *psteamIDRemote, int nChannel)
|
bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID *psteamIDRemote, int nChannel)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::ReadP2PPacket %u %i\n", cubDest, nChannel);
|
PRINT_DEBUG("%u %i", cubDest, nChannel);
|
||||||
std::lock_guard<std::recursive_mutex> lock(messages_mutex);
|
std::lock_guard<std::recursive_mutex> lock(messages_mutex);
|
||||||
//Not sure if this should be here because it slightly screws up games that don't like such low "pings"
|
//Not sure if this should be here because it slightly screws up games that don't like such low "pings"
|
||||||
//Commenting it out for now because it looks like it causes a bug where 20xx gets stuck in an infinite receive packet loop
|
//Commenting it out for now because it looks like it causes a bug where 20xx gets stuck in an infinite receive packet loop
|
||||||
@ -348,7 +348,7 @@ bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID
|
|||||||
//RunCallbacks();
|
//RunCallbacks();
|
||||||
|
|
||||||
bool read = false;
|
bool read = false;
|
||||||
PRINT_DEBUG("Number messages %zu\n", messages.size());
|
PRINT_DEBUG("Number messages %zu", messages.size());
|
||||||
auto msg = std::begin(messages);
|
auto msg = std::begin(messages);
|
||||||
while (msg != std::end(messages)) {
|
while (msg != std::end(messages)) {
|
||||||
if (connection_exists((uint64)msg->source_id()) && msg->network().channel() == nChannel && msg->network().processed()) {
|
if (connection_exists((uint64)msg->source_id()) && msg->network().channel() == nChannel && msg->network().processed()) {
|
||||||
@ -357,13 +357,11 @@ bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID
|
|||||||
if (pcubMsgSize) *pcubMsgSize = msg_size;
|
if (pcubMsgSize) *pcubMsgSize = msg_size;
|
||||||
memcpy(pubDest, msg->network().data().data(), msg_size);
|
memcpy(pubDest, msg->network().data().data(), msg_size);
|
||||||
|
|
||||||
#ifndef EMU_RELEASE_BUILD
|
PRINT_DEBUG("%s",
|
||||||
for (int i = 0; i < msg_size; ++i) {
|
common_helpers::uint8_vector_to_hex_string(std::vector<uint8_t>((uint8_t*)pubDest, (uint8_t*)pubDest + msg_size)).c_str());
|
||||||
PRINT_DEBUG("%02hhX", ((char*)pubDest)[i]);
|
|
||||||
}PRINT_DEBUG("\n");
|
|
||||||
#endif
|
|
||||||
*psteamIDRemote = CSteamID((uint64)msg->source_id());
|
*psteamIDRemote = CSteamID((uint64)msg->source_id());
|
||||||
PRINT_DEBUG("Steam_Networking::ReadP2PPacket len %u channel: %u from: " "%" PRIu64 "\n", msg_size, nChannel, msg->source_id());
|
PRINT_DEBUG("len %u channel: %u from: " "%" PRIu64 "", msg_size, nChannel, msg->source_id());
|
||||||
msg = messages.erase(msg);
|
msg = messages.erase(msg);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -378,7 +376,7 @@ bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID
|
|||||||
|
|
||||||
bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID *psteamIDRemote)
|
bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID *psteamIDRemote)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::ReadP2PPacket old\n");
|
PRINT_DEBUG("old");
|
||||||
return ReadP2PPacket(pubDest, cubDest, pcubMsgSize, psteamIDRemote, OLD_CHANNEL_NUMBER);
|
return ReadP2PPacket(pubDest, cubDest, pcubMsgSize, psteamIDRemote, OLD_CHANNEL_NUMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +388,7 @@ bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID
|
|||||||
// (if you've called SendP2PPacket() on the other user, this implicitly accepts the session request)
|
// (if you've called SendP2PPacket() on the other user, this implicitly accepts the session request)
|
||||||
bool AcceptP2PSessionWithUser( CSteamID steamIDRemote )
|
bool AcceptP2PSessionWithUser( CSteamID steamIDRemote )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::AcceptP2PSessionWithUser %llu\n", steamIDRemote.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDRemote.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Steam_Networking_Connection *conn = get_or_create_connection(steamIDRemote);
|
struct Steam_Networking_Connection *conn = get_or_create_connection(steamIDRemote);
|
||||||
if (conn) new_connection_times.erase(steamIDRemote);
|
if (conn) new_connection_times.erase(steamIDRemote);
|
||||||
@ -402,7 +400,7 @@ bool AcceptP2PSessionWithUser( CSteamID steamIDRemote )
|
|||||||
// if the remote user tries to send data to you again, another P2PSessionRequest_t callback will be posted
|
// if the remote user tries to send data to you again, another P2PSessionRequest_t callback will be posted
|
||||||
bool CloseP2PSessionWithUser( CSteamID steamIDRemote )
|
bool CloseP2PSessionWithUser( CSteamID steamIDRemote )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::CloseP2PSessionWithUser %llu\n", steamIDRemote.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDRemote.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!connection_exists(steamIDRemote)) {
|
if (!connection_exists(steamIDRemote)) {
|
||||||
|
|
||||||
@ -420,7 +418,7 @@ bool CloseP2PSessionWithUser( CSteamID steamIDRemote )
|
|||||||
// user will trigger a P2PSessionRequest_t callback
|
// user will trigger a P2PSessionRequest_t callback
|
||||||
bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel )
|
bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::CloseP2PChannelWithUser\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!connection_exists(steamIDRemote)) {
|
if (!connection_exists(steamIDRemote)) {
|
||||||
return false;
|
return false;
|
||||||
@ -442,7 +440,7 @@ bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel )
|
|||||||
// returns false if no connection exists to the specified user
|
// returns false if no connection exists to the specified user
|
||||||
bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionState )
|
bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionState )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::GetP2PSessionState %llu\n", steamIDRemote.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDRemote.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!connection_exists(steamIDRemote) && (steamIDRemote != settings->get_local_steam_id())) {
|
if (!connection_exists(steamIDRemote) && (steamIDRemote != settings->get_local_steam_id())) {
|
||||||
if (pConnectionState) {
|
if (pConnectionState) {
|
||||||
@ -456,7 +454,7 @@ bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionS
|
|||||||
pConnectionState->m_nRemotePort = 0;
|
pConnectionState->m_nRemotePort = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("No Connection\n");
|
PRINT_DEBUG("No Connection");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,7 +469,7 @@ bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionS
|
|||||||
pConnectionState->m_nRemotePort = 12345;
|
pConnectionState->m_nRemotePort = 12345;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Connection\n");
|
PRINT_DEBUG("Connection");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +481,7 @@ bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionS
|
|||||||
// P2P packet relay is allowed by default
|
// P2P packet relay is allowed by default
|
||||||
bool AllowP2PPacketRelay( bool bAllow )
|
bool AllowP2PPacketRelay( bool bAllow )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::AllowP2PPacketRelay %u\n", bAllow);
|
PRINT_DEBUG("%u", bAllow);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,7 +507,7 @@ SNetListenSocket_t socket_number = 0;
|
|||||||
// pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only
|
// pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only
|
||||||
SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay )
|
SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::CreateListenSocket old %i %u %hu %u\n", nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay);
|
PRINT_DEBUG("old %i %u %hu %u", nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
for (auto & c : listen_sockets) {
|
for (auto & c : listen_sockets) {
|
||||||
if (c.nVirtualP2PPort == nVirtualP2PPort || c.nPort == nPort)
|
if (c.nVirtualP2PPort == nVirtualP2PPort || c.nPort == nPort)
|
||||||
@ -530,14 +528,14 @@ SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 n
|
|||||||
|
|
||||||
SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, SteamIPAddress_t nIP, uint16 nPort, bool bAllowUseOfPacketRelay )
|
SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, SteamIPAddress_t nIP, uint16 nPort, bool bAllowUseOfPacketRelay )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::CreateListenSocket %i %i %u %hu %u\n", nVirtualP2PPort, nIP.m_eType, nIP.m_unIPv4, nPort, bAllowUseOfPacketRelay);
|
PRINT_DEBUG("%i %i %u %hu %u", nVirtualP2PPort, nIP.m_eType, nIP.m_unIPv4, nPort, bAllowUseOfPacketRelay);
|
||||||
//TODO: ipv6
|
//TODO: ipv6
|
||||||
return CreateListenSocket(nVirtualP2PPort, nIP.m_unIPv4, nPort, bAllowUseOfPacketRelay);
|
return CreateListenSocket(nVirtualP2PPort, nIP.m_unIPv4, nPort, bAllowUseOfPacketRelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort )
|
SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::CreateListenSocket old\n");
|
PRINT_DEBUG("old");
|
||||||
return CreateListenSocket(nVirtualP2PPort, nIP, nPort, true);
|
return CreateListenSocket(nVirtualP2PPort, nIP, nPort, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,7 +545,7 @@ SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 n
|
|||||||
// on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState
|
// on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState
|
||||||
SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay )
|
SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::CreateP2PConnectionSocket %llu %i %i %u\n", steamIDTarget.ConvertToUint64(), nVirtualPort, nTimeoutSec, bAllowUseOfPacketRelay);
|
PRINT_DEBUG("%llu %i %i %u", steamIDTarget.ConvertToUint64(), nVirtualPort, nTimeoutSec, bAllowUseOfPacketRelay);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO: nTimeoutSec
|
//TODO: nTimeoutSec
|
||||||
return create_connection_socket(steamIDTarget, nVirtualPort, 0, 0);
|
return create_connection_socket(steamIDTarget, nVirtualPort, 0, 0);
|
||||||
@ -555,13 +553,13 @@ SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort
|
|||||||
|
|
||||||
SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec )
|
SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::CreateP2PConnectionSocket old\n");
|
PRINT_DEBUG("old");
|
||||||
return CreateP2PConnectionSocket(steamIDTarget, nVirtualPort, nTimeoutSec, true);
|
return CreateP2PConnectionSocket(steamIDTarget, nVirtualPort, nTimeoutSec, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec )
|
SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::CreateConnectionSocket_old %u %hu %i\n", nIP, nPort, nTimeoutSec);
|
PRINT_DEBUG("%u %hu %i", nIP, nPort, nTimeoutSec);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO: nTimeoutSec
|
//TODO: nTimeoutSec
|
||||||
return create_connection_socket((uint64)0, 0, nIP, nPort);
|
return create_connection_socket((uint64)0, 0, nIP, nPort);
|
||||||
@ -569,7 +567,7 @@ SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec )
|
|||||||
|
|
||||||
SNetSocket_t CreateConnectionSocket( SteamIPAddress_t nIP, uint16 nPort, int nTimeoutSec )
|
SNetSocket_t CreateConnectionSocket( SteamIPAddress_t nIP, uint16 nPort, int nTimeoutSec )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::CreateConnectionSocket %i %u %hu %i\n", nIP.m_eType, nIP.m_unIPv4, nPort, nTimeoutSec);
|
PRINT_DEBUG("%i %u %hu %i", nIP.m_eType, nIP.m_unIPv4, nPort, nTimeoutSec);
|
||||||
//TODO: ipv6
|
//TODO: ipv6
|
||||||
return CreateConnectionSocket(nIP.m_unIPv4, nPort, nTimeoutSec);
|
return CreateConnectionSocket(nIP.m_unIPv4, nPort, nTimeoutSec);
|
||||||
}
|
}
|
||||||
@ -579,7 +577,7 @@ SNetSocket_t CreateConnectionSocket( SteamIPAddress_t nIP, uint16 nPort, int nTi
|
|||||||
// if bNotifyRemoteEnd is set, socket will not be completely destroyed until the remote end acknowledges the disconnect
|
// if bNotifyRemoteEnd is set, socket will not be completely destroyed until the remote end acknowledges the disconnect
|
||||||
bool DestroySocket( SNetSocket_t hSocket, bool bNotifyRemoteEnd )
|
bool DestroySocket( SNetSocket_t hSocket, bool bNotifyRemoteEnd )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::DestroySocket\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
||||||
if (!socket || socket->status == SOCKET_KILLED) return false;
|
if (!socket || socket->status == SOCKET_KILLED) return false;
|
||||||
@ -590,7 +588,7 @@ bool DestroySocket( SNetSocket_t hSocket, bool bNotifyRemoteEnd )
|
|||||||
// destroying a listen socket will automatically kill all the regular sockets generated from it
|
// destroying a listen socket will automatically kill all the regular sockets generated from it
|
||||||
bool DestroyListenSocket( SNetListenSocket_t hSocket, bool bNotifyRemoteEnd )
|
bool DestroyListenSocket( SNetListenSocket_t hSocket, bool bNotifyRemoteEnd )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::DestroyListenSocket\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto c = std::begin(listen_sockets);
|
auto c = std::begin(listen_sockets);
|
||||||
while (c != std::end(listen_sockets)) {
|
while (c != std::end(listen_sockets)) {
|
||||||
@ -618,7 +616,7 @@ bool DestroyListenSocket( SNetListenSocket_t hSocket, bool bNotifyRemoteEnd )
|
|||||||
// it can still cause stalls in receiving data (like TCP)
|
// it can still cause stalls in receiving data (like TCP)
|
||||||
bool SendDataOnSocket( SNetSocket_t hSocket, void *pubData, uint32 cubData, bool bReliable )
|
bool SendDataOnSocket( SNetSocket_t hSocket, void *pubData, uint32 cubData, bool bReliable )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::SendDataOnSocket\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
||||||
if (!socket || socket->status != SOCKET_CONNECTED) return false;
|
if (!socket || socket->status != SOCKET_CONNECTED) return false;
|
||||||
@ -639,7 +637,7 @@ bool SendDataOnSocket( SNetSocket_t hSocket, void *pubData, uint32 cubData, bool
|
|||||||
// fills out *pcubMsgSize with the size of the next message, in bytes
|
// fills out *pcubMsgSize with the size of the next message, in bytes
|
||||||
bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize )
|
bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::IsDataAvailableOnSocket\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
||||||
if (!socket) {
|
if (!socket) {
|
||||||
@ -659,7 +657,7 @@ bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize )
|
|||||||
// returns false if no data is available
|
// returns false if no data is available
|
||||||
bool RetrieveDataFromSocket( SNetSocket_t hSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize )
|
bool RetrieveDataFromSocket( SNetSocket_t hSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::RetrieveDataFromSocket\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
||||||
if (!socket || socket->data_packets.size() == 0) return false;
|
if (!socket || socket->data_packets.size() == 0) return false;
|
||||||
@ -684,7 +682,7 @@ bool RetrieveDataFromSocket( SNetSocket_t hSocket, void *pubDest, uint32 cubDest
|
|||||||
// fills out *phSocket with the socket that data is available on
|
// fills out *phSocket with the socket that data is available on
|
||||||
bool IsDataAvailable( SNetListenSocket_t hListenSocket, uint32 *pcubMsgSize, SNetSocket_t *phSocket )
|
bool IsDataAvailable( SNetListenSocket_t hListenSocket, uint32 *pcubMsgSize, SNetSocket_t *phSocket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::IsDataAvailable\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!hListenSocket) return false;
|
if (!hListenSocket) return false;
|
||||||
|
|
||||||
@ -708,7 +706,7 @@ bool IsDataAvailable( SNetListenSocket_t hListenSocket, uint32 *pcubMsgSize, SNe
|
|||||||
// fills out *phSocket with the socket that data is available on
|
// fills out *phSocket with the socket that data is available on
|
||||||
bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, SNetSocket_t *phSocket )
|
bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, SNetSocket_t *phSocket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::RetrieveData\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!hListenSocket) return false;
|
if (!hListenSocket) return false;
|
||||||
|
|
||||||
@ -734,7 +732,7 @@ bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDe
|
|||||||
// returns information about the specified socket, filling out the contents of the pointers
|
// returns information about the specified socket, filling out the contents of the pointers
|
||||||
bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, uint32 *punIPRemote, uint16 *punPortRemote )
|
bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, uint32 *punIPRemote, uint16 *punPortRemote )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::GetSocketInfo_old\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
||||||
if (!socket) return false;
|
if (!socket) return false;
|
||||||
@ -761,7 +759,7 @@ bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocke
|
|||||||
|
|
||||||
bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, SteamIPAddress_t *punIPRemote, uint16 *punPortRemote )
|
bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, SteamIPAddress_t *punIPRemote, uint16 *punPortRemote )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::GetSocketInfo\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
//TODO: ipv6
|
//TODO: ipv6
|
||||||
uint32 *ip_remote = NULL;
|
uint32 *ip_remote = NULL;
|
||||||
if (punIPRemote) {
|
if (punIPRemote) {
|
||||||
@ -780,7 +778,7 @@ bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocke
|
|||||||
// *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only
|
// *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only
|
||||||
bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16 *pnPort )
|
bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16 *pnPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::GetListenSocketInfo_old\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto conn = std::find_if(listen_sockets.begin(), listen_sockets.end(), [&hListenSocket](struct steam_listen_socket const& conn) { return conn.id == hListenSocket;});
|
auto conn = std::find_if(listen_sockets.begin(), listen_sockets.end(), [&hListenSocket](struct steam_listen_socket const& conn) { return conn.id == hListenSocket;});
|
||||||
if (conn == listen_sockets.end()) return false;
|
if (conn == listen_sockets.end()) return false;
|
||||||
@ -791,7 +789,7 @@ bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16
|
|||||||
|
|
||||||
bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, SteamIPAddress_t *pnIP, uint16 *pnPort )
|
bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, SteamIPAddress_t *pnIP, uint16 *pnPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::GetListenSocketInfo\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
//TODO: ipv6
|
//TODO: ipv6
|
||||||
uint32 *ip = NULL;
|
uint32 *ip = NULL;
|
||||||
if (pnIP) {
|
if (pnIP) {
|
||||||
@ -809,7 +807,7 @@ bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, SteamIPAddress_t *pn
|
|||||||
// returns true to describe how the socket ended up connecting
|
// returns true to describe how the socket ended up connecting
|
||||||
ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket )
|
ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::GetSocketConnectionType\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
struct steam_connection_socket *socket = get_connection_socket(hSocket);
|
||||||
if (!socket || socket->status != SOCKET_CONNECTED) return k_ESNetSocketConnectionTypeNotConnected;
|
if (!socket || socket->status != SOCKET_CONNECTED) return k_ESNetSocketConnectionTypeNotConnected;
|
||||||
@ -820,7 +818,7 @@ ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket )
|
|||||||
// max packet size, in bytes
|
// max packet size, in bytes
|
||||||
int GetMaxPacketSize( SNetSocket_t hSocket )
|
int GetMaxPacketSize( SNetSocket_t hSocket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking::GetMaxPacketSize\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return 1500;
|
return 1500;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,11 +905,11 @@ void RunCallbacks()
|
|||||||
void Callback(Common_Message *msg)
|
void Callback(Common_Message *msg)
|
||||||
{
|
{
|
||||||
if (msg->has_network()) {
|
if (msg->has_network()) {
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("got msg from: " "%" PRIu64 " to: " "%" PRIu64 " size %zu type %u | messages %p: %zu",
|
||||||
"Steam_Networking: got msg from: " "%" PRIu64 " to: " "%" PRIu64 " size %zu type %u | messages %p: %zu\n",
|
|
||||||
msg->source_id(), msg->dest_id(), msg->network().data().size(), msg->network().type(), &messages, messages.size()
|
msg->source_id(), msg->dest_id(), msg->network().data().size(), msg->network().type(), &messages, messages.size()
|
||||||
);
|
);
|
||||||
PRINT_DEBUG("Steam_Networking msg data: '%s'\n", common_helpers::uint8_vector_to_hex_string( std::vector<uint8_t>(msg->network().data().begin(), msg->network().data().end()) ).c_str());
|
PRINT_DEBUG("msg data: '%s'",
|
||||||
|
common_helpers::uint8_vector_to_hex_string(std::vector<uint8_t>(msg->network().data().begin(), msg->network().data().end())).c_str());
|
||||||
|
|
||||||
if (msg->network().type() == Network_pb::DATA) {
|
if (msg->network().type() == Network_pb::DATA) {
|
||||||
unprocessed_messages.push_back(Common_Message(*msg));
|
unprocessed_messages.push_back(Common_Message(*msg));
|
||||||
@ -932,7 +930,7 @@ void Callback(Common_Message *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_network_old()) {
|
if (msg->has_network_old()) {
|
||||||
PRINT_DEBUG("Steam_Networking: got network socket msg %u\n", msg->network_old().type());
|
PRINT_DEBUG("got network socket msg %u", msg->network_old().type());
|
||||||
if (msg->network_old().type() == Network_Old::CONNECTION_REQUEST_IP) {
|
if (msg->network_old().type() == Network_Old::CONNECTION_REQUEST_IP) {
|
||||||
for (auto & listen : listen_sockets) {
|
for (auto & listen : listen_sockets) {
|
||||||
if (listen.nPort == msg->network_old().port()) {
|
if (listen.nPort == msg->network_old().port()) {
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
|
|
||||||
static void steam_callback(void *object, Common_Message *msg)
|
static void steam_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_networking_messages_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Networking_Messages *steam_networking_messages = (Steam_Networking_Messages *)object;
|
Steam_Networking_Messages *steam_networking_messages = (Steam_Networking_Messages *)object;
|
||||||
steam_networking_messages->Callback(msg);
|
steam_networking_messages->Callback(msg);
|
||||||
@ -59,7 +59,7 @@ static void steam_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_networking_messages_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Networking_Messages *steam_networking_messages = (Steam_Networking_Messages *)object;
|
Steam_Networking_Messages *steam_networking_messages = (Steam_Networking_Messages *)object;
|
||||||
steam_networking_messages->RunCallbacks();
|
steam_networking_messages->RunCallbacks();
|
||||||
@ -170,7 +170,7 @@ std::map<CSteamID, Steam_Message_Connection>::iterator find_or_create_message_co
|
|||||||
/// - See SendMessageToConnection::SendMessageToConnection for more
|
/// - See SendMessageToConnection::SendMessageToConnection for more
|
||||||
EResult SendMessageToUser( const SteamNetworkingIdentity &identityRemote, const void *pubData, uint32 cubData, int nSendFlags, int nRemoteChannel )
|
EResult SendMessageToUser( const SteamNetworkingIdentity &identityRemote, const void *pubData, uint32 cubData, int nSendFlags, int nRemoteChannel )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Messages::SendMessageToUser\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
const SteamNetworkingIPAddr *ip = identityRemote.GetIPAddr();
|
const SteamNetworkingIPAddr *ip = identityRemote.GetIPAddr();
|
||||||
bool reliable = false;
|
bool reliable = false;
|
||||||
@ -184,10 +184,10 @@ EResult SendMessageToUser( const SteamNetworkingIdentity &identityRemote, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (identityRemote.m_eType == k_ESteamNetworkingIdentityType_SteamID) {
|
if (identityRemote.m_eType == k_ESteamNetworkingIdentityType_SteamID) {
|
||||||
PRINT_DEBUG("Steam_Networking_Messages::SendMessageToUser %llu\n", identityRemote.GetSteamID64());
|
PRINT_DEBUG("%llu", identityRemote.GetSteamID64());
|
||||||
//steam id identity
|
//steam id identity
|
||||||
} else if (ip) {
|
} else if (ip) {
|
||||||
PRINT_DEBUG("Steam_Networking_Messages::SendMessageToUser %u:%u ipv4? %u\n", ip->GetIPv4(), ip->m_port, ip->IsIPv4());
|
PRINT_DEBUG("%u:%u ipv4? %u", ip->GetIPv4(), ip->m_port, ip->IsIPv4());
|
||||||
//ip addr
|
//ip addr
|
||||||
return k_EResultNoConnection; //TODO
|
return k_EResultNoConnection; //TODO
|
||||||
} else {
|
} else {
|
||||||
@ -230,7 +230,7 @@ static void delete_steam_message(SteamNetworkingMessage_t *pMsg)
|
|||||||
/// When you're done with the message object(s), make sure and call Release()!
|
/// When you're done with the message object(s), make sure and call Release()!
|
||||||
int ReceiveMessagesOnChannel( int nLocalChannel, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages )
|
int ReceiveMessagesOnChannel( int nLocalChannel, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Messages::ReceiveMessagesOnChannel\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
int message_counter = 0;
|
int message_counter = 0;
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ int ReceiveMessagesOnChannel( int nLocalChannel, SteamNetworkingMessage_t **ppOu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Networking_Messages::ReceiveMessagesOnChannel got %u\n", message_counter);
|
PRINT_DEBUG("got %u", message_counter);
|
||||||
return message_counter;
|
return message_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ int ReceiveMessagesOnChannel( int nLocalChannel, SteamNetworkingMessage_t **ppOu
|
|||||||
/// Calling SendMessage() on the other user, this implicitly accepts any pending session request.
|
/// Calling SendMessage() on the other user, this implicitly accepts any pending session request.
|
||||||
bool AcceptSessionWithUser( const SteamNetworkingIdentity &identityRemote )
|
bool AcceptSessionWithUser( const SteamNetworkingIdentity &identityRemote )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Messages::AcceptSessionWithUser\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto conn = connections.find(identityRemote.GetSteamID());
|
auto conn = connections.find(identityRemote.GetSteamID());
|
||||||
if (conn == connections.end()) {
|
if (conn == connections.end()) {
|
||||||
@ -296,7 +296,7 @@ bool AcceptSessionWithUser( const SteamNetworkingIdentity &identityRemote )
|
|||||||
/// Note that sessions that go unused for a few minutes are automatically timed out.
|
/// Note that sessions that go unused for a few minutes are automatically timed out.
|
||||||
bool CloseSessionWithUser( const SteamNetworkingIdentity &identityRemote )
|
bool CloseSessionWithUser( const SteamNetworkingIdentity &identityRemote )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Messages::CloseSessionWithUser\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto conn = connections.find(identityRemote.GetSteamID());
|
auto conn = connections.find(identityRemote.GetSteamID());
|
||||||
if (conn == connections.end()) {
|
if (conn == connections.end()) {
|
||||||
@ -322,7 +322,7 @@ bool CloseSessionWithUser( const SteamNetworkingIdentity &identityRemote )
|
|||||||
/// callback
|
/// callback
|
||||||
bool CloseChannelWithUser( const SteamNetworkingIdentity &identityRemote, int nLocalChannel )
|
bool CloseChannelWithUser( const SteamNetworkingIdentity &identityRemote, int nLocalChannel )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Messages::CloseChannelWithUser\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO
|
//TODO
|
||||||
return false;
|
return false;
|
||||||
@ -339,7 +339,7 @@ bool CloseChannelWithUser( const SteamNetworkingIdentity &identityRemote, int nL
|
|||||||
/// indefinitely to obtain the reason for failure.
|
/// indefinitely to obtain the reason for failure.
|
||||||
ESteamNetworkingConnectionState GetSessionConnectionInfo( const SteamNetworkingIdentity &identityRemote, SteamNetConnectionInfo_t *pConnectionInfo, SteamNetConnectionRealTimeStatus_t *pQuickStatus )
|
ESteamNetworkingConnectionState GetSessionConnectionInfo( const SteamNetworkingIdentity &identityRemote, SteamNetConnectionInfo_t *pConnectionInfo, SteamNetConnectionRealTimeStatus_t *pQuickStatus )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Messages::GetSessionConnectionInfo\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto conn = connections.find(identityRemote.GetSteamID());
|
auto conn = connections.find(identityRemote.GetSteamID());
|
||||||
if (conn == connections.end()) {
|
if (conn == connections.end()) {
|
||||||
@ -418,7 +418,7 @@ void Callback(Common_Message *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_networking_messages()) {
|
if (msg->has_networking_messages()) {
|
||||||
PRINT_DEBUG("Steam_Networking_Messages: got network socket msg %u\n", msg->networking_messages().type());
|
PRINT_DEBUG("got network socket msg %u", msg->networking_messages().type());
|
||||||
if (msg->networking_messages().type() == Networking_Messages::CONNECTION_NEW) {
|
if (msg->networking_messages().type() == Networking_Messages::CONNECTION_NEW) {
|
||||||
SteamNetworkingIdentity identity;
|
SteamNetworkingIdentity identity;
|
||||||
identity.SetSteamID64(msg->source_id());
|
identity.SetSteamID64(msg->source_id());
|
||||||
|
@ -94,7 +94,7 @@ public ISteamNetworkingSockets
|
|||||||
public:
|
public:
|
||||||
static void steam_callback(void *object, Common_Message *msg)
|
static void steam_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_networkingsockets_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Networking_Sockets *steam_networkingsockets = (Steam_Networking_Sockets *)object;
|
Steam_Networking_Sockets *steam_networkingsockets = (Steam_Networking_Sockets *)object;
|
||||||
steam_networkingsockets->Callback(msg);
|
steam_networkingsockets->Callback(msg);
|
||||||
@ -102,7 +102,7 @@ static void steam_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_networkingsockets_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Networking_Sockets *steam_networkingsockets = (Steam_Networking_Sockets *)object;
|
Steam_Networking_Sockets *steam_networkingsockets = (Steam_Networking_Sockets *)object;
|
||||||
steam_networkingsockets->RunCallbacks();
|
steam_networkingsockets->RunCallbacks();
|
||||||
@ -311,7 +311,7 @@ void launch_callback(HSteamNetConnection m_hConn, enum connect_socket_status old
|
|||||||
/// A SocketStatusCallback_t callback when another client attempts a connection.
|
/// A SocketStatusCallback_t callback when another client attempts a connection.
|
||||||
HSteamListenSocket CreateListenSocket( int nSteamConnectVirtualPort, uint32 nIP, uint16 nPort )
|
HSteamListenSocket CreateListenSocket( int nSteamConnectVirtualPort, uint32 nIP, uint16 nPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocket %i %u %u\n", nSteamConnectVirtualPort, nIP, nPort);
|
PRINT_DEBUG("%i %u %u", nSteamConnectVirtualPort, nIP, nPort);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return new_listen_socket(nSteamConnectVirtualPort, nPort);
|
return new_listen_socket(nSteamConnectVirtualPort, nPort);
|
||||||
}
|
}
|
||||||
@ -332,21 +332,21 @@ HSteamListenSocket CreateListenSocket( int nSteamConnectVirtualPort, uint32 nIP,
|
|||||||
/// will be posted. The connection will be in the connecting state.
|
/// will be posted. The connection will be in the connecting state.
|
||||||
HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress )
|
HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketIP old\n");
|
PRINT_DEBUG("old");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return new_listen_socket(SNS_DISABLED_PORT, localAddress.m_port);
|
return new_listen_socket(SNS_DISABLED_PORT, localAddress.m_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr *localAddress )
|
HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr *localAddress )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketIP old1\n");
|
PRINT_DEBUG("old1");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return new_listen_socket(SNS_DISABLED_PORT, localAddress->m_port);
|
return new_listen_socket(SNS_DISABLED_PORT, localAddress->m_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketIP\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return new_listen_socket(SNS_DISABLED_PORT, localAddress.m_port);
|
return new_listen_socket(SNS_DISABLED_PORT, localAddress.m_port);
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddre
|
|||||||
/// man-in-the-middle attacks.
|
/// man-in-the-middle attacks.
|
||||||
HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address )
|
HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectByIPAddress old\n");
|
PRINT_DEBUG("old");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
SteamNetworkingIdentity ip_id;
|
SteamNetworkingIdentity ip_id;
|
||||||
ip_id.SetIPAddr(address);
|
ip_id.SetIPAddr(address);
|
||||||
@ -382,7 +382,7 @@ HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address )
|
|||||||
|
|
||||||
HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr *address )
|
HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr *address )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectByIPAddress old1\n");
|
PRINT_DEBUG("old1");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
SteamNetworkingIdentity ip_id;
|
SteamNetworkingIdentity ip_id;
|
||||||
ip_id.SetIPAddr(*address);
|
ip_id.SetIPAddr(*address);
|
||||||
@ -393,7 +393,7 @@ HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr *address )
|
|||||||
|
|
||||||
HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectByIPAddress %X\n", address.GetIPv4());
|
PRINT_DEBUG("%X", address.GetIPv4());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
SteamNetworkingIdentity ip_id;
|
SteamNetworkingIdentity ip_id;
|
||||||
ip_id.SetIPAddr(address);
|
ip_id.SetIPAddr(address);
|
||||||
@ -414,14 +414,14 @@ HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address, in
|
|||||||
/// when your app initializes
|
/// when your app initializes
|
||||||
HSteamListenSocket CreateListenSocketP2P( int nVirtualPort )
|
HSteamListenSocket CreateListenSocketP2P( int nVirtualPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketP2P old %i\n", nVirtualPort);
|
PRINT_DEBUG("old %i", nVirtualPort);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return new_listen_socket(nVirtualPort, SNS_DISABLED_PORT);
|
return new_listen_socket(nVirtualPort, SNS_DISABLED_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
HSteamListenSocket CreateListenSocketP2P( int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
HSteamListenSocket CreateListenSocketP2P( int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketP2P %i\n", nVirtualPort);
|
PRINT_DEBUG("%i", nVirtualPort);
|
||||||
//TODO config options
|
//TODO config options
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return new_listen_socket(nVirtualPort, SNS_DISABLED_PORT);
|
return new_listen_socket(nVirtualPort, SNS_DISABLED_PORT);
|
||||||
@ -440,16 +440,16 @@ HSteamListenSocket CreateListenSocketP2P( int nVirtualPort, int nOptions, const
|
|||||||
/// when your app initializes
|
/// when your app initializes
|
||||||
HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort )
|
HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2P old %i\n", nVirtualPort);
|
PRINT_DEBUG("old %i", nVirtualPort);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
const SteamNetworkingIPAddr *ip = identityRemote.GetIPAddr();
|
const SteamNetworkingIPAddr *ip = identityRemote.GetIPAddr();
|
||||||
|
|
||||||
if (identityRemote.m_eType == k_ESteamNetworkingIdentityType_SteamID) {
|
if (identityRemote.m_eType == k_ESteamNetworkingIdentityType_SteamID) {
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2P %llu\n", identityRemote.GetSteamID64());
|
PRINT_DEBUG("%llu", identityRemote.GetSteamID64());
|
||||||
//steam id identity
|
//steam id identity
|
||||||
} else if (ip) {
|
} else if (ip) {
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2P %u:%u ipv4? %u\n", ip->GetIPv4(), ip->m_port, ip->IsIPv4());
|
PRINT_DEBUG("%u:%u ipv4? %u", ip->GetIPv4(), ip->m_port, ip->IsIPv4());
|
||||||
//ip addr
|
//ip addr
|
||||||
} else {
|
} else {
|
||||||
return k_HSteamNetConnection_Invalid;
|
return k_HSteamNetConnection_Invalid;
|
||||||
@ -462,13 +462,13 @@ HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, i
|
|||||||
|
|
||||||
HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity *identityRemote, int nVirtualPort )
|
HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity *identityRemote, int nVirtualPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2P old1\n");
|
PRINT_DEBUG("old1");
|
||||||
return ConnectP2P(*identityRemote, nVirtualPort);
|
return ConnectP2P(*identityRemote, nVirtualPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2P %i\n", nVirtualPort);
|
PRINT_DEBUG("%i", nVirtualPort);
|
||||||
//TODO config options
|
//TODO config options
|
||||||
return ConnectP2P(identityRemote, nVirtualPort);
|
return ConnectP2P(identityRemote, nVirtualPort);
|
||||||
}
|
}
|
||||||
@ -484,14 +484,16 @@ HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, i
|
|||||||
//#ifndef STEAMNETWORKINGSOCKETS_OPENSOURCE
|
//#ifndef STEAMNETWORKINGSOCKETS_OPENSOURCE
|
||||||
HSteamNetConnection ConnectBySteamID( CSteamID steamIDTarget, int nVirtualPort )
|
HSteamNetConnection ConnectBySteamID( CSteamID steamIDTarget, int nVirtualPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectBySteamID\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_HSteamNetConnection_Invalid;
|
return k_HSteamNetConnection_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endif
|
//#endif
|
||||||
HSteamNetConnection ConnectByIPv4Address( uint32 nIP, uint16 nPort )
|
HSteamNetConnection ConnectByIPv4Address( uint32 nIP, uint16 nPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectByIPv4Address\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_HSteamNetConnection_Invalid;
|
return k_HSteamNetConnection_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,7 +533,7 @@ HSteamNetConnection ConnectByIPv4Address( uint32 nIP, uint16 nPort )
|
|||||||
/// notification being posted to the queue and when it is received by the application.)
|
/// notification being posted to the queue and when it is received by the application.)
|
||||||
EResult AcceptConnection( HSteamNetConnection hConn )
|
EResult AcceptConnection( HSteamNetConnection hConn )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::AcceptConnection %u\n", hConn);
|
PRINT_DEBUG("%u", hConn);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto connect_socket = s->connect_sockets.find(hConn);
|
auto connect_socket = s->connect_sockets.find(hConn);
|
||||||
@ -568,7 +570,7 @@ EResult AcceptConnection( HSteamNetConnection hConn )
|
|||||||
/// ignored.
|
/// ignored.
|
||||||
bool CloseConnection( HSteamNetConnection hPeer, int nReason, const char *pszDebug, bool bEnableLinger )
|
bool CloseConnection( HSteamNetConnection hPeer, int nReason, const char *pszDebug, bool bEnableLinger )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CloseConnection %u\n", hPeer);
|
PRINT_DEBUG("%u", hPeer);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto connect_socket = s->connect_sockets.find(hPeer);
|
auto connect_socket = s->connect_sockets.find(hPeer);
|
||||||
@ -604,7 +606,8 @@ bool CloseConnection( HSteamNetConnection hPeer, int nReason, const char *pszDeb
|
|||||||
/// socket must remain open until all clients have been cleaned up.
|
/// socket must remain open until all clients have been cleaned up.
|
||||||
bool CloseListenSocket( HSteamListenSocket hSocket, const char *pszNotifyRemoteReason )
|
bool CloseListenSocket( HSteamListenSocket hSocket, const char *pszNotifyRemoteReason )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CloseListenSocket old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,7 +615,7 @@ bool CloseListenSocket( HSteamListenSocket hSocket, const char *pszNotifyRemoteR
|
|||||||
/// socket are closed ungracefully.
|
/// socket are closed ungracefully.
|
||||||
bool CloseListenSocket( HSteamListenSocket hSocket )
|
bool CloseListenSocket( HSteamListenSocket hSocket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CloseListenSocket\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto conn = std::find_if(s->listen_sockets.begin(), s->listen_sockets.end(), [&hSocket](struct Listen_Socket const& conn) { return conn.socket_id == hSocket;});
|
auto conn = std::find_if(s->listen_sockets.begin(), s->listen_sockets.end(), [&hSocket](struct Listen_Socket const& conn) { return conn.socket_id == hSocket;});
|
||||||
@ -641,7 +644,7 @@ bool CloseListenSocket( HSteamListenSocket hSocket )
|
|||||||
/// Set connection user data. Returns false if the handle is invalid.
|
/// Set connection user data. Returns false if the handle is invalid.
|
||||||
bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData )
|
bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::SetConnectionUserData\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto connect_socket = s->connect_sockets.find(hPeer);
|
auto connect_socket = s->connect_sockets.find(hPeer);
|
||||||
if (connect_socket == s->connect_sockets.end()) return false;
|
if (connect_socket == s->connect_sockets.end()) return false;
|
||||||
@ -654,7 +657,7 @@ bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData )
|
|||||||
/// or if you haven't set any userdata on the connection.
|
/// or if you haven't set any userdata on the connection.
|
||||||
int64 GetConnectionUserData( HSteamNetConnection hPeer )
|
int64 GetConnectionUserData( HSteamNetConnection hPeer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionUserData\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto connect_socket = s->connect_sockets.find(hPeer);
|
auto connect_socket = s->connect_sockets.find(hPeer);
|
||||||
if (connect_socket == s->connect_sockets.end()) return -1;
|
if (connect_socket == s->connect_sockets.end()) return -1;
|
||||||
@ -665,14 +668,16 @@ int64 GetConnectionUserData( HSteamNetConnection hPeer )
|
|||||||
/// Set a name for the connection, used mostly for debugging
|
/// Set a name for the connection, used mostly for debugging
|
||||||
void SetConnectionName( HSteamNetConnection hPeer, const char *pszName )
|
void SetConnectionName( HSteamNetConnection hPeer, const char *pszName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::SetConnectionName\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Fetch connection name. Returns false if handle is invalid
|
/// Fetch connection name. Returns false if handle is invalid
|
||||||
bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen )
|
bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionName\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +708,8 @@ bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen )
|
|||||||
/// work without any changes.
|
/// work without any changes.
|
||||||
EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, ESteamNetworkingSendType eSendType )
|
EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, ESteamNetworkingSendType eSendType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::SendMessageToConnection old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EResultFail;
|
return k_EResultFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -746,7 +752,7 @@ EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, u
|
|||||||
/// (See k_ESteamNetworkingConfig_SendBufferSize)
|
/// (See k_ESteamNetworkingConfig_SendBufferSize)
|
||||||
EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags, int64 *pOutMessageNumber )
|
EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags, int64 *pOutMessageNumber )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::SendMessageToConnection %u, len %u, flags %i\n", hConn, cbData, nSendFlags);
|
PRINT_DEBUG("%u, len %u, flags %i", hConn, cbData, nSendFlags);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto connect_socket = s->connect_sockets.find(hConn);
|
auto connect_socket = s->connect_sockets.find(hConn);
|
||||||
@ -781,7 +787,7 @@ EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, u
|
|||||||
|
|
||||||
EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags )
|
EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::SendMessageToConnection old %u, len %u, flags %i\n", hConn, cbData, nSendFlags);
|
PRINT_DEBUG("old %u, len %u, flags %i", hConn, cbData, nSendFlags);
|
||||||
return SendMessageToConnection(hConn, pData, cbData, nSendFlags, NULL);
|
return SendMessageToConnection(hConn, pData, cbData, nSendFlags, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -819,7 +825,8 @@ EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, u
|
|||||||
/// failure codes.
|
/// failure codes.
|
||||||
void SendMessages( int nMessages, SteamNetworkingMessage_t *const *pMessages, int64 *pOutMessageNumberOrResult )
|
void SendMessages( int nMessages, SteamNetworkingMessage_t *const *pMessages, int64 *pOutMessageNumberOrResult )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::SendMessages\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
for (int i = 0; i < nMessages; ++i) {
|
for (int i = 0; i < nMessages; ++i) {
|
||||||
int64 out_number = 0;
|
int64 out_number = 0;
|
||||||
int result = SendMessageToConnection(pMessages[i]->m_conn, pMessages[i]->m_pData, pMessages[i]->m_cbSize, pMessages[i]->m_nFlags, &out_number);
|
int result = SendMessageToConnection(pMessages[i]->m_conn, pMessages[i]->m_pData, pMessages[i]->m_cbSize, pMessages[i]->m_nFlags, &out_number);
|
||||||
@ -845,7 +852,8 @@ void SendMessages( int nMessages, SteamNetworkingMessage_t *const *pMessages, in
|
|||||||
/// on the next transmission time (often that means right now).
|
/// on the next transmission time (often that means right now).
|
||||||
EResult FlushMessagesOnConnection( HSteamNetConnection hConn )
|
EResult FlushMessagesOnConnection( HSteamNetConnection hConn )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::FlushMessagesOnConnection\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EResultOK;
|
return k_EResultOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -882,7 +890,7 @@ SteamNetworkingMessage_t *get_steam_message_connection(HSteamNetConnection hConn
|
|||||||
pMsg->m_pfnRelease = &delete_steam_message;
|
pMsg->m_pfnRelease = &delete_steam_message;
|
||||||
pMsg->m_nChannel = 0;
|
pMsg->m_nChannel = 0;
|
||||||
connect_socket->second.data.pop();
|
connect_socket->second.data.pop();
|
||||||
PRINT_DEBUG("get_steam_message_connection %u %lu, %llu\n", hConn, size, pMsg->m_nMessageNumber);
|
PRINT_DEBUG("get_steam_message_connection %u %lu, %llu", hConn, size, pMsg->m_nMessageNumber);
|
||||||
return pMsg;
|
return pMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -903,10 +911,10 @@ SteamNetworkingMessage_t *get_steam_message_connection(HSteamNetConnection hConn
|
|||||||
/// a little while (put it into some queue, etc), and you may call Release() from any thread.
|
/// a little while (put it into some queue, etc), and you may call Release() from any thread.
|
||||||
int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages )
|
int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ReceiveMessagesOnConnection %u %i\n", hConn, nMaxMessages);
|
PRINT_DEBUG("%u %i", hConn, nMaxMessages);
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!ppOutMessages || !nMaxMessages) return 0;
|
if (!ppOutMessages || !nMaxMessages) return 0;
|
||||||
|
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
|
||||||
SteamNetworkingMessage_t *msg = NULL;
|
SteamNetworkingMessage_t *msg = NULL;
|
||||||
int messages = 0;
|
int messages = 0;
|
||||||
while (messages < nMaxMessages && (msg = get_steam_message_connection(hConn))) {
|
while (messages < nMaxMessages && (msg = get_steam_message_connection(hConn))) {
|
||||||
@ -914,7 +922,7 @@ int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessa
|
|||||||
++messages;
|
++messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("messages %u\n", messages);
|
PRINT_DEBUG("messages %u", messages);
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -928,10 +936,10 @@ int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessa
|
|||||||
/// messages is relevant!)
|
/// messages is relevant!)
|
||||||
int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages )
|
int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ReceiveMessagesOnListenSocket %u %i\n", hSocket, nMaxMessages);
|
PRINT_DEBUG("%u %i", hSocket, nMaxMessages);
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!ppOutMessages || !nMaxMessages) return 0;
|
if (!ppOutMessages || !nMaxMessages) return 0;
|
||||||
|
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
|
||||||
SteamNetworkingMessage_t *msg = NULL;
|
SteamNetworkingMessage_t *msg = NULL;
|
||||||
int messages = 0;
|
int messages = 0;
|
||||||
|
|
||||||
@ -953,11 +961,10 @@ int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMe
|
|||||||
/// Returns basic information about the high-level state of the connection.
|
/// Returns basic information about the high-level state of the connection.
|
||||||
bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo )
|
bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionInfo\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (!pInfo)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
if (!pInfo) return false;
|
||||||
|
|
||||||
auto connect_socket = s->connect_sockets.find(hConn);
|
auto connect_socket = s->connect_sockets.find(hConn);
|
||||||
if (connect_socket == s->connect_sockets.end()) return false;
|
if (connect_socket == s->connect_sockets.end()) return false;
|
||||||
|
|
||||||
@ -985,7 +992,7 @@ bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pIn
|
|||||||
/// - k_EResultInvalidParam - nLanes is bad
|
/// - k_EResultInvalidParam - nLanes is bad
|
||||||
EResult GetConnectionRealTimeStatus( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus, int nLanes, SteamNetConnectionRealTimeLaneStatus_t *pLanes )
|
EResult GetConnectionRealTimeStatus( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus, int nLanes, SteamNetConnectionRealTimeLaneStatus_t *pLanes )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("%s %u %p %i %p\n", __FUNCTION__, hConn, pStatus, nLanes, pLanes);
|
PRINT_DEBUG("%s %u %p %i %p", __FUNCTION__, hConn, pStatus, nLanes, pLanes);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto connect_socket = s->connect_sockets.find(hConn);
|
auto connect_socket = s->connect_sockets.find(hConn);
|
||||||
if (connect_socket == s->connect_sockets.end()) return k_EResultNoConnection;
|
if (connect_socket == s->connect_sockets.end()) return k_EResultNoConnection;
|
||||||
@ -1030,7 +1037,8 @@ EResult GetConnectionRealTimeStatus( HSteamNetConnection hConn, SteamNetConnecti
|
|||||||
/// into some queue, etc), and you may call Release() from any thread.
|
/// into some queue, etc), and you may call Release() from any thread.
|
||||||
int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage001_t **ppOutMessages, int nMaxMessages )
|
int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage001_t **ppOutMessages, int nMaxMessages )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ReceiveMessagesOnConnection\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1045,7 +1053,8 @@ int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessa
|
|||||||
/// messages is relevant!)
|
/// messages is relevant!)
|
||||||
int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMessage001_t **ppOutMessages, int nMaxMessages )
|
int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMessage001_t **ppOutMessages, int nMaxMessages )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ReceiveMessagesOnListenSocket\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1053,7 +1062,8 @@ int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMe
|
|||||||
/// Returns information about the specified connection.
|
/// Returns information about the specified connection.
|
||||||
bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo001_t *pInfo )
|
bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo001_t *pInfo )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionInfo001\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1062,7 +1072,7 @@ bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo001_t *
|
|||||||
/// to the user in game.
|
/// to the user in game.
|
||||||
bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats )
|
bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetQuickConnectionStatus\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (!pStats)
|
if (!pStats)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1079,7 +1089,8 @@ bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickCo
|
|||||||
/// >0 Your buffer was either nullptr, or it was too small and the text got truncated. Try again with a buffer of at least N bytes.
|
/// >0 Your buffer was either nullptr, or it was too small and the text got truncated. Try again with a buffer of at least N bytes.
|
||||||
int GetDetailedConnectionStatus( HSteamNetConnection hConn, char *pszBuf, int cbBuf )
|
int GetDetailedConnectionStatus( HSteamNetConnection hConn, char *pszBuf, int cbBuf )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetDetailedConnectionStatus\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1089,7 +1100,8 @@ int GetDetailedConnectionStatus( HSteamNetConnection hConn, char *pszBuf, int cb
|
|||||||
/// An IPv6 address of ::ffff:0000:0000 means "any IPv4"
|
/// An IPv6 address of ::ffff:0000:0000 means "any IPv4"
|
||||||
bool GetListenSocketAddress( HSteamListenSocket hSocket, SteamNetworkingIPAddr *address )
|
bool GetListenSocketAddress( HSteamListenSocket hSocket, SteamNetworkingIPAddr *address )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetListenSocketAddress\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1102,7 +1114,7 @@ bool GetListenSocketAddress( HSteamListenSocket hSocket, SteamNetworkingIPAddr *
|
|||||||
/// and may not be reachable by a general host on the Internet.
|
/// and may not be reachable by a general host on the Internet.
|
||||||
bool GetListenSocketInfo( HSteamListenSocket hSocket, uint32 *pnIP, uint16 *pnPort )
|
bool GetListenSocketInfo( HSteamListenSocket hSocket, uint32 *pnIP, uint16 *pnPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetListenSocketInfo\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct Listen_Socket *socket = get_connection_socket(hSocket);
|
struct Listen_Socket *socket = get_connection_socket(hSocket);
|
||||||
if (!socket) return false;
|
if (!socket) return false;
|
||||||
@ -1131,7 +1143,7 @@ bool GetListenSocketInfo( HSteamListenSocket hSocket, uint32 *pnIP, uint16 *pnPo
|
|||||||
/// The SteamID assigned to both ends of the connection will be the SteamID of this interface.
|
/// The SteamID assigned to both ends of the connection will be the SteamID of this interface.
|
||||||
bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection *pOutConnection2, bool bUseNetworkLoopback )
|
bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection *pOutConnection2, bool bUseNetworkLoopback )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CreateSocketPair old\n");
|
PRINT_DEBUG("old");
|
||||||
return CreateSocketPair(pOutConnection1, pOutConnection2, bUseNetworkLoopback, NULL, NULL);
|
return CreateSocketPair(pOutConnection1, pOutConnection2, bUseNetworkLoopback, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1157,9 +1169,9 @@ bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection
|
|||||||
/// actual bound loopback port. Otherwise, the port will be zero.
|
/// actual bound loopback port. Otherwise, the port will be zero.
|
||||||
bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection *pOutConnection2, bool bUseNetworkLoopback, const SteamNetworkingIdentity *pIdentity1, const SteamNetworkingIdentity *pIdentity2 )
|
bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection *pOutConnection2, bool bUseNetworkLoopback, const SteamNetworkingIdentity *pIdentity1, const SteamNetworkingIdentity *pIdentity2 )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CreateSocketPair %u %p %p\n", bUseNetworkLoopback, pIdentity1, pIdentity2);
|
PRINT_DEBUG("%u %p %p", bUseNetworkLoopback, pIdentity1, pIdentity2);
|
||||||
if (!pOutConnection1 || !pOutConnection1) return false;
|
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
if (!pOutConnection1 || !pOutConnection1) return false;
|
||||||
|
|
||||||
SteamNetworkingIdentity remote_identity;
|
SteamNetworkingIdentity remote_identity;
|
||||||
remote_identity.SetSteamID(settings->get_local_steam_id());
|
remote_identity.SetSteamID(settings->get_local_steam_id());
|
||||||
@ -1241,7 +1253,7 @@ bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection
|
|||||||
/// SteamNetworkingMessage_t::m_idxLane
|
/// SteamNetworkingMessage_t::m_idxLane
|
||||||
EResult ConfigureConnectionLanes( HSteamNetConnection hConn, int nNumLanes, const int *pLanePriorities, const uint16 *pLaneWeights )
|
EResult ConfigureConnectionLanes( HSteamNetConnection hConn, int nNumLanes, const int *pLanePriorities, const uint16 *pLaneWeights )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto connect_socket = s->connect_sockets.find(hConn);
|
auto connect_socket = s->connect_sockets.find(hConn);
|
||||||
if (connect_socket == s->connect_sockets.end()) return k_EResultNoConnection;
|
if (connect_socket == s->connect_sockets.end()) return k_EResultNoConnection;
|
||||||
@ -1257,7 +1269,8 @@ EResult ConfigureConnectionLanes( HSteamNetConnection hConn, int nNumLanes, cons
|
|||||||
/// even if they are not signed into Steam.)
|
/// even if they are not signed into Steam.)
|
||||||
bool GetIdentity( SteamNetworkingIdentity *pIdentity )
|
bool GetIdentity( SteamNetworkingIdentity *pIdentity )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetIdentity\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pIdentity) return false;
|
if (!pIdentity) return false;
|
||||||
pIdentity->SetSteamID(settings->get_local_steam_id());
|
pIdentity->SetSteamID(settings->get_local_steam_id());
|
||||||
return true;
|
return true;
|
||||||
@ -1288,7 +1301,8 @@ bool GetIdentity( SteamNetworkingIdentity *pIdentity )
|
|||||||
/// Returns the current value that would be returned from GetAuthenticationStatus.
|
/// Returns the current value that would be returned from GetAuthenticationStatus.
|
||||||
ESteamNetworkingAvailability InitAuthentication()
|
ESteamNetworkingAvailability InitAuthentication()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::InitAuthentication\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_ESteamNetworkingAvailability_Current;
|
return k_ESteamNetworkingAvailability_Current;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1301,7 +1315,8 @@ ESteamNetworkingAvailability InitAuthentication()
|
|||||||
/// details, pass non-NULL to receive them.
|
/// details, pass non-NULL to receive them.
|
||||||
ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStatus_t *pDetails )
|
ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStatus_t *pDetails )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetAuthenticationStatus\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_ESteamNetworkingAvailability_Current;
|
return k_ESteamNetworkingAvailability_Current;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1310,7 +1325,7 @@ ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStat
|
|||||||
/// You should destroy the poll group when you are done using DestroyPollGroup
|
/// You should destroy the poll group when you are done using DestroyPollGroup
|
||||||
HSteamNetPollGroup CreatePollGroup()
|
HSteamNetPollGroup CreatePollGroup()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CreatePollGroup\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
static HSteamNetPollGroup poll_group_counter;
|
static HSteamNetPollGroup poll_group_counter;
|
||||||
++poll_group_counter;
|
++poll_group_counter;
|
||||||
@ -1327,7 +1342,7 @@ HSteamNetPollGroup CreatePollGroup()
|
|||||||
/// Returns false if passed an invalid poll group handle.
|
/// Returns false if passed an invalid poll group handle.
|
||||||
bool DestroyPollGroup( HSteamNetPollGroup hPollGroup )
|
bool DestroyPollGroup( HSteamNetPollGroup hPollGroup )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::DestroyPollGroup\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto group = s->poll_groups.find(hPollGroup);
|
auto group = s->poll_groups.find(hPollGroup);
|
||||||
if (group == s->poll_groups.end()) {
|
if (group == s->poll_groups.end()) {
|
||||||
@ -1361,7 +1376,7 @@ bool DestroyPollGroup( HSteamNetPollGroup hPollGroup )
|
|||||||
/// is invalid (and not k_HSteamNetPollGroup_Invalid).
|
/// is invalid (and not k_HSteamNetPollGroup_Invalid).
|
||||||
bool SetConnectionPollGroup( HSteamNetConnection hConn, HSteamNetPollGroup hPollGroup )
|
bool SetConnectionPollGroup( HSteamNetConnection hConn, HSteamNetPollGroup hPollGroup )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::SetConnectionPollGroup %u %u\n", hConn, hPollGroup);
|
PRINT_DEBUG("%u %u", hConn, hPollGroup);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto connect_socket = s->connect_sockets.find(hConn);
|
auto connect_socket = s->connect_sockets.find(hConn);
|
||||||
if (connect_socket == s->connect_sockets.end()) {
|
if (connect_socket == s->connect_sockets.end()) {
|
||||||
@ -1407,7 +1422,7 @@ bool SetConnectionPollGroup( HSteamNetConnection hConn, HSteamNetPollGroup hPoll
|
|||||||
/// other connections.)
|
/// other connections.)
|
||||||
int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages )
|
int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ReceiveMessagesOnPollGroup %u %i\n", hPollGroup, nMaxMessages);
|
PRINT_DEBUG("%u %i", hPollGroup, nMaxMessages);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto group = s->poll_groups.find(hPollGroup);
|
auto group = s->poll_groups.find(hPollGroup);
|
||||||
if (group == s->poll_groups.end()) {
|
if (group == s->poll_groups.end()) {
|
||||||
@ -1424,7 +1439,7 @@ int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ReceiveMessagesOnPollGroup out %i\n", messages);
|
PRINT_DEBUG("out %i", messages);
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1442,7 +1457,8 @@ int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMe
|
|||||||
/// See stamdatagram_ticketgen.h for more details.
|
/// See stamdatagram_ticketgen.h for more details.
|
||||||
bool ReceivedRelayAuthTicket( const void *pvTicket, int cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket )
|
bool ReceivedRelayAuthTicket( const void *pvTicket, int cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ReceivedRelayAuthTicket\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1455,7 +1471,7 @@ bool ReceivedRelayAuthTicket( const void *pvTicket, int cbTicket, SteamDatagramR
|
|||||||
/// call ConnectToHostedDedicatedServer to connect to the server.
|
/// call ConnectToHostedDedicatedServer to connect to the server.
|
||||||
int FindRelayAuthTicketForServer( CSteamID steamID, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket )
|
int FindRelayAuthTicketForServer( CSteamID steamID, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::FindRelayAuthTicketForServer old\n");
|
PRINT_DEBUG("old");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1467,13 +1483,14 @@ int FindRelayAuthTicketForServer( CSteamID steamID, int nVirtualPort, SteamDatag
|
|||||||
/// call ConnectToHostedDedicatedServer to connect to the server.
|
/// call ConnectToHostedDedicatedServer to connect to the server.
|
||||||
int FindRelayAuthTicketForServer( const SteamNetworkingIdentity *identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket )
|
int FindRelayAuthTicketForServer( const SteamNetworkingIdentity *identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::FindRelayAuthTicketForServer old1\n");
|
PRINT_DEBUG("old1");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket )
|
int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::FindRelayAuthTicketForServer\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1488,13 +1505,15 @@ int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameSer
|
|||||||
/// when your app initializes
|
/// when your app initializes
|
||||||
HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort )
|
HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_HSteamListenSocket_Invalid;
|
return k_HSteamListenSocket_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity *identityTarget, int nVirtualPort )
|
HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity *identityTarget, int nVirtualPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer old1\n");
|
PRINT_DEBUG("old1");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_HSteamListenSocket_Invalid;
|
return k_HSteamListenSocket_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1506,13 +1525,15 @@ HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentit
|
|||||||
/// connection to Steam or the central backend, or the app is restarted or crashes, etc.
|
/// connection to Steam or the central backend, or the app is restarted or crashes, etc.
|
||||||
HSteamNetConnection ConnectToHostedDedicatedServer( CSteamID steamIDTarget, int nVirtualPort )
|
HSteamNetConnection ConnectToHostedDedicatedServer( CSteamID steamIDTarget, int nVirtualPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer older\n");
|
PRINT_DEBUG("older");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_HSteamListenSocket_Invalid;
|
return k_HSteamListenSocket_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_HSteamListenSocket_Invalid;
|
return k_HSteamListenSocket_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1523,7 +1544,8 @@ HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentit
|
|||||||
/// Returns the value of the SDR_LISTEN_PORT environment variable.
|
/// Returns the value of the SDR_LISTEN_PORT environment variable.
|
||||||
uint16 GetHostedDedicatedServerPort()
|
uint16 GetHostedDedicatedServerPort()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetHostedDedicatedServerPort\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO?
|
//TODO?
|
||||||
return 27054;
|
return 27054;
|
||||||
}
|
}
|
||||||
@ -1533,7 +1555,8 @@ uint16 GetHostedDedicatedServerPort()
|
|||||||
/// center code. Returns 0 otherwise.
|
/// center code. Returns 0 otherwise.
|
||||||
SteamNetworkingPOPID GetHostedDedicatedServerPOPID()
|
SteamNetworkingPOPID GetHostedDedicatedServerPOPID()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetHostedDedicatedServerPOPID\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1558,7 +1581,7 @@ SteamNetworkingPOPID GetHostedDedicatedServerPOPID()
|
|||||||
/// Returns false if the SDR_LISTEN_PORT environment variable is not set.
|
/// Returns false if the SDR_LISTEN_PORT environment variable is not set.
|
||||||
bool GetHostedDedicatedServerAddress001( SteamDatagramHostedAddress *pRouting )
|
bool GetHostedDedicatedServerAddress001( SteamDatagramHostedAddress *pRouting )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetHostedDedicatedServerAddress002 %p\n", pRouting);
|
PRINT_DEBUG("%p", pRouting);
|
||||||
return GetHostedDedicatedServerAddress(pRouting) == k_EResultOK;
|
return GetHostedDedicatedServerAddress(pRouting) == k_EResultOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1590,7 +1613,7 @@ bool GetHostedDedicatedServerAddress001( SteamDatagramHostedAddress *pRouting )
|
|||||||
/// directly share it with clients.
|
/// directly share it with clients.
|
||||||
virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRouting )
|
virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRouting )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetHostedDedicatedServerAddress %p\n", pRouting);
|
PRINT_DEBUG("%p", pRouting);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
pRouting->SetDevAddress(network->getOwnIP(), 27054);
|
pRouting->SetDevAddress(network->getOwnIP(), 27054);
|
||||||
return k_EResultOK;
|
return k_EResultOK;
|
||||||
@ -1603,7 +1626,7 @@ virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRo
|
|||||||
/// Note that this call MUST be made through the SteamNetworkingSocketsGameServer() interface
|
/// Note that this call MUST be made through the SteamNetworkingSocketsGameServer() interface
|
||||||
HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort )
|
HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CreateHostedDedicatedServerListenSocket old %i\n", nVirtualPort);
|
PRINT_DEBUG("old %i", nVirtualPort);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return new_listen_socket(nVirtualPort, SNS_DISABLED_PORT);
|
return new_listen_socket(nVirtualPort, SNS_DISABLED_PORT);
|
||||||
}
|
}
|
||||||
@ -1619,7 +1642,7 @@ HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort )
|
|||||||
/// setting the options "immediately" after creation.
|
/// setting the options "immediately" after creation.
|
||||||
HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::CreateHostedDedicatedServerListenSocket old %i\n", nVirtualPort);
|
PRINT_DEBUG("old %i", nVirtualPort);
|
||||||
//TODO config options
|
//TODO config options
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return new_listen_socket(nVirtualPort, SNS_DISABLED_PORT);
|
return new_listen_socket(nVirtualPort, SNS_DISABLED_PORT);
|
||||||
@ -1633,7 +1656,8 @@ HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort, in
|
|||||||
//
|
//
|
||||||
bool GetConnectionDebugText( HSteamNetConnection hConn, char *pOut, int nOutCCH )
|
bool GetConnectionDebugText( HSteamNetConnection hConn, char *pOut, int nOutCCH )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionDebugText\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1644,14 +1668,16 @@ bool GetConnectionDebugText( HSteamNetConnection hConn, char *pOut, int nOutCCH
|
|||||||
// Returns the value or -1 is eConfigValue is invalid
|
// Returns the value or -1 is eConfigValue is invalid
|
||||||
int32 GetConfigurationValue( ESteamNetworkingConfigurationValue eConfigValue )
|
int32 GetConfigurationValue( ESteamNetworkingConfigurationValue eConfigValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConfigurationValue\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if successfully set
|
// Returns true if successfully set
|
||||||
bool SetConfigurationValue( ESteamNetworkingConfigurationValue eConfigValue, int32 nValue )
|
bool SetConfigurationValue( ESteamNetworkingConfigurationValue eConfigValue, int32 nValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::SetConfigurationValue %i: %i\n", eConfigValue, nValue);
|
PRINT_DEBUG("%i: %i", eConfigValue, nValue);
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1659,7 +1685,8 @@ bool SetConfigurationValue( ESteamNetworkingConfigurationValue eConfigValue, int
|
|||||||
// Return the name of an int configuration value, or NULL if config value isn't known
|
// Return the name of an int configuration value, or NULL if config value isn't known
|
||||||
const char *GetConfigurationValueName( ESteamNetworkingConfigurationValue eConfigValue )
|
const char *GetConfigurationValueName( ESteamNetworkingConfigurationValue eConfigValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConfigurationValueName\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1671,13 +1698,15 @@ const char *GetConfigurationValueName( ESteamNetworkingConfigurationValue eConfi
|
|||||||
// returns -1 if the eConfigValue is invalid
|
// returns -1 if the eConfigValue is invalid
|
||||||
int32 GetConfigurationString( ESteamNetworkingConfigurationString eConfigString, char *pDest, int32 destSize )
|
int32 GetConfigurationString( ESteamNetworkingConfigurationString eConfigString, char *pDest, int32 destSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConfigurationString\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetConfigurationString( ESteamNetworkingConfigurationString eConfigString, const char *pString )
|
bool SetConfigurationString( ESteamNetworkingConfigurationString eConfigString, const char *pString )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::SetConfigurationString\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1685,7 +1714,8 @@ bool SetConfigurationString( ESteamNetworkingConfigurationString eConfigString,
|
|||||||
// Return the name of a string configuration value, or NULL if config value isn't known
|
// Return the name of a string configuration value, or NULL if config value isn't known
|
||||||
const char *GetConfigurationStringName( ESteamNetworkingConfigurationString eConfigString )
|
const char *GetConfigurationStringName( ESteamNetworkingConfigurationString eConfigString )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConfigurationStringName\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1696,14 +1726,16 @@ const char *GetConfigurationStringName( ESteamNetworkingConfigurationString eCon
|
|||||||
// Returns the value or -1 is eConfigValue is invalid
|
// Returns the value or -1 is eConfigValue is invalid
|
||||||
int32 GetConnectionConfigurationValue( HSteamNetConnection hConn, ESteamNetworkingConnectionConfigurationValue eConfigValue )
|
int32 GetConnectionConfigurationValue( HSteamNetConnection hConn, ESteamNetworkingConnectionConfigurationValue eConfigValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionConfigurationValue\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if successfully set
|
// Returns true if successfully set
|
||||||
bool SetConnectionConfigurationValue( HSteamNetConnection hConn, ESteamNetworkingConnectionConfigurationValue eConfigValue, int32 nValue )
|
bool SetConnectionConfigurationValue( HSteamNetConnection hConn, ESteamNetworkingConnectionConfigurationValue eConfigValue, int32 nValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::SetConnectionConfigurationValue\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1739,7 +1771,8 @@ bool SetConnectionConfigurationValue( HSteamNetConnection hConn, ESteamNetworkin
|
|||||||
/// and don't share it directly with clients.
|
/// and don't share it directly with clients.
|
||||||
EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *pLoginInfo, int *pcbSignedBlob, void *pBlob )
|
EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *pLoginInfo, int *pcbSignedBlob, void *pBlob )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetGameCoordinatorServerLogin\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EResultFail;
|
return k_EResultFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1785,7 +1818,8 @@ EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *
|
|||||||
/// setting the options "immediately" after creation.
|
/// setting the options "immediately" after creation.
|
||||||
HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionCustomSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionCustomSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2PCustomSignaling old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//return ConnectP2PCustomSignaling(pSignaling, pPeerIdentity, 0, nOptions, pOptions);
|
//return ConnectP2PCustomSignaling(pSignaling, pPeerIdentity, 0, nOptions, pOptions);
|
||||||
return k_HSteamNetConnection_Invalid;
|
return k_HSteamNetConnection_Invalid;
|
||||||
}
|
}
|
||||||
@ -1793,7 +1827,8 @@ HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionCustomS
|
|||||||
//HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionCustomSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
//HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionCustomSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
||||||
HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2PCustomSignaling\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_HSteamNetConnection_Invalid;
|
return k_HSteamNetConnection_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1828,13 +1863,15 @@ HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionSignali
|
|||||||
/// to call ISteamNetworkingUtils::InitRelayNetworkAccess() when your app initializes
|
/// to call ISteamNetworkingUtils::InitRelayNetworkAccess() when your app initializes
|
||||||
bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingCustomSignalingRecvContext *pContext )
|
bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingCustomSignalingRecvContext *pContext )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ReceivedP2PCustomSignal old\n");
|
PRINT_DEBUG("old");
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingSignalingRecvContext *pContext )
|
bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingSignalingRecvContext *pContext )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::ReceivedP2PCustomSignal\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1851,7 +1888,8 @@ bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingSigna
|
|||||||
/// Pass this blob to your game coordinator and call SteamDatagram_CreateCert.
|
/// Pass this blob to your game coordinator and call SteamDatagram_CreateCert.
|
||||||
bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg )
|
bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetCertificateRequest\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1859,7 +1897,8 @@ bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &er
|
|||||||
/// SteamDatagram_CreateCert.
|
/// SteamDatagram_CreateCert.
|
||||||
bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg )
|
bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::SetCertificate\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1873,7 +1912,8 @@ bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkin
|
|||||||
/// a new user can sign in.
|
/// a new user can sign in.
|
||||||
void ResetIdentity( const SteamNetworkingIdentity *pIdentity )
|
void ResetIdentity( const SteamNetworkingIdentity *pIdentity )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1938,7 +1978,8 @@ void ResetIdentity( const SteamNetworkingIdentity *pIdentity )
|
|||||||
/// use CreateFakeUDPPort.
|
/// use CreateFakeUDPPort.
|
||||||
bool BeginAsyncRequestFakeIP( int nNumPorts )
|
bool BeginAsyncRequestFakeIP( int nNumPorts )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1947,7 +1988,8 @@ bool BeginAsyncRequestFakeIP( int nNumPorts )
|
|||||||
/// Make sure and check SteamNetworkingFakeIPResult_t::m_eResult
|
/// Make sure and check SteamNetworkingFakeIPResult_t::m_eResult
|
||||||
void GetFakeIP( int idxFirstPort, SteamNetworkingFakeIPResult_t *pInfo )
|
void GetFakeIP( int idxFirstPort, SteamNetworkingFakeIPResult_t *pInfo )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a listen socket that will listen for P2P connections sent
|
/// Create a listen socket that will listen for P2P connections sent
|
||||||
@ -1961,7 +2003,8 @@ void GetFakeIP( int idxFirstPort, SteamNetworkingFakeIPResult_t *pInfo )
|
|||||||
/// request to complete before creating the listen socket.
|
/// request to complete before creating the listen socket.
|
||||||
HSteamListenSocket CreateListenSocketP2PFakeIP( int idxFakePort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
HSteamListenSocket CreateListenSocketP2PFakeIP( int idxFakePort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_HSteamListenSocket_Invalid;
|
return k_HSteamListenSocket_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1982,7 +2025,8 @@ HSteamListenSocket CreateListenSocketP2PFakeIP( int idxFakePort, int nOptions, c
|
|||||||
/// - k_EResultIPNotFound: This connection wasn't made using FakeIP system
|
/// - k_EResultIPNotFound: This connection wasn't made using FakeIP system
|
||||||
EResult GetRemoteFakeIPForConnection( HSteamNetConnection hConn, SteamNetworkingIPAddr *pOutAddr )
|
EResult GetRemoteFakeIPForConnection( HSteamNetConnection hConn, SteamNetworkingIPAddr *pOutAddr )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EResultNone;
|
return k_EResultNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2005,7 +2049,8 @@ EResult GetRemoteFakeIPForConnection( HSteamNetConnection hConn, SteamNetworking
|
|||||||
/// assign a FakeIP from its own locally-controlled namespace.
|
/// assign a FakeIP from its own locally-controlled namespace.
|
||||||
ISteamNetworkingFakeUDPPort *CreateFakeUDPPort( int idxFakeServerPort )
|
ISteamNetworkingFakeUDPPort *CreateFakeUDPPort( int idxFakeServerPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2015,12 +2060,14 @@ ISteamNetworkingFakeUDPPort *CreateFakeUDPPort( int idxFakeServerPort )
|
|||||||
// to minimize potential changes in timing when that change happens.
|
// to minimize potential changes in timing when that change happens.
|
||||||
void RunCallbacks( ISteamNetworkingSocketsCallbacks *pCallbacks )
|
void RunCallbacks( ISteamNetworkingSocketsCallbacks *pCallbacks )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets:RunCallbacks\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RunCallbacks()
|
void RunCallbacks()
|
||||||
{
|
{
|
||||||
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
//TODO: timeout unaccepted connections after a few seconds or so
|
//TODO: timeout unaccepted connections after a few seconds or so
|
||||||
auto current_time = std::chrono::steady_clock::now();
|
auto current_time = std::chrono::steady_clock::now();
|
||||||
auto socket_conn = std::begin(s->connect_sockets);
|
auto socket_conn = std::begin(s->connect_sockets);
|
||||||
@ -2038,6 +2085,8 @@ void RunCallbacks()
|
|||||||
|
|
||||||
void Callback(Common_Message *msg)
|
void Callback(Common_Message *msg)
|
||||||
{
|
{
|
||||||
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
if (msg->has_low_level()) {
|
if (msg->has_low_level()) {
|
||||||
if (msg->low_level().type() == Low_Level::CONNECT) {
|
if (msg->low_level().type() == Low_Level::CONNECT) {
|
||||||
|
|
||||||
@ -2055,7 +2104,7 @@ void Callback(Common_Message *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_networking_sockets()) {
|
if (msg->has_networking_sockets()) {
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets: got network socket msg %u " "%" PRIu64 "\n", msg->networking_sockets().type(), msg->source_id());
|
PRINT_DEBUG("got network socket msg %u " "%" PRIu64 "", msg->networking_sockets().type(), msg->source_id());
|
||||||
if (msg->networking_sockets().type() == Networking_Sockets::CONNECTION_REQUEST) {
|
if (msg->networking_sockets().type() == Networking_Sockets::CONNECTION_REQUEST) {
|
||||||
int virtual_port = msg->networking_sockets().virtual_port();
|
int virtual_port = msg->networking_sockets().virtual_port();
|
||||||
int real_port = msg->networking_sockets().real_port();
|
int real_port = msg->networking_sockets().real_port();
|
||||||
@ -2094,13 +2143,13 @@ void Callback(Common_Message *msg)
|
|||||||
auto connect_socket = s->connect_sockets.find(msg->networking_sockets().connection_id());
|
auto connect_socket = s->connect_sockets.find(msg->networking_sockets().connection_id());
|
||||||
if (connect_socket != s->connect_sockets.end()) {
|
if (connect_socket != s->connect_sockets.end()) {
|
||||||
if (connect_socket->second.remote_identity.GetSteamID64() == msg->source_id() && (connect_socket->second.status == CONNECT_SOCKET_CONNECTED)) {
|
if (connect_socket->second.remote_identity.GetSteamID64() == msg->source_id() && (connect_socket->second.status == CONNECT_SOCKET_CONNECTED)) {
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets: got data len %zu, num " "%" PRIu64 " on connection %u\n", msg->networking_sockets().data().size(), msg->networking_sockets().message_number(), connect_socket->first);
|
PRINT_DEBUG("got data len %zu, num " "%" PRIu64 " on connection %u", msg->networking_sockets().data().size(), msg->networking_sockets().message_number(), connect_socket->first);
|
||||||
connect_socket->second.data.push(msg->networking_sockets());
|
connect_socket->second.data.push(msg->networking_sockets());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
connect_socket = std::find_if(s->connect_sockets.begin(), s->connect_sockets.end(), [msg](const auto &in) {return in.second.remote_identity.GetSteamID64() == msg->source_id() && (in.second.status == CONNECT_SOCKET_NOT_ACCEPTED || in.second.status == CONNECT_SOCKET_CONNECTED) && in.second.remote_id == msg->networking_sockets().connection_id_from();});
|
connect_socket = std::find_if(s->connect_sockets.begin(), s->connect_sockets.end(), [msg](const auto &in) {return in.second.remote_identity.GetSteamID64() == msg->source_id() && (in.second.status == CONNECT_SOCKET_NOT_ACCEPTED || in.second.status == CONNECT_SOCKET_CONNECTED) && in.second.remote_id == msg->networking_sockets().connection_id_from();});
|
||||||
if (connect_socket != s->connect_sockets.end()) {
|
if (connect_socket != s->connect_sockets.end()) {
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets: got data len %zu, num " "%" PRIu64 " on not accepted connection %u\n", msg->networking_sockets().data().size(), msg->networking_sockets().message_number(), connect_socket->first);
|
PRINT_DEBUG("got data len %zu, num " "%" PRIu64 " on not accepted connection %u", msg->networking_sockets().data().size(), msg->networking_sockets().message_number(), connect_socket->first);
|
||||||
connect_socket->second.data.push(msg->networking_sockets());
|
connect_socket->second.data.push(msg->networking_sockets());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public ISteamNetworkingSocketsSerialized005
|
|||||||
public:
|
public:
|
||||||
static void steam_callback(void *object, Common_Message *msg)
|
static void steam_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_networkingsockets_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Networking_Sockets_Serialized *steam_networkingsockets = (Steam_Networking_Sockets_Serialized *)object;
|
Steam_Networking_Sockets_Serialized *steam_networkingsockets = (Steam_Networking_Sockets_Serialized *)object;
|
||||||
steam_networkingsockets->Callback(msg);
|
steam_networkingsockets->Callback(msg);
|
||||||
@ -40,7 +40,7 @@ static void steam_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_networkingsockets_serialized_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Networking_Sockets_Serialized *steam_networkingsockets = (Steam_Networking_Sockets_Serialized *)object;
|
Steam_Networking_Sockets_Serialized *steam_networkingsockets = (Steam_Networking_Sockets_Serialized *)object;
|
||||||
steam_networkingsockets->RunCallbacks();
|
steam_networkingsockets->RunCallbacks();
|
||||||
@ -66,17 +66,19 @@ Steam_Networking_Sockets_Serialized(class Settings *settings, class Networking *
|
|||||||
|
|
||||||
void SendP2PRendezvous( CSteamID steamIDRemote, uint32 unConnectionIDSrc, const void *pMsgRendezvous, uint32 cbRendezvous )
|
void SendP2PRendezvous( CSteamID steamIDRemote, uint32 unConnectionIDSrc, const void *pMsgRendezvous, uint32 cbRendezvous )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::SendP2PRendezvous\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendP2PConnectionFailure( CSteamID steamIDRemote, uint32 unConnectionIDDest, uint32 nReason, const char *pszReason )
|
void SendP2PConnectionFailure( CSteamID steamIDRemote, uint32 unConnectionIDDest, uint32 nReason, const char *pszReason )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::SendP2PConnectionFailure\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamAPICall_t GetCertAsync()
|
SteamAPICall_t GetCertAsync()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::GetCertAsync\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
struct SteamNetworkingSocketsCert_t data = {};
|
struct SteamNetworkingSocketsCert_t data = {};
|
||||||
data.m_eResult = k_EResultOK;
|
data.m_eResult = k_EResultOK;
|
||||||
@ -86,53 +88,62 @@ SteamAPICall_t GetCertAsync()
|
|||||||
|
|
||||||
int GetNetworkConfigJSON( void *buf, uint32 cbBuf, const char *pszLauncherPartner )
|
int GetNetworkConfigJSON( void *buf, uint32 cbBuf, const char *pszLauncherPartner )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::GetNetworkConfigJSON %s\n", pszLauncherPartner);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetNetworkConfigJSON( void *buf, uint32 cbBuf )
|
int GetNetworkConfigJSON( void *buf, uint32 cbBuf )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::GetNetworkConfigJSON old\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return GetNetworkConfigJSON(buf, cbBuf, "");
|
return GetNetworkConfigJSON(buf, cbBuf, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CacheRelayTicket( const void *pTicket, uint32 cbTicket )
|
void CacheRelayTicket( const void *pTicket, uint32 cbTicket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::CacheRelayTicket\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GetCachedRelayTicketCount()
|
uint32 GetCachedRelayTicketCount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::GetCachedRelayTicketCount\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetCachedRelayTicket( uint32 idxTicket, void *buf, uint32 cbBuf )
|
int GetCachedRelayTicket( uint32 idxTicket, void *buf, uint32 cbBuf )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::GetCachedRelayTicket\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostConnectionStateMsg( const void *pMsg, uint32 cbMsg )
|
void PostConnectionStateMsg( const void *pMsg, uint32 cbMsg )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::PostConnectionStateMsg\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetSTUNServer(int dont_know, char *buf, unsigned int len)
|
bool GetSTUNServer(int dont_know, char *buf, unsigned int len)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::GetSTUNServer %i %p %u\n", dont_know, buf, len);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BAllowDirectConnectToPeer(SteamNetworkingIdentity const &identity)
|
bool BAllowDirectConnectToPeer(SteamNetworkingIdentity const &identity)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::BAllowDirectConnectToPeer\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BeginAsyncRequestFakeIP(int a)
|
int BeginAsyncRequestFakeIP(int a)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets_Serialized::BeginAsyncRequestFakeIP\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public ISteamNetworkingUtils
|
|||||||
public:
|
public:
|
||||||
static void steam_callback(void *object, Common_Message *msg)
|
static void steam_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_networkingutils_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Networking_Utils *steam_networkingutils = (Steam_Networking_Utils *)object;
|
Steam_Networking_Utils *steam_networkingutils = (Steam_Networking_Utils *)object;
|
||||||
steam_networkingutils->Callback(msg);
|
steam_networkingutils->Callback(msg);
|
||||||
@ -44,7 +44,7 @@ static void steam_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_networkingutils_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Networking_Utils *steam_networkingutils = (Steam_Networking_Utils *)object;
|
Steam_Networking_Utils *steam_networkingutils = (Steam_Networking_Utils *)object;
|
||||||
steam_networkingutils->RunCallbacks();
|
steam_networkingutils->RunCallbacks();
|
||||||
@ -101,7 +101,8 @@ static void delete_steam_message(SteamNetworkingMessage_t *pMsg)
|
|||||||
/// counting and ownership.
|
/// counting and ownership.
|
||||||
SteamNetworkingMessage_t *AllocateMessage( int cbAllocateBuffer )
|
SteamNetworkingMessage_t *AllocateMessage( int cbAllocateBuffer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::AllocateMessage\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
SteamNetworkingMessage_t *pMsg = new SteamNetworkingMessage_t();
|
SteamNetworkingMessage_t *pMsg = new SteamNetworkingMessage_t();
|
||||||
pMsg->m_pfnFreeData = &free_steam_message_data;
|
pMsg->m_pfnFreeData = &free_steam_message_data;
|
||||||
pMsg->m_pfnRelease = &delete_steam_message;
|
pMsg->m_pfnRelease = &delete_steam_message;
|
||||||
@ -117,7 +118,8 @@ SteamNetworkingMessage_t *AllocateMessage( int cbAllocateBuffer )
|
|||||||
|
|
||||||
bool InitializeRelayAccess()
|
bool InitializeRelayAccess()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::InitializeRelayAccess\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
init_relay = true;
|
init_relay = true;
|
||||||
return relay_initialized;
|
return relay_initialized;
|
||||||
}
|
}
|
||||||
@ -143,7 +145,7 @@ SteamRelayNetworkStatus_t get_network_status()
|
|||||||
/// more details, you can pass a non-NULL value.
|
/// more details, you can pass a non-NULL value.
|
||||||
ESteamNetworkingAvailability GetRelayNetworkStatus( SteamRelayNetworkStatus_t *pDetails )
|
ESteamNetworkingAvailability GetRelayNetworkStatus( SteamRelayNetworkStatus_t *pDetails )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::GetRelayNetworkStatus %p\n", pDetails);
|
PRINT_DEBUG("TODO %p", pDetails);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
//TODO: check if this is how real steam returns it
|
//TODO: check if this is how real steam returns it
|
||||||
@ -161,7 +163,8 @@ ESteamNetworkingAvailability GetRelayNetworkStatus( SteamRelayNetworkStatus_t *p
|
|||||||
|
|
||||||
float GetLocalPingLocation( SteamNetworkPingLocation_t &result )
|
float GetLocalPingLocation( SteamNetworkPingLocation_t &result )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::GetLocalPingLocation\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (relay_initialized) {
|
if (relay_initialized) {
|
||||||
result.m_data[2] = 123;
|
result.m_data[2] = 123;
|
||||||
result.m_data[8] = 67;
|
result.m_data[8] = 67;
|
||||||
@ -173,36 +176,40 @@ float GetLocalPingLocation( SteamNetworkPingLocation_t &result )
|
|||||||
|
|
||||||
int EstimatePingTimeBetweenTwoLocations( const SteamNetworkPingLocation_t &location1, const SteamNetworkPingLocation_t &location2 )
|
int EstimatePingTimeBetweenTwoLocations( const SteamNetworkPingLocation_t &location1, const SteamNetworkPingLocation_t &location2 )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::EstimatePingTimeBetweenTwoLocations\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//return k_nSteamNetworkingPing_Unknown;
|
//return k_nSteamNetworkingPing_Unknown;
|
||||||
return 10;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EstimatePingTimeFromLocalHost( const SteamNetworkPingLocation_t &remoteLocation )
|
int EstimatePingTimeFromLocalHost( const SteamNetworkPingLocation_t &remoteLocation )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::EstimatePingTimeFromLocalHost\n");
|
PRINT_DEBUG_TODO();
|
||||||
return 10;
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ConvertPingLocationToString( const SteamNetworkPingLocation_t &location, char *pszBuf, int cchBufSize )
|
void ConvertPingLocationToString( const SteamNetworkPingLocation_t &location, char *pszBuf, int cchBufSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::ConvertPingLocationToString\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
strncpy(pszBuf, "fra=10+2", cchBufSize);
|
strncpy(pszBuf, "fra=10+2", cchBufSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ParsePingLocationString( const char *pszString, SteamNetworkPingLocation_t &result )
|
bool ParsePingLocationString( const char *pszString, SteamNetworkPingLocation_t &result )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::ParsePingLocationString\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CheckPingDataUpToDate( float flMaxAgeSeconds )
|
bool CheckPingDataUpToDate( float flMaxAgeSeconds )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::CheckPingDataUpToDate %f\n", flMaxAgeSeconds);
|
PRINT_DEBUG("TODO %f", flMaxAgeSeconds);
|
||||||
init_relay = true;
|
init_relay = true;
|
||||||
return relay_initialized;
|
return relay_initialized;
|
||||||
}
|
}
|
||||||
@ -210,35 +217,40 @@ bool CheckPingDataUpToDate( float flMaxAgeSeconds )
|
|||||||
|
|
||||||
bool IsPingMeasurementInProgress()
|
bool IsPingMeasurementInProgress()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::IsPingMeasurementInProgress\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GetPingToDataCenter( SteamNetworkingPOPID popID, SteamNetworkingPOPID *pViaRelayPoP )
|
int GetPingToDataCenter( SteamNetworkingPOPID popID, SteamNetworkingPOPID *pViaRelayPoP )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::GetPingToDataCenter\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GetDirectPingToPOP( SteamNetworkingPOPID popID )
|
int GetDirectPingToPOP( SteamNetworkingPOPID popID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::GetDirectPingToPOP\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GetPOPCount()
|
int GetPOPCount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::GetPOPCount\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GetPOPList( SteamNetworkingPOPID *list, int nListSz )
|
int GetPOPList( SteamNetworkingPOPID *list, int nListSz )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::GetPOPList\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,7 +278,8 @@ int GetPOPList( SteamNetworkingPOPID *list, int nListSz )
|
|||||||
/// it to values obtained on another computer, or other runs of the same process.
|
/// it to values obtained on another computer, or other runs of the same process.
|
||||||
SteamNetworkingMicroseconds GetLocalTimestamp()
|
SteamNetworkingMicroseconds GetLocalTimestamp()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::GetLocalTimestamp\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - initialized_time).count() + (SteamNetworkingMicroseconds)24*3600*30*1e6;
|
return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - initialized_time).count() + (SteamNetworkingMicroseconds)24*3600*30*1e6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +304,8 @@ SteamNetworkingMicroseconds GetLocalTimestamp()
|
|||||||
/// Steamworks calls from within the handler.
|
/// Steamworks calls from within the handler.
|
||||||
void SetDebugOutputFunction( ESteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc )
|
void SetDebugOutputFunction( ESteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::SetDebugOutputFunction %i\n", eDetailLevel);
|
PRINT_DEBUG("%i", eDetailLevel);
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (eDetailLevel != k_ESteamNetworkingSocketsDebugOutputType_None) {
|
if (eDetailLevel != k_ESteamNetworkingSocketsDebugOutputType_None) {
|
||||||
debug_function = pfnFunc;
|
debug_function = pfnFunc;
|
||||||
}
|
}
|
||||||
@ -309,7 +323,8 @@ void SetDebugOutputFunction( ESteamNetworkingSocketsDebugOutputType eDetailLevel
|
|||||||
// inline bool IsFakeIPv4( uint32 nIPv4 ) { return GetIPv4FakeIPType( nIPv4 ) > k_ESteamNetworkingFakeIPType_NotFake; }
|
// inline bool IsFakeIPv4( uint32 nIPv4 ) { return GetIPv4FakeIPType( nIPv4 ) > k_ESteamNetworkingFakeIPType_NotFake; }
|
||||||
ESteamNetworkingFakeIPType GetIPv4FakeIPType( uint32 nIPv4 )
|
ESteamNetworkingFakeIPType GetIPv4FakeIPType( uint32 nIPv4 )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_ESteamNetworkingFakeIPType_NotFake;
|
return k_ESteamNetworkingFakeIPType_NotFake;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +342,8 @@ ESteamNetworkingFakeIPType GetIPv4FakeIPType( uint32 nIPv4 )
|
|||||||
/// indefinitely.
|
/// indefinitely.
|
||||||
EResult GetRealIdentityForFakeIP( const SteamNetworkingIPAddr &fakeIP, SteamNetworkingIdentity *pOutRealIdentity )
|
EResult GetRealIdentityForFakeIP( const SteamNetworkingIPAddr &fakeIP, SteamNetworkingIdentity *pOutRealIdentity )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EResultNoMatch;
|
return k_EResultNoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +374,8 @@ bool SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworking
|
|||||||
bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
|
bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
|
||||||
ESteamNetworkingConfigDataType eDataType, const void *pArg )
|
ESteamNetworkingConfigDataType eDataType, const void *pArg )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::SetConfigValue %i %i " "%" PRIdPTR " %i %p\n", eValue, eScopeType, scopeObj, eDataType, pArg);
|
PRINT_DEBUG("TODO %i %i " "%" PRIdPTR " %i %p", eValue, eScopeType, scopeObj, eDataType, pArg);
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +390,8 @@ bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigS
|
|||||||
ESteamNetworkingGetConfigValueResult GetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
|
ESteamNetworkingGetConfigValueResult GetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
|
||||||
ESteamNetworkingConfigDataType *pOutDataType, void *pResult, size_t *cbResult )
|
ESteamNetworkingConfigDataType *pOutDataType, void *pResult, size_t *cbResult )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::GetConfigValue\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_ESteamNetworkingGetConfigValue_BadValue;
|
return k_ESteamNetworkingGetConfigValue_BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +402,8 @@ ESteamNetworkingGetConfigValueResult GetConfigValue( ESteamNetworkingConfigValue
|
|||||||
/// Any of the output parameters can be NULL if you do not need that information.
|
/// Any of the output parameters can be NULL if you do not need that information.
|
||||||
bool GetConfigValueInfo( ESteamNetworkingConfigValue eValue, const char **pOutName, ESteamNetworkingConfigDataType *pOutDataType, ESteamNetworkingConfigScope *pOutScope, ESteamNetworkingConfigValue *pOutNextValue )
|
bool GetConfigValueInfo( ESteamNetworkingConfigValue eValue, const char **pOutName, ESteamNetworkingConfigDataType *pOutDataType, ESteamNetworkingConfigScope *pOutScope, ESteamNetworkingConfigValue *pOutNextValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: Steam_Networking_Utils::GetConfigValueInfo old\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO flat api
|
//TODO flat api
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -394,7 +413,8 @@ bool GetConfigValueInfo( ESteamNetworkingConfigValue eValue, const char **pOutNa
|
|||||||
/// if you do not need them.
|
/// if you do not need them.
|
||||||
const char *GetConfigValueInfo( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigDataType *pOutDataType, ESteamNetworkingConfigScope *pOutScope )
|
const char *GetConfigValueInfo( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigDataType *pOutDataType, ESteamNetworkingConfigScope *pOutScope )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO flat api
|
//TODO flat api
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -402,7 +422,8 @@ const char *GetConfigValueInfo( ESteamNetworkingConfigValue eValue, ESteamNetwor
|
|||||||
/// Return the lowest numbered configuration value available in the current environment.
|
/// Return the lowest numbered configuration value available in the current environment.
|
||||||
ESteamNetworkingConfigValue GetFirstConfigValue()
|
ESteamNetworkingConfigValue GetFirstConfigValue()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::GetFirstConfigValue\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_ESteamNetworkingConfig_Invalid;
|
return k_ESteamNetworkingConfig_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,7 +437,8 @@ ESteamNetworkingConfigValue GetFirstConfigValue()
|
|||||||
/// shown in a retail environment where a malicious local user might use this to cheat.
|
/// shown in a retail environment where a malicious local user might use this to cheat.
|
||||||
ESteamNetworkingConfigValue IterateGenericEditableConfigValues( ESteamNetworkingConfigValue eCurrent, bool bEnumerateDevVars )
|
ESteamNetworkingConfigValue IterateGenericEditableConfigValues( ESteamNetworkingConfigValue eCurrent, bool bEnumerateDevVars )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_ESteamNetworkingConfig_Invalid;
|
return k_ESteamNetworkingConfig_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,47 +447,36 @@ ESteamNetworkingConfigValue IterateGenericEditableConfigValues( ESteamNetworking
|
|||||||
// inline methods.
|
// inline methods.
|
||||||
void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr &addr, char *buf, size_t cbBuf, bool bWithPort )
|
void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr &addr, char *buf, size_t cbBuf, bool bWithPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::SteamNetworkingIPAddr_ToString\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (buf == nullptr || cbBuf == 0)
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return;
|
if (buf == nullptr || cbBuf == 0) return;
|
||||||
|
|
||||||
char buffer[64]; // Its enought for ipv4 & ipv6 + port
|
char buffer[64]{}; // enough for ipv4 & ipv6 + port
|
||||||
std::string str_addr;
|
std::string str_addr{};
|
||||||
if (addr.IsIPv4())
|
if (addr.IsIPv4()) {
|
||||||
{
|
|
||||||
in_addr ipv4_addr;
|
in_addr ipv4_addr;
|
||||||
ipv4_addr.s_addr = htonl(addr.GetIPv4());
|
ipv4_addr.s_addr = htonl(addr.GetIPv4());
|
||||||
|
|
||||||
if (inet_ntop(AF_INET, &ipv4_addr, buffer, sizeof(buffer) / sizeof(*buffer)) != nullptr)
|
if (inet_ntop(AF_INET, &ipv4_addr, buffer, sizeof(buffer) / sizeof(*buffer)) != nullptr) {
|
||||||
{
|
if (bWithPort) {
|
||||||
if (bWithPort)
|
|
||||||
{
|
|
||||||
str_addr = buffer;
|
str_addr = buffer;
|
||||||
str_addr += ':';
|
str_addr += ':';
|
||||||
str_addr += std::to_string(addr.m_port);
|
str_addr += std::to_string(addr.m_port);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
str_addr = buffer;
|
str_addr = buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
in6_addr ipv6_addr{};
|
||||||
{
|
|
||||||
in6_addr ipv6_addr;
|
|
||||||
memcpy(ipv6_addr.s6_addr, addr.m_ipv6, sizeof(addr.m_ipv6));
|
memcpy(ipv6_addr.s6_addr, addr.m_ipv6, sizeof(addr.m_ipv6));
|
||||||
|
|
||||||
if (inet_ntop(AF_INET6, &ipv6_addr, buffer, sizeof(buffer) / sizeof(*buffer)) != nullptr)
|
if (inet_ntop(AF_INET6, &ipv6_addr, buffer, sizeof(buffer) / sizeof(*buffer)) != nullptr) {
|
||||||
{
|
if (bWithPort) {
|
||||||
if (bWithPort)
|
|
||||||
{
|
|
||||||
str_addr = '[';
|
str_addr = '[';
|
||||||
str_addr += buffer;
|
str_addr += buffer;
|
||||||
str_addr += "]:";
|
str_addr += "]:";
|
||||||
str_addr += std::to_string(addr.m_port);
|
str_addr += std::to_string(addr.m_port);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
str_addr = buffer;
|
str_addr = buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -478,18 +489,17 @@ void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr &addr, char *bu
|
|||||||
|
|
||||||
bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr )
|
bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::SteamNetworkingIPAddr_ParseString\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
|
|
||||||
if (pAddr == nullptr || pszStr == nullptr)
|
if (pAddr == nullptr || pszStr == nullptr) return valid;
|
||||||
return valid;
|
|
||||||
|
|
||||||
std::string str(pszStr);
|
std::string str(pszStr);
|
||||||
size_t pos = str.find(':');
|
size_t pos = str.find(':');
|
||||||
|
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos) {// Try ipv4 with port
|
||||||
{// Try ipv4 with port
|
|
||||||
in_addr ipv4_addr;
|
in_addr ipv4_addr;
|
||||||
std::string tmp(str);
|
std::string tmp(str);
|
||||||
tmp[pos] = 0;
|
tmp[pos] = 0;
|
||||||
@ -501,9 +511,7 @@ bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char
|
|||||||
valid = true;
|
valid = true;
|
||||||
pAddr->SetIPv4(ntohl(ipv4_addr.s_addr), strtoul(port, nullptr, 10));
|
pAddr->SetIPv4(ntohl(ipv4_addr.s_addr), strtoul(port, nullptr, 10));
|
||||||
}
|
}
|
||||||
}
|
} else {// Try ipv4 without port
|
||||||
else
|
|
||||||
{// Try ipv4 without port
|
|
||||||
in_addr ipv4_addr;
|
in_addr ipv4_addr;
|
||||||
if (inet_pton(AF_INET, str.c_str(), &ipv4_addr) == 1)
|
if (inet_pton(AF_INET, str.c_str(), &ipv4_addr) == 1)
|
||||||
{
|
{
|
||||||
@ -512,8 +520,7 @@ bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!valid)
|
if (!valid) {// Try ipv6
|
||||||
{// Try ipv6
|
|
||||||
addrinfo* info = nullptr;
|
addrinfo* info = nullptr;
|
||||||
addrinfo hints = {};
|
addrinfo hints = {};
|
||||||
hints.ai_family = AF_INET6;
|
hints.ai_family = AF_INET6;
|
||||||
@ -523,58 +530,46 @@ bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char
|
|||||||
size_t sep_pos = 0;
|
size_t sep_pos = 0;
|
||||||
std::string ip;
|
std::string ip;
|
||||||
int sep_count = 0;
|
int sep_count = 0;
|
||||||
for (int i = 0; i < str.length(); ++i)
|
for (int i = 0; i < str.length(); ++i) {
|
||||||
{
|
if (str[i] == ':') {
|
||||||
if (str[i] == ':')
|
|
||||||
{
|
|
||||||
sep_pos = i;
|
sep_pos = i;
|
||||||
++sep_count;
|
++sep_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sep_count == 8)
|
|
||||||
{
|
if (sep_count == 8) {
|
||||||
ip = std::move(std::string(str.begin(), str.begin() + sep_pos));
|
ip = std::move(std::string(str.begin(), str.begin() + sep_pos));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ip = str;
|
ip = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getaddrinfo(ip.c_str(), nullptr, &hints, &info) == 0)
|
if (getaddrinfo(ip.c_str(), nullptr, &hints, &info) == 0) {
|
||||||
{
|
|
||||||
sockaddr_in6* maddr = (sockaddr_in6*)info->ai_addr;
|
sockaddr_in6* maddr = (sockaddr_in6*)info->ai_addr;
|
||||||
|
|
||||||
size_t pos = str.find(']');
|
size_t pos = str.find(']');
|
||||||
std::string str_port("0");
|
std::string str_port("0");
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos) {
|
||||||
{
|
|
||||||
str_port = std::move(std::string(str.begin() + pos + 2, str.end()));
|
str_port = std::move(std::string(str.begin() + pos + 2, str.end()));
|
||||||
}
|
} else if (sep_count == 8) {
|
||||||
else if (sep_count == 8)
|
|
||||||
{
|
|
||||||
str_port = std::move(std::string(str.begin() + sep_pos + 1, str.end()));
|
str_port = std::move(std::string(str.begin() + sep_pos + 1, str.end()));
|
||||||
}
|
}
|
||||||
try
|
|
||||||
{
|
try {
|
||||||
int port = std::stoi(str_port);
|
int port = std::stoi(str_port);
|
||||||
if (port >= 0 && port <= 65535)
|
if (port >= 0 && port <= 65535) {
|
||||||
{
|
|
||||||
pAddr->SetIPv6(maddr->sin6_addr.s6_addr, port);
|
pAddr->SetIPv6(maddr->sin6_addr.s6_addr, port);
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...) { }
|
||||||
{ }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info)
|
if (info) {
|
||||||
{
|
|
||||||
freeaddrinfo(info);
|
freeaddrinfo(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!valid)
|
if (!valid) {
|
||||||
{
|
|
||||||
pAddr->Clear();
|
pAddr->Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,14 +578,16 @@ bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char
|
|||||||
|
|
||||||
ESteamNetworkingFakeIPType SteamNetworkingIPAddr_GetFakeIPType( const SteamNetworkingIPAddr &addr )
|
ESteamNetworkingFakeIPType SteamNetworkingIPAddr_GetFakeIPType( const SteamNetworkingIPAddr &addr )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO: %s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_ESteamNetworkingFakeIPType_NotFake;
|
return k_ESteamNetworkingFakeIPType_NotFake;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity, char *buf, size_t cbBuf )
|
void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity, char *buf, size_t cbBuf )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::SteamNetworkingIdentity_ToString\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (buf == nullptr)
|
if (buf == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -654,7 +651,8 @@ void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity,
|
|||||||
|
|
||||||
bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, const char *pszStr )
|
bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, const char *pszStr )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Utils::SteamNetworkingIdentity_ParseString\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
if (pIdentity == nullptr)
|
if (pIdentity == nullptr)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ public ISteamParties
|
|||||||
public:
|
public:
|
||||||
static void steam_callback(void *object, Common_Message *msg)
|
static void steam_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_parties_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Parties *steam_parties = (Steam_Parties *)object;
|
Steam_Parties *steam_parties = (Steam_Parties *)object;
|
||||||
steam_parties->Callback(msg);
|
steam_parties->Callback(msg);
|
||||||
@ -39,7 +39,7 @@ static void steam_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_parties_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Parties *steam_parties = (Steam_Parties *)object;
|
Steam_Parties *steam_parties = (Steam_Parties *)object;
|
||||||
steam_parties->RunCallbacks();
|
steam_parties->RunCallbacks();
|
||||||
@ -70,19 +70,22 @@ Steam_Parties(class Settings *settings, class Networking *network, class SteamCa
|
|||||||
// Enumerate any active beacons for parties you may wish to join
|
// Enumerate any active beacons for parties you may wish to join
|
||||||
uint32 GetNumActiveBeacons()
|
uint32 GetNumActiveBeacons()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::GetNumActiveBeacons\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PartyBeaconID_t GetBeaconByIndex( uint32 unIndex )
|
PartyBeaconID_t GetBeaconByIndex( uint32 unIndex )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::GetBeaconByIndex\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_ulPartyBeaconIdInvalid;
|
return k_ulPartyBeaconIdInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetBeaconDetails( PartyBeaconID_t ulBeaconID, CSteamID *pSteamIDBeaconOwner, STEAM_OUT_STRUCT() SteamPartyBeaconLocation_t *pLocation, STEAM_OUT_STRING_COUNT(cchMetadata) char *pchMetadata, int cchMetadata )
|
bool GetBeaconDetails( PartyBeaconID_t ulBeaconID, CSteamID *pSteamIDBeaconOwner, STEAM_OUT_STRUCT() SteamPartyBeaconLocation_t *pLocation, STEAM_OUT_STRING_COUNT(cchMetadata) char *pchMetadata, int cchMetadata )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::GetBeaconDetails\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +95,8 @@ bool GetBeaconDetails( PartyBeaconID_t ulBeaconID, CSteamID *pSteamIDBeaconOwner
|
|||||||
STEAM_CALL_RESULT( JoinPartyCallback_t )
|
STEAM_CALL_RESULT( JoinPartyCallback_t )
|
||||||
SteamAPICall_t JoinParty( PartyBeaconID_t ulBeaconID )
|
SteamAPICall_t JoinParty( PartyBeaconID_t ulBeaconID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::JoinParty\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,13 +107,15 @@ SteamAPICall_t JoinParty( PartyBeaconID_t ulBeaconID )
|
|||||||
// Get a list of possible beacon locations
|
// Get a list of possible beacon locations
|
||||||
bool GetNumAvailableBeaconLocations( uint32 *puNumLocations )
|
bool GetNumAvailableBeaconLocations( uint32 *puNumLocations )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::GetNumAvailableBeaconLocations\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetAvailableBeaconLocations( SteamPartyBeaconLocation_t *pLocationList, uint32 uMaxNumLocations )
|
bool GetAvailableBeaconLocations( SteamPartyBeaconLocation_t *pLocationList, uint32 uMaxNumLocations )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::GetAvailableBeaconLocations\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +127,8 @@ bool GetAvailableBeaconLocations( SteamPartyBeaconLocation_t *pLocationList, uin
|
|||||||
STEAM_CALL_RESULT( CreateBeaconCallback_t )
|
STEAM_CALL_RESULT( CreateBeaconCallback_t )
|
||||||
SteamAPICall_t CreateBeacon( uint32 unOpenSlots, SteamPartyBeaconLocation_t *pBeaconLocation, const char *pchConnectString, const char *pchMetadata )
|
SteamAPICall_t CreateBeacon( uint32 unOpenSlots, SteamPartyBeaconLocation_t *pBeaconLocation, const char *pchConnectString, const char *pchMetadata )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::CreateBeacon\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +138,8 @@ SteamAPICall_t CreateBeacon( uint32 unOpenSlots, SteamPartyBeaconLocation_t *pBe
|
|||||||
// Steam will manage the remaining open slots automatically.
|
// Steam will manage the remaining open slots automatically.
|
||||||
void OnReservationCompleted( PartyBeaconID_t ulBeacon, CSteamID steamIDUser )
|
void OnReservationCompleted( PartyBeaconID_t ulBeacon, CSteamID steamIDUser )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::OnReservationCompleted\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -140,7 +148,8 @@ void OnReservationCompleted( PartyBeaconID_t ulBeacon, CSteamID steamIDUser )
|
|||||||
// Note: The user may already be in-flight to your game, so it's possible they will still connect and try to join your party.
|
// Note: The user may already be in-flight to your game, so it's possible they will still connect and try to join your party.
|
||||||
void CancelReservation( PartyBeaconID_t ulBeacon, CSteamID steamIDUser )
|
void CancelReservation( PartyBeaconID_t ulBeacon, CSteamID steamIDUser )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::CancelReservation\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -149,7 +158,8 @@ void CancelReservation( PartyBeaconID_t ulBeacon, CSteamID steamIDUser )
|
|||||||
STEAM_CALL_RESULT( ChangeNumOpenSlotsCallback_t )
|
STEAM_CALL_RESULT( ChangeNumOpenSlotsCallback_t )
|
||||||
SteamAPICall_t ChangeNumOpenSlots( PartyBeaconID_t ulBeacon, uint32 unOpenSlots )
|
SteamAPICall_t ChangeNumOpenSlots( PartyBeaconID_t ulBeacon, uint32 unOpenSlots )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::ChangeNumOpenSlots\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +167,8 @@ SteamAPICall_t ChangeNumOpenSlots( PartyBeaconID_t ulBeacon, uint32 unOpenSlots
|
|||||||
// Turn off the beacon.
|
// Turn off the beacon.
|
||||||
bool DestroyBeacon( PartyBeaconID_t ulBeacon )
|
bool DestroyBeacon( PartyBeaconID_t ulBeacon )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::DestroyBeacon\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +176,8 @@ bool DestroyBeacon( PartyBeaconID_t ulBeacon )
|
|||||||
// Utils
|
// Utils
|
||||||
bool GetBeaconLocationData( SteamPartyBeaconLocation_t BeaconLocation, ESteamPartyBeaconLocationData eData, STEAM_OUT_STRING_COUNT(cchDataStringOut) char *pchDataStringOut, int cchDataStringOut )
|
bool GetBeaconLocationData( SteamPartyBeaconLocation_t BeaconLocation, ESteamPartyBeaconLocationData eData, STEAM_OUT_STRING_COUNT(cchDataStringOut) char *pchDataStringOut, int cchDataStringOut )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Parties::GetBeaconLocationData\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ static void copy_file(const std::string &src_filepath, const std::string &dst_fi
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::copy_file copying file '%s' to '%s'", src_filepath.c_str(), dst_filepath.c_str());
|
PRINT_DEBUG("copying file '%s' to '%s'", src_filepath.c_str(), dst_filepath.c_str());
|
||||||
const auto src_p = std::filesystem::path(src_filepath);
|
const auto src_p = std::filesystem::path(src_filepath);
|
||||||
if (!std::filesystem::exists(src_p) || std::filesystem::is_directory(src_p)) return;
|
if (!std::filesystem::exists(src_p) || std::filesystem::is_directory(src_p)) return;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ Steam_Remote_Storage(class Settings *settings, class Ugc_Remote_Storage_Bridge *
|
|||||||
// file operations
|
// file operations
|
||||||
bool FileWrite( const char *pchFile, const void *pvData, int32 cubData )
|
bool FileWrite( const char *pchFile, const void *pvData, int32 cubData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileWrite '%s' %p %u\n", pchFile, pvData, cubData);
|
PRINT_DEBUG("'%s' %p %u", pchFile, pvData, cubData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchFile || !pchFile[0] || cubData <= 0 || cubData > k_unMaxCloudFileChunkSize || !pvData) {
|
if (!pchFile || !pchFile[0] || cubData <= 0 || cubData > k_unMaxCloudFileChunkSize || !pvData) {
|
||||||
@ -122,26 +122,26 @@ bool FileWrite( const char *pchFile, const void *pvData, int32 cubData )
|
|||||||
}
|
}
|
||||||
|
|
||||||
int data_stored = local_storage->store_data(Local_Storage::remote_storage_folder, pchFile, (char* )pvData, cubData);
|
int data_stored = local_storage->store_data(Local_Storage::remote_storage_folder, pchFile, (char* )pvData, cubData);
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::Stored %i, %u\n", data_stored, data_stored == cubData);
|
PRINT_DEBUG("%i, %u", data_stored, data_stored == cubData);
|
||||||
return data_stored == cubData;
|
return data_stored == cubData;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead )
|
int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileRead '%s' %p %i\n", pchFile, pvData, cubDataToRead);
|
PRINT_DEBUG("'%s' %p %i", pchFile, pvData, cubDataToRead);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchFile || !pchFile[0] || !pvData || !cubDataToRead) return 0;
|
if (!pchFile || !pchFile[0] || !pvData || !cubDataToRead) return 0;
|
||||||
int read_data = local_storage->get_data(Local_Storage::remote_storage_folder, pchFile, (char* )pvData, cubDataToRead);
|
int read_data = local_storage->get_data(Local_Storage::remote_storage_folder, pchFile, (char* )pvData, cubDataToRead);
|
||||||
if (read_data < 0) read_data = 0;
|
if (read_data < 0) read_data = 0;
|
||||||
PRINT_DEBUG(" Read %i\n", read_data);
|
PRINT_DEBUG(" Read %i", read_data);
|
||||||
return read_data;
|
return read_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
STEAM_CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t )
|
STEAM_CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t )
|
||||||
SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData )
|
SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileWriteAsync '%s' %p %u\n", pchFile, pvData, cubData);
|
PRINT_DEBUG("'%s' %p %u", pchFile, pvData, cubData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchFile || !pchFile[0] || cubData > k_unMaxCloudFileChunkSize || cubData == 0 || !pvData) {
|
if (!pchFile || !pchFile[0] || cubData > k_unMaxCloudFileChunkSize || cubData == 0 || !pvData) {
|
||||||
@ -159,7 +159,7 @@ SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 c
|
|||||||
STEAM_CALL_RESULT( RemoteStorageFileReadAsyncComplete_t )
|
STEAM_CALL_RESULT( RemoteStorageFileReadAsyncComplete_t )
|
||||||
SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToRead )
|
SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToRead )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileReadAsync '%s' %u %u\n", pchFile, nOffset, cubToRead);
|
PRINT_DEBUG("'%s' %u %u", pchFile, nOffset, cubToRead);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchFile || !pchFile[0]) return k_uAPICallInvalid;
|
if (!pchFile || !pchFile[0]) return k_uAPICallInvalid;
|
||||||
@ -187,7 +187,7 @@ SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToR
|
|||||||
|
|
||||||
bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cubToRead )
|
bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cubToRead )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileReadAsyncComplete\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pvBuffer) return false;
|
if (!pvBuffer) return false;
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cub
|
|||||||
|
|
||||||
bool FileForget( const char *pchFile )
|
bool FileForget( const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileForget\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchFile || !pchFile[0]) return false;
|
if (!pchFile || !pchFile[0]) return false;
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ bool FileForget( const char *pchFile )
|
|||||||
|
|
||||||
bool FileDelete( const char *pchFile )
|
bool FileDelete( const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileDelete\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchFile || !pchFile[0]) return false;
|
if (!pchFile || !pchFile[0]) return false;
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ bool FileDelete( const char *pchFile )
|
|||||||
STEAM_CALL_RESULT( RemoteStorageFileShareResult_t )
|
STEAM_CALL_RESULT( RemoteStorageFileShareResult_t )
|
||||||
SteamAPICall_t FileShare( const char *pchFile )
|
SteamAPICall_t FileShare( const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileShare\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchFile || !pchFile[0]) return k_uAPICallInvalid;
|
if (!pchFile || !pchFile[0]) return k_uAPICallInvalid;
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ SteamAPICall_t FileShare( const char *pchFile )
|
|||||||
|
|
||||||
bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform )
|
bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::SetSyncPlatforms\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchFile || !pchFile[0]) return false;
|
if (!pchFile || !pchFile[0]) return false;
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStorag
|
|||||||
// file operations that cause network IO
|
// file operations that cause network IO
|
||||||
UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile )
|
UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileWriteStreamOpen\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchFile || !pchFile[0]) return k_UGCFileStreamHandleInvalid;
|
if (!pchFile || !pchFile[0]) return k_UGCFileStreamHandleInvalid;
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile )
|
|||||||
|
|
||||||
bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const void *pvData, int32 cubData )
|
bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const void *pvData, int32 cubData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileWriteStreamWriteChunk\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pvData || cubData < 0) return false;
|
if (!pvData || cubData < 0) return false;
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const vo
|
|||||||
|
|
||||||
bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle )
|
bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileWriteStreamClose\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto request = std::find_if(stream_writes.begin(), stream_writes.end(), [&writeHandle](struct Stream_Write const& item) { return item.write_stream_handle == writeHandle; });
|
auto request = std::find_if(stream_writes.begin(), stream_writes.end(), [&writeHandle](struct Stream_Write const& item) { return item.write_stream_handle == writeHandle; });
|
||||||
if (stream_writes.end() == request)
|
if (stream_writes.end() == request)
|
||||||
@ -305,7 +305,7 @@ bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle )
|
|||||||
|
|
||||||
bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle )
|
bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileWriteStreamCancel\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto request = std::find_if(stream_writes.begin(), stream_writes.end(), [&writeHandle](struct Stream_Write const& item) { return item.write_stream_handle == writeHandle; });
|
auto request = std::find_if(stream_writes.begin(), stream_writes.end(), [&writeHandle](struct Stream_Write const& item) { return item.write_stream_handle == writeHandle; });
|
||||||
if (stream_writes.end() == request)
|
if (stream_writes.end() == request)
|
||||||
@ -318,7 +318,7 @@ bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle )
|
|||||||
// file information
|
// file information
|
||||||
bool FileExists( const char *pchFile )
|
bool FileExists( const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileExists %s\n", pchFile);
|
PRINT_DEBUG("%s", pchFile);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchFile || !pchFile[0]) return false;
|
if (!pchFile || !pchFile[0]) return false;
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ bool FileExists( const char *pchFile )
|
|||||||
|
|
||||||
bool FilePersisted( const char *pchFile )
|
bool FilePersisted( const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FilePersisted\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchFile || !pchFile[0]) return false;
|
if (!pchFile || !pchFile[0]) return false;
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ bool FilePersisted( const char *pchFile )
|
|||||||
|
|
||||||
int32 GetFileSize( const char *pchFile )
|
int32 GetFileSize( const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetFileSize %s\n", pchFile);
|
PRINT_DEBUG("%s", pchFile);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchFile || !pchFile[0]) return 0;
|
if (!pchFile || !pchFile[0]) return 0;
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ int32 GetFileSize( const char *pchFile )
|
|||||||
|
|
||||||
int64 GetFileTimestamp( const char *pchFile )
|
int64 GetFileTimestamp( const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetFileTimestamp '%s'\n", pchFile);
|
PRINT_DEBUG("'%s'", pchFile);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchFile || !pchFile[0]) return 0;
|
if (!pchFile || !pchFile[0]) return 0;
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ int64 GetFileTimestamp( const char *pchFile )
|
|||||||
|
|
||||||
ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile )
|
ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetSyncPlatforms\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_ERemoteStoragePlatformAll;
|
return k_ERemoteStoragePlatformAll;
|
||||||
@ -364,22 +364,22 @@ ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile )
|
|||||||
// iteration
|
// iteration
|
||||||
int32 GetFileCount()
|
int32 GetFileCount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetFileCount\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
int32 num = local_storage->count_files(Local_Storage::remote_storage_folder);
|
int32 num = local_storage->count_files(Local_Storage::remote_storage_folder);
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::File count: %i\n", num);
|
PRINT_DEBUG("count: %i", num);
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes )
|
const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetFileNameAndSize %i\n", iFile);
|
PRINT_DEBUG("%i", iFile);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
static char output_filename[MAX_FILENAME_LENGTH];
|
static char output_filename[MAX_FILENAME_LENGTH];
|
||||||
if (local_storage->iterate_file(Local_Storage::remote_storage_folder, iFile, output_filename, pnFileSizeInBytes)) {
|
if (local_storage->iterate_file(Local_Storage::remote_storage_folder, iFile, output_filename, pnFileSizeInBytes)) {
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::Name: |%s|, size: %i\n", output_filename, pnFileSizeInBytes ? *pnFileSizeInBytes : 0);
|
PRINT_DEBUG("|%s|, size: %i", output_filename, pnFileSizeInBytes ? *pnFileSizeInBytes : 0);
|
||||||
return output_filename;
|
return output_filename;
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
@ -390,7 +390,7 @@ const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes )
|
|||||||
// configuration management
|
// configuration management
|
||||||
bool GetQuota( uint64 *pnTotalBytes, uint64 *puAvailableBytes )
|
bool GetQuota( uint64 *pnTotalBytes, uint64 *puAvailableBytes )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetQuota\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
uint64 quota = 2 << 26;
|
uint64 quota = 2 << 26;
|
||||||
@ -401,7 +401,7 @@ bool GetQuota( uint64 *pnTotalBytes, uint64 *puAvailableBytes )
|
|||||||
|
|
||||||
bool GetQuota( int32 *pnTotalBytes, int32 *puAvailableBytes )
|
bool GetQuota( int32 *pnTotalBytes, int32 *puAvailableBytes )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetQuota\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
uint64 quota = 2 << 26;
|
uint64 quota = 2 << 26;
|
||||||
@ -412,7 +412,7 @@ bool GetQuota( int32 *pnTotalBytes, int32 *puAvailableBytes )
|
|||||||
|
|
||||||
bool IsCloudEnabledForAccount()
|
bool IsCloudEnabledForAccount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::IsCloudEnabledForAccount\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -420,7 +420,7 @@ bool IsCloudEnabledForAccount()
|
|||||||
|
|
||||||
bool IsCloudEnabledForApp()
|
bool IsCloudEnabledForApp()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::IsCloudEnabledForApp\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return steam_cloud_enabled;
|
return steam_cloud_enabled;
|
||||||
@ -428,7 +428,7 @@ bool IsCloudEnabledForApp()
|
|||||||
|
|
||||||
bool IsCloudEnabledThisApp()
|
bool IsCloudEnabledThisApp()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::IsCloudEnabledThisApp\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return steam_cloud_enabled;
|
return steam_cloud_enabled;
|
||||||
@ -436,7 +436,7 @@ bool IsCloudEnabledThisApp()
|
|||||||
|
|
||||||
void SetCloudEnabledForApp( bool bEnabled )
|
void SetCloudEnabledForApp( bool bEnabled )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::SetCloudEnabledForApp\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
steam_cloud_enabled = bEnabled;
|
steam_cloud_enabled = bEnabled;
|
||||||
@ -444,7 +444,7 @@ void SetCloudEnabledForApp( bool bEnabled )
|
|||||||
|
|
||||||
bool SetCloudEnabledThisApp( bool bEnabled )
|
bool SetCloudEnabledThisApp( bool bEnabled )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::SetCloudEnabledThisApp\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
steam_cloud_enabled = bEnabled;
|
steam_cloud_enabled = bEnabled;
|
||||||
@ -459,7 +459,7 @@ bool SetCloudEnabledThisApp( bool bEnabled )
|
|||||||
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
|
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
|
||||||
SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority )
|
SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::UGCDownload %llu\n", hContent);
|
PRINT_DEBUG("%llu", hContent);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (hContent == k_UGCHandleInvalid) return k_uAPICallInvalid;
|
if (hContent == k_UGCHandleInvalid) return k_uAPICallInvalid;
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority )
|
|||||||
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
|
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
|
||||||
SteamAPICall_t UGCDownload( UGCHandle_t hContent )
|
SteamAPICall_t UGCDownload( UGCHandle_t hContent )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::UGCDownload old\n");
|
PRINT_DEBUG("old");
|
||||||
return UGCDownload(hContent, 1);
|
return UGCDownload(hContent, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ SteamAPICall_t UGCDownload( UGCHandle_t hContent )
|
|||||||
// or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage
|
// or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage
|
||||||
bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected )
|
bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetUGCDownloadProgress\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -527,7 +527,7 @@ bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int
|
|||||||
|
|
||||||
bool GetUGCDownloadProgress( UGCHandle_t hContent, uint32 *pnBytesDownloaded, uint32 *pnBytesExpected )
|
bool GetUGCDownloadProgress( UGCHandle_t hContent, uint32 *pnBytesDownloaded, uint32 *pnBytesExpected )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetUGCDownloadProgress old\n");
|
PRINT_DEBUG("old");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -537,7 +537,7 @@ bool GetUGCDownloadProgress( UGCHandle_t hContent, uint32 *pnBytesDownloaded, ui
|
|||||||
// Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result
|
// Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result
|
||||||
bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, STEAM_OUT_STRING() char **ppchName, int32 *pnFileSizeInBytes, STEAM_OUT_STRUCT() CSteamID *pSteamIDOwner )
|
bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, STEAM_OUT_STRING() char **ppchName, int32 *pnFileSizeInBytes, STEAM_OUT_STRUCT() CSteamID *pSteamIDOwner )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetUGCDetails\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -552,7 +552,7 @@ bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, STEAM_OUT_STRING() c
|
|||||||
// For especially large files (anything over 100MB) it is a requirement that the file is read in chunks.
|
// For especially large files (anything over 100MB) it is a requirement that the file is read in chunks.
|
||||||
int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction )
|
int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::UGCRead %llu, %p, %i, %u, %i\n", hContent, pvData, cubDataToRead, cOffset, eAction);
|
PRINT_DEBUG("%llu, %p, %i, %u, %i", hContent, pvData, cubDataToRead, cOffset, eAction);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (hContent == k_UGCHandleInvalid || !downloaded_files.count(hContent) || cubDataToRead < 0) {
|
if (hContent == k_UGCHandleInvalid || !downloaded_files.count(hContent) || cubDataToRead < 0) {
|
||||||
@ -568,7 +568,7 @@ int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 c
|
|||||||
{
|
{
|
||||||
case Downloaded_File::DownloadSource::AfterFileShare:
|
case Downloaded_File::DownloadSource::AfterFileShare:
|
||||||
{
|
{
|
||||||
PRINT_DEBUG(" Steam_Remote_Storage::UGCRead source = AfterFileShare '%s'\n", f.file.c_str());
|
PRINT_DEBUG(" source = AfterFileShare '%s'", f.file.c_str());
|
||||||
read_data = local_storage->get_data(Local_Storage::remote_storage_folder, f.file, (char *)pvData, cubDataToRead, cOffset);
|
read_data = local_storage->get_data(Local_Storage::remote_storage_folder, f.file, (char *)pvData, cubDataToRead, cOffset);
|
||||||
total_size = f.total_size;
|
total_size = f.total_size;
|
||||||
}
|
}
|
||||||
@ -577,7 +577,7 @@ int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 c
|
|||||||
case Downloaded_File::DownloadSource::AfterSendQueryUGCRequest:
|
case Downloaded_File::DownloadSource::AfterSendQueryUGCRequest:
|
||||||
case Downloaded_File::DownloadSource::FromUGCDownloadToLocation:
|
case Downloaded_File::DownloadSource::FromUGCDownloadToLocation:
|
||||||
{
|
{
|
||||||
PRINT_DEBUG(" Steam_Remote_Storage::UGCRead source = AfterSendQueryUGCRequest || FromUGCDownloadToLocation [%i]\n", (int)f.source);
|
PRINT_DEBUG(" source = AfterSendQueryUGCRequest || FromUGCDownloadToLocation [%i]", (int)f.source);
|
||||||
auto mod = settings->getMod(f.mod_query_info.mod_id);
|
auto mod = settings->getMod(f.mod_query_info.mod_id);
|
||||||
auto &mod_name = f.mod_query_info.is_primary_file
|
auto &mod_name = f.mod_query_info.is_primary_file
|
||||||
? mod.primaryFileName
|
? mod.primaryFileName
|
||||||
@ -595,18 +595,18 @@ int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 c
|
|||||||
}
|
}
|
||||||
|
|
||||||
read_data = Local_Storage::get_file_data(mod_fullpath, (char *)pvData, cubDataToRead, cOffset);
|
read_data = Local_Storage::get_file_data(mod_fullpath, (char *)pvData, cubDataToRead, cOffset);
|
||||||
PRINT_DEBUG(" Steam_Remote_Storage::UGCRead mod file '%s' [%i]\n", mod_fullpath.c_str(), read_data);
|
PRINT_DEBUG(" mod file '%s' [%i]", mod_fullpath.c_str(), read_data);
|
||||||
total_size = f.total_size;
|
total_size = f.total_size;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG(" Steam_Remote_Storage::UGCRead unhandled download source %i\n", (int)f.source);
|
PRINT_DEBUG(" unhandled download source %i", (int)f.source);
|
||||||
return -1; //TODO: is this the right return value?
|
return -1; //TODO: is this the right return value?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG(" Steam_Remote_Storage::UGCRead read bytes = %i\n", read_data);
|
PRINT_DEBUG(" read bytes = %i", read_data);
|
||||||
if (read_data < 0) return -1; //TODO: is this the right return value?
|
if (read_data < 0) return -1; //TODO: is this the right return value?
|
||||||
|
|
||||||
if (eAction == k_EUGCRead_Close ||
|
if (eAction == k_EUGCRead_Close ||
|
||||||
@ -619,7 +619,7 @@ int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 c
|
|||||||
|
|
||||||
int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead )
|
int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::UGCRead old\n");
|
PRINT_DEBUG("old");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return UGCRead( hContent, pvData, cubDataToRead, 0);
|
return UGCRead( hContent, pvData, cubDataToRead, 0);
|
||||||
@ -627,7 +627,7 @@ int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead )
|
|||||||
|
|
||||||
int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset)
|
int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::UGCRead old2\n");
|
PRINT_DEBUG("old2");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return UGCRead(hContent, pvData, cubDataToRead, cOffset, k_EUGCRead_ContinueReadingUntilFinished);
|
return UGCRead(hContent, pvData, cubDataToRead, cOffset, k_EUGCRead_ContinueReadingUntilFinished);
|
||||||
@ -636,7 +636,7 @@ int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 c
|
|||||||
// Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead()
|
// Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead()
|
||||||
int32 GetCachedUGCCount()
|
int32 GetCachedUGCCount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetCachedUGCCount\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -644,7 +644,7 @@ int32 GetCachedUGCCount()
|
|||||||
|
|
||||||
UGCHandle_t GetCachedUGCHandle( int32 iCachedContent )
|
UGCHandle_t GetCachedUGCHandle( int32 iCachedContent )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetCachedUGCHandle\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_UGCHandleInvalid;
|
return k_UGCHandleInvalid;
|
||||||
@ -658,7 +658,7 @@ UGCHandle_t GetCachedUGCHandle( int32 iCachedContent )
|
|||||||
// Connect to Steam and get a list of files in the Cloud - results in a RemoteStorageAppSyncStatusCheck_t callback
|
// Connect to Steam and get a list of files in the Cloud - results in a RemoteStorageAppSyncStatusCheck_t callback
|
||||||
void GetFileListFromServer()
|
void GetFileListFromServer()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetFileListFromServer\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -666,7 +666,7 @@ void GetFileListFromServer()
|
|||||||
// Indicate this file should be downloaded in the next sync
|
// Indicate this file should be downloaded in the next sync
|
||||||
bool FileFetch( const char *pchFile )
|
bool FileFetch( const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FileFetch\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -675,7 +675,7 @@ bool FileFetch( const char *pchFile )
|
|||||||
// Indicate this file should be persisted in the next sync
|
// Indicate this file should be persisted in the next sync
|
||||||
bool FilePersist( const char *pchFile )
|
bool FilePersist( const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::FilePersist\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -684,7 +684,7 @@ bool FilePersist( const char *pchFile )
|
|||||||
// Pull any requested files down from the Cloud - results in a RemoteStorageAppSyncedClient_t callback
|
// Pull any requested files down from the Cloud - results in a RemoteStorageAppSyncedClient_t callback
|
||||||
bool SynchronizeToClient()
|
bool SynchronizeToClient()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::SynchronizeToClient\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -692,7 +692,7 @@ bool SynchronizeToClient()
|
|||||||
// Upload any requested files to the Cloud - results in a RemoteStorageAppSyncedServer_t callback
|
// Upload any requested files to the Cloud - results in a RemoteStorageAppSyncedServer_t callback
|
||||||
bool SynchronizeToServer()
|
bool SynchronizeToServer()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::SynchronizeToServer\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -700,7 +700,7 @@ bool SynchronizeToServer()
|
|||||||
// Reset any fetch/persist/etc requests
|
// Reset any fetch/persist/etc requests
|
||||||
bool ResetFileRequestState()
|
bool ResetFileRequestState()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::ResetFileRequestState\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -711,7 +711,7 @@ bool ResetFileRequestState()
|
|||||||
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
|
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
|
||||||
SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags, EWorkshopFileType eWorkshopFileType )
|
SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags, EWorkshopFileType eWorkshopFileType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::PublishWorkshopFile\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
@ -719,7 +719,7 @@ SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewF
|
|||||||
|
|
||||||
PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t unPublishedFileId )
|
PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t unPublishedFileId )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::CreatePublishedFileUpdateRequest\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_PublishedFileUpdateHandleInvalid;
|
return k_PublishedFileUpdateHandleInvalid;
|
||||||
@ -727,7 +727,7 @@ PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t
|
|||||||
|
|
||||||
bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const char *pchFile )
|
bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const char *pchFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFileFile\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -735,7 +735,7 @@ bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const ch
|
|||||||
|
|
||||||
SteamAPICall_t PublishFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags )
|
SteamAPICall_t PublishFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::PublishFile\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
@ -743,7 +743,7 @@ SteamAPICall_t PublishFile( const char *pchFile, const char *pchPreviewFile, App
|
|||||||
|
|
||||||
SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, SteamParamStringArray_t *pTags )
|
SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, SteamParamStringArray_t *pTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::PublishWorkshopFile old\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
@ -751,7 +751,7 @@ SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewF
|
|||||||
|
|
||||||
SteamAPICall_t UpdatePublishedFile( RemoteStorageUpdatePublishedFileRequest_t updatePublishedFileRequest )
|
SteamAPICall_t UpdatePublishedFile( RemoteStorageUpdatePublishedFileRequest_t updatePublishedFileRequest )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFile\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
@ -759,7 +759,7 @@ SteamAPICall_t UpdatePublishedFile( RemoteStorageUpdatePublishedFileRequest_t up
|
|||||||
|
|
||||||
bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, const char *pchPreviewFile )
|
bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, const char *pchPreviewFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFilePreviewFile\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -767,7 +767,7 @@ bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, c
|
|||||||
|
|
||||||
bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const char *pchTitle )
|
bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const char *pchTitle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFileTitle\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -775,7 +775,7 @@ bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const c
|
|||||||
|
|
||||||
bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchDescription )
|
bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchDescription )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFileDescription\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -783,7 +783,7 @@ bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, c
|
|||||||
|
|
||||||
bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility )
|
bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFileVisibility\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -791,7 +791,7 @@ bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ER
|
|||||||
|
|
||||||
bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags )
|
bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFileTags\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -800,7 +800,7 @@ bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamPar
|
|||||||
STEAM_CALL_RESULT( RemoteStorageUpdatePublishedFileResult_t )
|
STEAM_CALL_RESULT( RemoteStorageUpdatePublishedFileResult_t )
|
||||||
SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle )
|
SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::CommitPublishedFileUpdate %llu\n", updateHandle);
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
@ -812,7 +812,7 @@ SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHand
|
|||||||
STEAM_CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t )
|
STEAM_CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t )
|
||||||
SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld )
|
SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::GetPublishedFileDetails %llu %u\n", unPublishedFileId, unMaxSecondsOld);
|
PRINT_DEBUG("TODO %llu %u", unPublishedFileId, unMaxSecondsOld);
|
||||||
//TODO: check what this function really returns
|
//TODO: check what this function really returns
|
||||||
// TODO is this implementation correct?
|
// TODO is this implementation correct?
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
@ -864,14 +864,14 @@ SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uin
|
|||||||
STEAM_CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t )
|
STEAM_CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t )
|
||||||
SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId )
|
SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::GetPublishedFileDetails old\n");
|
PRINT_DEBUG_TODO();
|
||||||
return GetPublishedFileDetails(unPublishedFileId, 0);
|
return GetPublishedFileDetails(unPublishedFileId, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
STEAM_CALL_RESULT( RemoteStorageDeletePublishedFileResult_t )
|
STEAM_CALL_RESULT( RemoteStorageDeletePublishedFileResult_t )
|
||||||
SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId )
|
SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::DeletePublishedFile %llu\n", unPublishedFileId);
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
@ -881,7 +881,7 @@ SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId )
|
|||||||
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
|
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
|
||||||
SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex )
|
SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::EnumerateUserPublishedFiles %u\n", unStartIndex);
|
PRINT_DEBUG("TODO %u", unStartIndex);
|
||||||
// TODO is this implementation correct?
|
// TODO is this implementation correct?
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
RemoteStorageEnumerateUserPublishedFilesResult_t data{};
|
RemoteStorageEnumerateUserPublishedFilesResult_t data{};
|
||||||
@ -910,7 +910,7 @@ SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex )
|
|||||||
auto mod = settings->getMod(modId);
|
auto mod = settings->getMod(modId);
|
||||||
data.m_rgPublishedFileId[iterated] = modId;
|
data.m_rgPublishedFileId[iterated] = modId;
|
||||||
iterated++;
|
iterated++;
|
||||||
PRINT_DEBUG(" EnumerateUserPublishedFiles file %llu\n", modId);
|
PRINT_DEBUG(" EnumerateUserPublishedFiles file %llu", modId);
|
||||||
}
|
}
|
||||||
data.m_nResultsReturned = iterated;
|
data.m_nResultsReturned = iterated;
|
||||||
}
|
}
|
||||||
@ -921,7 +921,7 @@ SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex )
|
|||||||
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
|
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
|
||||||
SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId )
|
SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::SubscribePublishedFile %llu\n", unPublishedFileId);
|
PRINT_DEBUG("TODO %llu", unPublishedFileId);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (unPublishedFileId == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
if (unPublishedFileId == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
||||||
|
|
||||||
@ -943,7 +943,7 @@ STEAM_CALL_RESULT( RemoteStorageEnumerateUserSubscribedFilesResult_t )
|
|||||||
SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex )
|
SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex )
|
||||||
{
|
{
|
||||||
// https://partner.steamgames.com/doc/api/ISteamRemoteStorage
|
// https://partner.steamgames.com/doc/api/ISteamRemoteStorage
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::EnumerateUserSubscribedFiles %u\n", unStartIndex);
|
PRINT_DEBUG("%u", unStartIndex);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
// Get ready for a working but bad implementation - Detanup01
|
// Get ready for a working but bad implementation - Detanup01
|
||||||
RemoteStorageEnumerateUserSubscribedFilesResult_t data{};
|
RemoteStorageEnumerateUserSubscribedFilesResult_t data{};
|
||||||
@ -963,7 +963,7 @@ SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex )
|
|||||||
data.m_rgPublishedFileId[iterated] = modId;
|
data.m_rgPublishedFileId[iterated] = modId;
|
||||||
data.m_rgRTimeSubscribed[iterated] = time;
|
data.m_rgRTimeSubscribed[iterated] = time;
|
||||||
iterated++;
|
iterated++;
|
||||||
PRINT_DEBUG(" EnumerateUserSubscribedFiles file %llu\n", modId);
|
PRINT_DEBUG(" EnumerateUserSubscribedFiles file %llu", modId);
|
||||||
}
|
}
|
||||||
data.m_nResultsReturned = iterated;
|
data.m_nResultsReturned = iterated;
|
||||||
}
|
}
|
||||||
@ -974,7 +974,7 @@ SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex )
|
|||||||
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
|
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
|
||||||
SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId )
|
SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::UnsubscribePublishedFile %llu\n", unPublishedFileId);
|
PRINT_DEBUG("TODO %llu", unPublishedFileId);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (unPublishedFileId == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
if (unPublishedFileId == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
||||||
|
|
||||||
@ -994,7 +994,7 @@ SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId )
|
|||||||
|
|
||||||
bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchChangeDescription )
|
bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchChangeDescription )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::UpdatePublishedFileSetChangeDescription\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1003,7 +1003,7 @@ bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t update
|
|||||||
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
|
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
|
||||||
SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId )
|
SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::GetPublishedItemVoteDetails\n");
|
PRINT_DEBUG_TODO();
|
||||||
// TODO s this implementation correct?
|
// TODO s this implementation correct?
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (unPublishedFileId == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
if (unPublishedFileId == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
||||||
@ -1029,7 +1029,7 @@ SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId,
|
|||||||
{
|
{
|
||||||
// I assume this function is supposed to increase the upvotes of the mod,
|
// I assume this function is supposed to increase the upvotes of the mod,
|
||||||
// given that the mod owner is the current user
|
// given that the mod owner is the current user
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::UpdateUserPublishedItemVote\n");
|
PRINT_DEBUG_TODO();
|
||||||
// TODO is this implementation correct?
|
// TODO is this implementation correct?
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (unPublishedFileId == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
if (unPublishedFileId == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
||||||
@ -1053,7 +1053,7 @@ SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId,
|
|||||||
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
|
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
|
||||||
SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId )
|
SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::GetUserPublishedItemVoteDetails\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
// TODO is this implementation correct?
|
// TODO is this implementation correct?
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
@ -1084,7 +1084,7 @@ SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFil
|
|||||||
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
|
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
|
||||||
SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags )
|
SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::EnumerateUserSharedWorkshopFiles\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
RemoteStorageEnumerateUserPublishedFilesResult_t data{};
|
RemoteStorageEnumerateUserPublishedFilesResult_t data{};
|
||||||
data.m_eResult = k_EResultOK;
|
data.m_eResult = k_EResultOK;
|
||||||
@ -1097,14 +1097,14 @@ SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStar
|
|||||||
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
|
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
|
||||||
SteamAPICall_t EnumerateUserSharedWorkshopFiles(AppId_t nAppId, CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags )
|
SteamAPICall_t EnumerateUserSharedWorkshopFiles(AppId_t nAppId, CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Remote_Storage::EnumerateUserSharedWorkshopFiles old\n");
|
PRINT_DEBUG("old");
|
||||||
return EnumerateUserSharedWorkshopFiles(steamId, unStartIndex, pRequiredTags, pExcludedTags);
|
return EnumerateUserSharedWorkshopFiles(steamId, unStartIndex, pRequiredTags, pExcludedTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
|
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
|
||||||
SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char *pchVideoAccount, const char *pchVideoIdentifier, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags )
|
SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char *pchVideoAccount, const char *pchVideoIdentifier, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::PublishVideo\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
}
|
}
|
||||||
@ -1112,7 +1112,7 @@ SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char *
|
|||||||
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
|
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
|
||||||
SteamAPICall_t PublishVideo(const char *pchFileName, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags )
|
SteamAPICall_t PublishVideo(const char *pchFileName, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::PublishVideo old\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
}
|
}
|
||||||
@ -1120,7 +1120,7 @@ SteamAPICall_t PublishVideo(const char *pchFileName, const char *pchPreviewFile,
|
|||||||
STEAM_CALL_RESULT( RemoteStorageSetUserPublishedFileActionResult_t )
|
STEAM_CALL_RESULT( RemoteStorageSetUserPublishedFileActionResult_t )
|
||||||
SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction )
|
SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::SetUserPublishedFileAction\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
}
|
}
|
||||||
@ -1128,7 +1128,7 @@ SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId,
|
|||||||
STEAM_CALL_RESULT( RemoteStorageEnumeratePublishedFilesByUserActionResult_t )
|
STEAM_CALL_RESULT( RemoteStorageEnumeratePublishedFilesByUserActionResult_t )
|
||||||
SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex )
|
SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::EnumeratePublishedFilesByUserAction\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
}
|
}
|
||||||
@ -1137,7 +1137,7 @@ SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction,
|
|||||||
STEAM_CALL_RESULT( RemoteStorageEnumerateWorkshopFilesResult_t )
|
STEAM_CALL_RESULT( RemoteStorageEnumerateWorkshopFilesResult_t )
|
||||||
SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t *pTags, SteamParamStringArray_t *pUserTags )
|
SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t *pTags, SteamParamStringArray_t *pUserTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::EnumeratePublishedWorkshopFiles\n");
|
PRINT_DEBUG_TODO();
|
||||||
// TODO is this implementation correct?
|
// TODO is this implementation correct?
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
RemoteStorageEnumerateWorkshopFilesResult_t data{};
|
RemoteStorageEnumerateWorkshopFilesResult_t data{};
|
||||||
@ -1152,7 +1152,7 @@ SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumer
|
|||||||
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
|
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
|
||||||
SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority )
|
SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Remote_Storage::UGCDownloadToLocation %llu %s\n", hContent, pchLocation);
|
PRINT_DEBUG("TODO %llu %s", hContent, pchLocation);
|
||||||
// TODO is this implementation correct?
|
// TODO is this implementation correct?
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO: not sure if this is the right result
|
//TODO: not sure if this is the right result
|
||||||
@ -1205,7 +1205,7 @@ SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocat
|
|||||||
// Cloud dynamic state change notification
|
// Cloud dynamic state change notification
|
||||||
int32 GetLocalFileChangeCount()
|
int32 GetLocalFileChangeCount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("GetLocalFileChangeCount\n");
|
PRINT_DEBUG("GetLocalFileChangeCount");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1213,7 +1213,7 @@ int32 GetLocalFileChangeCount()
|
|||||||
|
|
||||||
const char *GetLocalFileChange( int iFile, ERemoteStorageLocalFileChange *pEChangeType, ERemoteStorageFilePathType *pEFilePathType )
|
const char *GetLocalFileChange( int iFile, ERemoteStorageLocalFileChange *pEChangeType, ERemoteStorageFilePathType *pEFilePathType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("GetLocalFileChange\n");
|
PRINT_DEBUG("GetLocalFileChange");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
@ -1223,7 +1223,7 @@ const char *GetLocalFileChange( int iFile, ERemoteStorageLocalFileChange *pEChan
|
|||||||
// operations - for example, writing a game save that requires updating two files.
|
// operations - for example, writing a game save that requires updating two files.
|
||||||
bool BeginFileWriteBatch()
|
bool BeginFileWriteBatch()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("BeginFileWriteBatch\n");
|
PRINT_DEBUG("BeginFileWriteBatch");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1231,7 +1231,7 @@ bool BeginFileWriteBatch()
|
|||||||
|
|
||||||
bool EndFileWriteBatch()
|
bool EndFileWriteBatch()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("EndFileWriteBatch\n");
|
PRINT_DEBUG("EndFileWriteBatch");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -30,7 +30,7 @@ public ISteamRemotePlay
|
|||||||
public:
|
public:
|
||||||
static void steam_callback(void *object, Common_Message *msg)
|
static void steam_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_remoteplay_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_RemotePlay *steam_remoteplay = (Steam_RemotePlay *)object;
|
Steam_RemotePlay *steam_remoteplay = (Steam_RemotePlay *)object;
|
||||||
steam_remoteplay->Callback(msg);
|
steam_remoteplay->Callback(msg);
|
||||||
@ -38,7 +38,7 @@ static void steam_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_remoteplay_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_RemotePlay *steam_remoteplay = (Steam_RemotePlay *)object;
|
Steam_RemotePlay *steam_remoteplay = (Steam_RemotePlay *)object;
|
||||||
steam_remoteplay->RunCallbacks();
|
steam_remoteplay->RunCallbacks();
|
||||||
@ -65,7 +65,7 @@ Steam_RemotePlay(class Settings *settings, class Networking *network, class Stea
|
|||||||
// Get the number of currently connected Steam Remote Play sessions
|
// Get the number of currently connected Steam Remote Play sessions
|
||||||
uint32 GetSessionCount()
|
uint32 GetSessionCount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_RemotePlay::GetSessionCount\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ uint32 GetSessionCount()
|
|||||||
// Get the currently connected Steam Remote Play session ID at the specified index. Returns zero if index is out of bounds.
|
// Get the currently connected Steam Remote Play session ID at the specified index. Returns zero if index is out of bounds.
|
||||||
uint32 GetSessionID( int iSessionIndex )
|
uint32 GetSessionID( int iSessionIndex )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_RemotePlay::GetSessionID\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ uint32 GetSessionID( int iSessionIndex )
|
|||||||
// Get the SteamID of the connected user
|
// Get the SteamID of the connected user
|
||||||
CSteamID GetSessionSteamID( uint32 unSessionID )
|
CSteamID GetSessionSteamID( uint32 unSessionID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_RemotePlay::GetSessionSteamID\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_steamIDNil;
|
return k_steamIDNil;
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ CSteamID GetSessionSteamID( uint32 unSessionID )
|
|||||||
// This returns NULL if the sessionID is not valid
|
// This returns NULL if the sessionID is not valid
|
||||||
const char *GetSessionClientName( uint32 unSessionID )
|
const char *GetSessionClientName( uint32 unSessionID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_RemotePlay::GetSessionClientName\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ const char *GetSessionClientName( uint32 unSessionID )
|
|||||||
// Get the form factor of the session client device
|
// Get the form factor of the session client device
|
||||||
ESteamDeviceFormFactor GetSessionClientFormFactor( uint32 unSessionID )
|
ESteamDeviceFormFactor GetSessionClientFormFactor( uint32 unSessionID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_RemotePlay::GetSessionClientFormFactor\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_ESteamDeviceFormFactorUnknown;
|
return k_ESteamDeviceFormFactorUnknown;
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ ESteamDeviceFormFactor GetSessionClientFormFactor( uint32 unSessionID )
|
|||||||
// This is set to 0x0 if the resolution is not available
|
// This is set to 0x0 if the resolution is not available
|
||||||
bool BGetSessionClientResolution( uint32 unSessionID, int *pnResolutionX, int *pnResolutionY )
|
bool BGetSessionClientResolution( uint32 unSessionID, int *pnResolutionX, int *pnResolutionY )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_RemotePlay::BGetSessionClientResolution\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (pnResolutionX) *pnResolutionX = 0;
|
if (pnResolutionX) *pnResolutionX = 0;
|
||||||
if (pnResolutionY) *pnResolutionY = 0;
|
if (pnResolutionY) *pnResolutionY = 0;
|
||||||
@ -116,7 +116,7 @@ bool BGetSessionClientResolution( uint32 unSessionID, int *pnResolutionX, int *p
|
|||||||
|
|
||||||
bool BStartRemotePlayTogether( bool bShowOverlay )
|
bool BStartRemotePlayTogether( bool bShowOverlay )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_RemotePlay::BStartRemotePlayTogether: %d\n", (int)bShowOverlay);
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ bool BStartRemotePlayTogether( bool bShowOverlay )
|
|||||||
// This returns false if the invite can't be sent
|
// This returns false if the invite can't be sent
|
||||||
bool BSendRemotePlayTogetherInvite( CSteamID steamIDFriend )
|
bool BSendRemotePlayTogetherInvite( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_RemotePlay::BSendRemotePlayTogetherInvite\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public ISteamTV
|
|||||||
public:
|
public:
|
||||||
static void steam_callback(void *object, Common_Message *msg)
|
static void steam_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("TODO Steam_TV::steam_tv_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_TV *steam_parties = (Steam_TV *)object;
|
Steam_TV *steam_parties = (Steam_TV *)object;
|
||||||
steam_parties->Callback(msg);
|
steam_parties->Callback(msg);
|
||||||
@ -39,7 +39,7 @@ static void steam_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_tv_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_TV *steam_parties = (Steam_TV *)object;
|
Steam_TV *steam_parties = (Steam_TV *)object;
|
||||||
steam_parties->RunCallbacks();
|
steam_parties->RunCallbacks();
|
||||||
@ -65,39 +65,46 @@ Steam_TV(class Settings *settings, class Networking *network, class SteamCallRes
|
|||||||
|
|
||||||
bool IsBroadcasting(int *pnNumViewers)
|
bool IsBroadcasting(int *pnNumViewers)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddBroadcastGameData(const char * pchKey, const char * pchValue)
|
void AddBroadcastGameData(const char * pchKey, const char * pchValue)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveBroadcastGameData(const char * pchKey)
|
void RemoveBroadcastGameData(const char * pchKey)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddTimelineMarker(const char * pchTemplateName, bool bPersistent, uint8 nColorR, uint8 nColorG, uint8 nColorB)
|
void AddTimelineMarker(const char * pchTemplateName, bool bPersistent, uint8 nColorR, uint8 nColorG, uint8 nColorB)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveTimelineMarker()
|
void RemoveTimelineMarker()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 AddRegion(const char * pchElementName, const char * pchTimelineDataSection, const SteamTVRegion_t * pSteamTVRegion, ESteamTVRegionBehavior eSteamTVRegionBehavior)
|
uint32 AddRegion(const char * pchElementName, const char * pchTimelineDataSection, const SteamTVRegion_t * pSteamTVRegion, ESteamTVRegionBehavior eSteamTVRegionBehavior)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveRegion(uint32 unRegionHandle)
|
void RemoveRegion(uint32 unRegionHandle)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunCallbacks()
|
void RunCallbacks()
|
||||||
|
@ -70,7 +70,7 @@ UGCQueryHandle_t new_ugc_query(
|
|||||||
query.return_all_subscribed = return_all_subscribed;
|
query.return_all_subscribed = return_all_subscribed;
|
||||||
query.return_only = return_only;
|
query.return_only = return_only;
|
||||||
ugc_queries.push_back(query);
|
ugc_queries.push_back(query);
|
||||||
PRINT_DEBUG("Steam_UGC::new_ugc_query handle = %llu\n", query.handle);
|
PRINT_DEBUG("handle = %llu", query.handle);
|
||||||
return query.handle;
|
return query.handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ void set_details(PublishedFileId_t id, SteamUGCDetails_t *pDetails)
|
|||||||
pDetails->m_nPublishedFileId = id;
|
pDetails->m_nPublishedFileId = id;
|
||||||
|
|
||||||
if (settings->isModInstalled(id)) {
|
if (settings->isModInstalled(id)) {
|
||||||
PRINT_DEBUG(" mod is installed, setting details\n");
|
PRINT_DEBUG(" mod is installed, setting details");
|
||||||
pDetails->m_eResult = k_EResultOK;
|
pDetails->m_eResult = k_EResultOK;
|
||||||
|
|
||||||
auto mod = settings->getMod(id);
|
auto mod = settings->getMod(id);
|
||||||
@ -115,7 +115,7 @@ void set_details(PublishedFileId_t id, SteamUGCDetails_t *pDetails)
|
|||||||
// TODO should we enable this?
|
// TODO should we enable this?
|
||||||
// pDetails->m_unNumChildren = mod.numChildren;
|
// pDetails->m_unNumChildren = mod.numChildren;
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG(" mod isn't installed, returning failure\n");
|
PRINT_DEBUG(" mod isn't installed, returning failure");
|
||||||
pDetails->m_eResult = k_EResultFail;
|
pDetails->m_eResult = k_EResultFail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ void read_ugc_favorites()
|
|||||||
{
|
{
|
||||||
unsigned long long fav_id = std::stoull(line);
|
unsigned long long fav_id = std::stoull(line);
|
||||||
favorites.insert(fav_id);
|
favorites.insert(fav_id);
|
||||||
PRINT_DEBUG("Steam_UGC added item to favorites %llu\n", fav_id);
|
PRINT_DEBUG("added item to favorites %llu", fav_id);
|
||||||
} catch(...) { }
|
} catch(...) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ Steam_UGC(class Settings *settings, class Ugc_Remote_Storage_Bridge *ugc_bridge,
|
|||||||
// Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
|
// Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
|
||||||
UGCQueryHandle_t CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage )
|
UGCQueryHandle_t CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::CreateQueryUserUGCRequest %u %i %i %i %u %u %u\n", unAccountID, eListType, eMatchingUGCType, eSortOrder, nCreatorAppID, nConsumerAppID, unPage);
|
PRINT_DEBUG("%u %i %i %i %u %u %u", unAccountID, eListType, eMatchingUGCType, eSortOrder, nCreatorAppID, nConsumerAppID, unPage);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (nCreatorAppID != settings->get_local_game_id().AppID() || nConsumerAppID != settings->get_local_game_id().AppID()) return k_UGCQueryHandleInvalid;
|
if (nCreatorAppID != settings->get_local_game_id().AppID() || nConsumerAppID != settings->get_local_game_id().AppID()) return k_UGCQueryHandleInvalid;
|
||||||
@ -189,7 +189,7 @@ UGCQueryHandle_t CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCLis
|
|||||||
// Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
|
// Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
|
||||||
UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage )
|
UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::CreateQueryAllUGCRequest\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (nCreatorAppID != settings->get_local_game_id().AppID() || nConsumerAppID != settings->get_local_game_id().AppID()) return k_UGCQueryHandleInvalid;
|
if (nCreatorAppID != settings->get_local_game_id().AppID() || nConsumerAppID != settings->get_local_game_id().AppID()) return k_UGCQueryHandleInvalid;
|
||||||
@ -203,7 +203,7 @@ UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGC
|
|||||||
// Query for all matching UGC using the new deep paging interface. Creator app id or consumer app id must be valid and be set to the current running app. pchCursor should be set to NULL or "*" to get the first result set.
|
// Query for all matching UGC using the new deep paging interface. Creator app id or consumer app id must be valid and be set to the current running app. pchCursor should be set to NULL or "*" to get the first result set.
|
||||||
UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, const char *pchCursor = NULL )
|
UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, const char *pchCursor = NULL )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::CreateQueryAllUGCRequest other\n");
|
PRINT_DEBUG("other");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (nCreatorAppID != settings->get_local_game_id().AppID() || nConsumerAppID != settings->get_local_game_id().AppID()) return k_UGCQueryHandleInvalid;
|
if (nCreatorAppID != settings->get_local_game_id().AppID() || nConsumerAppID != settings->get_local_game_id().AppID()) return k_UGCQueryHandleInvalid;
|
||||||
@ -216,7 +216,7 @@ UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGC
|
|||||||
// Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this)
|
// Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this)
|
||||||
UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs )
|
UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::CreateQueryUGCDetailsRequest %p, max file IDs = [%u]\n", pvecPublishedFileID, unNumPublishedFileIDs);
|
PRINT_DEBUG("%p, max file IDs = [%u]", pvecPublishedFileID, unNumPublishedFileIDs);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pvecPublishedFileID) return k_UGCQueryHandleInvalid;
|
if (!pvecPublishedFileID) return k_UGCQueryHandleInvalid;
|
||||||
@ -227,7 +227,7 @@ UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedF
|
|||||||
|
|
||||||
#ifndef EMU_RELEASE_BUILD
|
#ifndef EMU_RELEASE_BUILD
|
||||||
for (const auto &id : only) {
|
for (const auto &id : only) {
|
||||||
PRINT_DEBUG(" Steam_UGC::CreateQueryUGCDetailsRequest file ID = %llu\n", id);
|
PRINT_DEBUG(" file ID = %llu", id);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedF
|
|||||||
STEAM_CALL_RESULT( SteamUGCQueryCompleted_t )
|
STEAM_CALL_RESULT( SteamUGCQueryCompleted_t )
|
||||||
SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle )
|
SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SendQueryUGCRequest %llu\n", handle);
|
PRINT_DEBUG("%llu", handle);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return k_uAPICallInvalid;
|
if (handle == k_UGCQueryHandleInvalid) return k_uAPICallInvalid;
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle )
|
|||||||
// Retrieve an individual result after receiving the callback for querying UGC
|
// Retrieve an individual result after receiving the callback for querying UGC
|
||||||
bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails )
|
bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetQueryUGCResult %llu %u %p\n", handle, index, pDetails);
|
PRINT_DEBUG("%llu %u %p", handle, index, pDetails);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ std::optional<std::string> get_query_ugc_tag(UGCQueryHandle_t handle, uint32 ind
|
|||||||
|
|
||||||
uint32 GetQueryUGCNumTags( UGCQueryHandle_t handle, uint32 index )
|
uint32 GetQueryUGCNumTags( UGCQueryHandle_t handle, uint32 index )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCNumTags\n");
|
PRINT_DEBUG_TODO();
|
||||||
// TODO is this correct?
|
// TODO is this correct?
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return 0;
|
if (handle == k_UGCQueryHandleInvalid) return 0;
|
||||||
@ -355,7 +355,7 @@ uint32 GetQueryUGCNumTags( UGCQueryHandle_t handle, uint32 index )
|
|||||||
|
|
||||||
bool GetQueryUGCTag( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize )
|
bool GetQueryUGCTag( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCTag\n");
|
PRINT_DEBUG_TODO();
|
||||||
// TODO is this correct?
|
// TODO is this correct?
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
@ -371,7 +371,7 @@ bool GetQueryUGCTag( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STE
|
|||||||
|
|
||||||
bool GetQueryUGCTagDisplayName( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize )
|
bool GetQueryUGCTagDisplayName( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCTagDisplayName\n");
|
PRINT_DEBUG_TODO();
|
||||||
// TODO is this correct?
|
// TODO is this correct?
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
@ -387,7 +387,7 @@ bool GetQueryUGCTagDisplayName( UGCQueryHandle_t handle, uint32 index, uint32 in
|
|||||||
|
|
||||||
bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize )
|
bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetQueryUGCPreviewURL\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
//TODO: escape simulator tries downloading this url and unsubscribes if it fails
|
//TODO: escape simulator tries downloading this url and unsubscribes if it fails
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
@ -397,7 +397,7 @@ bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STR
|
|||||||
if (!res.has_value()) return false;
|
if (!res.has_value()) return false;
|
||||||
|
|
||||||
auto mod = res.value();
|
auto mod = res.value();
|
||||||
PRINT_DEBUG("Steam_UGC:GetQueryUGCPreviewURL: '%s'\n", mod.previewURL.c_str());
|
PRINT_DEBUG("Steam_UGC:GetQueryUGCPreviewURL: '%s'", mod.previewURL.c_str());
|
||||||
mod.previewURL.copy(pchURL, cchURLSize - 1);
|
mod.previewURL.copy(pchURL, cchURLSize - 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -405,7 +405,7 @@ bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STR
|
|||||||
|
|
||||||
bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize )
|
bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCMetadata\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -418,7 +418,7 @@ bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRIN
|
|||||||
|
|
||||||
bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries )
|
bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCChildren\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId
|
|||||||
|
|
||||||
bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint64 *pStatValue )
|
bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint64 *pStatValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCStatistic\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic
|
|||||||
|
|
||||||
bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint32 *pStatValue )
|
bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint32 *pStatValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCStatistic old\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic
|
|||||||
|
|
||||||
uint32 GetQueryUGCNumAdditionalPreviews( UGCQueryHandle_t handle, uint32 index )
|
uint32 GetQueryUGCNumAdditionalPreviews( UGCQueryHandle_t handle, uint32 index )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCNumAdditionalPreviews\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return 0;
|
if (handle == k_UGCQueryHandleInvalid) return 0;
|
||||||
|
|
||||||
@ -468,7 +468,7 @@ uint32 GetQueryUGCNumAdditionalPreviews( UGCQueryHandle_t handle, uint32 index )
|
|||||||
|
|
||||||
bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURLOrVideoID, uint32 cchURLSize, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchOriginalFileName, uint32 cchOriginalFileNameSize, EItemPreviewType *pPreviewType )
|
bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURLOrVideoID, uint32 cchURLSize, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchOriginalFileName, uint32 cchOriginalFileNameSize, EItemPreviewType *pPreviewType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCAdditionalPreview\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32
|
|||||||
|
|
||||||
bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, char *pchURLOrVideoID, uint32 cchURLSize, bool *hz )
|
bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, char *pchURLOrVideoID, uint32 cchURLSize, bool *hz )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCAdditionalPreview old\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32
|
|||||||
|
|
||||||
uint32 GetQueryUGCNumKeyValueTags( UGCQueryHandle_t handle, uint32 index )
|
uint32 GetQueryUGCNumKeyValueTags( UGCQueryHandle_t handle, uint32 index )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCNumKeyValueTags\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return 0;
|
if (handle == k_UGCQueryHandleInvalid) return 0;
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ uint32 GetQueryUGCNumKeyValueTags( UGCQueryHandle_t handle, uint32 index )
|
|||||||
|
|
||||||
bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, STEAM_OUT_STRING_COUNT(cchKeySize) char *pchKey, uint32 cchKeySize, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize )
|
bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, STEAM_OUT_STRING_COUNT(cchKeySize) char *pchKey, uint32 cchKeySize, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCKeyValueTag\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, uint32 keyVa
|
|||||||
|
|
||||||
bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, const char *pchKey, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize )
|
bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, const char *pchKey, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCKeyValueTag2\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -529,7 +529,7 @@ bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, const char *
|
|||||||
|
|
||||||
uint32 GetQueryUGCContentDescriptors( UGCQueryHandle_t handle, uint32 index, EUGCContentDescriptorID *pvecDescriptors, uint32 cMaxEntries )
|
uint32 GetQueryUGCContentDescriptors( UGCQueryHandle_t handle, uint32 index, EUGCContentDescriptorID *pvecDescriptors, uint32 cMaxEntries )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCContentDescriptors\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return 0;
|
if (handle == k_UGCQueryHandleInvalid) return 0;
|
||||||
|
|
||||||
@ -542,7 +542,7 @@ uint32 GetQueryUGCContentDescriptors( UGCQueryHandle_t handle, uint32 index, EUG
|
|||||||
// Release the request to free up memory, after retrieving results
|
// Release the request to free up memory, after retrieving results
|
||||||
bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle )
|
bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::ReleaseQueryUGCRequest %llu\n", handle);
|
PRINT_DEBUG("%llu", handle);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -557,7 +557,7 @@ bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle )
|
|||||||
// Options to set for querying UGC
|
// Options to set for querying UGC
|
||||||
bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName )
|
bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::AddRequiredTag\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -569,7 +569,7 @@ bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName )
|
|||||||
|
|
||||||
bool AddRequiredTagGroup( UGCQueryHandle_t handle, const SteamParamStringArray_t *pTagGroups )
|
bool AddRequiredTagGroup( UGCQueryHandle_t handle, const SteamParamStringArray_t *pTagGroups )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::AddRequiredTagGroup\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -581,7 +581,7 @@ bool AddRequiredTagGroup( UGCQueryHandle_t handle, const SteamParamStringArray_t
|
|||||||
|
|
||||||
bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName )
|
bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::AddExcludedTag\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -594,7 +594,7 @@ bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName )
|
|||||||
|
|
||||||
bool SetReturnOnlyIDs( UGCQueryHandle_t handle, bool bReturnOnlyIDs )
|
bool SetReturnOnlyIDs( UGCQueryHandle_t handle, bool bReturnOnlyIDs )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetReturnOnlyIDs\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -607,7 +607,7 @@ bool SetReturnOnlyIDs( UGCQueryHandle_t handle, bool bReturnOnlyIDs )
|
|||||||
|
|
||||||
bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags )
|
bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetReturnKeyValueTags\n");
|
PRINT_DEBUG_TODO();
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
auto request = std::find_if(ugc_queries.begin(), ugc_queries.end(), [&handle](struct UGC_query const& item) { return item.handle == handle; });
|
auto request = std::find_if(ugc_queries.begin(), ugc_queries.end(), [&handle](struct UGC_query const& item) { return item.handle == handle; });
|
||||||
@ -619,7 +619,7 @@ bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags )
|
|||||||
|
|
||||||
bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription )
|
bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetReturnLongDescription\n");
|
PRINT_DEBUG_TODO();
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
auto request = std::find_if(ugc_queries.begin(), ugc_queries.end(), [&handle](struct UGC_query const& item) { return item.handle == handle; });
|
auto request = std::find_if(ugc_queries.begin(), ugc_queries.end(), [&handle](struct UGC_query const& item) { return item.handle == handle; });
|
||||||
@ -631,7 +631,7 @@ bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescript
|
|||||||
|
|
||||||
bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata )
|
bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetReturnMetadata %i\n", (int)bReturnMetadata);
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -644,7 +644,7 @@ bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata )
|
|||||||
|
|
||||||
bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren )
|
bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetReturnChildren\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -657,7 +657,7 @@ bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren )
|
|||||||
|
|
||||||
bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditionalPreviews )
|
bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditionalPreviews )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetReturnAdditionalPreviews\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -670,7 +670,7 @@ bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditiona
|
|||||||
|
|
||||||
bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly )
|
bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetReturnTotalOnly\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -683,7 +683,7 @@ bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly )
|
|||||||
|
|
||||||
bool SetReturnPlaytimeStats( UGCQueryHandle_t handle, uint32 unDays )
|
bool SetReturnPlaytimeStats( UGCQueryHandle_t handle, uint32 unDays )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetReturnPlaytimeStats\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -696,7 +696,7 @@ bool SetReturnPlaytimeStats( UGCQueryHandle_t handle, uint32 unDays )
|
|||||||
|
|
||||||
bool SetLanguage( UGCQueryHandle_t handle, const char *pchLanguage )
|
bool SetLanguage( UGCQueryHandle_t handle, const char *pchLanguage )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetLanguage\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -709,7 +709,7 @@ bool SetLanguage( UGCQueryHandle_t handle, const char *pchLanguage )
|
|||||||
|
|
||||||
bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds )
|
bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetAllowCachedResponse\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -723,7 +723,7 @@ bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds )
|
|||||||
// Options only for querying user UGC
|
// Options only for querying user UGC
|
||||||
bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName )
|
bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetCloudFileNameFilter\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -737,7 +737,7 @@ bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFil
|
|||||||
// Options only for querying all UGC
|
// Options only for querying all UGC
|
||||||
bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag )
|
bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetMatchAnyTag\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -750,7 +750,7 @@ bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag )
|
|||||||
|
|
||||||
bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText )
|
bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetSearchText\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -763,7 +763,7 @@ bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText )
|
|||||||
|
|
||||||
bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays )
|
bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetRankedByTrendDays\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -776,7 +776,7 @@ bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays )
|
|||||||
|
|
||||||
bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue )
|
bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::AddRequiredKeyValueTag\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -788,7 +788,7 @@ bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const ch
|
|||||||
|
|
||||||
bool SetTimeCreatedDateRange( UGCQueryHandle_t handle, RTime32 rtStart, RTime32 rtEnd )
|
bool SetTimeCreatedDateRange( UGCQueryHandle_t handle, RTime32 rtStart, RTime32 rtEnd )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetTimeCreatedDateRange\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -800,7 +800,7 @@ bool SetTimeCreatedDateRange( UGCQueryHandle_t handle, RTime32 rtStart, RTime32
|
|||||||
|
|
||||||
bool SetTimeUpdatedDateRange( UGCQueryHandle_t handle, RTime32 rtStart, RTime32 rtEnd )
|
bool SetTimeUpdatedDateRange( UGCQueryHandle_t handle, RTime32 rtStart, RTime32 rtEnd )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_UGC::SetTimeUpdatedDateRange\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (handle == k_UGCQueryHandleInvalid) return false;
|
if (handle == k_UGCQueryHandleInvalid) return false;
|
||||||
|
|
||||||
@ -813,7 +813,7 @@ bool SetTimeUpdatedDateRange( UGCQueryHandle_t handle, RTime32 rtStart, RTime32
|
|||||||
// DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead!
|
// DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead!
|
||||||
SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds )
|
SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::RequestUGCDetails %llu\n", nPublishedFileID);
|
PRINT_DEBUG("%llu", nPublishedFileID);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
SteamUGCRequestUGCDetailsResult_t data{};
|
SteamUGCRequestUGCDetailsResult_t data{};
|
||||||
@ -824,7 +824,7 @@ SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unM
|
|||||||
|
|
||||||
SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID )
|
SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::RequestUGCDetails old\n");
|
PRINT_DEBUG("old");
|
||||||
return RequestUGCDetails(nPublishedFileID, 0);
|
return RequestUGCDetails(nPublishedFileID, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -833,7 +833,7 @@ SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID )
|
|||||||
STEAM_CALL_RESULT( CreateItemResult_t )
|
STEAM_CALL_RESULT( CreateItemResult_t )
|
||||||
SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType )
|
SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::CreateItem\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
@ -843,7 +843,7 @@ SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType )
|
|||||||
|
|
||||||
UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID )
|
UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::StartItemUpdate\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_UGCUpdateHandleInvalid;
|
return k_UGCUpdateHandleInvalid;
|
||||||
@ -853,7 +853,7 @@ UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPu
|
|||||||
|
|
||||||
bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle )
|
bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SetItemTitle\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -863,7 +863,7 @@ bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle )
|
|||||||
|
|
||||||
bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription )
|
bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SetItemDescription\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -873,7 +873,7 @@ bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription )
|
|||||||
|
|
||||||
bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage )
|
bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SetItemUpdateLanguage\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -883,7 +883,7 @@ bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage )
|
|||||||
|
|
||||||
bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData )
|
bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SetItemMetadata\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -893,7 +893,7 @@ bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData )
|
|||||||
|
|
||||||
bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility )
|
bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SetItemVisibility\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -903,7 +903,7 @@ bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVis
|
|||||||
|
|
||||||
bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags )
|
bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SetItemTags old\n");
|
PRINT_DEBUG("old");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -911,7 +911,7 @@ bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t
|
|||||||
|
|
||||||
bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags, bool bAllowAdminTags )
|
bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags, bool bAllowAdminTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SetItemTags\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -920,7 +920,7 @@ bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t
|
|||||||
|
|
||||||
bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder )
|
bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SetItemContent\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -930,7 +930,7 @@ bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder )
|
|||||||
|
|
||||||
bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile )
|
bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SetItemPreview\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -939,7 +939,7 @@ bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile )
|
|||||||
|
|
||||||
bool SetAllowLegacyUpload( UGCUpdateHandle_t handle, bool bAllowLegacyUpload )
|
bool SetAllowLegacyUpload( UGCUpdateHandle_t handle, bool bAllowLegacyUpload )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SetAllowLegacyUpload\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -947,7 +947,7 @@ bool SetAllowLegacyUpload( UGCUpdateHandle_t handle, bool bAllowLegacyUpload )
|
|||||||
|
|
||||||
bool RemoveAllItemKeyValueTags( UGCUpdateHandle_t handle )
|
bool RemoveAllItemKeyValueTags( UGCUpdateHandle_t handle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::RemoveAllItemKeyValueTags\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -956,7 +956,7 @@ bool RemoveAllItemKeyValueTags( UGCUpdateHandle_t handle )
|
|||||||
|
|
||||||
bool RemoveItemKeyValueTags( UGCUpdateHandle_t handle, const char *pchKey )
|
bool RemoveItemKeyValueTags( UGCUpdateHandle_t handle, const char *pchKey )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::RemoveItemKeyValueTags\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -966,7 +966,7 @@ bool RemoveItemKeyValueTags( UGCUpdateHandle_t handle, const char *pchKey )
|
|||||||
|
|
||||||
bool AddItemKeyValueTag( UGCUpdateHandle_t handle, const char *pchKey, const char *pchValue )
|
bool AddItemKeyValueTag( UGCUpdateHandle_t handle, const char *pchKey, const char *pchValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::AddItemKeyValueTag\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -976,7 +976,7 @@ bool AddItemKeyValueTag( UGCUpdateHandle_t handle, const char *pchKey, const cha
|
|||||||
|
|
||||||
bool AddItemPreviewFile( UGCUpdateHandle_t handle, const char *pszPreviewFile, EItemPreviewType type )
|
bool AddItemPreviewFile( UGCUpdateHandle_t handle, const char *pszPreviewFile, EItemPreviewType type )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::AddItemPreviewFile\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -986,7 +986,7 @@ bool AddItemPreviewFile( UGCUpdateHandle_t handle, const char *pszPreviewFile, E
|
|||||||
|
|
||||||
bool AddItemPreviewVideo( UGCUpdateHandle_t handle, const char *pszVideoID )
|
bool AddItemPreviewVideo( UGCUpdateHandle_t handle, const char *pszVideoID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::AddItemPreviewVideo\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -996,7 +996,7 @@ bool AddItemPreviewVideo( UGCUpdateHandle_t handle, const char *pszVideoID )
|
|||||||
|
|
||||||
bool UpdateItemPreviewFile( UGCUpdateHandle_t handle, uint32 index, const char *pszPreviewFile )
|
bool UpdateItemPreviewFile( UGCUpdateHandle_t handle, uint32 index, const char *pszPreviewFile )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::UpdateItemPreviewFile\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1006,7 +1006,7 @@ bool UpdateItemPreviewFile( UGCUpdateHandle_t handle, uint32 index, const char *
|
|||||||
|
|
||||||
bool UpdateItemPreviewVideo( UGCUpdateHandle_t handle, uint32 index, const char *pszVideoID )
|
bool UpdateItemPreviewVideo( UGCUpdateHandle_t handle, uint32 index, const char *pszVideoID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::UpdateItemPreviewVideo\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1016,7 +1016,7 @@ bool UpdateItemPreviewVideo( UGCUpdateHandle_t handle, uint32 index, const char
|
|||||||
|
|
||||||
bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index )
|
bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::RemoveItemPreview %llu %u\n", handle, index);
|
PRINT_DEBUG("%llu %u", handle, index);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1025,7 +1025,7 @@ bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index )
|
|||||||
|
|
||||||
bool AddContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid )
|
bool AddContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::AddContentDescriptor %llu %u\n", handle, descid);
|
PRINT_DEBUG("%llu %u", handle, descid);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1033,7 +1033,7 @@ bool AddContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID des
|
|||||||
|
|
||||||
bool RemoveContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid )
|
bool RemoveContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::RemoveContentDescriptor %llu %u\n", handle, descid);
|
PRINT_DEBUG("%llu %u", handle, descid);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1042,7 +1042,7 @@ bool RemoveContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID
|
|||||||
STEAM_CALL_RESULT( SubmitItemUpdateResult_t )
|
STEAM_CALL_RESULT( SubmitItemUpdateResult_t )
|
||||||
SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote )
|
SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SubmitItemUpdate\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
@ -1052,7 +1052,7 @@ SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChange
|
|||||||
|
|
||||||
EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal )
|
EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetItemUpdateProgress\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_EItemUpdateStatusInvalid;
|
return k_EItemUpdateStatusInvalid;
|
||||||
@ -1064,7 +1064,7 @@ EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBy
|
|||||||
STEAM_CALL_RESULT( SetUserItemVoteResult_t )
|
STEAM_CALL_RESULT( SetUserItemVoteResult_t )
|
||||||
SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp )
|
SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SetUserItemVote\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!settings->isModInstalled(nPublishedFileID)) return k_uAPICallInvalid; // TODO is this correct
|
if (!settings->isModInstalled(nPublishedFileID)) return k_uAPICallInvalid; // TODO is this correct
|
||||||
|
|
||||||
@ -1085,7 +1085,7 @@ SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp
|
|||||||
STEAM_CALL_RESULT( GetUserItemVoteResult_t )
|
STEAM_CALL_RESULT( GetUserItemVoteResult_t )
|
||||||
SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID )
|
SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetUserItemVote\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (nPublishedFileID == k_PublishedFileIdInvalid || !settings->isModInstalled(nPublishedFileID)) return k_uAPICallInvalid; // TODO is this correct
|
if (nPublishedFileID == k_PublishedFileIdInvalid || !settings->isModInstalled(nPublishedFileID)) return k_uAPICallInvalid; // TODO is this correct
|
||||||
|
|
||||||
@ -1103,7 +1103,7 @@ SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID )
|
|||||||
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
|
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
|
||||||
SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID )
|
SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::AddItemToFavorites %u %llu\n", nAppId, nPublishedFileID);
|
PRINT_DEBUG("%u %llu", nAppId, nPublishedFileID);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (nAppId == k_uAppIdInvalid || nAppId != settings->get_local_game_id().AppID()) return k_uAPICallInvalid; // TODO is this correct
|
if (nAppId == k_uAppIdInvalid || nAppId != settings->get_local_game_id().AppID()) return k_uAPICallInvalid; // TODO is this correct
|
||||||
if (nPublishedFileID == k_PublishedFileIdInvalid || !settings->isModInstalled(nPublishedFileID)) return k_uAPICallInvalid; // TODO is this correct
|
if (nPublishedFileID == k_PublishedFileIdInvalid || !settings->isModInstalled(nPublishedFileID)) return k_uAPICallInvalid; // TODO is this correct
|
||||||
@ -1128,7 +1128,7 @@ SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedF
|
|||||||
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
|
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
|
||||||
SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID )
|
SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::RemoveItemFromFavorites\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (nAppId == k_uAppIdInvalid || nAppId != settings->get_local_game_id().AppID()) return k_uAPICallInvalid; // TODO is this correct
|
if (nAppId == k_uAppIdInvalid || nAppId != settings->get_local_game_id().AppID()) return k_uAPICallInvalid; // TODO is this correct
|
||||||
if (nPublishedFileID == k_PublishedFileIdInvalid || !settings->isModInstalled(nPublishedFileID)) return k_uAPICallInvalid; // TODO is this correct
|
if (nPublishedFileID == k_PublishedFileIdInvalid || !settings->isModInstalled(nPublishedFileID)) return k_uAPICallInvalid; // TODO is this correct
|
||||||
@ -1153,7 +1153,7 @@ SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPubli
|
|||||||
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
|
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
|
||||||
SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID )
|
SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SubscribeItem %llu\n", nPublishedFileID);
|
PRINT_DEBUG("%llu", nPublishedFileID);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
RemoteStorageSubscribePublishedFileResult_t data;
|
RemoteStorageSubscribePublishedFileResult_t data;
|
||||||
@ -1171,7 +1171,7 @@ SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID )
|
|||||||
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
|
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
|
||||||
SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID )
|
SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::UnsubscribeItem %llu\n", nPublishedFileID);
|
PRINT_DEBUG("%llu", nPublishedFileID);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
RemoteStorageUnsubscribePublishedFileResult_t data;
|
RemoteStorageUnsubscribePublishedFileResult_t data;
|
||||||
@ -1189,17 +1189,17 @@ SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID )
|
|||||||
|
|
||||||
uint32 GetNumSubscribedItems()
|
uint32 GetNumSubscribedItems()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetNumSubscribedItems\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
PRINT_DEBUG(" Steam_UGC::GetNumSubscribedItems = %zu\n", ugc_bridge->subbed_mods_count());
|
PRINT_DEBUG(" Steam_UGC::GetNumSubscribedItems = %zu", ugc_bridge->subbed_mods_count());
|
||||||
return (uint32)ugc_bridge->subbed_mods_count();
|
return (uint32)ugc_bridge->subbed_mods_count();
|
||||||
}
|
}
|
||||||
// number of subscribed items
|
// number of subscribed items
|
||||||
|
|
||||||
uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries )
|
uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetSubscribedItems %p %u\n", pvecPublishedFileID, cMaxEntries);
|
PRINT_DEBUG("%p %u", pvecPublishedFileID, cMaxEntries);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if ((size_t)cMaxEntries > ugc_bridge->subbed_mods_count()) {
|
if ((size_t)cMaxEntries > ugc_bridge->subbed_mods_count()) {
|
||||||
cMaxEntries = (uint32)ugc_bridge->subbed_mods_count();
|
cMaxEntries = (uint32)ugc_bridge->subbed_mods_count();
|
||||||
@ -1213,19 +1213,19 @@ uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEn
|
|||||||
// get EItemState flags about item on this client
|
// get EItemState flags about item on this client
|
||||||
uint32 GetItemState( PublishedFileId_t nPublishedFileID )
|
uint32 GetItemState( PublishedFileId_t nPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetItemState %llu\n", nPublishedFileID);
|
PRINT_DEBUG("%llu", nPublishedFileID);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (ugc_bridge->has_subbed_mod(nPublishedFileID)) {
|
if (ugc_bridge->has_subbed_mod(nPublishedFileID)) {
|
||||||
if (settings->isModInstalled(nPublishedFileID)) {
|
if (settings->isModInstalled(nPublishedFileID)) {
|
||||||
PRINT_DEBUG(" mod is subscribed and installed\n");
|
PRINT_DEBUG(" mod is subscribed and installed");
|
||||||
return k_EItemStateInstalled | k_EItemStateSubscribed;
|
return k_EItemStateInstalled | k_EItemStateSubscribed;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG(" mod is subscribed\n");
|
PRINT_DEBUG(" mod is subscribed");
|
||||||
return k_EItemStateSubscribed;
|
return k_EItemStateSubscribed;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG(" mod isn't found\n");
|
PRINT_DEBUG(" mod isn't found");
|
||||||
return k_EItemStateNone;
|
return k_EItemStateNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1234,7 +1234,7 @@ uint32 GetItemState( PublishedFileId_t nPublishedFileID )
|
|||||||
// if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder)
|
// if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder)
|
||||||
bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, STEAM_OUT_STRING_COUNT( cchFolderSize ) char *pchFolder, uint32 cchFolderSize, uint32 *punTimeStamp )
|
bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, STEAM_OUT_STRING_COUNT( cchFolderSize ) char *pchFolder, uint32 cchFolderSize, uint32 *punTimeStamp )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetItemInstallInfo %llu %p %p [%u] %p\n", nPublishedFileID, punSizeOnDisk, pchFolder, cchFolderSize, punTimeStamp);
|
PRINT_DEBUG("%llu %p %p [%u] %p", nPublishedFileID, punSizeOnDisk, pchFolder, cchFolderSize, punTimeStamp);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!cchFolderSize) return false;
|
if (!cchFolderSize) return false;
|
||||||
if (!settings->isModInstalled(nPublishedFileID)) return false;
|
if (!settings->isModInstalled(nPublishedFileID)) return false;
|
||||||
@ -1243,7 +1243,7 @@ bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDi
|
|||||||
|
|
||||||
// I don't know if this is accurate behavior, but to avoid returning true with invalid data
|
// I don't know if this is accurate behavior, but to avoid returning true with invalid data
|
||||||
if ((cchFolderSize - 1) < mod.path.size()) { // -1 because the last char is reserved for null terminator
|
if ((cchFolderSize - 1) < mod.path.size()) { // -1 because the last char is reserved for null terminator
|
||||||
PRINT_DEBUG(" ERROR mod path: '%s' [%zu bytes] cannot fit into the given buffer\n", mod.path.c_str(), mod.path.size());
|
PRINT_DEBUG(" ERROR mod path: '%s' [%zu bytes] cannot fit into the given buffer", mod.path.c_str(), mod.path.size());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1253,7 +1253,7 @@ bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDi
|
|||||||
// human fall flat doesn't send a nulled buffer, and won't recognize the proper mod path because of that
|
// human fall flat doesn't send a nulled buffer, and won't recognize the proper mod path because of that
|
||||||
memset(pchFolder, 0, cchFolderSize);
|
memset(pchFolder, 0, cchFolderSize);
|
||||||
mod.path.copy(pchFolder, cchFolderSize - 1);
|
mod.path.copy(pchFolder, cchFolderSize - 1);
|
||||||
PRINT_DEBUG(" copied mod path: '%s'\n", pchFolder);
|
PRINT_DEBUG(" copied mod path: '%s'", pchFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1263,7 +1263,7 @@ bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDi
|
|||||||
// get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once
|
// get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once
|
||||||
bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDownloaded, uint64 *punBytesTotal )
|
bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDownloaded, uint64 *punBytesTotal )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetItemDownloadInfo %llu\n", nPublishedFileID);
|
PRINT_DEBUG("%llu", nPublishedFileID);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!settings->isModInstalled(nPublishedFileID)) return false;
|
if (!settings->isModInstalled(nPublishedFileID)) return false;
|
||||||
|
|
||||||
@ -1275,13 +1275,13 @@ bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDo
|
|||||||
|
|
||||||
bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, STEAM_OUT_STRING_COUNT( cchFolderSize ) char *pchFolder, uint32 cchFolderSize, bool *pbLegacyItem ) // returns true if item is installed
|
bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, STEAM_OUT_STRING_COUNT( cchFolderSize ) char *pchFolder, uint32 cchFolderSize, bool *pbLegacyItem ) // returns true if item is installed
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetItemInstallInfo old\n");
|
PRINT_DEBUG("old");
|
||||||
return GetItemInstallInfo(nPublishedFileID, punSizeOnDisk, pchFolder, cchFolderSize, (uint32*) nullptr);
|
return GetItemInstallInfo(nPublishedFileID, punSizeOnDisk, pchFolder, cchFolderSize, (uint32*) nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetItemUpdateInfo( PublishedFileId_t nPublishedFileID, bool *pbNeedsUpdate, bool *pbIsDownloading, uint64 *punBytesDownloaded, uint64 *punBytesTotal )
|
bool GetItemUpdateInfo( PublishedFileId_t nPublishedFileID, bool *pbNeedsUpdate, bool *pbIsDownloading, uint64 *punBytesDownloaded, uint64 *punBytesTotal )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetItemDownloadInfo old\n");
|
PRINT_DEBUG("old");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
bool res = GetItemDownloadInfo(nPublishedFileID, punBytesDownloaded, punBytesTotal);
|
bool res = GetItemDownloadInfo(nPublishedFileID, punBytesDownloaded, punBytesTotal);
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -1293,7 +1293,7 @@ bool GetItemUpdateInfo( PublishedFileId_t nPublishedFileID, bool *pbNeedsUpdate,
|
|||||||
|
|
||||||
bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, char *pchFolder, uint32 cchFolderSize ) // returns true if item is installed
|
bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, char *pchFolder, uint32 cchFolderSize ) // returns true if item is installed
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetItemInstallInfo older\n");
|
PRINT_DEBUG("older");
|
||||||
return GetItemInstallInfo(nPublishedFileID, punSizeOnDisk, pchFolder, cchFolderSize, (uint32*) nullptr);
|
return GetItemInstallInfo(nPublishedFileID, punSizeOnDisk, pchFolder, cchFolderSize, (uint32*) nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1303,7 +1303,7 @@ bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDi
|
|||||||
// If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.
|
// If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.
|
||||||
bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority )
|
bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::DownloadItem\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1314,7 +1314,7 @@ bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority )
|
|||||||
// This is helpful if you want to support multiple game servers running out of the same install folder
|
// This is helpful if you want to support multiple game servers running out of the same install folder
|
||||||
bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFolder )
|
bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFolder )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::BInitWorkshopForGameServer\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1324,7 +1324,7 @@ bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFol
|
|||||||
// SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends
|
// SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends
|
||||||
void SuspendDownloads( bool bSuspend )
|
void SuspendDownloads( bool bSuspend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::SuspendDownloads\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1334,7 +1334,7 @@ void SuspendDownloads( bool bSuspend )
|
|||||||
STEAM_CALL_RESULT( StartPlaytimeTrackingResult_t )
|
STEAM_CALL_RESULT( StartPlaytimeTrackingResult_t )
|
||||||
SteamAPICall_t StartPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs )
|
SteamAPICall_t StartPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::StartPlaytimeTracking\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
StopPlaytimeTrackingResult_t data;
|
StopPlaytimeTrackingResult_t data;
|
||||||
data.m_eResult = k_EResultOK;
|
data.m_eResult = k_EResultOK;
|
||||||
@ -1344,7 +1344,7 @@ SteamAPICall_t StartPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, ui
|
|||||||
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
|
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
|
||||||
SteamAPICall_t StopPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs )
|
SteamAPICall_t StopPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::StopPlaytimeTracking\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
StopPlaytimeTrackingResult_t data;
|
StopPlaytimeTrackingResult_t data;
|
||||||
data.m_eResult = k_EResultOK;
|
data.m_eResult = k_EResultOK;
|
||||||
@ -1354,7 +1354,7 @@ SteamAPICall_t StopPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uin
|
|||||||
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
|
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
|
||||||
SteamAPICall_t StopPlaytimeTrackingForAllItems()
|
SteamAPICall_t StopPlaytimeTrackingForAllItems()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::StopPlaytimeTrackingForAllItems\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
StopPlaytimeTrackingResult_t data;
|
StopPlaytimeTrackingResult_t data;
|
||||||
data.m_eResult = k_EResultOK;
|
data.m_eResult = k_EResultOK;
|
||||||
@ -1366,7 +1366,7 @@ SteamAPICall_t StopPlaytimeTrackingForAllItems()
|
|||||||
STEAM_CALL_RESULT( AddUGCDependencyResult_t )
|
STEAM_CALL_RESULT( AddUGCDependencyResult_t )
|
||||||
SteamAPICall_t AddDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID )
|
SteamAPICall_t AddDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::AddDependency\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (nParentPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
if (nParentPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
||||||
@ -1377,7 +1377,7 @@ SteamAPICall_t AddDependency( PublishedFileId_t nParentPublishedFileID, Publishe
|
|||||||
STEAM_CALL_RESULT( RemoveUGCDependencyResult_t )
|
STEAM_CALL_RESULT( RemoveUGCDependencyResult_t )
|
||||||
SteamAPICall_t RemoveDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID )
|
SteamAPICall_t RemoveDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::RemoveDependency\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (nParentPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
if (nParentPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
||||||
@ -1390,7 +1390,7 @@ SteamAPICall_t RemoveDependency( PublishedFileId_t nParentPublishedFileID, Publi
|
|||||||
STEAM_CALL_RESULT( AddAppDependencyResult_t )
|
STEAM_CALL_RESULT( AddAppDependencyResult_t )
|
||||||
SteamAPICall_t AddAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID )
|
SteamAPICall_t AddAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::AddAppDependency\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (nPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
if (nPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
||||||
@ -1401,7 +1401,7 @@ SteamAPICall_t AddAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAp
|
|||||||
STEAM_CALL_RESULT( RemoveAppDependencyResult_t )
|
STEAM_CALL_RESULT( RemoveAppDependencyResult_t )
|
||||||
SteamAPICall_t RemoveAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID )
|
SteamAPICall_t RemoveAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::RemoveAppDependency\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (nPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
if (nPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
||||||
@ -1414,7 +1414,7 @@ SteamAPICall_t RemoveAppDependency( PublishedFileId_t nPublishedFileID, AppId_t
|
|||||||
STEAM_CALL_RESULT( GetAppDependenciesResult_t )
|
STEAM_CALL_RESULT( GetAppDependenciesResult_t )
|
||||||
SteamAPICall_t GetAppDependencies( PublishedFileId_t nPublishedFileID )
|
SteamAPICall_t GetAppDependencies( PublishedFileId_t nPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::GetAppDependencies\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (nPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
if (nPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
||||||
@ -1427,7 +1427,7 @@ SteamAPICall_t GetAppDependencies( PublishedFileId_t nPublishedFileID )
|
|||||||
STEAM_CALL_RESULT( DeleteItemResult_t )
|
STEAM_CALL_RESULT( DeleteItemResult_t )
|
||||||
SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID )
|
SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_UGC::DeleteItem\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (nPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
if (nPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid;
|
||||||
@ -1438,7 +1438,7 @@ SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID )
|
|||||||
// Show the app's latest Workshop EULA to the user in an overlay window, where they can accept it or not
|
// Show the app's latest Workshop EULA to the user in an overlay window, where they can accept it or not
|
||||||
bool ShowWorkshopEULA()
|
bool ShowWorkshopEULA()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("ShowWorkshopEULA\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1448,7 +1448,7 @@ bool ShowWorkshopEULA()
|
|||||||
STEAM_CALL_RESULT( WorkshopEULAStatus_t )
|
STEAM_CALL_RESULT( WorkshopEULAStatus_t )
|
||||||
SteamAPICall_t GetWorkshopEULAStatus()
|
SteamAPICall_t GetWorkshopEULAStatus()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("GetWorkshopEULAStatus\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return k_uAPICallInvalid;
|
return k_uAPICallInvalid;
|
||||||
@ -1457,7 +1457,7 @@ SteamAPICall_t GetWorkshopEULAStatus()
|
|||||||
// Return the user's community content descriptor preferences
|
// Return the user's community content descriptor preferences
|
||||||
uint32 GetUserContentDescriptorPreferences( EUGCContentDescriptorID *pvecDescriptors, uint32 cMaxEntries )
|
uint32 GetUserContentDescriptorPreferences( EUGCContentDescriptorID *pvecDescriptors, uint32 cMaxEntries )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("GetWorkshopEULAStatus\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -29,7 +29,7 @@ public ISteamUnifiedMessages
|
|||||||
public:
|
public:
|
||||||
static void steam_callback(void *object, Common_Message *msg)
|
static void steam_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_steamunifiedmessages_callback\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Unified_Messages *steam_steamunifiedmessages = (Steam_Unified_Messages *)object;
|
Steam_Unified_Messages *steam_steamunifiedmessages = (Steam_Unified_Messages *)object;
|
||||||
steam_steamunifiedmessages->Callback(msg);
|
steam_steamunifiedmessages->Callback(msg);
|
||||||
@ -37,7 +37,7 @@ static void steam_callback(void *object, Common_Message *msg)
|
|||||||
|
|
||||||
static void steam_run_every_runcb(void *object)
|
static void steam_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("steam_steamunifiedmessages_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
Steam_Unified_Messages *steam_steamunifiedmessages = (Steam_Unified_Messages *)object;
|
Steam_Unified_Messages *steam_steamunifiedmessages = (Steam_Unified_Messages *)object;
|
||||||
steam_steamunifiedmessages->RunCallbacks();
|
steam_steamunifiedmessages->RunCallbacks();
|
||||||
@ -65,7 +65,8 @@ Steam_Unified_Messages(class Settings *settings, class Networking *network, clas
|
|||||||
// Returns a unified message handle (k_InvalidUnifiedMessageHandle if could not send the message).
|
// Returns a unified message handle (k_InvalidUnifiedMessageHandle if could not send the message).
|
||||||
ClientUnifiedMessageHandle SendMethod( const char *pchServiceMethod, const void *pRequestBuffer, uint32 unRequestBufferSize, uint64 unContext )
|
ClientUnifiedMessageHandle SendMethod( const char *pchServiceMethod, const void *pRequestBuffer, uint32 unRequestBufferSize, uint64 unContext )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Unified_Messages::SendMethod\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return ISteamUnifiedMessages::k_InvalidUnifiedMessageHandle;
|
return ISteamUnifiedMessages::k_InvalidUnifiedMessageHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +74,8 @@ ClientUnifiedMessageHandle SendMethod( const char *pchServiceMethod, const void
|
|||||||
// Gets the size of the response and the EResult. Returns false if the response is not ready yet.
|
// Gets the size of the response and the EResult. Returns false if the response is not ready yet.
|
||||||
bool GetMethodResponseInfo( ClientUnifiedMessageHandle hHandle, uint32 *punResponseSize, EResult *peResult )
|
bool GetMethodResponseInfo( ClientUnifiedMessageHandle hHandle, uint32 *punResponseSize, EResult *peResult )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Unified_Messages::GetMethodResponseInfo\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +83,8 @@ bool GetMethodResponseInfo( ClientUnifiedMessageHandle hHandle, uint32 *punRespo
|
|||||||
// Gets a response in binary serialized form (and optionally release the corresponding allocated memory).
|
// Gets a response in binary serialized form (and optionally release the corresponding allocated memory).
|
||||||
bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle, void *pResponseBuffer, uint32 unResponseBufferSize, bool bAutoRelease )
|
bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle, void *pResponseBuffer, uint32 unResponseBufferSize, bool bAutoRelease )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Unified_Messages::GetMethodResponseData\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +92,8 @@ bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle, void *pResponseB
|
|||||||
// Releases the message and its corresponding allocated memory.
|
// Releases the message and its corresponding allocated memory.
|
||||||
bool ReleaseMethod( ClientUnifiedMessageHandle hHandle )
|
bool ReleaseMethod( ClientUnifiedMessageHandle hHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Unified_Messages::ReleaseMethod\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +102,8 @@ bool ReleaseMethod( ClientUnifiedMessageHandle hHandle )
|
|||||||
// Returns true if the notification was sent successfully.
|
// Returns true if the notification was sent successfully.
|
||||||
bool SendNotification( const char *pchServiceNotification, const void *pNotificationBuffer, uint32 unNotificationBufferSize )
|
bool SendNotification( const char *pchServiceNotification, const void *pNotificationBuffer, uint32 unNotificationBufferSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Unified_Messages::SendNotification\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ Steam_User(Settings *settings, Local_Storage *local_storage, class Networking *n
|
|||||||
// this is only used internally by the API, and by a few select interfaces that support multi-user
|
// this is only used internally by the API, and by a few select interfaces that support multi-user
|
||||||
HSteamUser GetHSteamUser()
|
HSteamUser GetHSteamUser()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetHSteamUser\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return CLIENT_HSTEAMUSER;
|
return CLIENT_HSTEAMUSER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ HSteamUser GetHSteamUser()
|
|||||||
// The Steam client will automatically be trying to recreate the connection as often as possible.
|
// The Steam client will automatically be trying to recreate the connection as often as possible.
|
||||||
bool BLoggedOn()
|
bool BLoggedOn()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::BLoggedOn\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return !settings->is_offline();
|
return !settings->is_offline();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ bool BLoggedOn()
|
|||||||
// a CSteamID is a unique identifier for an account, and used to differentiate users in all parts of the Steamworks API
|
// a CSteamID is a unique identifier for an account, and used to differentiate users in all parts of the Steamworks API
|
||||||
CSteamID GetSteamID()
|
CSteamID GetSteamID()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetSteamID\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
CSteamID id = settings->get_local_steam_id();
|
CSteamID id = settings->get_local_steam_id();
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
@ -112,7 +112,7 @@ CSteamID GetSteamID()
|
|||||||
|
|
||||||
int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure )
|
int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::InitiateGameConnection %i %llu %u %u %u %p\n", cbMaxAuthBlob, steamIDGameServer.ConvertToUint64(), unIPServer, usPortServer, bSecure, pAuthBlob);
|
PRINT_DEBUG("%i %llu %u %u %u %p", cbMaxAuthBlob, steamIDGameServer.ConvertToUint64(), unIPServer, usPortServer, bSecure, pAuthBlob);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (cbMaxAuthBlob < INITIATE_GAME_CONNECTION_TICKET_SIZE) return 0;
|
if (cbMaxAuthBlob < INITIATE_GAME_CONNECTION_TICKET_SIZE) return 0;
|
||||||
if (!pAuthBlob) return 0;
|
if (!pAuthBlob) return 0;
|
||||||
@ -123,7 +123,7 @@ int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamID
|
|||||||
|
|
||||||
int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, CGameID gameID, uint32 unIPServer, uint16 usPortServer, bool bSecure )
|
int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, CGameID gameID, uint32 unIPServer, uint16 usPortServer, bool bSecure )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("InitiateGameConnection old\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return InitiateGameConnection(pAuthBlob, cbMaxAuthBlob, steamIDGameServer, unIPServer, usPortServer, bSecure);
|
return InitiateGameConnection(pAuthBlob, cbMaxAuthBlob, steamIDGameServer, unIPServer, usPortServer, bSecure);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamID
|
|||||||
// needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection() call
|
// needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection() call
|
||||||
void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer )
|
void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::TerminateGameConnection\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Legacy functions
|
// Legacy functions
|
||||||
@ -139,19 +139,19 @@ void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer )
|
|||||||
// used by only a few games to track usage events
|
// used by only a few games to track usage events
|
||||||
void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo)
|
void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::TrackAppUsageEvent\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshSteam2Login()
|
void RefreshSteam2Login()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("RefreshSteam2Login\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the local storage folder for current Steam account to write application data, e.g. save games, configs etc.
|
// get the local storage folder for current Steam account to write application data, e.g. save games, configs etc.
|
||||||
// this will usually be something like "C:\Progam Files\Steam\userdata\<SteamID>\<AppID>\local"
|
// this will usually be something like "C:\Progam Files\Steam\userdata\<SteamID>\<AppID>\local"
|
||||||
bool GetUserDataFolder( char *pchBuffer, int cubBuffer )
|
bool GetUserDataFolder( char *pchBuffer, int cubBuffer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetUserDataFolder\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (!cubBuffer) return false;
|
if (!cubBuffer) return false;
|
||||||
|
|
||||||
std::string user_data = local_storage->get_path(Local_Storage::user_data_storage);
|
std::string user_data = local_storage->get_path(Local_Storage::user_data_storage);
|
||||||
@ -163,7 +163,7 @@ bool GetUserDataFolder( char *pchBuffer, int cubBuffer )
|
|||||||
// Starts voice recording. Once started, use GetVoice() to get the data
|
// Starts voice recording. Once started, use GetVoice() to get the data
|
||||||
void StartVoiceRecording( )
|
void StartVoiceRecording( )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::StartVoiceRecording\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
last_get_voice = std::chrono::high_resolution_clock::now();
|
last_get_voice = std::chrono::high_resolution_clock::now();
|
||||||
recording = true;
|
recording = true;
|
||||||
//TODO:fix
|
//TODO:fix
|
||||||
@ -175,7 +175,7 @@ void StartVoiceRecording( )
|
|||||||
// k_eVoiceResultNotRecording
|
// k_eVoiceResultNotRecording
|
||||||
void StopVoiceRecording( )
|
void StopVoiceRecording( )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::StopVoiceRecording\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
recording = false;
|
recording = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ void StopVoiceRecording( )
|
|||||||
// below for further explanation of "uncompressed" data.
|
// below for further explanation of "uncompressed" data.
|
||||||
EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed_Deprecated, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated )
|
EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed_Deprecated, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetAvailableVoice\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (pcbCompressed) *pcbCompressed = 0;
|
if (pcbCompressed) *pcbCompressed = 0;
|
||||||
if (pcbUncompressed_Deprecated) *pcbUncompressed_Deprecated = 0;
|
if (pcbUncompressed_Deprecated) *pcbUncompressed_Deprecated = 0;
|
||||||
if (!recording) return k_EVoiceResultNotRecording;
|
if (!recording) return k_EVoiceResultNotRecording;
|
||||||
@ -198,7 +198,7 @@ EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed_D
|
|||||||
|
|
||||||
EVoiceResult GetAvailableVoice(uint32 *pcbCompressed, uint32 *pcbUncompressed)
|
EVoiceResult GetAvailableVoice(uint32 *pcbCompressed, uint32 *pcbUncompressed)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("GetAvailableVoice old\n");
|
PRINT_DEBUG("old");
|
||||||
return GetAvailableVoice(pcbCompressed, pcbUncompressed, 11025);
|
return GetAvailableVoice(pcbCompressed, pcbUncompressed, 11025);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ EVoiceResult GetAvailableVoice(uint32 *pcbCompressed, uint32 *pcbUncompressed)
|
|||||||
// using the DecompressVoice function below.
|
// using the DecompressVoice function below.
|
||||||
EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed_Deprecated, void *pUncompressedDestBuffer_Deprecated , uint32 cbUncompressedDestBufferSize_Deprecated , uint32 *nUncompressBytesWritten_Deprecated , uint32 nUncompressedVoiceDesiredSampleRate_Deprecated )
|
EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed_Deprecated, void *pUncompressedDestBuffer_Deprecated , uint32 cbUncompressedDestBufferSize_Deprecated , uint32 *nUncompressBytesWritten_Deprecated , uint32 nUncompressedVoiceDesiredSampleRate_Deprecated )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetVoice\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (!recording) return k_EVoiceResultNotRecording;
|
if (!recording) return k_EVoiceResultNotRecording;
|
||||||
double seconds = std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::high_resolution_clock::now() - last_get_voice).count();
|
double seconds = std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::high_resolution_clock::now() - last_get_voice).count();
|
||||||
if (bWantCompressed) {
|
if (bWantCompressed) {
|
||||||
@ -236,7 +236,7 @@ EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBuf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bWantUncompressed_Deprecated) {
|
if (bWantUncompressed_Deprecated) {
|
||||||
PRINT_DEBUG("Steam_User::GetVoice Wanted Uncompressed\n");
|
PRINT_DEBUG("Wanted Uncompressed");
|
||||||
}
|
}
|
||||||
|
|
||||||
last_get_voice = std::chrono::high_resolution_clock::now();
|
last_get_voice = std::chrono::high_resolution_clock::now();
|
||||||
@ -245,13 +245,13 @@ EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBuf
|
|||||||
|
|
||||||
EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed, void *pUncompressedDestBuffer, uint32 cbUncompressedDestBufferSize, uint32 *nUncompressBytesWritten )
|
EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed, void *pUncompressedDestBuffer, uint32 cbUncompressedDestBufferSize, uint32 *nUncompressBytesWritten )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("GetVoice old\n");
|
PRINT_DEBUG("old");
|
||||||
return GetVoice(bWantCompressed, pDestBuffer, cbDestBufferSize, nBytesWritten, bWantUncompressed, pUncompressedDestBuffer, cbUncompressedDestBufferSize, nUncompressBytesWritten, 11025);
|
return GetVoice(bWantCompressed, pDestBuffer, cbDestBufferSize, nBytesWritten, bWantUncompressed, pUncompressedDestBuffer, cbUncompressedDestBufferSize, nUncompressBytesWritten, 11025);
|
||||||
}
|
}
|
||||||
|
|
||||||
EVoiceResult GetCompressedVoice( void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten )
|
EVoiceResult GetCompressedVoice( void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("GetCompressedVoice\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return GetVoice(true, pDestBuffer, cbDestBufferSize, nBytesWritten, false, NULL, 0, NULL);
|
return GetVoice(true, pDestBuffer, cbDestBufferSize, nBytesWritten, false, NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ EVoiceResult GetCompressedVoice( void *pDestBuffer, uint32 cbDestBufferSize, uin
|
|||||||
// It is suggested to start with a 20kb buffer and reallocate as necessary.
|
// It is suggested to start with a 20kb buffer and reallocate as necessary.
|
||||||
EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, uint32 nDesiredSampleRate )
|
EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, uint32 nDesiredSampleRate )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::DecompressVoice\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (!recording) return k_EVoiceResultNotRecording;
|
if (!recording) return k_EVoiceResultNotRecording;
|
||||||
uint32 uncompressed = (double)cbCompressed * ((double)nDesiredSampleRate / 8192.0);
|
uint32 uncompressed = (double)cbCompressed * ((double)nDesiredSampleRate / 8192.0);
|
||||||
if(nBytesWritten) *nBytesWritten = uncompressed;
|
if(nBytesWritten) *nBytesWritten = uncompressed;
|
||||||
@ -275,13 +275,13 @@ EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void
|
|||||||
|
|
||||||
EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten )
|
EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("DecompressVoice old\n");
|
PRINT_DEBUG("old");
|
||||||
return DecompressVoice(pCompressed, cbCompressed, pDestBuffer, cbDestBufferSize, nBytesWritten, 11025);
|
return DecompressVoice(pCompressed, cbCompressed, pDestBuffer, cbDestBufferSize, nBytesWritten, 11025);
|
||||||
}
|
}
|
||||||
|
|
||||||
EVoiceResult DecompressVoice( void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten )
|
EVoiceResult DecompressVoice( void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("DecompressVoice older\n");
|
PRINT_DEBUG("older");
|
||||||
return DecompressVoice(pCompressed, cbCompressed, pDestBuffer, cbDestBufferSize, nBytesWritten, 11025);
|
return DecompressVoice(pCompressed, cbCompressed, pDestBuffer, cbDestBufferSize, nBytesWritten, 11025);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ EVoiceResult DecompressVoice( void *pCompressed, uint32 cbCompressed, void *pDes
|
|||||||
// which is usually 48000 or 44100.
|
// which is usually 48000 or 44100.
|
||||||
uint32 GetVoiceOptimalSampleRate()
|
uint32 GetVoiceOptimalSampleRate()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetVoiceOptimalSampleRate\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return 48000;
|
return 48000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTic
|
|||||||
// if a Steam ID is passed Steam will only allow the ticket to be used by that Steam ID
|
// if a Steam ID is passed Steam will only allow the ticket to be used by that Steam ID
|
||||||
HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket, const SteamNetworkingIdentity *pSteamNetworkingIdentity )
|
HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket, const SteamNetworkingIdentity *pSteamNetworkingIdentity )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetAuthSessionTicket %i\n", cbMaxTicket);
|
PRINT_DEBUG("%i", cbMaxTicket);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pTicket) return k_HAuthTicketInvalid;
|
if (!pTicket) return k_HAuthTicketInvalid;
|
||||||
@ -322,7 +322,7 @@ HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTic
|
|||||||
// the ticket will be returned in callback GetTicketForWebApiResponse_t
|
// the ticket will be returned in callback GetTicketForWebApiResponse_t
|
||||||
HAuthTicket GetAuthTicketForWebApi( const char *pchIdentity )
|
HAuthTicket GetAuthTicketForWebApi( const char *pchIdentity )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetAuthTicketForWebApi %s\n", pchIdentity);
|
PRINT_DEBUG("%s", pchIdentity);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return auth_manager->getWebApiTicket(pchIdentity);
|
return auth_manager->getWebApiTicket(pchIdentity);
|
||||||
@ -332,7 +332,7 @@ HAuthTicket GetAuthTicketForWebApi( const char *pchIdentity )
|
|||||||
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
|
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
|
||||||
EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID )
|
EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::BeginAuthSession %i %llu\n", cbAuthTicket, steamID.ConvertToUint64());
|
PRINT_DEBUG("%i %llu", cbAuthTicket, steamID.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return auth_manager->beginAuth(pAuthTicket, cbAuthTicket, steamID);
|
return auth_manager->beginAuth(pAuthTicket, cbAuthTicket, steamID);
|
||||||
@ -341,7 +341,7 @@ EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTic
|
|||||||
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
|
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
|
||||||
void EndAuthSession( CSteamID steamID )
|
void EndAuthSession( CSteamID steamID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::EndAuthSession\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auth_manager->endAuth(steamID);
|
auth_manager->endAuth(steamID);
|
||||||
@ -350,7 +350,7 @@ void EndAuthSession( CSteamID steamID )
|
|||||||
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
|
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
|
||||||
void CancelAuthTicket( HAuthTicket hAuthTicket )
|
void CancelAuthTicket( HAuthTicket hAuthTicket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::CancelAuthTicket\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auth_manager->cancelTicket(hAuthTicket);
|
auth_manager->cancelTicket(hAuthTicket);
|
||||||
@ -360,7 +360,7 @@ void CancelAuthTicket( HAuthTicket hAuthTicket )
|
|||||||
// to determine if the user owns downloadable content specified by the provided AppID.
|
// to determine if the user owns downloadable content specified by the provided AppID.
|
||||||
EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID )
|
EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::UserHasLicenseForApp\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return k_EUserHasLicenseResultHasLicense;
|
return k_EUserHasLicenseResultHasLicense;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appI
|
|||||||
// (i.e a SteamServersConnected_t has been issued) and may not catch all forms of NAT.
|
// (i.e a SteamServersConnected_t has been issued) and may not catch all forms of NAT.
|
||||||
bool BIsBehindNAT()
|
bool BIsBehindNAT()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::BIsBehindNAT\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ bool BIsBehindNAT()
|
|||||||
// uint32 unIPServer, uint16 usPortServer - the IP address of the game server
|
// uint32 unIPServer, uint16 usPortServer - the IP address of the game server
|
||||||
void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer )
|
void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::AdvertiseGame\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Gameserver *server = new Gameserver();
|
Gameserver *server = new Gameserver();
|
||||||
server->set_id(steamIDGameServer.ConvertToUint64());
|
server->set_id(steamIDGameServer.ConvertToUint64());
|
||||||
@ -403,7 +403,7 @@ void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPort
|
|||||||
STEAM_CALL_RESULT( EncryptedAppTicketResponse_t )
|
STEAM_CALL_RESULT( EncryptedAppTicketResponse_t )
|
||||||
SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude )
|
SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::RequestEncryptedAppTicket %i\n", cbDataToInclude);
|
PRINT_DEBUG("%i", cbDataToInclude);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
EncryptedAppTicketResponse_t data;
|
EncryptedAppTicketResponse_t data;
|
||||||
data.m_eResult = k_EResultOK;
|
data.m_eResult = k_EResultOK;
|
||||||
@ -452,7 +452,7 @@ SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToIncl
|
|||||||
// retrieve a finished ticket
|
// retrieve a finished ticket
|
||||||
bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket )
|
bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetEncryptedAppTicket %i\n", cbMaxTicket);
|
PRINT_DEBUG("%i", cbMaxTicket);
|
||||||
unsigned int ticket_size = encrypted_app_ticket.size();
|
unsigned int ticket_size = encrypted_app_ticket.size();
|
||||||
if (!cbMaxTicket) {
|
if (!cbMaxTicket) {
|
||||||
if (!pcbTicket) return false;
|
if (!pcbTicket) return false;
|
||||||
@ -473,14 +473,14 @@ bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket )
|
|||||||
// the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1)
|
// the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1)
|
||||||
int GetGameBadgeLevel( int nSeries, bool bFoil )
|
int GetGameBadgeLevel( int nSeries, bool bFoil )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetGameBadgeLevel\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets the Steam Level of the user, as shown on their profile
|
// gets the Steam Level of the user, as shown on their profile
|
||||||
int GetPlayerSteamLevel()
|
int GetPlayerSteamLevel()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetPlayerSteamLevel\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,42 +497,42 @@ int GetPlayerSteamLevel()
|
|||||||
STEAM_CALL_RESULT( StoreAuthURLResponse_t )
|
STEAM_CALL_RESULT( StoreAuthURLResponse_t )
|
||||||
SteamAPICall_t RequestStoreAuthURL( const char *pchRedirectURL )
|
SteamAPICall_t RequestStoreAuthURL( const char *pchRedirectURL )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::RequestStoreAuthURL\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets whether the users phone number is verified
|
// gets whether the users phone number is verified
|
||||||
bool BIsPhoneVerified()
|
bool BIsPhoneVerified()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::BIsPhoneVerified\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets whether the user has two factor enabled on their account
|
// gets whether the user has two factor enabled on their account
|
||||||
bool BIsTwoFactorEnabled()
|
bool BIsTwoFactorEnabled()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::BIsTwoFactorEnabled\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets whether the users phone number is identifying
|
// gets whether the users phone number is identifying
|
||||||
bool BIsPhoneIdentifying()
|
bool BIsPhoneIdentifying()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::BIsPhoneIdentifying\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets whether the users phone number is awaiting (re)verification
|
// gets whether the users phone number is awaiting (re)verification
|
||||||
bool BIsPhoneRequiringVerification()
|
bool BIsPhoneRequiringVerification()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::BIsPhoneRequiringVerification\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
STEAM_CALL_RESULT( MarketEligibilityResponse_t )
|
STEAM_CALL_RESULT( MarketEligibilityResponse_t )
|
||||||
SteamAPICall_t GetMarketEligibility()
|
SteamAPICall_t GetMarketEligibility()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetMarketEligibility\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ SteamAPICall_t GetMarketEligibility()
|
|||||||
STEAM_CALL_RESULT( DurationControl_t )
|
STEAM_CALL_RESULT( DurationControl_t )
|
||||||
SteamAPICall_t GetDurationControl()
|
SteamAPICall_t GetDurationControl()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::GetDurationControl\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ SteamAPICall_t GetDurationControl()
|
|||||||
// playtime limits.
|
// playtime limits.
|
||||||
bool BSetDurationControlOnlineState( EDurationControlOnlineState eNewState )
|
bool BSetDurationControlOnlineState( EDurationControlOnlineState eNewState )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User::BSetDurationControlOnlineState\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -734,7 +734,7 @@ bool Local_Storage::update_save_filenames(std::string folder)
|
|||||||
|
|
||||||
for (auto &f : files) {
|
for (auto &f : files) {
|
||||||
std::string path = f.name;
|
std::string path = f.name;
|
||||||
PRINT_DEBUG("Local_Storage:: remote file %s\n", path.c_str());
|
PRINT_DEBUG("remote file '%s'", path.c_str());
|
||||||
std::string to = sanitize_file_name(desanitize_file_name(path));
|
std::string to = sanitize_file_name(desanitize_file_name(path));
|
||||||
if (path != to && !file_exists(folder, to)) {
|
if (path != to && !file_exists(folder, to)) {
|
||||||
//create the folder
|
//create the folder
|
||||||
@ -743,9 +743,9 @@ bool Local_Storage::update_save_filenames(std::string folder)
|
|||||||
|
|
||||||
std::string from = (save_directory + appid + folder + PATH_SEPARATOR + path);
|
std::string from = (save_directory + appid + folder + PATH_SEPARATOR + path);
|
||||||
to = (save_directory + appid + folder + PATH_SEPARATOR + to);
|
to = (save_directory + appid + folder + PATH_SEPARATOR + to);
|
||||||
PRINT_DEBUG("Local_Storage::update_save_filenames renaming %s to %s\n", from.c_str(), to.c_str());
|
PRINT_DEBUG("renaming '%s' to '%s'", from.c_str(), to.c_str());
|
||||||
if (std::rename(from.c_str(), to.c_str()) < 0) {
|
if (std::rename(from.c_str(), to.c_str()) < 0) {
|
||||||
PRINT_DEBUG("ERROR RENAMING\n");
|
PRINT_DEBUG("ERROR RENAMING");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -757,8 +757,7 @@ bool Local_Storage::load_json(std::string full_path, nlohmann::json& json)
|
|||||||
{
|
{
|
||||||
std::ifstream inventory_file(utf8_decode(full_path));
|
std::ifstream inventory_file(utf8_decode(full_path));
|
||||||
// If there is a file and we opened it
|
// If there is a file and we opened it
|
||||||
if (inventory_file)
|
if (inventory_file) {
|
||||||
{
|
|
||||||
inventory_file.seekg(0, std::ios::end);
|
inventory_file.seekg(0, std::ios::end);
|
||||||
size_t size = inventory_file.tellg();
|
size_t size = inventory_file.tellg();
|
||||||
std::string buffer(size, '\0');
|
std::string buffer(size, '\0');
|
||||||
@ -770,15 +769,13 @@ bool Local_Storage::load_json(std::string full_path, nlohmann::json& json)
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
json = std::move(nlohmann::json::parse(buffer));
|
json = std::move(nlohmann::json::parse(buffer));
|
||||||
PRINT_DEBUG("Loaded json \"%s\". Loaded %zu items.\n", full_path.c_str(), json.size());
|
PRINT_DEBUG("Loaded json '%s' (%zu items)", full_path.c_str(), json.size());
|
||||||
return true;
|
return true;
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
PRINT_DEBUG("Error while parsing \"%s\" json: %s\n", full_path.c_str(), e.what());
|
PRINT_DEBUG("Error while parsing '%s' json error: %s", full_path.c_str(), e.what());
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
PRINT_DEBUG("Couldn't open file '%s' to read json", full_path.c_str());
|
||||||
{
|
|
||||||
PRINT_DEBUG("Couldn't open file \"%s\" to read json\n", full_path.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_LastError();
|
reset_LastError();
|
||||||
@ -807,13 +804,12 @@ bool Local_Storage::write_json_file(std::string folder, std::string const&file,
|
|||||||
create_directory(inv_path);
|
create_directory(inv_path);
|
||||||
|
|
||||||
std::ofstream inventory_file(utf8_decode(full_path), std::ios::trunc | std::ios::out);
|
std::ofstream inventory_file(utf8_decode(full_path), std::ios::trunc | std::ios::out);
|
||||||
if (inventory_file)
|
if (inventory_file) {
|
||||||
{
|
|
||||||
inventory_file << std::setw(2) << json;
|
inventory_file << std::setw(2) << json;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Couldn't open file \"%s\" to write json\n", full_path.c_str());
|
PRINT_DEBUG("Couldn't open file '%s' to write json", full_path.c_str());
|
||||||
|
|
||||||
reset_LastError();
|
reset_LastError();
|
||||||
return false;
|
return false;
|
||||||
@ -845,7 +841,7 @@ std::string Local_Storage::load_image_resized(std::string const& image_path, std
|
|||||||
int width = 0;
|
int width = 0;
|
||||||
int height = 0;
|
int height = 0;
|
||||||
unsigned char *img = stbi_load(image_path.c_str(), &width, &height, nullptr, 4);
|
unsigned char *img = stbi_load(image_path.c_str(), &width, &height, nullptr, 4);
|
||||||
PRINT_DEBUG("Local_Storage::load_image_resized: stbi_load %s '%s'\n", (img == nullptr ? stbi_failure_reason() : "loaded"), image_path.c_str());
|
PRINT_DEBUG("stbi_load('%s') -> %s", image_path.c_str(), (img == nullptr ? stbi_failure_reason() : "loaded"));
|
||||||
if (img != nullptr) {
|
if (img != nullptr) {
|
||||||
std::vector<char> out_resized(resized_img_size);
|
std::vector<char> out_resized(resized_img_size);
|
||||||
stbir_resize_uint8(img, width, height, 0, (unsigned char*)&out_resized[0], resolution, resolution, 0, 4);
|
stbir_resize_uint8(img, width, height, 0, (unsigned char*)&out_resized[0], resolution, resolution, 0, 4);
|
||||||
|
168
dll/network.cpp
168
dll/network.cpp
@ -251,7 +251,7 @@ static void run_at_startup()
|
|||||||
#if defined(STEAM_WIN32)
|
#if defined(STEAM_WIN32)
|
||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != NO_ERROR) {
|
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != NO_ERROR) {
|
||||||
PRINT_DEBUG("Networking WSAStartup error\n");
|
PRINT_DEBUG("Networking WSAStartup error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ static void reset_last_error()
|
|||||||
|
|
||||||
static int send_packet_to(sock_t sock, IP_PORT ip_port, char *data, unsigned long length)
|
static int send_packet_to(sock_t sock, IP_PORT ip_port, char *data, unsigned long length)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("send: %lu %hhu.%hhu.%hhu.%hhu:%hu\n\n", length, ((unsigned char *)&ip_port.ip)[0], ((unsigned char *)&ip_port.ip)[1], ((unsigned char *)&ip_port.ip)[2], ((unsigned char *)&ip_port.ip)[3], htons(ip_port.port));
|
PRINT_DEBUG("send: %lu %hhu.%hhu.%hhu.%hhu:%hu", length, ((unsigned char *)&ip_port.ip)[0], ((unsigned char *)&ip_port.ip)[1], ((unsigned char *)&ip_port.ip)[2], ((unsigned char *)&ip_port.ip)[3], htons(ip_port.port));
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
size_t addrsize = 0;
|
size_t addrsize = 0;
|
||||||
struct sockaddr_in *addr4 = (struct sockaddr_in *)&addr;
|
struct sockaddr_in *addr4 = (struct sockaddr_in *)&addr;
|
||||||
@ -322,7 +322,7 @@ static bool send_broadcasts(sock_t sock, uint16 port, char *data, unsigned long
|
|||||||
{
|
{
|
||||||
static std::chrono::high_resolution_clock::time_point last_get_broadcast_info;
|
static std::chrono::high_resolution_clock::time_point last_get_broadcast_info;
|
||||||
if (number_broadcasts < 0 || check_timedout(last_get_broadcast_info, 60.0)) {
|
if (number_broadcasts < 0 || check_timedout(last_get_broadcast_info, 60.0)) {
|
||||||
PRINT_DEBUG("get_broadcast_info\n");
|
PRINT_DEBUG("get_broadcast_info");
|
||||||
get_broadcast_info(port);
|
get_broadcast_info(port);
|
||||||
std::vector<uint32_t> lower_range(lower_range_ips, lower_range_ips + number_broadcasts), upper_range(upper_range_ips, upper_range_ips + number_broadcasts);
|
std::vector<uint32_t> lower_range(lower_range_ips, lower_range_ips + number_broadcasts), upper_range(upper_range_ips, upper_range_ips + number_broadcasts);
|
||||||
for(auto &addr : *custom_broadcasts) {
|
for(auto &addr : *custom_broadcasts) {
|
||||||
@ -353,12 +353,11 @@ static bool send_broadcasts(sock_t sock, uint16 port, char *data, unsigned long
|
|||||||
* Sends to custom IPs the broadcast packet
|
* Sends to custom IPs the broadcast packet
|
||||||
* This is useful in cases of undetected network interfaces
|
* This is useful in cases of undetected network interfaces
|
||||||
*/
|
*/
|
||||||
PRINT_DEBUG("start custom broadcasts\n");
|
PRINT_DEBUG("start custom broadcasts");
|
||||||
for(auto &addr : *custom_broadcasts) {
|
for(auto &addr : *custom_broadcasts) {
|
||||||
send_packet_to(sock, addr, data, length);
|
send_packet_to(sock, addr, data, length);
|
||||||
}
|
}
|
||||||
|
PRINT_DEBUG("end custom broadcasts");
|
||||||
PRINT_DEBUG("end custom broadcasts\n");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -461,7 +460,7 @@ static bool unbuffer_tcp(struct TCP_Socket &socket, Common_Message *msg)
|
|||||||
socket.recv_buffer.erase(socket.recv_buffer.begin(), socket.recv_buffer.begin() + sizeof(l) + l);
|
socket.recv_buffer.erase(socket.recv_buffer.begin(), socket.recv_buffer.begin() + sizeof(l) + l);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("BAD TCP DATA %u %zu %zu %hhu\n", l, socket.recv_buffer.size(), sizeof(uint32), *((char *)&(socket.recv_buffer[sizeof(uint32)])));
|
PRINT_DEBUG("BAD TCP DATA %u %zu %zu %hhu", l, socket.recv_buffer.size(), sizeof(uint32), *((char *)&(socket.recv_buffer[sizeof(uint32)])));
|
||||||
kill_tcp_socket(socket);
|
kill_tcp_socket(socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +495,7 @@ static void socket_timeouts(struct TCP_Socket &socket, double extra_time)
|
|||||||
|
|
||||||
if (check_timedout(socket.last_heartbeat_received, HEARTBEAT_TIMEOUT + extra_time)) {
|
if (check_timedout(socket.last_heartbeat_received, HEARTBEAT_TIMEOUT + extra_time)) {
|
||||||
kill_tcp_socket(socket);
|
kill_tcp_socket(socket);
|
||||||
PRINT_DEBUG("TCP SOCKET HEARTBEAT TIMEOUT\n");
|
PRINT_DEBUG("TCP SOCKET HEARTBEAT TIMEOUT");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,7 +516,7 @@ std::set<IP_PORT> Networking::resolve_ip(std::string dns)
|
|||||||
if (getaddrinfo(dns.c_str(), NULL, NULL, &result) == 0) {
|
if (getaddrinfo(dns.c_str(), NULL, NULL, &result) == 0) {
|
||||||
for (struct addrinfo *res = result; res != NULL; res = res->ai_next) {
|
for (struct addrinfo *res = result; res != NULL; res = res->ai_next) {
|
||||||
// cast to size_t because on Linux 'ai_addrlen' is defined as unsigned int and clang complains
|
// cast to size_t because on Linux 'ai_addrlen' is defined as unsigned int and clang complains
|
||||||
PRINT_DEBUG("%zu %u\n", (size_t)res->ai_addrlen, res->ai_family);
|
PRINT_DEBUG("%zu %u", (size_t)res->ai_addrlen, res->ai_family);
|
||||||
if (res->ai_family == AF_INET) {
|
if (res->ai_family == AF_INET) {
|
||||||
struct sockaddr_in *ipv4 = (struct sockaddr_in *)res->ai_addr;
|
struct sockaddr_in *ipv4 = (struct sockaddr_in *)res->ai_addr;
|
||||||
uint32 ip;
|
uint32 ip;
|
||||||
@ -536,62 +535,62 @@ std::set<IP_PORT> Networking::resolve_ip(std::string dns)
|
|||||||
void Networking::do_callbacks_message(Common_Message *msg)
|
void Networking::do_callbacks_message(Common_Message *msg)
|
||||||
{
|
{
|
||||||
if (msg->has_network() || msg->has_network_old()) {
|
if (msg->has_network() || msg->has_network_old()) {
|
||||||
PRINT_DEBUG("Networking has_network\n");
|
PRINT_DEBUG("has_network");
|
||||||
run_callbacks(CALLBACK_ID_NETWORKING, msg);
|
run_callbacks(CALLBACK_ID_NETWORKING, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_lobby()) {
|
if (msg->has_lobby()) {
|
||||||
PRINT_DEBUG("Networking has_lobby\n");
|
PRINT_DEBUG("has_lobby");
|
||||||
run_callbacks(CALLBACK_ID_LOBBY, msg);
|
run_callbacks(CALLBACK_ID_LOBBY, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_lobby_messages()) {
|
if (msg->has_lobby_messages()) {
|
||||||
PRINT_DEBUG("Networking has_lobby_messages\n");
|
PRINT_DEBUG("has_lobby_messages");
|
||||||
run_callbacks(CALLBACK_ID_LOBBY, msg);
|
run_callbacks(CALLBACK_ID_LOBBY, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_gameserver()) {
|
if (msg->has_gameserver()) {
|
||||||
PRINT_DEBUG("Networking has_gameserver\n");
|
PRINT_DEBUG("has_gameserver");
|
||||||
run_callbacks(CALLBACK_ID_GAMESERVER, msg);
|
run_callbacks(CALLBACK_ID_GAMESERVER, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_friend_()) {
|
if (msg->has_friend_()) {
|
||||||
PRINT_DEBUG("Networking has_friend_\n");
|
PRINT_DEBUG("has_friend_");
|
||||||
run_callbacks(CALLBACK_ID_FRIEND, msg);
|
run_callbacks(CALLBACK_ID_FRIEND, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_auth_ticket()) {
|
if (msg->has_auth_ticket()) {
|
||||||
PRINT_DEBUG("Networking has_auth_ticket\n");
|
PRINT_DEBUG("has_auth_ticket");
|
||||||
run_callbacks(CALLBACK_ID_AUTH_TICKET, msg);
|
run_callbacks(CALLBACK_ID_AUTH_TICKET, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_friend_messages()) {
|
if (msg->has_friend_messages()) {
|
||||||
PRINT_DEBUG("Networking has_friend_messages\n");
|
PRINT_DEBUG("has_friend_messages");
|
||||||
run_callbacks(CALLBACK_ID_FRIEND_MESSAGES, msg);
|
run_callbacks(CALLBACK_ID_FRIEND_MESSAGES, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_networking_sockets()) {
|
if (msg->has_networking_sockets()) {
|
||||||
PRINT_DEBUG("Networking has_networking_sockets\n");
|
PRINT_DEBUG("has_networking_sockets");
|
||||||
run_callbacks(CALLBACK_ID_NETWORKING_SOCKETS, msg);
|
run_callbacks(CALLBACK_ID_NETWORKING_SOCKETS, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_steam_messages()) {
|
if (msg->has_steam_messages()) {
|
||||||
PRINT_DEBUG("Networking has_steam_messages\n");
|
PRINT_DEBUG("has_steam_messages");
|
||||||
run_callbacks(CALLBACK_ID_STEAM_MESSAGES, msg);
|
run_callbacks(CALLBACK_ID_STEAM_MESSAGES, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_networking_messages()) {
|
if (msg->has_networking_messages()) {
|
||||||
PRINT_DEBUG("Networking has_networking_messages\n");
|
PRINT_DEBUG("has_networking_messages");
|
||||||
run_callbacks(CALLBACK_ID_NETWORKING_MESSAGES, msg);
|
run_callbacks(CALLBACK_ID_NETWORKING_MESSAGES, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_gameserver_stats_messages()) {
|
if (msg->has_gameserver_stats_messages()) {
|
||||||
PRINT_DEBUG("Networking has_gameserver_stats\n");
|
PRINT_DEBUG("has_gameserver_stats");
|
||||||
run_callbacks(CALLBACK_ID_GAMESERVER_STATS, msg);
|
run_callbacks(CALLBACK_ID_GAMESERVER_STATS, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_leaderboards_messages()) {
|
if (msg->has_leaderboards_messages()) {
|
||||||
PRINT_DEBUG("Networking has_leaderboards_messages\n");
|
PRINT_DEBUG("has_leaderboards_messages");
|
||||||
run_callbacks(CALLBACK_ID_LEADERBOARDS_STATS, msg);
|
run_callbacks(CALLBACK_ID_LEADERBOARDS_STATS, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +640,7 @@ bool Networking::add_id_connection(struct Connection *connection, CSteamID steam
|
|||||||
if (id != connection->ids.end())
|
if (id != connection->ids.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PRINT_DEBUG("Networking::add_id_connection ADDED ID %llu\n", (uint64)steam_id.ConvertToUint64());
|
PRINT_DEBUG("ADDED ID %llu", (uint64)steam_id.ConvertToUint64());
|
||||||
connection->ids.push_back(steam_id);
|
connection->ids.push_back(steam_id);
|
||||||
if (connection->connected) {
|
if (connection->connected) {
|
||||||
run_callback_user(steam_id, true, connection->appid);
|
run_callback_user(steam_id, true, connection->appid);
|
||||||
@ -660,7 +659,7 @@ struct Connection *Networking::new_connection(CSteamID search_id, uint32 appid)
|
|||||||
connection.appid = appid;
|
connection.appid = appid;
|
||||||
connection.last_received = std::chrono::high_resolution_clock::now();
|
connection.last_received = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
PRINT_DEBUG("Networking::new_connection ADDED ID %llu\n", (uint64)search_id.ConvertToUint64());
|
PRINT_DEBUG("ADDED ID %llu", (uint64)search_id.ConvertToUint64());
|
||||||
connections.push_back(connection);
|
connections.push_back(connection);
|
||||||
return &(connections[connections.size() - 1]);
|
return &(connections[connections.size() - 1]);
|
||||||
}
|
}
|
||||||
@ -671,13 +670,10 @@ bool Networking::handle_announce(Common_Message *msg, IP_PORT ip_port)
|
|||||||
if (!conn || conn->appid != msg->announce().appid()) {
|
if (!conn || conn->appid != msg->announce().appid()) {
|
||||||
conn = new_connection((uint64)msg->source_id(), msg->announce().appid());
|
conn = new_connection((uint64)msg->source_id(), msg->announce().appid());
|
||||||
if (!conn) return false;
|
if (!conn) return false;
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("new connection created: user %llu, appid %u", (uint64)msg->source_id(), msg->announce().appid());
|
||||||
"Networking::handle_announce new connection created: user %llu, appid %u\n",
|
|
||||||
(uint64)msg->source_id(), msg->announce().appid()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Handle Announce: %u, " "%" PRIu64 ", %u, %u\n", conn->appid, msg->source_id(), msg->announce().appid(), msg->announce().type());
|
PRINT_DEBUG("Handle Announce: %u, " "%" PRIu64 ", %u, %u", conn->appid, msg->source_id(), msg->announce().appid(), msg->announce().type());
|
||||||
conn->tcp_ip_port = ip_port;
|
conn->tcp_ip_port = ip_port;
|
||||||
conn->tcp_ip_port.port = htons(msg->announce().tcp_port());
|
conn->tcp_ip_port.port = htons(msg->announce().tcp_port());
|
||||||
conn->appid = msg->announce().appid();
|
conn->appid = msg->announce().appid();
|
||||||
@ -694,7 +690,7 @@ bool Networking::handle_announce(Common_Message *msg, IP_PORT ip_port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Connection *conn = find_connection((uint64)msg->announce().peers(i).id(), msg->announce().peers(i).appid());
|
Connection *conn = find_connection((uint64)msg->announce().peers(i).id(), msg->announce().peers(i).appid());
|
||||||
PRINT_DEBUG("%p %u %u " "%" PRIu64 "\n", conn, conn ? conn->appid : (uint32)0, msg->announce().peers(i).appid(), msg->announce().peers(i).id());
|
PRINT_DEBUG("%p %u %u " "%" PRIu64 "", conn, conn ? conn->appid : (uint32)0, msg->announce().peers(i).appid(), msg->announce().peers(i).id());
|
||||||
if (!conn || conn->appid != msg->announce().peers(i).appid()) {
|
if (!conn || conn->appid != msg->announce().peers(i).appid()) {
|
||||||
Common_Message msg_ = create_announce(true);
|
Common_Message msg_ = create_announce(true);
|
||||||
|
|
||||||
@ -781,7 +777,7 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set<IP_PORT>
|
|||||||
|
|
||||||
run_at_startup();
|
run_at_startup();
|
||||||
sock_t sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
sock_t sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
PRINT_DEBUG("UDP socket: %u\n", sock);
|
PRINT_DEBUG("UDP socket: %u", sock);
|
||||||
if (is_socket_valid(sock) && set_socket_nonblocking(sock)) {
|
if (is_socket_valid(sock) && set_socket_nonblocking(sock)) {
|
||||||
int broadcast = 1;
|
int broadcast = 1;
|
||||||
setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&broadcast, sizeof(broadcast));
|
setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&broadcast, sizeof(broadcast));
|
||||||
@ -791,7 +787,7 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set<IP_PORT>
|
|||||||
for (unsigned i = 0; i < 1000; ++i) {
|
for (unsigned i = 0; i < 1000; ++i) {
|
||||||
udp_port = port + i;
|
udp_port = port + i;
|
||||||
if (bind_socket(sock, udp_port)) {
|
if (bind_socket(sock, udp_port)) {
|
||||||
PRINT_DEBUG("UDP successful\n");
|
PRINT_DEBUG("UDP successful");
|
||||||
udp_socket = sock;
|
udp_socket = sock;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@ -803,14 +799,14 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set<IP_PORT>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_socket_valid(udp_socket)) {
|
if (!is_socket_valid(udp_socket)) {
|
||||||
PRINT_DEBUG("UDP: could not bind socket\n");
|
PRINT_DEBUG("UDP: could not bind socket");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("UDP: could not initialize %i\n", get_last_error());
|
PRINT_DEBUG("UDP: could not initialize %i", get_last_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
PRINT_DEBUG("TCP socket: %u\n", sock);
|
PRINT_DEBUG("TCP socket: %u", sock);
|
||||||
if (is_socket_valid(sock) && set_socket_nonblocking(sock)) {
|
if (is_socket_valid(sock) && set_socket_nonblocking(sock)) {
|
||||||
buffers_set(sock);
|
buffers_set(sock);
|
||||||
//socket_reuseaddr(sock);
|
//socket_reuseaddr(sock);
|
||||||
@ -819,14 +815,14 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set<IP_PORT>
|
|||||||
tcp_port = port + i;
|
tcp_port = port + i;
|
||||||
if (bind_socket(sock, tcp_port)) {
|
if (bind_socket(sock, tcp_port)) {
|
||||||
if ((listen(sock, NUM_TCP_WAITING) == 0)) {
|
if ((listen(sock, NUM_TCP_WAITING) == 0)) {
|
||||||
PRINT_DEBUG("TCP successful\n");
|
PRINT_DEBUG("TCP successful");
|
||||||
tcp_socket = sock;
|
tcp_socket = sock;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
socklen_t len = sizeof(error);
|
socklen_t len = sizeof(error);
|
||||||
getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *)&error, &len);
|
getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *)&error, &len);
|
||||||
PRINT_DEBUG("TCP listen error %i\n", error);
|
PRINT_DEBUG("TCP listen error %i", error);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
@ -836,24 +832,24 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set<IP_PORT>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_socket_valid(udp_socket)) {
|
if (!is_socket_valid(udp_socket)) {
|
||||||
PRINT_DEBUG("TCP: could not bind or listen\n");
|
PRINT_DEBUG("TCP: could not bind or listen");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("TCP: could not initialize %i\n", get_last_error());
|
PRINT_DEBUG("TCP: could not initialize %i", get_last_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curl_global_init(CURL_GLOBAL_ALL) == 0) {
|
if (curl_global_init(CURL_GLOBAL_ALL) == 0) {
|
||||||
PRINT_DEBUG("CURL successful\n");
|
PRINT_DEBUG("CURL successful");
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("CURL: could not initialize\n");
|
PRINT_DEBUG("CURL: could not initialize");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_socket_valid(udp_socket) && is_socket_valid(tcp_socket)) {
|
if (is_socket_valid(udp_socket) && is_socket_valid(tcp_socket)) {
|
||||||
PRINT_DEBUG("Networking initialized successfully on udp: %u tcp: %u \n", udp_port, tcp_port);
|
PRINT_DEBUG("Networking initialized successfully on udp: %u tcp: %u", udp_port, tcp_port);
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Networking::Networking ADDED ID %llu\n", (uint64)id.ConvertToUint64());
|
PRINT_DEBUG("ADDED ID %llu", (uint64)id.ConvertToUint64());
|
||||||
ids.push_back(id);
|
ids.push_back(id);
|
||||||
|
|
||||||
reset_last_error();
|
reset_last_error();
|
||||||
@ -879,13 +875,13 @@ Networking::~Networking()
|
|||||||
Common_Message Networking::create_announce(bool request)
|
Common_Message Networking::create_announce(bool request)
|
||||||
{
|
{
|
||||||
Announce *announce = new Announce();
|
Announce *announce = new Announce();
|
||||||
PRINT_DEBUG("Networking:: ids length %zu\n", ids.size());
|
PRINT_DEBUG("ids length %zu", ids.size());
|
||||||
if (request) {
|
if (request) {
|
||||||
announce->set_type(Announce::PING);
|
announce->set_type(Announce::PING);
|
||||||
} else {
|
} else {
|
||||||
announce->set_type(Announce::PONG);
|
announce->set_type(Announce::PONG);
|
||||||
for (auto &conn: connections) {
|
for (auto &conn: connections) {
|
||||||
PRINT_DEBUG("Connection %u %llu %u\n", conn.udp_pinged, conn.ids[0].ConvertToUint64(), conn.appid);
|
PRINT_DEBUG("Connection %u %llu %u", conn.udp_pinged, conn.ids[0].ConvertToUint64(), conn.appid);
|
||||||
if (conn.udp_pinged) {
|
if (conn.udp_pinged) {
|
||||||
Announce_Other_Peers *peer = announce->add_peers();
|
Announce_Other_Peers *peer = announce->add_peers();
|
||||||
peer->set_id(conn.ids[0].ConvertToUint64());
|
peer->set_id(conn.ids[0].ConvertToUint64());
|
||||||
@ -910,16 +906,15 @@ void Networking::send_announce_broadcasts()
|
|||||||
Common_Message msg = create_announce(true);
|
Common_Message msg = create_announce(true);
|
||||||
|
|
||||||
size_t size = msg.ByteSizeLong();
|
size_t size = msg.ByteSizeLong();
|
||||||
char *buffer = new char[size];
|
std::vector<char> buffer(size);
|
||||||
msg.SerializeToArray(buffer, size);
|
msg.SerializeToArray(&buffer[0], size);
|
||||||
send_broadcasts(udp_socket, htons(DEFAULT_PORT), buffer, size, &this->custom_broadcasts);
|
send_broadcasts(udp_socket, htons(DEFAULT_PORT), &buffer[0], size, &this->custom_broadcasts);
|
||||||
if (udp_port != DEFAULT_PORT) {
|
if (udp_port != DEFAULT_PORT) {
|
||||||
send_broadcasts(udp_socket, htons(udp_port), buffer, size, &this->custom_broadcasts);
|
send_broadcasts(udp_socket, htons(udp_port), &buffer[0], size, &this->custom_broadcasts);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] buffer;
|
|
||||||
last_broadcast = std::chrono::high_resolution_clock::now();
|
last_broadcast = std::chrono::high_resolution_clock::now();
|
||||||
PRINT_DEBUG("Networking:: sent broadcasts\n");
|
PRINT_DEBUG("sent broadcasts");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Networking::Run()
|
void Networking::Run()
|
||||||
@ -932,8 +927,8 @@ void Networking::Run()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//PRINT_DEBUG("Networking::Run() %lf\n", time_extra);
|
//PRINT_DEBUG("%lf", time_extra);
|
||||||
// PRINT_DEBUG("Networking::Run()\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
if (check_timedout(last_broadcast, BROADCAST_INTERVAL)) {
|
if (check_timedout(last_broadcast, BROADCAST_INTERVAL)) {
|
||||||
send_announce_broadcasts();
|
send_announce_broadcasts();
|
||||||
}
|
}
|
||||||
@ -943,38 +938,35 @@ void Networking::Run()
|
|||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (query_alive && is_socket_valid(query_socket)) {
|
if (query_alive && is_socket_valid(query_socket)) {
|
||||||
PRINT_DEBUG("Networking::Run RECV Source Query\n");
|
PRINT_DEBUG("RECV Source Query");
|
||||||
Steam_Client* client = get_steam_client();
|
Steam_Client* client = get_steam_client();
|
||||||
sockaddr_in addr;
|
sockaddr_in addr;
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
|
|
||||||
while ((len = receive_packet(query_socket, &ip_port, data, sizeof(data))) >= 0) {
|
while ((len = receive_packet(query_socket, &ip_port, data, sizeof(data))) >= 0) {
|
||||||
PRINT_DEBUG("Networking::Run requesting Source Query server info from Steam_GameServer\n");
|
PRINT_DEBUG("requesting Source Query server info from Steam_GameServer");
|
||||||
client->steam_gameserver->HandleIncomingPacket(data, len, htonl(ip_port.ip), htons(ip_port.port));
|
client->steam_gameserver->HandleIncomingPacket(data, len, htonl(ip_port.ip), htons(ip_port.port));
|
||||||
len = client->steam_gameserver->GetNextOutgoingPacket(data, sizeof(data), &ip_port.ip, &ip_port.port);
|
len = client->steam_gameserver->GetNextOutgoingPacket(data, sizeof(data), &ip_port.ip, &ip_port.port);
|
||||||
|
|
||||||
PRINT_DEBUG("Networking::Run sending Source Query server info\n");
|
PRINT_DEBUG("sending Source Query server info");
|
||||||
addr.sin_addr.s_addr = htonl(ip_port.ip);
|
addr.sin_addr.s_addr = htonl(ip_port.ip);
|
||||||
addr.sin_port = htons(ip_port.port);
|
addr.sin_port = htons(ip_port.port);
|
||||||
sendto(query_socket, data, len, 0, (sockaddr*)&addr, sizeof(addr));
|
sendto(query_socket, data, len, 0, (sockaddr*)&addr, sizeof(addr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Networking::Run RECV UDP\n");
|
PRINT_DEBUG("RECV UDP");
|
||||||
while((len = receive_packet(udp_socket, &ip_port, data, sizeof(data))) >= 0) {
|
while((len = receive_packet(udp_socket, &ip_port, data, sizeof(data))) >= 0) {
|
||||||
PRINT_DEBUG("recv %i %hhu.%hhu.%hhu.%hhu:%hu\n", len, ((unsigned char *)&ip_port.ip)[0], ((unsigned char *)&ip_port.ip)[1], ((unsigned char *)&ip_port.ip)[2], ((unsigned char *)&ip_port.ip)[3], htons(ip_port.port));
|
PRINT_DEBUG("recv %i %hhu.%hhu.%hhu.%hhu:%hu", len,
|
||||||
|
((unsigned char *)&ip_port.ip)[0], ((unsigned char *)&ip_port.ip)[1], ((unsigned char *)&ip_port.ip)[2], ((unsigned char *)&ip_port.ip)[3], htons(ip_port.port));
|
||||||
Common_Message msg;
|
Common_Message msg;
|
||||||
if (msg.ParseFromArray(data, len)) {
|
if (msg.ParseFromArray(data, len)) {
|
||||||
if (msg.source_id()) {
|
if (msg.source_id()) {
|
||||||
if (msg.has_announce()) {
|
if (msg.has_announce()) {
|
||||||
handle_announce(&msg, ip_port);
|
handle_announce(&msg, ip_port);
|
||||||
} else
|
} else if (msg.has_low_level()) {
|
||||||
|
|
||||||
if (msg.has_low_level()) {
|
|
||||||
handle_low_level_udp(&msg, ip_port);
|
handle_low_level_udp(&msg, ip_port);
|
||||||
} else
|
} else {
|
||||||
|
|
||||||
{
|
|
||||||
msg.set_source_ip(ntohl(ip_port.ip));
|
msg.set_source_ip(ntohl(ip_port.ip));
|
||||||
msg.set_source_port(ntohs(ip_port.port));
|
msg.set_source_port(ntohs(ip_port.port));
|
||||||
do_callbacks_message(&msg);
|
do_callbacks_message(&msg);
|
||||||
@ -983,7 +975,7 @@ void Networking::Run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Networking::Run RECV LOCAL\n");
|
PRINT_DEBUG("RECV LOCAL %zu", local_send.size());
|
||||||
std::vector<Common_Message> local_send_copy = local_send;
|
std::vector<Common_Message> local_send_copy = local_send;
|
||||||
local_send.clear();
|
local_send.clear();
|
||||||
|
|
||||||
@ -1000,9 +992,9 @@ void Networking::Run()
|
|||||||
socklen_t addrlen = sizeof(addr);
|
socklen_t addrlen = sizeof(addr);
|
||||||
#endif
|
#endif
|
||||||
sock_t sock;
|
sock_t sock;
|
||||||
PRINT_DEBUG("ACCEPTING\n");
|
PRINT_DEBUG("ACCEPTING");
|
||||||
while (is_socket_valid(sock = accept(tcp_socket, (struct sockaddr *)&addr, &addrlen))) {
|
while (is_socket_valid(sock = accept(tcp_socket, (struct sockaddr *)&addr, &addrlen))) {
|
||||||
PRINT_DEBUG("ACCEPT SOCKET %u\n", sock);
|
PRINT_DEBUG("ACCEPT SOCKET %u", sock);
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
#if defined(STEAM_WIN32)
|
#if defined(STEAM_WIN32)
|
||||||
int addrlen = sizeof(addr);
|
int addrlen = sizeof(addr);
|
||||||
@ -1014,17 +1006,17 @@ void Networking::Run()
|
|||||||
ip_port.port = addr_in->sin_port;
|
ip_port.port = addr_in->sin_port;
|
||||||
struct TCP_Socket socket;
|
struct TCP_Socket socket;
|
||||||
if (set_socket_nonblocking(sock)) {
|
if (set_socket_nonblocking(sock)) {
|
||||||
PRINT_DEBUG("SET NONBLOCK\n");
|
PRINT_DEBUG("SET NONBLOCK");
|
||||||
disable_nagle(sock);
|
disable_nagle(sock);
|
||||||
socket.sock = sock;
|
socket.sock = sock;
|
||||||
socket.received_data = true;
|
socket.received_data = true;
|
||||||
socket.last_heartbeat_received = std::chrono::high_resolution_clock::now();
|
socket.last_heartbeat_received = std::chrono::high_resolution_clock::now();
|
||||||
accepted.push_back(socket);
|
accepted.push_back(socket);
|
||||||
PRINT_DEBUG("TCP ACCEPTED %u\n", sock);
|
PRINT_DEBUG("TCP ACCEPTED %u", sock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("ACCEPTED %zu\n", accepted.size());
|
PRINT_DEBUG("ACCEPTED %zu", accepted.size());
|
||||||
auto conn = std::begin(accepted);
|
auto conn = std::begin(accepted);
|
||||||
while (conn != std::end(accepted)) {
|
while (conn != std::end(accepted)) {
|
||||||
bool deleted = false;
|
bool deleted = false;
|
||||||
@ -1038,7 +1030,7 @@ void Networking::Run()
|
|||||||
connection->tcp_socket_incoming = *conn;
|
connection->tcp_socket_incoming = *conn;
|
||||||
conn = accepted.erase(conn);
|
conn = accepted.erase(conn);
|
||||||
deleted = true;
|
deleted = true;
|
||||||
PRINT_DEBUG("TCP REPLACED\n");
|
PRINT_DEBUG("TCP REPLACED");
|
||||||
//TODO: add other ids?
|
//TODO: add other ids?
|
||||||
} else {
|
} else {
|
||||||
//Don't allow connection from unknown
|
//Don't allow connection from unknown
|
||||||
@ -1046,7 +1038,7 @@ void Networking::Run()
|
|||||||
kill_tcp_socket(*conn);
|
kill_tcp_socket(*conn);
|
||||||
conn = accepted.erase(conn);
|
conn = accepted.erase(conn);
|
||||||
deleted = true;
|
deleted = true;
|
||||||
PRINT_DEBUG("TCP UNKNOWN\n");
|
PRINT_DEBUG("TCP UNKNOWN");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1055,7 +1047,7 @@ void Networking::Run()
|
|||||||
kill_tcp_socket(*conn);
|
kill_tcp_socket(*conn);
|
||||||
conn = accepted.erase(conn);
|
conn = accepted.erase(conn);
|
||||||
deleted = true;
|
deleted = true;
|
||||||
PRINT_DEBUG("TCP TIMEOUT\n");
|
PRINT_DEBUG("TCP TIMEOUT");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!deleted){
|
if (!deleted){
|
||||||
@ -1063,12 +1055,12 @@ void Networking::Run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("CONNECTIONS %zu\n", connections.size());
|
PRINT_DEBUG("CONNECTIONS %zu", connections.size());
|
||||||
for (auto &conn: connections) {
|
for (auto &conn: connections) {
|
||||||
if (!is_tcp_socket_valid(conn.tcp_socket_outgoing)) {
|
if (!is_tcp_socket_valid(conn.tcp_socket_outgoing)) {
|
||||||
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
if (is_socket_valid(sock) && set_socket_nonblocking(sock)) {
|
if (is_socket_valid(sock) && set_socket_nonblocking(sock)) {
|
||||||
PRINT_DEBUG("NEW SOCKET %u %u\n", sock, conn.tcp_socket_outgoing.sock);
|
PRINT_DEBUG("NEW SOCKET %u %u", sock, conn.tcp_socket_outgoing.sock);
|
||||||
disable_nagle(sock);
|
disable_nagle(sock);
|
||||||
connect_socket(sock, conn.tcp_ip_port);
|
connect_socket(sock, conn.tcp_ip_port);
|
||||||
conn.tcp_socket_outgoing.sock = sock;
|
conn.tcp_socket_outgoing.sock = sock;
|
||||||
@ -1079,7 +1071,7 @@ void Networking::Run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("RUN SOCKET1 %u %u\n", conn.tcp_socket_outgoing.sock, conn.tcp_socket_incoming.sock);
|
PRINT_DEBUG("RUN SOCKET1 %u %u", conn.tcp_socket_outgoing.sock, conn.tcp_socket_incoming.sock);
|
||||||
recv_tcp(conn.tcp_socket_outgoing);
|
recv_tcp(conn.tcp_socket_outgoing);
|
||||||
recv_tcp(conn.tcp_socket_incoming);
|
recv_tcp(conn.tcp_socket_incoming);
|
||||||
|
|
||||||
@ -1095,7 +1087,7 @@ void Networking::Run()
|
|||||||
if (i != c.ids.end()) {
|
if (i != c.ids.end()) {
|
||||||
c.ids.erase(i);
|
c.ids.erase(i);
|
||||||
run_callback_user(steam_id, false, c.appid);
|
run_callback_user(steam_id, false, c.appid);
|
||||||
PRINT_DEBUG("REMOVE OLD CONNECTION ID\n");
|
PRINT_DEBUG("REMOVE OLD CONNECTION ID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1107,27 +1099,27 @@ void Networking::Run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("RUN SOCKET2 %u %u\n", conn.tcp_socket_outgoing.sock, conn.tcp_socket_incoming.sock);
|
PRINT_DEBUG("RUN SOCKET2 %u %u", conn.tcp_socket_outgoing.sock, conn.tcp_socket_incoming.sock);
|
||||||
send_tcp_pending(conn.tcp_socket_outgoing);
|
send_tcp_pending(conn.tcp_socket_outgoing);
|
||||||
send_tcp_pending(conn.tcp_socket_incoming);
|
send_tcp_pending(conn.tcp_socket_incoming);
|
||||||
|
|
||||||
PRINT_DEBUG("RUN SOCKET3 %u %u\n", conn.tcp_socket_outgoing.sock, conn.tcp_socket_incoming.sock);
|
PRINT_DEBUG("RUN SOCKET3 %u %u", conn.tcp_socket_outgoing.sock, conn.tcp_socket_incoming.sock);
|
||||||
Common_Message msg;
|
Common_Message msg;
|
||||||
while (unbuffer_tcp(conn.tcp_socket_outgoing, &msg)) {
|
while (unbuffer_tcp(conn.tcp_socket_outgoing, &msg)) {
|
||||||
PRINT_DEBUG("UNBUFFER SOCKET\n");
|
PRINT_DEBUG("UNBUFFER SOCKET");
|
||||||
msg.set_source_ip(ntohl(conn.tcp_ip_port.ip)); //TODO: get from tcp socket
|
msg.set_source_ip(ntohl(conn.tcp_ip_port.ip)); //TODO: get from tcp socket
|
||||||
handle_tcp(&msg, conn.tcp_socket_outgoing);
|
handle_tcp(&msg, conn.tcp_socket_outgoing);
|
||||||
conn.last_received = std::chrono::high_resolution_clock::now();
|
conn.last_received = std::chrono::high_resolution_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (unbuffer_tcp(conn.tcp_socket_incoming, &msg)) {
|
while (unbuffer_tcp(conn.tcp_socket_incoming, &msg)) {
|
||||||
PRINT_DEBUG("UNBUFFER SOCKET\n");
|
PRINT_DEBUG("UNBUFFER SOCKET");
|
||||||
msg.set_source_ip(ntohl(conn.tcp_ip_port.ip)); //TODO: get from tcp socket
|
msg.set_source_ip(ntohl(conn.tcp_ip_port.ip)); //TODO: get from tcp socket
|
||||||
handle_tcp(&msg, conn.tcp_socket_incoming);
|
handle_tcp(&msg, conn.tcp_socket_incoming);
|
||||||
conn.last_received = std::chrono::high_resolution_clock::now();
|
conn.last_received = std::chrono::high_resolution_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("RUN SOCKET4 %u %u\n", conn.tcp_socket_outgoing.sock, conn.tcp_socket_incoming.sock);
|
PRINT_DEBUG("RUN SOCKET4 %u %u", conn.tcp_socket_outgoing.sock, conn.tcp_socket_incoming.sock);
|
||||||
socket_timeouts(conn.tcp_socket_outgoing, time_extra);
|
socket_timeouts(conn.tcp_socket_outgoing, time_extra);
|
||||||
socket_timeouts(conn.tcp_socket_incoming, time_extra);
|
socket_timeouts(conn.tcp_socket_incoming, time_extra);
|
||||||
|
|
||||||
@ -1141,7 +1133,7 @@ void Networking::Run()
|
|||||||
kill_tcp_socket(conn->tcp_socket_outgoing);
|
kill_tcp_socket(conn->tcp_socket_outgoing);
|
||||||
kill_tcp_socket(conn->tcp_socket_incoming);
|
kill_tcp_socket(conn->tcp_socket_incoming);
|
||||||
conn = connections.erase(conn);
|
conn = connections.erase(conn);
|
||||||
PRINT_DEBUG("USER TIMEOUT\n");
|
PRINT_DEBUG("USER TIMEOUT");
|
||||||
} else {
|
} else {
|
||||||
++conn;
|
++conn;
|
||||||
}
|
}
|
||||||
@ -1166,7 +1158,7 @@ void Networking::addListenId(CSteamID id)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Networking::addListenId ADDED ID %llu\n", (uint64)id.ConvertToUint64());
|
PRINT_DEBUG("ADDED ID %llu", (uint64)id.ConvertToUint64());
|
||||||
ids.push_back(id);
|
ids.push_back(id);
|
||||||
send_announce_broadcasts();
|
send_announce_broadcasts();
|
||||||
return;
|
return;
|
||||||
@ -1181,7 +1173,7 @@ bool Networking::sendToIPPort(Common_Message *msg, uint32 ip, uint16 port, bool
|
|||||||
{
|
{
|
||||||
bool is_local_ip = ((ip >> 24) == 0x7F);
|
bool is_local_ip = ((ip >> 24) == 0x7F);
|
||||||
uint32_t local_ip = getIP(ids.front());
|
uint32_t local_ip = getIP(ids.front());
|
||||||
PRINT_DEBUG("Networking::sendToIPPort %X %u %X\n", ip, is_local_ip, local_ip);
|
PRINT_DEBUG("%X %u %X", ip, is_local_ip, local_ip);
|
||||||
//TODO: actually send to ip/port
|
//TODO: actually send to ip/port
|
||||||
for (auto &conn: connections) {
|
for (auto &conn: connections) {
|
||||||
if (ntohl(conn.tcp_ip_port.ip) == ip || (is_local_ip && ntohl(conn.tcp_ip_port.ip) == local_ip)) {
|
if (ntohl(conn.tcp_ip_port.ip) == ip || (is_local_ip && ntohl(conn.tcp_ip_port.ip) == local_ip)) {
|
||||||
@ -1215,9 +1207,9 @@ bool Networking::sendTo(Common_Message *msg, bool reliable, Connection *conn)
|
|||||||
bool ret = false;
|
bool ret = false;
|
||||||
CSteamID dest_id((uint64)msg->dest_id());
|
CSteamID dest_id((uint64)msg->dest_id());
|
||||||
if (std::find(ids.begin(), ids.end(), dest_id) != ids.end()) {
|
if (std::find(ids.begin(), ids.end(), dest_id) != ids.end()) {
|
||||||
PRINT_DEBUG("Networking sending to self\n");
|
PRINT_DEBUG("sending to self");
|
||||||
if (!conn) {
|
if (!conn) {
|
||||||
PRINT_DEBUG("Networking local send\n");
|
PRINT_DEBUG("local send");
|
||||||
local_send.push_back(*msg);
|
local_send.push_back(*msg);
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
@ -1363,7 +1355,7 @@ void Networking::startQuery(IP_PORT ip_port)
|
|||||||
{
|
{
|
||||||
if (ip_port.port == MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE)
|
if (ip_port.port == MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Source Query in Shared Mode\n");
|
PRINT_DEBUG("Source Query in Shared Mode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1409,7 +1401,7 @@ void Networking::startQuery(IP_PORT ip_port)
|
|||||||
char str_ip[16]{};
|
char str_ip[16]{};
|
||||||
inet_ntop(AF_INET, &(addr.sin_addr), str_ip, 16);
|
inet_ntop(AF_INET, &(addr.sin_addr), str_ip, 16);
|
||||||
|
|
||||||
PRINT_DEBUG("Started query server on %s:%d\n", str_ip, htons(addr.sin_port));
|
PRINT_DEBUG("Started query server on %s:%d", str_ip, htons(addr.sin_port));
|
||||||
}
|
}
|
||||||
query_alive = true;
|
query_alive = true;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ std::vector<uint8_t> Source_Query::handle_source_query(const void* buffer, size_
|
|||||||
switch (query.header)
|
switch (query.header)
|
||||||
{
|
{
|
||||||
case source_query_header::A2S_INFO:
|
case source_query_header::A2S_INFO:
|
||||||
PRINT_DEBUG("Source_Query::handle_source_query got request for server info\n");
|
PRINT_DEBUG("got request for server info");
|
||||||
if (len >= a2s_query_info_size && !strncmp(query.a2s_info_payload, a2s_info_payload, a2s_info_payload_size))
|
if (len >= a2s_query_info_size && !strncmp(query.a2s_info_payload, a2s_info_payload, a2s_info_payload_size))
|
||||||
{
|
{
|
||||||
std::vector<std::pair<CSteamID, Gameserver_Player_Info_t>> const& players = *get_steam_client()->steam_gameserver->get_players();
|
std::vector<std::pair<CSteamID, Gameserver_Player_Info_t>> const& players = *get_steam_client()->steam_gameserver->get_players();
|
||||||
@ -213,7 +213,7 @@ std::vector<uint8_t> Source_Query::handle_source_query(const void* buffer, size_
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case source_query_header::A2S_PLAYER:
|
case source_query_header::A2S_PLAYER:
|
||||||
PRINT_DEBUG("Source_Query::handle_source_query got request for player info\n");
|
PRINT_DEBUG("got request for player info");
|
||||||
if (len >= a2s_query_challenge_size)
|
if (len >= a2s_query_challenge_size)
|
||||||
{
|
{
|
||||||
if (query.challenge == 0xFFFFFFFFul)
|
if (query.challenge == 0xFFFFFFFFul)
|
||||||
@ -241,7 +241,7 @@ std::vector<uint8_t> Source_Query::handle_source_query(const void* buffer, size_
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case source_query_header::A2S_RULES:
|
case source_query_header::A2S_RULES:
|
||||||
PRINT_DEBUG("Source_Query::handle_source_query got request for rules info\n");
|
PRINT_DEBUG("got request for rules info");
|
||||||
if (len >= a2s_query_challenge_size)
|
if (len >= a2s_query_challenge_size)
|
||||||
{
|
{
|
||||||
if (query.challenge == 0xFFFFFFFFul)
|
if (query.challenge == 0xFFFFFFFFul)
|
||||||
@ -266,7 +266,7 @@ std::vector<uint8_t> Source_Query::handle_source_query(const void* buffer, size_
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Source_Query::handle_source_query got unknown request\n");
|
PRINT_DEBUG("got unknown request");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return output_buffer;
|
return output_buffer;
|
||||||
|
@ -19,33 +19,33 @@
|
|||||||
|
|
||||||
uint32 Steam_Applist::GetNumInstalledApps()
|
uint32 Steam_Applist::GetNumInstalledApps()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Applist::GetNumInstalledApps\n");
|
PRINT_DEBUG_TODO();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Steam_Applist::GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs )
|
uint32 Steam_Applist::GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Applist::GetInstalledApps\n");
|
PRINT_DEBUG_TODO();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns -1 if no name was found
|
// returns -1 if no name was found
|
||||||
int Steam_Applist::GetAppName( AppId_t nAppID, STEAM_OUT_STRING() char *pchName, int cchNameMax )
|
int Steam_Applist::GetAppName( AppId_t nAppID, STEAM_OUT_STRING() char *pchName, int cchNameMax )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Applist::GetAppName\n");
|
PRINT_DEBUG_TODO();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns -1 if no dir was found
|
// returns -1 if no dir was found
|
||||||
int Steam_Applist::GetAppInstallDir( AppId_t nAppID, char *pchDirectory, int cchNameMax )
|
int Steam_Applist::GetAppInstallDir( AppId_t nAppID, char *pchDirectory, int cchNameMax )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Applist::GetAppInstallDir\n");
|
PRINT_DEBUG_TODO();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the buildid of this app, may change at any time based on backend updates to the game
|
// return the buildid of this app, may change at any time based on backend updates to the game
|
||||||
int Steam_Applist::GetAppBuildId( AppId_t nAppID )
|
int Steam_Applist::GetAppBuildId( AppId_t nAppID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Applist::GetAppBuildId\n");
|
PRINT_DEBUG_TODO();
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ std::vector<std::pair<CSteamID, Gameserver_Player_Info_t>>* Steam_GameServer::ge
|
|||||||
/// This is called by SteamGameServer_Init, and you will usually not need to call it directly
|
/// This is called by SteamGameServer_Init, and you will usually not need to call it directly
|
||||||
bool Steam_GameServer::InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString )
|
bool Steam_GameServer::InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::InitGameServer\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (logged_in) return false; // may not be changed after logged in.
|
if (logged_in) return false; // may not be changed after logged in.
|
||||||
@ -56,14 +56,14 @@ bool Steam_GameServer::InitGameServer( uint32 unIP, uint16 usGamePort, uint16 us
|
|||||||
std::string version(pchVersionString);
|
std::string version(pchVersionString);
|
||||||
version.erase(std::remove(version.begin(), version.end(), ' '), version.end());
|
version.erase(std::remove(version.begin(), version.end(), ' '), version.end());
|
||||||
version.erase(std::remove(version.begin(), version.end(), '.'), version.end());
|
version.erase(std::remove(version.begin(), version.end(), '.'), version.end());
|
||||||
PRINT_DEBUG("Steam_GameServer::InitGameServer version trimmed '%s'\n", version.c_str());
|
PRINT_DEBUG("version trimmed '%s'", version.c_str());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto ver = std::stoul(version);
|
auto ver = std::stoul(version);
|
||||||
server_data.set_version(ver);
|
server_data.set_version(ver);
|
||||||
PRINT_DEBUG("Steam_GameServer::InitGameServer set version to %lu\n", ver);
|
PRINT_DEBUG("set version to %lu", ver);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
PRINT_DEBUG("Steam_GameServer::InitGameServer: not a number: %s\n", pchVersionString);
|
PRINT_DEBUG("not a number: %s", pchVersionString);
|
||||||
server_data.set_version(0);
|
server_data.set_version(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ bool Steam_GameServer::InitGameServer( uint32 unIP, uint16 usGamePort, uint16 us
|
|||||||
/// It's a required field, but will eventually will go away, and the AppID will be used for this purpose.
|
/// It's a required field, but will eventually will go away, and the AppID will be used for this purpose.
|
||||||
void Steam_GameServer::SetProduct( const char *pszProduct )
|
void Steam_GameServer::SetProduct( const char *pszProduct )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetProduct\n");
|
PRINT_DEBUG("%s", pszProduct);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
// pszGameDescription should be used instead of pszProduct for accurate information
|
// pszGameDescription should be used instead of pszProduct for accurate information
|
||||||
// Example: 'Counter-Strike: Source' instead of 'cstrike'
|
// Example: 'Counter-Strike: Source' instead of 'cstrike'
|
||||||
@ -102,7 +102,7 @@ void Steam_GameServer::SetProduct( const char *pszProduct )
|
|||||||
/// This is a required field, but it will go away eventually, as the data should be determined from the AppID.
|
/// This is a required field, but it will go away eventually, as the data should be determined from the AppID.
|
||||||
void Steam_GameServer::SetGameDescription( const char *pszGameDescription )
|
void Steam_GameServer::SetGameDescription( const char *pszGameDescription )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetGameDescription\n");
|
PRINT_DEBUG("%s", pszGameDescription);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_game_description(pszGameDescription);
|
server_data.set_game_description(pszGameDescription);
|
||||||
//server_data.set_product(pszGameDescription);
|
//server_data.set_product(pszGameDescription);
|
||||||
@ -115,7 +115,7 @@ void Steam_GameServer::SetGameDescription( const char *pszGameDescription )
|
|||||||
/// @see k_cbMaxGameServerGameDir
|
/// @see k_cbMaxGameServerGameDir
|
||||||
void Steam_GameServer::SetModDir( const char *pszModDir )
|
void Steam_GameServer::SetModDir( const char *pszModDir )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetModDir\n");
|
PRINT_DEBUG("%s", pszModDir);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_mod_dir(pszModDir);
|
server_data.set_mod_dir(pszModDir);
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ void Steam_GameServer::SetModDir( const char *pszModDir )
|
|||||||
/// Is this is a dedicated server? The default value is false.
|
/// Is this is a dedicated server? The default value is false.
|
||||||
void Steam_GameServer::SetDedicatedServer( bool bDedicated )
|
void Steam_GameServer::SetDedicatedServer( bool bDedicated )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetDedicatedServer\n");
|
PRINT_DEBUG("%i", bDedicated);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_dedicated_server(bDedicated);
|
server_data.set_dedicated_server(bDedicated);
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ void Steam_GameServer::SetDedicatedServer( bool bDedicated )
|
|||||||
/// @see SteamServersDisconnected_t
|
/// @see SteamServersDisconnected_t
|
||||||
void Steam_GameServer::LogOn( const char *pszToken )
|
void Steam_GameServer::LogOn( const char *pszToken )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::LogOn %s\n", pszToken);
|
PRINT_DEBUG("%s", pszToken);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
call_servers_connected = true;
|
call_servers_connected = true;
|
||||||
logged_in = true;
|
logged_in = true;
|
||||||
@ -153,7 +153,7 @@ void Steam_GameServer::LogOn(
|
|||||||
const char *pszPassword
|
const char *pszPassword
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::LogOn %s %s\n", pszAccountName, pszPassword);
|
PRINT_DEBUG("%s %s", pszAccountName, pszPassword);
|
||||||
LogOn(pszAccountName);
|
LogOn(pszAccountName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ void Steam_GameServer::LogOn(
|
|||||||
/// but this is no longer the case.
|
/// but this is no longer the case.
|
||||||
void Steam_GameServer::LogOnAnonymous()
|
void Steam_GameServer::LogOnAnonymous()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::LogOnAnonymous\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
call_servers_connected = true;
|
call_servers_connected = true;
|
||||||
logged_in = true;
|
logged_in = true;
|
||||||
@ -171,14 +171,14 @@ void Steam_GameServer::LogOnAnonymous()
|
|||||||
|
|
||||||
void Steam_GameServer::LogOn()
|
void Steam_GameServer::LogOn()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::LogOn\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
LogOnAnonymous();
|
LogOnAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Begin process of logging game server out of steam
|
/// Begin process of logging game server out of steam
|
||||||
void Steam_GameServer::LogOff()
|
void Steam_GameServer::LogOff()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::LogOff\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (logged_in) {
|
if (logged_in) {
|
||||||
call_servers_disconnected = true;
|
call_servers_disconnected = true;
|
||||||
@ -191,14 +191,14 @@ void Steam_GameServer::LogOff()
|
|||||||
// status functions
|
// status functions
|
||||||
bool Steam_GameServer::BLoggedOn()
|
bool Steam_GameServer::BLoggedOn()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::BLoggedOn\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return logged_in;
|
return logged_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_GameServer::BSecure()
|
bool Steam_GameServer::BSecure()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::BSecure\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!policy_response_called) {
|
if (!policy_response_called) {
|
||||||
server_data.set_secure(0);
|
server_data.set_secure(0);
|
||||||
@ -211,7 +211,7 @@ bool Steam_GameServer::BSecure()
|
|||||||
|
|
||||||
CSteamID Steam_GameServer::GetSteamID()
|
CSteamID Steam_GameServer::GetSteamID()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::GetSteamID\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!logged_in) return k_steamIDNil;
|
if (!logged_in) return k_steamIDNil;
|
||||||
return settings->get_local_steam_id();
|
return settings->get_local_steam_id();
|
||||||
@ -222,7 +222,7 @@ CSteamID Steam_GameServer::GetSteamID()
|
|||||||
/// Only returns true once per request.
|
/// Only returns true once per request.
|
||||||
bool Steam_GameServer::WasRestartRequested()
|
bool Steam_GameServer::WasRestartRequested()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::WasRestartRequested\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -235,7 +235,7 @@ bool Steam_GameServer::WasRestartRequested()
|
|||||||
/// Max player count that will be reported to server browser and client queries
|
/// Max player count that will be reported to server browser and client queries
|
||||||
void Steam_GameServer::SetMaxPlayerCount( int cPlayersMax )
|
void Steam_GameServer::SetMaxPlayerCount( int cPlayersMax )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetMaxPlayerCount\n");
|
PRINT_DEBUG("%i", cPlayersMax);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_max_player_count(cPlayersMax);
|
server_data.set_max_player_count(cPlayersMax);
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ void Steam_GameServer::SetMaxPlayerCount( int cPlayersMax )
|
|||||||
/// Number of bots. Default value is zero
|
/// Number of bots. Default value is zero
|
||||||
void Steam_GameServer::SetBotPlayerCount( int cBotplayers )
|
void Steam_GameServer::SetBotPlayerCount( int cBotplayers )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetBotPlayerCount\n");
|
PRINT_DEBUG("%i", cBotplayers);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_bot_player_count(cBotplayers);
|
server_data.set_bot_player_count(cBotplayers);
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ void Steam_GameServer::SetBotPlayerCount( int cBotplayers )
|
|||||||
/// @see k_cbMaxGameServerName
|
/// @see k_cbMaxGameServerName
|
||||||
void Steam_GameServer::SetServerName( const char *pszServerName )
|
void Steam_GameServer::SetServerName( const char *pszServerName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetServerName\n");
|
PRINT_DEBUG("%s", pszServerName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_server_name(pszServerName);
|
server_data.set_server_name(pszServerName);
|
||||||
}
|
}
|
||||||
@ -266,7 +266,7 @@ void Steam_GameServer::SetServerName( const char *pszServerName )
|
|||||||
/// @see k_cbMaxGameServerName
|
/// @see k_cbMaxGameServerName
|
||||||
void Steam_GameServer::SetMapName( const char *pszMapName )
|
void Steam_GameServer::SetMapName( const char *pszMapName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetMapName\n");
|
PRINT_DEBUG("%s", pszMapName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_map_name(pszMapName);
|
server_data.set_map_name(pszMapName);
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ void Steam_GameServer::SetMapName( const char *pszMapName )
|
|||||||
/// Let people know if your server will require a password
|
/// Let people know if your server will require a password
|
||||||
void Steam_GameServer::SetPasswordProtected( bool bPasswordProtected )
|
void Steam_GameServer::SetPasswordProtected( bool bPasswordProtected )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetPasswordProtected\n");
|
PRINT_DEBUG("%i", bPasswordProtected);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_password_protected(bPasswordProtected);
|
server_data.set_password_protected(bPasswordProtected);
|
||||||
}
|
}
|
||||||
@ -285,7 +285,7 @@ void Steam_GameServer::SetPasswordProtected( bool bPasswordProtected )
|
|||||||
/// is not used.
|
/// is not used.
|
||||||
void Steam_GameServer::SetSpectatorPort( uint16 unSpectatorPort )
|
void Steam_GameServer::SetSpectatorPort( uint16 unSpectatorPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetSpectatorPort\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_spectator_port(unSpectatorPort);
|
server_data.set_spectator_port(unSpectatorPort);
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ void Steam_GameServer::SetSpectatorPort( uint16 unSpectatorPort )
|
|||||||
/// @see k_cbMaxGameServerMapName
|
/// @see k_cbMaxGameServerMapName
|
||||||
void Steam_GameServer::SetSpectatorServerName( const char *pszSpectatorServerName )
|
void Steam_GameServer::SetSpectatorServerName( const char *pszSpectatorServerName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetSpectatorServerName\n");
|
PRINT_DEBUG("%s", pszSpectatorServerName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_spectator_server_name(pszSpectatorServerName);
|
server_data.set_spectator_server_name(pszSpectatorServerName);
|
||||||
}
|
}
|
||||||
@ -305,7 +305,7 @@ void Steam_GameServer::SetSpectatorServerName( const char *pszSpectatorServerNam
|
|||||||
/// Call this to clear the whole list of key/values that are sent in rules queries.
|
/// Call this to clear the whole list of key/values that are sent in rules queries.
|
||||||
void Steam_GameServer::ClearAllKeyValues()
|
void Steam_GameServer::ClearAllKeyValues()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::ClearAllKeyValues\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.clear_values();
|
server_data.clear_values();
|
||||||
}
|
}
|
||||||
@ -314,7 +314,7 @@ void Steam_GameServer::ClearAllKeyValues()
|
|||||||
/// Call this to add/update a key/value pair.
|
/// Call this to add/update a key/value pair.
|
||||||
void Steam_GameServer::SetKeyValue( const char *pKey, const char *pValue )
|
void Steam_GameServer::SetKeyValue( const char *pKey, const char *pValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetKeyValue %s %s\n", pKey, pValue);
|
PRINT_DEBUG("%s %s", pKey, pValue);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
(*server_data.mutable_values())[std::string(pKey)] = std::string(pValue);
|
(*server_data.mutable_values())[std::string(pKey)] = std::string(pValue);
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ void Steam_GameServer::SetKeyValue( const char *pKey, const char *pValue )
|
|||||||
/// @see k_cbMaxGameServerTags
|
/// @see k_cbMaxGameServerTags
|
||||||
void Steam_GameServer::SetGameTags( const char *pchGameTags )
|
void Steam_GameServer::SetGameTags( const char *pchGameTags )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetGameTags\n");
|
PRINT_DEBUG("%s", pchGameTags);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_tags(pchGameTags);
|
server_data.set_tags(pchGameTags);
|
||||||
}
|
}
|
||||||
@ -340,7 +340,7 @@ void Steam_GameServer::SetGameTags( const char *pchGameTags )
|
|||||||
/// @see k_cbMaxGameServerGameData
|
/// @see k_cbMaxGameServerGameData
|
||||||
void Steam_GameServer::SetGameData( const char *pchGameData )
|
void Steam_GameServer::SetGameData( const char *pchGameData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetGameData\n");
|
PRINT_DEBUG("%s", pchGameData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_gamedata(pchGameData);
|
server_data.set_gamedata(pchGameData);
|
||||||
}
|
}
|
||||||
@ -349,7 +349,7 @@ void Steam_GameServer::SetGameData( const char *pchGameData )
|
|||||||
/// Region identifier. This is an optional field, the default value is empty, meaning the "world" region
|
/// Region identifier. This is an optional field, the default value is empty, meaning the "world" region
|
||||||
void Steam_GameServer::SetRegion( const char *pszRegion )
|
void Steam_GameServer::SetRegion( const char *pszRegion )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetRegion\n");
|
PRINT_DEBUG("%s", pszRegion);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_region(pszRegion);
|
server_data.set_region(pszRegion);
|
||||||
}
|
}
|
||||||
@ -370,7 +370,7 @@ void Steam_GameServer::SetRegion( const char *pszRegion )
|
|||||||
// for the user has succeeded or failed (the steamid in the callback will match the one returned by this call)
|
// for the user has succeeded or failed (the steamid in the callback will match the one returned by this call)
|
||||||
bool Steam_GameServer::SendUserConnectAndAuthenticate( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser )
|
bool Steam_GameServer::SendUserConnectAndAuthenticate( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SendUserConnectAndAuthenticate %u %u\n", unIPClient, cubAuthBlobSize);
|
PRINT_DEBUG("%u %u", unIPClient, cubAuthBlobSize);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
bool res = auth_manager->SendUserConnectAndAuthenticate(unIPClient, pvAuthBlob, cubAuthBlobSize, pSteamIDUser);
|
bool res = auth_manager->SendUserConnectAndAuthenticate(unIPClient, pvAuthBlob, cubAuthBlobSize, pSteamIDUser);
|
||||||
@ -389,6 +389,7 @@ bool Steam_GameServer::SendUserConnectAndAuthenticate( uint32 unIPClient, const
|
|||||||
|
|
||||||
void Steam_GameServer::SendUserConnectAndAuthenticate( CSteamID steamIDUser, uint32 unIPClient, void *pvAuthBlob, uint32 cubAuthBlobSize )
|
void Steam_GameServer::SendUserConnectAndAuthenticate( CSteamID steamIDUser, uint32 unIPClient, void *pvAuthBlob, uint32 cubAuthBlobSize )
|
||||||
{
|
{
|
||||||
|
PRINT_DEBUG_ENTRY();
|
||||||
SendUserConnectAndAuthenticate(unIPClient, pvAuthBlob, cubAuthBlobSize, NULL);
|
SendUserConnectAndAuthenticate(unIPClient, pvAuthBlob, cubAuthBlobSize, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +399,7 @@ void Steam_GameServer::SendUserConnectAndAuthenticate( CSteamID steamIDUser, uin
|
|||||||
// when this user leaves the server just like you would for a real user.
|
// when this user leaves the server just like you would for a real user.
|
||||||
CSteamID Steam_GameServer::CreateUnauthenticatedUserConnection()
|
CSteamID Steam_GameServer::CreateUnauthenticatedUserConnection()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::CreateUnauthenticatedUserConnection\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
CSteamID bot_id = auth_manager->fakeUser();
|
CSteamID bot_id = auth_manager->fakeUser();
|
||||||
@ -418,7 +419,7 @@ CSteamID Steam_GameServer::CreateUnauthenticatedUserConnection()
|
|||||||
// account being logged into multiple servers, showing who is currently on a server, etc.
|
// account being logged into multiple servers, showing who is currently on a server, etc.
|
||||||
void Steam_GameServer::SendUserDisconnect( CSteamID steamIDUser )
|
void Steam_GameServer::SendUserDisconnect( CSteamID steamIDUser )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SendUserDisconnect\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto player_it = std::find_if(players.begin(), players.end(), [&steamIDUser](std::pair<CSteamID, Gameserver_Player_Info_t>& player)
|
auto player_it = std::find_if(players.begin(), players.end(), [&steamIDUser](std::pair<CSteamID, Gameserver_Player_Info_t>& player)
|
||||||
@ -442,7 +443,7 @@ void Steam_GameServer::SendUserDisconnect( CSteamID steamIDUser )
|
|||||||
// Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player)
|
// Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player)
|
||||||
bool Steam_GameServer::BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore )
|
bool Steam_GameServer::BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::BUpdateUserData %llu %s %u\n", steamIDUser.ConvertToUint64(), pchPlayerName, uScore);
|
PRINT_DEBUG("%llu %s %u", steamIDUser.ConvertToUint64(), pchPlayerName, uScore);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto player_it = std::find_if(players.begin(), players.end(), [&steamIDUser](std::pair<CSteamID, Gameserver_Player_Info_t>& player)
|
auto player_it = std::find_if(players.begin(), players.end(), [&steamIDUser](std::pair<CSteamID, Gameserver_Player_Info_t>& player)
|
||||||
@ -480,7 +481,7 @@ bool Steam_GameServer::BUpdateUserData( CSteamID steamIDUser, const char *pchPla
|
|||||||
bool Steam_GameServer::BSetServerType( uint32 unServerFlags, uint32 unGameIP, uint16 unGamePort,
|
bool Steam_GameServer::BSetServerType( uint32 unServerFlags, uint32 unGameIP, uint16 unGamePort,
|
||||||
uint16 unSpectatorPort, uint16 usQueryPort, const char *pchGameDir, const char *pchVersion, bool bLANMode )
|
uint16 unSpectatorPort, uint16 usQueryPort, const char *pchGameDir, const char *pchVersion, bool bLANMode )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::BSetServerType\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_ip(unGameIP);
|
server_data.set_ip(unGameIP);
|
||||||
server_data.set_port(unGamePort);
|
server_data.set_port(unGamePort);
|
||||||
@ -508,7 +509,7 @@ void Steam_GameServer::UpdateServerStatus( int cPlayers, int cPlayersMax, int cB
|
|||||||
const char *pchServerName, const char *pSpectatorServerName,
|
const char *pchServerName, const char *pSpectatorServerName,
|
||||||
const char *pchMapName )
|
const char *pchMapName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::UpdateServerStatus\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
server_data.set_num_players(cPlayers);
|
server_data.set_num_players(cPlayers);
|
||||||
server_data.set_max_player_count(cPlayersMax);
|
server_data.set_max_player_count(cPlayersMax);
|
||||||
@ -521,7 +522,7 @@ void Steam_GameServer::UpdateServerStatus( int cPlayers, int cPlayersMax, int cB
|
|||||||
// This can be called if spectator goes away or comes back (passing 0 means there is no spectator server now).
|
// 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 )
|
void Steam_GameServer::UpdateSpectatorPort( uint16 unSpectatorPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::UpdateSpectatorPort\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
SetSpectatorPort(unSpectatorPort);
|
SetSpectatorPort(unSpectatorPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,14 +530,14 @@ void Steam_GameServer::UpdateSpectatorPort( uint16 unSpectatorPort )
|
|||||||
// it allows users to filter in the matchmaking/server-browser interfaces based on the value
|
// it allows users to filter in the matchmaking/server-browser interfaces based on the value
|
||||||
void Steam_GameServer::SetGameType( const char *pchGameType )
|
void Steam_GameServer::SetGameType( const char *pchGameType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetGameType\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
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
|
// 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 )
|
bool Steam_GameServer::BGetUserAchievementStatus( CSteamID steamID, const char *pchAchievementName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::BGetUserAchievementStatus\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -548,6 +549,7 @@ bool Steam_GameServer::BGetUserAchievementStatus( CSteamID steamID, const char *
|
|||||||
// pcbTicket retrieves the length of the actual ticket.
|
// pcbTicket retrieves the length of the actual ticket.
|
||||||
HAuthTicket Steam_GameServer::GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket )
|
HAuthTicket Steam_GameServer::GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket )
|
||||||
{
|
{
|
||||||
|
PRINT_DEBUG_ENTRY();
|
||||||
return GetAuthSessionTicket(pTicket, cbMaxTicket, pcbTicket, NULL);
|
return GetAuthSessionTicket(pTicket, cbMaxTicket, pcbTicket, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,7 +557,7 @@ HAuthTicket Steam_GameServer::GetAuthSessionTicket( void *pTicket, int cbMaxTick
|
|||||||
// if an IP address is passed Steam will only allow the ticket to be used by an entity with that IP address
|
// if an IP address is passed Steam will only allow the ticket to be used by an entity with that IP address
|
||||||
HAuthTicket Steam_GameServer::GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket, const SteamNetworkingIdentity *pSnid )
|
HAuthTicket Steam_GameServer::GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket, const SteamNetworkingIdentity *pSnid )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::GetAuthSessionTicket\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pTicket) return k_HAuthTicketInvalid;
|
if (!pTicket) return k_HAuthTicketInvalid;
|
||||||
@ -568,7 +570,7 @@ HAuthTicket Steam_GameServer::GetAuthSessionTicket( void *pTicket, int cbMaxTick
|
|||||||
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
|
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
|
||||||
EBeginAuthSessionResult Steam_GameServer::BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID )
|
EBeginAuthSessionResult Steam_GameServer::BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::BeginAuthSession %i %llu\n", cbAuthTicket, steamID.ConvertToUint64());
|
PRINT_DEBUG("%i %llu", cbAuthTicket, steamID.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
std::pair<CSteamID, Gameserver_Player_Info_t> infos;
|
std::pair<CSteamID, Gameserver_Player_Info_t> infos;
|
||||||
@ -585,7 +587,7 @@ EBeginAuthSessionResult Steam_GameServer::BeginAuthSession( const void *pAuthTic
|
|||||||
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
|
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
|
||||||
void Steam_GameServer::EndAuthSession( CSteamID steamID )
|
void Steam_GameServer::EndAuthSession( CSteamID steamID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::EndAuthSession %llu\n", steamID.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamID.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto player_it = std::find_if(players.begin(), players.end(), [&steamID](std::pair<CSteamID, Gameserver_Player_Info_t>& player)
|
auto player_it = std::find_if(players.begin(), players.end(), [&steamID](std::pair<CSteamID, Gameserver_Player_Info_t>& player)
|
||||||
@ -605,7 +607,7 @@ void Steam_GameServer::EndAuthSession( CSteamID steamID )
|
|||||||
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
|
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
|
||||||
void Steam_GameServer::CancelAuthTicket( HAuthTicket hAuthTicket )
|
void Steam_GameServer::CancelAuthTicket( HAuthTicket hAuthTicket )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::CancelAuthTicket\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auth_manager->cancelTicket(hAuthTicket);
|
auth_manager->cancelTicket(hAuthTicket);
|
||||||
@ -616,7 +618,7 @@ void Steam_GameServer::CancelAuthTicket( HAuthTicket hAuthTicket )
|
|||||||
// to determine if the user owns downloadable content specified by the provided AppID.
|
// to determine if the user owns downloadable content specified by the provided AppID.
|
||||||
EUserHasLicenseForAppResult Steam_GameServer::UserHasLicenseForApp( CSteamID steamID, AppId_t appID )
|
EUserHasLicenseForAppResult Steam_GameServer::UserHasLicenseForApp( CSteamID steamID, AppId_t appID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::UserHasLicenseForApp\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EUserHasLicenseResultHasLicense;
|
return k_EUserHasLicenseResultHasLicense;
|
||||||
}
|
}
|
||||||
@ -626,7 +628,7 @@ EUserHasLicenseForAppResult Steam_GameServer::UserHasLicenseForApp( CSteamID ste
|
|||||||
// returns false if we're not connected to the steam servers and thus cannot ask
|
// returns false if we're not connected to the steam servers and thus cannot ask
|
||||||
bool Steam_GameServer::RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup )
|
bool Steam_GameServer::RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::RequestUserGroupStatus\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -637,14 +639,14 @@ bool Steam_GameServer::RequestUserGroupStatus( CSteamID steamIDUser, CSteamID st
|
|||||||
// they will be removed in a future version of the SDK
|
// they will be removed in a future version of the SDK
|
||||||
void Steam_GameServer::GetGameplayStats( )
|
void Steam_GameServer::GetGameplayStats( )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::GetGameplayStats\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
STEAM_CALL_RESULT( GSReputation_t )
|
STEAM_CALL_RESULT( GSReputation_t )
|
||||||
SteamAPICall_t Steam_GameServer::GetServerReputation()
|
SteamAPICall_t Steam_GameServer::GetServerReputation()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::GetServerReputation\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -655,16 +657,16 @@ SteamAPICall_t Steam_GameServer::GetServerReputation()
|
|||||||
// connect to
|
// connect to
|
||||||
uint32 Steam_GameServer::GetPublicIP_old()
|
uint32 Steam_GameServer::GetPublicIP_old()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::GetPublicIP_old\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
uint32 ip = network->getOwnIP();
|
uint32 ip = network->getOwnIP();
|
||||||
PRINT_DEBUG(" %X\n", ip);
|
PRINT_DEBUG(" %X", ip);
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamIPAddress_t Steam_GameServer::GetPublicIP()
|
SteamIPAddress_t Steam_GameServer::GetPublicIP()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::GetPublicIP\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
SteamIPAddress_t ip = SteamIPAddress_t::IPv4Any();
|
SteamIPAddress_t ip = SteamIPAddress_t::IPv4Any();
|
||||||
ip.m_unIPv4 = GetPublicIP_old();
|
ip.m_unIPv4 = GetPublicIP_old();
|
||||||
return ip;
|
return ip;
|
||||||
@ -672,7 +674,7 @@ SteamIPAddress_t Steam_GameServer::GetPublicIP()
|
|||||||
|
|
||||||
void Steam_GameServer::GetPublicIP_fix(SteamIPAddress_t *out)
|
void Steam_GameServer::GetPublicIP_fix(SteamIPAddress_t *out)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::GetPublicIP_fix\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
if (out) *out = GetPublicIP();
|
if (out) *out = GetPublicIP();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,7 +695,7 @@ void Steam_GameServer::GetPublicIP_fix(SteamIPAddress_t *out)
|
|||||||
// it's for us.
|
// it's for us.
|
||||||
bool Steam_GameServer::HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort )
|
bool Steam_GameServer::HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::HandleIncomingPacket %i %X %i\n", cbData, srcIP, srcPort);
|
PRINT_DEBUG("%i %X %i", cbData, srcIP, srcPort);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_source_query) return true;
|
if (settings->disable_source_query) return true;
|
||||||
|
|
||||||
@ -717,7 +719,7 @@ bool Steam_GameServer::HandleIncomingPacket( const void *pData, int cbData, uint
|
|||||||
// Call this each frame until it returns 0.
|
// Call this each frame until it returns 0.
|
||||||
int Steam_GameServer::GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort )
|
int Steam_GameServer::GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::GetNextOutgoingPacket\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_source_query) return 0;
|
if (settings->disable_source_query) return 0;
|
||||||
if (outgoing_packets.size() == 0) return 0;
|
if (outgoing_packets.size() == 0) return 0;
|
||||||
@ -739,7 +741,7 @@ int Steam_GameServer::GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *p
|
|||||||
// you want it to be active (default: off).
|
// you want it to be active (default: off).
|
||||||
void Steam_GameServer::EnableHeartbeats( bool bActive )
|
void Steam_GameServer::EnableHeartbeats( bool bActive )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::EnableHeartbeats\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Indicate whether you wish to be listed on the master server list
|
/// Indicate whether you wish to be listed on the master server list
|
||||||
@ -752,7 +754,7 @@ void Steam_GameServer::EnableHeartbeats( bool bActive )
|
|||||||
/// the old name was just confusing.)
|
/// the old name was just confusing.)
|
||||||
void Steam_GameServer::SetAdvertiseServerActive( bool bActive )
|
void Steam_GameServer::SetAdvertiseServerActive( bool bActive )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetAdvertiseServerActive\n");
|
PRINT_DEBUG("%i", bActive);
|
||||||
EnableHeartbeats(bActive);
|
EnableHeartbeats(bActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -761,24 +763,24 @@ void Steam_GameServer::SetAdvertiseServerActive( bool bActive )
|
|||||||
// Some mods change this.
|
// Some mods change this.
|
||||||
void Steam_GameServer::SetHeartbeatInterval( int iHeartbeatInterval )
|
void Steam_GameServer::SetHeartbeatInterval( int iHeartbeatInterval )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetHeartbeatInterval\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_GameServer::SetMasterServerHeartbeatInterval_DEPRECATED( int iHeartbeatInterval )
|
void Steam_GameServer::SetMasterServerHeartbeatInterval_DEPRECATED( int iHeartbeatInterval )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::SetMasterServerHeartbeatInterval_DEPRECATED\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Force a heartbeat to steam at the next opportunity
|
// Force a heartbeat to steam at the next opportunity
|
||||||
void Steam_GameServer::ForceHeartbeat()
|
void Steam_GameServer::ForceHeartbeat()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::ForceHeartbeat\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_GameServer::ForceMasterServerHeartbeat_DEPRECATED()
|
void Steam_GameServer::ForceMasterServerHeartbeat_DEPRECATED()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::ForceMasterServerHeartbeat_DEPRECATED\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -786,7 +788,7 @@ void Steam_GameServer::ForceMasterServerHeartbeat_DEPRECATED()
|
|||||||
STEAM_CALL_RESULT( AssociateWithClanResult_t )
|
STEAM_CALL_RESULT( AssociateWithClanResult_t )
|
||||||
SteamAPICall_t Steam_GameServer::AssociateWithClan( CSteamID steamIDClan )
|
SteamAPICall_t Steam_GameServer::AssociateWithClan( CSteamID steamIDClan )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::AssociateWithClan\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -796,7 +798,7 @@ SteamAPICall_t Steam_GameServer::AssociateWithClan( CSteamID steamIDClan )
|
|||||||
STEAM_CALL_RESULT( ComputeNewPlayerCompatibilityResult_t )
|
STEAM_CALL_RESULT( ComputeNewPlayerCompatibilityResult_t )
|
||||||
SteamAPICall_t Steam_GameServer::ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer )
|
SteamAPICall_t Steam_GameServer::ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServer::ComputeNewPlayerCompatibility\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -808,13 +810,13 @@ void Steam_GameServer::RunCallbacks()
|
|||||||
call_servers_disconnected = call_servers_connected = false;
|
call_servers_disconnected = call_servers_connected = false;
|
||||||
|
|
||||||
if (temp_call_servers_connected) {
|
if (temp_call_servers_connected) {
|
||||||
PRINT_DEBUG("Steam_GameServer::SteamServersConnected_t\n");
|
PRINT_DEBUG("SteamServersConnected_t");
|
||||||
SteamServersConnected_t data;
|
SteamServersConnected_t data;
|
||||||
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data), 0.1);
|
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data), 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logged_in && !policy_response_called) {
|
if (logged_in && !policy_response_called) {
|
||||||
PRINT_DEBUG("Steam_GameServer::GSPolicyResponse_t\n");
|
PRINT_DEBUG("GSPolicyResponse_t");
|
||||||
GSPolicyResponse_t data;
|
GSPolicyResponse_t data;
|
||||||
data.m_bSecure = !!(flags & k_unServerFlagSecure);
|
data.m_bSecure = !!(flags & k_unServerFlagSecure);
|
||||||
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data), 0.11);
|
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data), 0.11);
|
||||||
@ -822,7 +824,7 @@ void Steam_GameServer::RunCallbacks()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (logged_in && check_timedout(last_sent_server_info, SEND_SERVER_RATE)) {
|
if (logged_in && check_timedout(last_sent_server_info, SEND_SERVER_RATE)) {
|
||||||
PRINT_DEBUG("Steam_GameServer Sending Gameserver\n");
|
PRINT_DEBUG("Sending Gameserver");
|
||||||
Common_Message msg;
|
Common_Message msg;
|
||||||
msg.set_source_id(settings->get_local_steam_id().ConvertToUint64());
|
msg.set_source_id(settings->get_local_steam_id().ConvertToUint64());
|
||||||
server_data.set_appid(settings->get_local_game_id().AppID());
|
server_data.set_appid(settings->get_local_game_id().AppID());
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
void Steam_GameServerStats::steam_gameserverstats_network_low_level(void *object, Common_Message *msg)
|
void Steam_GameServerStats::steam_gameserverstats_network_low_level(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_GameServerStats::steam_gameserverstats_network_low_level\n");
|
//PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
auto inst = (Steam_GameServerStats *)object;
|
auto inst = (Steam_GameServerStats *)object;
|
||||||
inst->network_callback_low_level(msg);
|
inst->network_callback_low_level(msg);
|
||||||
@ -31,7 +31,7 @@ void Steam_GameServerStats::steam_gameserverstats_network_low_level(void *object
|
|||||||
|
|
||||||
void Steam_GameServerStats::steam_gameserverstats_network_callback(void *object, Common_Message *msg)
|
void Steam_GameServerStats::steam_gameserverstats_network_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_GameServerStats::steam_gameserverstats_network_callback\n");
|
//PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
auto inst = (Steam_GameServerStats *)object;
|
auto inst = (Steam_GameServerStats *)object;
|
||||||
inst->network_callback(msg);
|
inst->network_callback(msg);
|
||||||
@ -39,7 +39,7 @@ void Steam_GameServerStats::steam_gameserverstats_network_callback(void *object,
|
|||||||
|
|
||||||
void Steam_GameServerStats::steam_gameserverstats_run_every_runcb(void *object)
|
void Steam_GameServerStats::steam_gameserverstats_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_GameServerStats::steam_gameserverstats_run_every_runcb\n");
|
//PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
auto inst = (Steam_GameServerStats *)object;
|
auto inst = (Steam_GameServerStats *)object;
|
||||||
inst->steam_run_callback();
|
inst->steam_run_callback();
|
||||||
@ -115,7 +115,7 @@ Steam_GameServerStats::~Steam_GameServerStats()
|
|||||||
STEAM_CALL_RESULT( GSStatsReceived_t )
|
STEAM_CALL_RESULT( GSStatsReceived_t )
|
||||||
SteamAPICall_t Steam_GameServerStats::RequestUserStats( CSteamID steamIDUser )
|
SteamAPICall_t Steam_GameServerStats::RequestUserStats( CSteamID steamIDUser )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServerStats::RequestUserStats %llu\n", (uint64)steamIDUser.ConvertToUint64());
|
PRINT_DEBUG("%llu", (uint64)steamIDUser.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_sharing_stats_with_gameserver) {
|
if (settings->disable_sharing_stats_with_gameserver) {
|
||||||
GSStatsReceived_t data_bad{};
|
GSStatsReceived_t data_bad{};
|
||||||
@ -153,7 +153,7 @@ SteamAPICall_t Steam_GameServerStats::RequestUserStats( CSteamID steamIDUser )
|
|||||||
// requests stat information for a user, usable after a successful call to RequestUserStats()
|
// requests stat information for a user, usable after a successful call to RequestUserStats()
|
||||||
bool Steam_GameServerStats::GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData )
|
bool Steam_GameServerStats::GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServerStats::GetUserStat <int32> %llu '%s' %p\n", (uint64)steamIDUser.ConvertToUint64(), pchName, pData);
|
PRINT_DEBUG("<int32> %llu '%s' %p", (uint64)steamIDUser.ConvertToUint64(), pchName, pData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_sharing_stats_with_gameserver) return false;
|
if (settings->disable_sharing_stats_with_gameserver) return false;
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ bool Steam_GameServerStats::GetUserStat( CSteamID steamIDUser, const char *pchNa
|
|||||||
|
|
||||||
bool Steam_GameServerStats::GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData )
|
bool Steam_GameServerStats::GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServerStats::GetUserStat <float> %llu '%s' %p\n", (uint64)steamIDUser.ConvertToUint64(), pchName, pData);
|
PRINT_DEBUG("<float> %llu '%s' %p", (uint64)steamIDUser.ConvertToUint64(), pchName, pData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_sharing_stats_with_gameserver) return false;
|
if (settings->disable_sharing_stats_with_gameserver) return false;
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ bool Steam_GameServerStats::GetUserStat( CSteamID steamIDUser, const char *pchNa
|
|||||||
|
|
||||||
bool Steam_GameServerStats::GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved )
|
bool Steam_GameServerStats::GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServerStats::GetUserAchievement %llu '%s' %p\n", (uint64)steamIDUser.ConvertToUint64(), pchName, pbAchieved);
|
PRINT_DEBUG("%llu '%s' %p", (uint64)steamIDUser.ConvertToUint64(), pchName, pbAchieved);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_sharing_stats_with_gameserver) return false;
|
if (settings->disable_sharing_stats_with_gameserver) return false;
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ bool Steam_GameServerStats::GetUserAchievement( CSteamID steamIDUser, const char
|
|||||||
// Set the IP range of your official servers on the Steamworks page
|
// Set the IP range of your official servers on the Steamworks page
|
||||||
bool Steam_GameServerStats::SetUserStat( CSteamID steamIDUser, const char *pchName, int32 nData )
|
bool Steam_GameServerStats::SetUserStat( CSteamID steamIDUser, const char *pchName, int32 nData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServerStats::SetUserStat <int32> %llu '%s'=%i\n", (uint64)steamIDUser.ConvertToUint64(), pchName, nData);
|
PRINT_DEBUG("<int32> %llu '%s'=%i", (uint64)steamIDUser.ConvertToUint64(), pchName, nData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_sharing_stats_with_gameserver) return false;
|
if (settings->disable_sharing_stats_with_gameserver) return false;
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ bool Steam_GameServerStats::SetUserStat( CSteamID steamIDUser, const char *pchNa
|
|||||||
|
|
||||||
bool Steam_GameServerStats::SetUserStat( CSteamID steamIDUser, const char *pchName, float fData )
|
bool Steam_GameServerStats::SetUserStat( CSteamID steamIDUser, const char *pchName, float fData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServerStats::SetUserStat <float> %llu '%s'=%f\n", (uint64)steamIDUser.ConvertToUint64(), pchName, fData);
|
PRINT_DEBUG("<float> %llu '%s'=%f", (uint64)steamIDUser.ConvertToUint64(), pchName, fData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_sharing_stats_with_gameserver) return false;
|
if (settings->disable_sharing_stats_with_gameserver) return false;
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ bool Steam_GameServerStats::SetUserStat( CSteamID steamIDUser, const char *pchNa
|
|||||||
|
|
||||||
bool Steam_GameServerStats::UpdateUserAvgRateStat( CSteamID steamIDUser, const char *pchName, float flCountThisSession, double dSessionLength )
|
bool Steam_GameServerStats::UpdateUserAvgRateStat( CSteamID steamIDUser, const char *pchName, float flCountThisSession, double dSessionLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServerStats::UpdateUserAvgRateStat %llu '%s'\n", (uint64)steamIDUser.ConvertToUint64(), pchName);
|
PRINT_DEBUG("%llu '%s'", (uint64)steamIDUser.ConvertToUint64(), pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_sharing_stats_with_gameserver) return false;
|
if (settings->disable_sharing_stats_with_gameserver) return false;
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ bool Steam_GameServerStats::UpdateUserAvgRateStat( CSteamID steamIDUser, const c
|
|||||||
|
|
||||||
bool Steam_GameServerStats::SetUserAchievement( CSteamID steamIDUser, const char *pchName )
|
bool Steam_GameServerStats::SetUserAchievement( CSteamID steamIDUser, const char *pchName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServerStats::SetUserAchievement %llu '%s'\n", (uint64)steamIDUser.ConvertToUint64(), pchName);
|
PRINT_DEBUG("%llu '%s'", (uint64)steamIDUser.ConvertToUint64(), pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_sharing_stats_with_gameserver) return false;
|
if (settings->disable_sharing_stats_with_gameserver) return false;
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ bool Steam_GameServerStats::SetUserAchievement( CSteamID steamIDUser, const char
|
|||||||
|
|
||||||
bool Steam_GameServerStats::ClearUserAchievement( CSteamID steamIDUser, const char *pchName )
|
bool Steam_GameServerStats::ClearUserAchievement( CSteamID steamIDUser, const char *pchName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_GameServerStats::ClearUserAchievement %llu '%s'\n", (uint64)steamIDUser.ConvertToUint64(), pchName);
|
PRINT_DEBUG("%llu '%s'", (uint64)steamIDUser.ConvertToUint64(), pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_sharing_stats_with_gameserver) return false;
|
if (settings->disable_sharing_stats_with_gameserver) return false;
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ STEAM_CALL_RESULT( GSStatsStored_t )
|
|||||||
SteamAPICall_t Steam_GameServerStats::StoreUserStats( CSteamID steamIDUser )
|
SteamAPICall_t Steam_GameServerStats::StoreUserStats( CSteamID steamIDUser )
|
||||||
{
|
{
|
||||||
// it's not necessary to send all data here, we already do that in run_callback() and on each API function call (immediate mode)
|
// it's not necessary to send all data here, we already do that in run_callback() and on each API function call (immediate mode)
|
||||||
PRINT_DEBUG("Steam_GameServerStats::StoreUserStats\n");
|
PRINT_DEBUG("Steam_GameServerStats::StoreUserStats");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (settings->disable_sharing_stats_with_gameserver) {
|
if (settings->disable_sharing_stats_with_gameserver) {
|
||||||
GSStatsStored_t data_bad{};
|
GSStatsStored_t data_bad{};
|
||||||
@ -367,10 +367,7 @@ void Steam_GameServerStats::remove_timedout_userstats_requests()
|
|||||||
data.m_steamIDUser = pendReq.steamIDUser;
|
data.m_steamIDUser = pendReq.steamIDUser;
|
||||||
callback_results->addCallResult(pendReq.steamAPICall, data.k_iCallback, &data, sizeof(data));
|
callback_results->addCallResult(pendReq.steamAPICall, data.k_iCallback, &data, sizeof(data));
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("RequestUserStats timeout, %llu", pendReq.steamIDUser.ConvertToUint64());
|
||||||
"Steam_GameServerStats::steam_run_callback RequestUserStats timeout, %llu\n",
|
|
||||||
pendReq.steamIDUser.ConvertToUint64()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,8 +438,7 @@ void Steam_GameServerStats::collect_and_send_updated_user_stats()
|
|||||||
msg.set_dest_id(user_steamid);
|
msg.set_dest_id(user_steamid);
|
||||||
network->sendTo(&msg, true);
|
network->sendTo(&msg, true);
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("server sent updated stats %llu: %zu stats, %zu achievements",
|
||||||
"Steam_GameServerStats::collect_and_send_updated_user_stats server sent updated stats %llu: %zu stats, %zu achievements\n",
|
|
||||||
user_steamid, updated_stats_msg->user_stats().size(), updated_stats_msg->user_achievements().size()
|
user_steamid, updated_stats_msg->user_stats().size(), updated_stats_msg->user_achievements().size()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -459,14 +455,15 @@ void Steam_GameServerStats::steam_run_callback()
|
|||||||
|
|
||||||
// --- networking callbacks
|
// --- networking callbacks
|
||||||
|
|
||||||
|
// user sent all their stats
|
||||||
void Steam_GameServerStats::network_callback_initial_stats(Common_Message *msg)
|
void Steam_GameServerStats::network_callback_initial_stats(Common_Message *msg)
|
||||||
{
|
{
|
||||||
uint64 user_steamid = msg->source_id();
|
uint64 user_steamid = msg->source_id();
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_GameServerStats::network_callback_initial_stats player sent all their stats %llu\n", user_steamid);
|
PRINT_DEBUG("player sent all their stats %llu", user_steamid);
|
||||||
if (!msg->gameserver_stats_messages().has_initial_user_stats() ||
|
if (!msg->gameserver_stats_messages().has_initial_user_stats() ||
|
||||||
!msg->gameserver_stats_messages().initial_user_stats().has_all_data()) {
|
!msg->gameserver_stats_messages().initial_user_stats().has_all_data()) {
|
||||||
PRINT_DEBUG("Steam_GameServerStats::network_callback_initial_stats error empty msg\n");
|
PRINT_DEBUG("error empty msg");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +478,7 @@ void Steam_GameServerStats::network_callback_initial_stats(Common_Message *msg)
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (pending_RequestUserStats.end() == it) { // timeout and already removed
|
if (pending_RequestUserStats.end() == it) { // timeout and already removed
|
||||||
PRINT_DEBUG("Steam_GameServerStats::network_callback_initial_stats error got all player stats but pending request timedout and removed\n");
|
PRINT_DEBUG("error got all player stats but pending request timedout/removed (doesn't exist)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,21 +504,21 @@ void Steam_GameServerStats::network_callback_initial_stats(Common_Message *msg)
|
|||||||
data.m_steamIDUser = user_steamid;
|
data.m_steamIDUser = user_steamid;
|
||||||
callback_results->addCallResult(it->steamAPICall, data.k_iCallback, &data, sizeof(data));
|
callback_results->addCallResult(it->steamAPICall, data.k_iCallback, &data, sizeof(data));
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("server got all player stats %llu: %zu stats, %zu achievements",
|
||||||
"Steam_GameServerStats::network_callback_initial_stats server got all player stats %llu: %zu stats, %zu achievements\n",
|
|
||||||
user_steamid, all_users_data[user_steamid].stats.size(), all_users_data[user_steamid].achievements.size()
|
user_steamid, all_users_data[user_steamid].stats.size(), all_users_data[user_steamid].achievements.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// user has updated/new stats
|
||||||
void Steam_GameServerStats::network_callback_updated_stats(Common_Message *msg)
|
void Steam_GameServerStats::network_callback_updated_stats(Common_Message *msg)
|
||||||
{
|
{
|
||||||
uint64 user_steamid = msg->source_id();
|
uint64 user_steamid = msg->source_id();
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_GameServerStats::network_callback_updated_stats player sent updated stats %llu\n", user_steamid);
|
PRINT_DEBUG("player sent updated stats %llu", user_steamid);
|
||||||
if (!msg->gameserver_stats_messages().has_update_user_stats()) {
|
if (!msg->gameserver_stats_messages().has_update_user_stats()) {
|
||||||
PRINT_DEBUG("Steam_GameServerStats::network_callback_updated_stats error empty msg\n");
|
PRINT_DEBUG("error empty msg");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,8 +539,7 @@ void Steam_GameServerStats::network_callback_updated_stats(Common_Message *msg)
|
|||||||
current_ach.ach = new_ach.second;
|
current_ach.ach = new_ach.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("got updated user stats %llu: %zu stats, %zu achievements",
|
||||||
"Steam_GameServerStats::network_callback got updated user stats %llu: %zu stats, %zu achievements\n",
|
|
||||||
user_steamid, new_user_data.user_stats().size(), new_user_data.user_achievements().size()
|
user_steamid, new_user_data.user_stats().size(), new_user_data.user_achievements().size()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -567,7 +563,7 @@ void Steam_GameServerStats::network_callback(Common_Message *msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Steam_GameServerStats::network_callback unhandled type %i\n", (int)msg->gameserver_stats_messages().type());
|
PRINT_DEBUG("unhandled type %i", (int)msg->gameserver_stats_messages().type());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -598,19 +594,16 @@ void Steam_GameServerStats::network_callback_low_level(Common_Message *msg)
|
|||||||
data.m_steamIDUser = it_rm->steamIDUser;
|
data.m_steamIDUser = it_rm->steamIDUser;
|
||||||
callback_results->addCallResult(it_rm->steamAPICall, data.k_iCallback, &data, sizeof(data));
|
callback_results->addCallResult(it_rm->steamAPICall, data.k_iCallback, &data, sizeof(data));
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("RequestUserStats timeout, %llu", it_rm->steamIDUser.ConvertToUint64());
|
||||||
"Steam_GameServerStats::network_callback_low_level RequestUserStats timeout, %llu\n",
|
|
||||||
it_rm->steamIDUser.ConvertToUint64()
|
|
||||||
);
|
|
||||||
it_rm = pending_RequestUserStats.erase(it_rm);
|
it_rm = pending_RequestUserStats.erase(it_rm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PRINT_DEBUG("Steam_GameServerStats::network_callback_low_level removed user %llu\n", steamid);
|
// PRINT_DEBUG("removed user %llu", steamid);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Steam_GameServerStats::network_callback_low_level unknown type %i\n", (int)msg->low_level().type());
|
PRINT_DEBUG("unknown type %i", (int)msg->low_level().type());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ Steam_Http_Request *Steam_HTTP::get_request(HTTPRequestHandle hRequest)
|
|||||||
// or such.
|
// or such.
|
||||||
HTTPRequestHandle Steam_HTTP::CreateHTTPRequest( EHTTPMethod eHTTPRequestMethod, const char *pchAbsoluteURL )
|
HTTPRequestHandle Steam_HTTP::CreateHTTPRequest( EHTTPMethod eHTTPRequestMethod, const char *pchAbsoluteURL )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::CreateHTTPRequest %i %s\n", eHTTPRequestMethod, pchAbsoluteURL);
|
PRINT_DEBUG("%i %s", eHTTPRequestMethod, pchAbsoluteURL);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchAbsoluteURL) return INVALID_HTTPREQUEST_HANDLE;
|
if (!pchAbsoluteURL) return INVALID_HTTPREQUEST_HANDLE;
|
||||||
@ -83,7 +83,7 @@ HTTPRequestHandle Steam_HTTP::CreateHTTPRequest( EHTTPMethod eHTTPRequestMethod,
|
|||||||
// sending the request. This is just so the caller can easily keep track of which callbacks go with which request data.
|
// sending the request. This is just so the caller can easily keep track of which callbacks go with which request data.
|
||||||
bool Steam_HTTP::SetHTTPRequestContextValue( HTTPRequestHandle hRequest, uint64 ulContextValue )
|
bool Steam_HTTP::SetHTTPRequestContextValue( HTTPRequestHandle hRequest, uint64 ulContextValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::SetHTTPRequestContextValue\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -101,7 +101,7 @@ bool Steam_HTTP::SetHTTPRequestContextValue( HTTPRequestHandle hRequest, uint64
|
|||||||
// has already been sent.
|
// has already been sent.
|
||||||
bool Steam_HTTP::SetHTTPRequestNetworkActivityTimeout( HTTPRequestHandle hRequest, uint32 unTimeoutSeconds )
|
bool Steam_HTTP::SetHTTPRequestNetworkActivityTimeout( HTTPRequestHandle hRequest, uint32 unTimeoutSeconds )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::SetHTTPRequestNetworkActivityTimeout\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -118,7 +118,7 @@ bool Steam_HTTP::SetHTTPRequestNetworkActivityTimeout( HTTPRequestHandle hReques
|
|||||||
// return false if the handle is invalid or the request is already sent.
|
// return false if the handle is invalid or the request is already sent.
|
||||||
bool Steam_HTTP::SetHTTPRequestHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, const char *pchHeaderValue )
|
bool Steam_HTTP::SetHTTPRequestHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, const char *pchHeaderValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::SetHTTPRequestHeaderValue '%s' = '%s'\n", pchHeaderName, pchHeaderValue);
|
PRINT_DEBUG("'%s'='%s'", pchHeaderName, pchHeaderValue);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchHeaderName || !pchHeaderValue) return false;
|
if (!pchHeaderName || !pchHeaderValue) return false;
|
||||||
@ -141,7 +141,7 @@ bool Steam_HTTP::SetHTTPRequestHeaderValue( HTTPRequestHandle hRequest, const ch
|
|||||||
// handle is invalid or the request is already sent.
|
// handle is invalid or the request is already sent.
|
||||||
bool Steam_HTTP::SetHTTPRequestGetOrPostParameter( HTTPRequestHandle hRequest, const char *pchParamName, const char *pchParamValue )
|
bool Steam_HTTP::SetHTTPRequestGetOrPostParameter( HTTPRequestHandle hRequest, const char *pchParamName, const char *pchParamValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::SetHTTPRequestGetOrPostParameter '%s' = '%s'\n", pchParamName, pchParamValue);
|
PRINT_DEBUG("'%s' = '%s'", pchParamName, pchParamValue);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchParamName || !pchParamValue) return false;
|
if (!pchParamName || !pchParamValue) return false;
|
||||||
@ -163,7 +163,7 @@ bool Steam_HTTP::SetHTTPRequestGetOrPostParameter( HTTPRequestHandle hRequest, c
|
|||||||
|
|
||||||
void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t *pCallHandle)
|
void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t *pCallHandle)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request attempting to download from url: '%s', target filepath: '%s'\n",
|
PRINT_DEBUG("attempting to download from url: '%s', target filepath: '%s'",
|
||||||
request->url.c_str(), request->target_filepath.c_str());
|
request->url.c_str(), request->target_filepath.c_str());
|
||||||
|
|
||||||
const auto send_callresult = [&]() -> void {
|
const auto send_callresult = [&]() -> void {
|
||||||
@ -194,19 +194,19 @@ void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t
|
|||||||
directory_path = ".";
|
directory_path = ".";
|
||||||
file_name = request->target_filepath;
|
file_name = request->target_filepath;
|
||||||
}
|
}
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request directory: '%s', filename '%s'\n", directory_path.c_str(), file_name.c_str());
|
PRINT_DEBUG("directory: '%s', filename '%s'", directory_path.c_str(), file_name.c_str());
|
||||||
Local_Storage::store_file_data(directory_path, file_name, (char *)"", sizeof(""));
|
Local_Storage::store_file_data(directory_path, file_name, (char *)"", sizeof(""));
|
||||||
|
|
||||||
FILE *hfile = std::fopen(request->target_filepath.c_str(), "wb");
|
FILE *hfile = std::fopen(request->target_filepath.c_str(), "wb");
|
||||||
if (!hfile) {
|
if (!hfile) {
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request failed to open file for writing\n");
|
PRINT_DEBUG("failed to open file for writing");
|
||||||
send_callresult();
|
send_callresult();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CURL *chttp = curl_easy_init();
|
CURL *chttp = curl_easy_init();
|
||||||
if (!chttp) {
|
if (!chttp) {
|
||||||
fclose(hfile);
|
fclose(hfile);
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request curl_easy_init() failed\n");
|
PRINT_DEBUG("curl_easy_init() failed");
|
||||||
send_callresult();
|
send_callresult();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t
|
|||||||
std::vector<std::string> headers{};
|
std::vector<std::string> headers{};
|
||||||
for (const auto &hdr : request->headers) {
|
for (const auto &hdr : request->headers) {
|
||||||
std::string new_header = hdr.first + ": " + hdr.second;
|
std::string new_header = hdr.first + ": " + hdr.second;
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request CURL header: '%s'\n", new_header.c_str());
|
PRINT_DEBUG("CURL header: '%s'", new_header.c_str());
|
||||||
headers.push_back(new_header);
|
headers.push_back(new_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,39 +229,39 @@ void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t
|
|||||||
switch (request->request_method)
|
switch (request->request_method)
|
||||||
{
|
{
|
||||||
case EHTTPMethod::k_EHTTPMethodGET:
|
case EHTTPMethod::k_EHTTPMethodGET:
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request CURL method type: GET\n");
|
PRINT_DEBUG("CURL method type: GET");
|
||||||
curl_easy_setopt(chttp, CURLOPT_HTTPGET, 1L);
|
curl_easy_setopt(chttp, CURLOPT_HTTPGET, 1L);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EHTTPMethod::k_EHTTPMethodHEAD:
|
case EHTTPMethod::k_EHTTPMethodHEAD:
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request CURL method type: HEAD\n");
|
PRINT_DEBUG("CURL method type: HEAD");
|
||||||
curl_easy_setopt(chttp, CURLOPT_NOBODY, 1L);
|
curl_easy_setopt(chttp, CURLOPT_NOBODY, 1L);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EHTTPMethod::k_EHTTPMethodPOST:
|
case EHTTPMethod::k_EHTTPMethodPOST:
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request CURL method type: POST\n");
|
PRINT_DEBUG("CURL method type: POST");
|
||||||
curl_easy_setopt(chttp, CURLOPT_POST, 1L);
|
curl_easy_setopt(chttp, CURLOPT_POST, 1L);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EHTTPMethod::k_EHTTPMethodPUT:
|
case EHTTPMethod::k_EHTTPMethodPUT:
|
||||||
PRINT_DEBUG("TODO Steam_HTTP::online_http_request CURL method type: PUT\n");
|
PRINT_DEBUG("TODO CURL method type: PUT");
|
||||||
curl_easy_setopt(chttp, CURLOPT_UPLOAD, 1L); // CURLOPT_PUT "This option is deprecated since version 7.12.1. Use CURLOPT_UPLOAD."
|
curl_easy_setopt(chttp, CURLOPT_UPLOAD, 1L); // CURLOPT_PUT "This option is deprecated since version 7.12.1. Use CURLOPT_UPLOAD."
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EHTTPMethod::k_EHTTPMethodDELETE:
|
case EHTTPMethod::k_EHTTPMethodDELETE:
|
||||||
PRINT_DEBUG("TODO Steam_HTTP::online_http_request CURL method type: DELETE\n");
|
PRINT_DEBUG("TODO CURL method type: DELETE");
|
||||||
headers_list = curl_slist_append(headers_list, "Content-Type: application/x-www-form-urlencoded");
|
headers_list = curl_slist_append(headers_list, "Content-Type: application/x-www-form-urlencoded");
|
||||||
headers_list = curl_slist_append(headers_list, "Accept: application/json,application/x-www-form-urlencoded,text/html,application/xhtml+xml,application/xml");
|
headers_list = curl_slist_append(headers_list, "Accept: application/json,application/x-www-form-urlencoded,text/html,application/xhtml+xml,application/xml");
|
||||||
curl_easy_setopt(chttp, CURLOPT_CUSTOMREQUEST, "DELETE"); // https://stackoverflow.com/a/34751940
|
curl_easy_setopt(chttp, CURLOPT_CUSTOMREQUEST, "DELETE"); // https://stackoverflow.com/a/34751940
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EHTTPMethod::k_EHTTPMethodOPTIONS:
|
case EHTTPMethod::k_EHTTPMethodOPTIONS:
|
||||||
PRINT_DEBUG("TODO Steam_HTTP::online_http_request CURL method type: OPTIONS\n");
|
PRINT_DEBUG("TODO CURL method type: OPTIONS");
|
||||||
curl_easy_setopt(chttp, CURLOPT_CUSTOMREQUEST, "OPTIONS");
|
curl_easy_setopt(chttp, CURLOPT_CUSTOMREQUEST, "OPTIONS");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EHTTPMethod::k_EHTTPMethodPATCH:
|
case EHTTPMethod::k_EHTTPMethodPATCH:
|
||||||
PRINT_DEBUG("TODO Steam_HTTP::online_http_request CURL method type: PATCH\n");
|
PRINT_DEBUG("TODO CURL method type: PATCH");
|
||||||
headers_list = curl_slist_append(headers_list, "Content-Type: application/x-www-form-urlencoded");
|
headers_list = curl_slist_append(headers_list, "Content-Type: application/x-www-form-urlencoded");
|
||||||
headers_list = curl_slist_append(headers_list, "Accept: application/json,application/x-www-form-urlencoded,text/html,application/xhtml+xml,application/xml");
|
headers_list = curl_slist_append(headers_list, "Accept: application/json,application/x-www-form-urlencoded,text/html,application/xhtml+xml,application/xml");
|
||||||
curl_easy_setopt(chttp, CURLOPT_CUSTOMREQUEST, "PATCH");
|
curl_easy_setopt(chttp, CURLOPT_CUSTOMREQUEST, "PATCH");
|
||||||
@ -292,13 +292,13 @@ void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t
|
|||||||
if (post_data.size()) post_data = post_data.substr(0, post_data.size() - 1); // remove the last "&"
|
if (post_data.size()) post_data = post_data.substr(0, post_data.size() - 1); // remove the last "&"
|
||||||
if (request->request_method == EHTTPMethod::k_EHTTPMethodGET) {
|
if (request->request_method == EHTTPMethod::k_EHTTPMethodGET) {
|
||||||
request->url += "?" + post_data;
|
request->url += "?" + post_data;
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request GET URL with params (url-encoded): '%s'\n", request->url.c_str());
|
PRINT_DEBUG("GET URL with params (url-encoded): '%s'", request->url.c_str());
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request POST form data (url-encoded): '%s'\n", post_data.c_str());
|
PRINT_DEBUG("POST form data (url-encoded): '%s'", post_data.c_str());
|
||||||
curl_easy_setopt(chttp, CURLOPT_POSTFIELDS, post_data.c_str());
|
curl_easy_setopt(chttp, CURLOPT_POSTFIELDS, post_data.c_str());
|
||||||
}
|
}
|
||||||
} else if (request->post_raw.size()) {
|
} else if (request->post_raw.size()) {
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request POST form data (raw): '%s'\n", request->post_raw.c_str());
|
PRINT_DEBUG("POST form data (raw): '%s'", request->post_raw.c_str());
|
||||||
curl_easy_setopt(chttp, CURLOPT_POSTFIELDS, request->post_raw.c_str());
|
curl_easy_setopt(chttp, CURLOPT_POSTFIELDS, request->post_raw.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t
|
|||||||
fclose(hfile);
|
fclose(hfile);
|
||||||
headers.clear();
|
headers.clear();
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_HTTP::online_http_request CURL for '%s' error code (0 == OK 0): [%i]\n", request->url.c_str(), (int)res_curl);
|
PRINT_DEBUG("CURL for '%s' error code (0 == OK 0): [%i]", request->url.c_str(), (int)res_curl);
|
||||||
|
|
||||||
unsigned int file_size = file_size_(request->target_filepath);
|
unsigned int file_size = file_size_(request->target_filepath);
|
||||||
if (file_size) {
|
if (file_size) {
|
||||||
@ -330,7 +330,7 @@ void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t
|
|||||||
// header and only do a local cache lookup rather than sending any actual remote request.
|
// header and only do a local cache lookup rather than sending any actual remote request.
|
||||||
bool Steam_HTTP::SendHTTPRequest( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle )
|
bool Steam_HTTP::SendHTTPRequest( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::SendHTTPRequest %u %p\n", hRequest, pCallHandle);
|
PRINT_DEBUG("%u %p", hRequest, pCallHandle);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -367,7 +367,7 @@ bool Steam_HTTP::SendHTTPRequest( HTTPRequestHandle hRequest, SteamAPICall_t *pC
|
|||||||
// HTTPRequestDataReceived_t callbacks while streaming.
|
// HTTPRequestDataReceived_t callbacks while streaming.
|
||||||
bool Steam_HTTP::SendHTTPRequestAndStreamResponse( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle )
|
bool Steam_HTTP::SendHTTPRequestAndStreamResponse( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::SendHTTPRequestAndStreamResponse\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return SendHTTPRequest(hRequest, pCallHandle);
|
return SendHTTPRequest(hRequest, pCallHandle);
|
||||||
@ -378,7 +378,7 @@ bool Steam_HTTP::SendHTTPRequestAndStreamResponse( HTTPRequestHandle hRequest, S
|
|||||||
// the specified request to the tail of the queue. Returns false on invalid handle, or if the request is not yet sent.
|
// the specified request to the tail of the queue. Returns false on invalid handle, or if the request is not yet sent.
|
||||||
bool Steam_HTTP::DeferHTTPRequest( HTTPRequestHandle hRequest )
|
bool Steam_HTTP::DeferHTTPRequest( HTTPRequestHandle hRequest )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::DeferHTTPRequest\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -394,7 +394,7 @@ bool Steam_HTTP::DeferHTTPRequest( HTTPRequestHandle hRequest )
|
|||||||
// the specified request to the head of the queue. Returns false on invalid handle, or if the request is not yet sent.
|
// the specified request to the head of the queue. Returns false on invalid handle, or if the request is not yet sent.
|
||||||
bool Steam_HTTP::PrioritizeHTTPRequest( HTTPRequestHandle hRequest )
|
bool Steam_HTTP::PrioritizeHTTPRequest( HTTPRequestHandle hRequest )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::PrioritizeHTTPRequest\n");
|
PRINT_DEBUG("Steam_HTTP::PrioritizeHTTPRequest");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -411,7 +411,7 @@ bool Steam_HTTP::PrioritizeHTTPRequest( HTTPRequestHandle hRequest )
|
|||||||
// GetHTTPResponseHeaderValue.
|
// GetHTTPResponseHeaderValue.
|
||||||
bool Steam_HTTP::GetHTTPResponseHeaderSize( HTTPRequestHandle hRequest, const char *pchHeaderName, uint32 *unResponseHeaderSize )
|
bool Steam_HTTP::GetHTTPResponseHeaderSize( HTTPRequestHandle hRequest, const char *pchHeaderName, uint32 *unResponseHeaderSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::GetHTTPResponseHeaderSize '%s'\n", pchHeaderName);
|
PRINT_DEBUG("'%s'", pchHeaderName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchHeaderName) return false;
|
if (!pchHeaderName) return false;
|
||||||
@ -433,7 +433,7 @@ bool Steam_HTTP::GetHTTPResponseHeaderSize( HTTPRequestHandle hRequest, const ch
|
|||||||
// BGetHTTPResponseHeaderSize to check for the presence of the header and to find out the size buffer needed.
|
// BGetHTTPResponseHeaderSize to check for the presence of the header and to find out the size buffer needed.
|
||||||
bool Steam_HTTP::GetHTTPResponseHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, uint8 *pHeaderValueBuffer, uint32 unBufferSize )
|
bool Steam_HTTP::GetHTTPResponseHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, uint8 *pHeaderValueBuffer, uint32 unBufferSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::GetHTTPResponseHeaderValue\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchHeaderName) return false;
|
if (!pchHeaderName) return false;
|
||||||
@ -457,7 +457,7 @@ bool Steam_HTTP::GetHTTPResponseHeaderValue( HTTPRequestHandle hRequest, const c
|
|||||||
// handle is invalid.
|
// handle is invalid.
|
||||||
bool Steam_HTTP::GetHTTPResponseBodySize( HTTPRequestHandle hRequest, uint32 *unBodySize )
|
bool Steam_HTTP::GetHTTPResponseBodySize( HTTPRequestHandle hRequest, uint32 *unBodySize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::GetHTTPResponseBodySize\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -475,14 +475,14 @@ bool Steam_HTTP::GetHTTPResponseBodySize( HTTPRequestHandle hRequest, uint32 *un
|
|||||||
// the correct buffer size to use.
|
// the correct buffer size to use.
|
||||||
bool Steam_HTTP::GetHTTPResponseBodyData( HTTPRequestHandle hRequest, uint8 *pBodyDataBuffer, uint32 unBufferSize )
|
bool Steam_HTTP::GetHTTPResponseBodyData( HTTPRequestHandle hRequest, uint8 *pBodyDataBuffer, uint32 unBufferSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::GetHTTPResponseBodyData %p %u\n", pBodyDataBuffer, unBufferSize);
|
PRINT_DEBUG("%p %u", pBodyDataBuffer, unBufferSize);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
if (!request) {
|
if (!request) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PRINT_DEBUG(" Steam_HTTP::GetHTTPResponseBodyData required buffer size = %zu\n", request->response.size());
|
PRINT_DEBUG(" required buffer size = %zu", request->response.size());
|
||||||
if (unBufferSize < request->response.size()) return false;
|
if (unBufferSize < request->response.size()) return false;
|
||||||
if (pBodyDataBuffer) {
|
if (pBodyDataBuffer) {
|
||||||
memset(pBodyDataBuffer, 0, unBufferSize);
|
memset(pBodyDataBuffer, 0, unBufferSize);
|
||||||
@ -497,7 +497,7 @@ bool Steam_HTTP::GetHTTPResponseBodyData( HTTPRequestHandle hRequest, uint8 *pBo
|
|||||||
// do not match the size and offset sent in HTTPRequestDataReceived_t.
|
// do not match the size and offset sent in HTTPRequestDataReceived_t.
|
||||||
bool Steam_HTTP::GetHTTPStreamingResponseBodyData( HTTPRequestHandle hRequest, uint32 cOffset, uint8 *pBodyDataBuffer, uint32 unBufferSize )
|
bool Steam_HTTP::GetHTTPStreamingResponseBodyData( HTTPRequestHandle hRequest, uint32 cOffset, uint8 *pBodyDataBuffer, uint32 unBufferSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::GetHTTPStreamingResponseBodyData\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -518,7 +518,7 @@ bool Steam_HTTP::GetHTTPStreamingResponseBodyData( HTTPRequestHandle hRequest, u
|
|||||||
// callback and finishing using the response.
|
// callback and finishing using the response.
|
||||||
bool Steam_HTTP::ReleaseHTTPRequest( HTTPRequestHandle hRequest )
|
bool Steam_HTTP::ReleaseHTTPRequest( HTTPRequestHandle hRequest )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::ReleaseHTTPRequest\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto c = std::begin(requests);
|
auto c = std::begin(requests);
|
||||||
@ -540,7 +540,7 @@ bool Steam_HTTP::ReleaseHTTPRequest( HTTPRequestHandle hRequest )
|
|||||||
// zero for the duration of the request as the size is unknown until the connection closes.
|
// zero for the duration of the request as the size is unknown until the connection closes.
|
||||||
bool Steam_HTTP::GetHTTPDownloadProgressPct( HTTPRequestHandle hRequest, float *pflPercentOut )
|
bool Steam_HTTP::GetHTTPDownloadProgressPct( HTTPRequestHandle hRequest, float *pflPercentOut )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::GetHTTPDownloadProgressPct\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -557,7 +557,7 @@ bool Steam_HTTP::GetHTTPDownloadProgressPct( HTTPRequestHandle hRequest, float *
|
|||||||
// parameter will set the content-type header for the request so the server may know how to interpret the body.
|
// parameter will set the content-type header for the request so the server may know how to interpret the body.
|
||||||
bool Steam_HTTP::SetHTTPRequestRawPostBody( HTTPRequestHandle hRequest, const char *pchContentType, uint8 *pubBody, uint32 unBodyLen )
|
bool Steam_HTTP::SetHTTPRequestRawPostBody( HTTPRequestHandle hRequest, const char *pchContentType, uint8 *pubBody, uint32 unBodyLen )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::SetHTTPRequestRawPostBody %s\n", pchContentType);
|
PRINT_DEBUG("%s", pchContentType);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -584,7 +584,7 @@ bool Steam_HTTP::SetHTTPRequestRawPostBody( HTTPRequestHandle hRequest, const ch
|
|||||||
// repeat executions of your process.
|
// repeat executions of your process.
|
||||||
HTTPCookieContainerHandle Steam_HTTP::CreateCookieContainer( bool bAllowResponsesToModify )
|
HTTPCookieContainerHandle Steam_HTTP::CreateCookieContainer( bool bAllowResponsesToModify )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_HTTP::CreateCookieContainer\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
static HTTPCookieContainerHandle handle = 0;
|
static HTTPCookieContainerHandle handle = 0;
|
||||||
@ -598,7 +598,7 @@ HTTPCookieContainerHandle Steam_HTTP::CreateCookieContainer( bool bAllowResponse
|
|||||||
// Release a cookie container you are finished using, freeing it's memory
|
// Release a cookie container you are finished using, freeing it's memory
|
||||||
bool Steam_HTTP::ReleaseCookieContainer( HTTPCookieContainerHandle hCookieContainer )
|
bool Steam_HTTP::ReleaseCookieContainer( HTTPCookieContainerHandle hCookieContainer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_HTTP::ReleaseCookieContainer\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -608,7 +608,7 @@ bool Steam_HTTP::ReleaseCookieContainer( HTTPCookieContainerHandle hCookieContai
|
|||||||
// Adds a cookie to the specified cookie container that will be used with future requests.
|
// Adds a cookie to the specified cookie container that will be used with future requests.
|
||||||
bool Steam_HTTP::SetCookie( HTTPCookieContainerHandle hCookieContainer, const char *pchHost, const char *pchUrl, const char *pchCookie )
|
bool Steam_HTTP::SetCookie( HTTPCookieContainerHandle hCookieContainer, const char *pchHost, const char *pchUrl, const char *pchCookie )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_HTTP::SetCookie\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -618,7 +618,7 @@ bool Steam_HTTP::SetCookie( HTTPCookieContainerHandle hCookieContainer, const ch
|
|||||||
// Set the cookie container to use for a HTTP request
|
// Set the cookie container to use for a HTTP request
|
||||||
bool Steam_HTTP::SetHTTPRequestCookieContainer( HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer )
|
bool Steam_HTTP::SetHTTPRequestCookieContainer( HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_HTTP::SetHTTPRequestCookieContainer\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -628,7 +628,7 @@ bool Steam_HTTP::SetHTTPRequestCookieContainer( HTTPRequestHandle hRequest, HTTP
|
|||||||
// Set the extra user agent info for a request, this doesn't clobber the normal user agent, it just adds the extra info on the end
|
// Set the extra user agent info for a request, this doesn't clobber the normal user agent, it just adds the extra info on the end
|
||||||
bool Steam_HTTP::SetHTTPRequestUserAgentInfo( HTTPRequestHandle hRequest, const char *pchUserAgentInfo )
|
bool Steam_HTTP::SetHTTPRequestUserAgentInfo( HTTPRequestHandle hRequest, const char *pchUserAgentInfo )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::SetHTTPRequestUserAgentInfo\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -648,7 +648,7 @@ bool Steam_HTTP::SetHTTPRequestUserAgentInfo( HTTPRequestHandle hRequest, const
|
|||||||
// Set that https request should require verified SSL certificate via machines certificate trust store
|
// Set that https request should require verified SSL certificate via machines certificate trust store
|
||||||
bool Steam_HTTP::SetHTTPRequestRequiresVerifiedCertificate( HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate )
|
bool Steam_HTTP::SetHTTPRequestRequiresVerifiedCertificate( HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::SetHTTPRequestRequiresVerifiedCertificate\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -665,7 +665,7 @@ bool Steam_HTTP::SetHTTPRequestRequiresVerifiedCertificate( HTTPRequestHandle hR
|
|||||||
// which can bump everytime we get more data
|
// which can bump everytime we get more data
|
||||||
bool Steam_HTTP::SetHTTPRequestAbsoluteTimeoutMS( HTTPRequestHandle hRequest, uint32 unMilliseconds )
|
bool Steam_HTTP::SetHTTPRequestAbsoluteTimeoutMS( HTTPRequestHandle hRequest, uint32 unMilliseconds )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::SetHTTPRequestAbsoluteTimeoutMS\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
@ -681,7 +681,7 @@ bool Steam_HTTP::SetHTTPRequestAbsoluteTimeoutMS( HTTPRequestHandle hRequest, ui
|
|||||||
// Check if the reason the request failed was because we timed it out (rather than some harder failure)
|
// Check if the reason the request failed was because we timed it out (rather than some harder failure)
|
||||||
bool Steam_HTTP::GetHTTPRequestWasTimedOut( HTTPRequestHandle hRequest, bool *pbWasTimedOut )
|
bool Steam_HTTP::GetHTTPRequestWasTimedOut( HTTPRequestHandle hRequest, bool *pbWasTimedOut )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_HTTP::GetHTTPRequestWasTimedOut\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_Http_Request *request = get_request(hRequest);
|
Steam_Http_Request *request = get_request(hRequest);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
static void network_callback(void *object, Common_Message *msg)
|
static void network_callback(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("steam_matchmaking_servers_callback\n");
|
PRINT_DEBUG("steam_matchmaking_servers_callback");
|
||||||
|
|
||||||
Steam_Matchmaking_Servers *obj = (Steam_Matchmaking_Servers *)object;
|
Steam_Matchmaking_Servers *obj = (Steam_Matchmaking_Servers *)object;
|
||||||
obj->Callback(msg);
|
obj->Callback(msg);
|
||||||
@ -42,13 +42,13 @@ static int server_list_request = 0;
|
|||||||
|
|
||||||
HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, ISteamMatchmakingServerListResponse *pRequestServersResponse, EMatchMakingType type)
|
HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, ISteamMatchmakingServerListResponse *pRequestServersResponse, EMatchMakingType type)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RequestServerList %u %p, %i\n", iApp, pRequestServersResponse, (int)type);
|
PRINT_DEBUG("%u %p, %i", iApp, pRequestServersResponse, (int)type);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
++server_list_request;
|
++server_list_request;
|
||||||
HServerListRequest id = (char *)0 + server_list_request; // (char *)0 silences the compiler warning
|
HServerListRequest id = (char *)0 + server_list_request; // (char *)0 silences the compiler warning
|
||||||
|
|
||||||
if (settings->matchmaking_server_list_always_lan_type) {
|
if (settings->matchmaking_server_list_always_lan_type) {
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RequestServerList forcing request type to LAN\n");
|
PRINT_DEBUG("forcing request type to LAN");
|
||||||
type = EMatchMakingType::eLANServer;
|
type = EMatchMakingType::eLANServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, IS
|
|||||||
request.type = type;
|
request.type = type;
|
||||||
request.id = id;
|
request.id = id;
|
||||||
requests.push_back(request);
|
requests.push_back(request);
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::request id: %p\n", id);
|
PRINT_DEBUG("id: %p", id);
|
||||||
|
|
||||||
if (type == eLANServer) return id;
|
if (type == eLANServer) return id;
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, IS
|
|||||||
g2.server = server;
|
g2.server = server;
|
||||||
g2.type = type;
|
g2.type = type;
|
||||||
gameservers.push_back(g2);
|
gameservers.push_back(g2);
|
||||||
PRINT_DEBUG(" eFriendsServer SERVER ADDED\n");
|
PRINT_DEBUG(" eFriendsServer SERVER ADDED");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
@ -98,7 +98,7 @@ HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, IS
|
|||||||
file_size = file_size_(file_path);
|
file_size = file_size_(file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::Server list file '%s' [%llu bytes]\n", file_path.c_str(), file_size);
|
PRINT_DEBUG("list file '%s' [%llu bytes]", file_path.c_str(), file_size);
|
||||||
std::string list;
|
std::string list;
|
||||||
if (file_size) {
|
if (file_size) {
|
||||||
list.resize(file_size);
|
list.resize(file_size);
|
||||||
@ -141,7 +141,7 @@ HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, IS
|
|||||||
g.server = server;
|
g.server = server;
|
||||||
g.type = type;
|
g.type = type;
|
||||||
gameservers.push_back(g);
|
gameservers.push_back(g);
|
||||||
PRINT_DEBUG(" SERVER ADDED\n");
|
PRINT_DEBUG(" SERVER ADDED");
|
||||||
|
|
||||||
list_ip = "";
|
list_ip = "";
|
||||||
}
|
}
|
||||||
@ -154,37 +154,37 @@ HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, IS
|
|||||||
// Request object must be released by calling ReleaseRequest( hServerListRequest )
|
// Request object must be released by calling ReleaseRequest( hServerListRequest )
|
||||||
HServerListRequest Steam_Matchmaking_Servers::RequestInternetServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
HServerListRequest Steam_Matchmaking_Servers::RequestInternetServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RequestInternetServerList\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return RequestServerList(iApp, pRequestServersResponse, eInternetServer);
|
return RequestServerList(iApp, pRequestServersResponse, eInternetServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HServerListRequest Steam_Matchmaking_Servers::RequestLANServerList( AppId_t iApp, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
HServerListRequest Steam_Matchmaking_Servers::RequestLANServerList( AppId_t iApp, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RequestLANServerList\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return RequestServerList(iApp, pRequestServersResponse, eLANServer);
|
return RequestServerList(iApp, pRequestServersResponse, eLANServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HServerListRequest Steam_Matchmaking_Servers::RequestFriendsServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
HServerListRequest Steam_Matchmaking_Servers::RequestFriendsServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RequestFriendsServerList\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return RequestServerList(iApp, pRequestServersResponse, eFriendsServer);
|
return RequestServerList(iApp, pRequestServersResponse, eFriendsServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HServerListRequest Steam_Matchmaking_Servers::RequestFavoritesServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
HServerListRequest Steam_Matchmaking_Servers::RequestFavoritesServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RequestFavoritesServerList\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return RequestServerList(iApp, pRequestServersResponse, eFavoritesServer);
|
return RequestServerList(iApp, pRequestServersResponse, eFavoritesServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HServerListRequest Steam_Matchmaking_Servers::RequestHistoryServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
HServerListRequest Steam_Matchmaking_Servers::RequestHistoryServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RequestHistoryServerList\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return RequestServerList(iApp, pRequestServersResponse, eHistoryServer);
|
return RequestServerList(iApp, pRequestServersResponse, eHistoryServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HServerListRequest Steam_Matchmaking_Servers::RequestSpectatorServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
HServerListRequest Steam_Matchmaking_Servers::RequestSpectatorServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RequestSpectatorServerList\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return RequestServerList(iApp, pRequestServersResponse, eSpectatorServer);
|
return RequestServerList(iApp, pRequestServersResponse, eSpectatorServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ HServerListRequest Steam_Matchmaking_Servers::RequestSpectatorServerList( AppId_
|
|||||||
|
|
||||||
void Steam_Matchmaking_Servers::RequestOldServerList(AppId_t iApp, ISteamMatchmakingServerListResponse001 *pRequestServersResponse, EMatchMakingType type)
|
void Steam_Matchmaking_Servers::RequestOldServerList(AppId_t iApp, ISteamMatchmakingServerListResponse001 *pRequestServersResponse, EMatchMakingType type)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RequestOldServerList %u\n", iApp);
|
PRINT_DEBUG("%u", iApp);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto g = std::begin(requests);
|
auto g = std::begin(requests);
|
||||||
while (g != std::end(requests)) {
|
while (g != std::end(requests)) {
|
||||||
@ -216,42 +216,42 @@ void Steam_Matchmaking_Servers::RequestOldServerList(AppId_t iApp, ISteamMatchma
|
|||||||
|
|
||||||
void Steam_Matchmaking_Servers::RequestInternetServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
void Steam_Matchmaking_Servers::RequestInternetServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::%s old\n", __FUNCTION__);
|
PRINT_DEBUG("old");
|
||||||
//TODO
|
//TODO
|
||||||
RequestOldServerList(iApp, pRequestServersResponse, eInternetServer);
|
RequestOldServerList(iApp, pRequestServersResponse, eInternetServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Matchmaking_Servers::RequestLANServerList( AppId_t iApp, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
void Steam_Matchmaking_Servers::RequestLANServerList( AppId_t iApp, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::%s old\n", __FUNCTION__);
|
PRINT_DEBUG("old");
|
||||||
//TODO
|
//TODO
|
||||||
RequestOldServerList(iApp, pRequestServersResponse, eLANServer);
|
RequestOldServerList(iApp, pRequestServersResponse, eLANServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Matchmaking_Servers::RequestFriendsServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
void Steam_Matchmaking_Servers::RequestFriendsServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::%s old\n", __FUNCTION__);
|
PRINT_DEBUG("old");
|
||||||
//TODO
|
//TODO
|
||||||
RequestOldServerList(iApp, pRequestServersResponse, eFriendsServer);
|
RequestOldServerList(iApp, pRequestServersResponse, eFriendsServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Matchmaking_Servers::RequestFavoritesServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
void Steam_Matchmaking_Servers::RequestFavoritesServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::%s old\n", __FUNCTION__);
|
PRINT_DEBUG("old");
|
||||||
//TODO
|
//TODO
|
||||||
RequestOldServerList(iApp, pRequestServersResponse, eFavoritesServer);
|
RequestOldServerList(iApp, pRequestServersResponse, eFavoritesServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Matchmaking_Servers::RequestHistoryServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
void Steam_Matchmaking_Servers::RequestHistoryServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::%s old\n", __FUNCTION__);
|
PRINT_DEBUG("old");
|
||||||
//TODO
|
//TODO
|
||||||
RequestOldServerList(iApp, pRequestServersResponse, eHistoryServer);
|
RequestOldServerList(iApp, pRequestServersResponse, eHistoryServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Matchmaking_Servers::RequestSpectatorServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
void Steam_Matchmaking_Servers::RequestSpectatorServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse001 *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::%s old\n", __FUNCTION__);
|
PRINT_DEBUG("old");
|
||||||
//TODO
|
//TODO
|
||||||
RequestOldServerList(iApp, pRequestServersResponse, eSpectatorServer);
|
RequestOldServerList(iApp, pRequestServersResponse, eSpectatorServer);
|
||||||
}
|
}
|
||||||
@ -261,7 +261,7 @@ void Steam_Matchmaking_Servers::RequestSpectatorServerList( AppId_t iApp, MatchM
|
|||||||
// RefreshComplete callback is not posted when request is released.
|
// RefreshComplete callback is not posted when request is released.
|
||||||
void Steam_Matchmaking_Servers::ReleaseRequest( HServerListRequest hServerListRequest )
|
void Steam_Matchmaking_Servers::ReleaseRequest( HServerListRequest hServerListRequest )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::ReleaseRequest %p\n", hServerListRequest);
|
PRINT_DEBUG("%p", hServerListRequest);
|
||||||
auto g = std::begin(requests);
|
auto g = std::begin(requests);
|
||||||
while (g != std::end(requests)) {
|
while (g != std::end(requests)) {
|
||||||
if (g->id == hServerListRequest) {
|
if (g->id == hServerListRequest) {
|
||||||
@ -350,7 +350,7 @@ void Steam_Matchmaking_Servers::ReleaseRequest( HServerListRequest hServerListRe
|
|||||||
|
|
||||||
void Steam_Matchmaking_Servers::server_details(Gameserver *g, gameserveritem_t *server)
|
void Steam_Matchmaking_Servers::server_details(Gameserver *g, gameserveritem_t *server)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::server_details\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
constexpr const static int MIN_LATENCY = 2;
|
constexpr const static int MIN_LATENCY = 2;
|
||||||
|
|
||||||
int latency = MIN_LATENCY;
|
int latency = MIN_LATENCY;
|
||||||
@ -364,10 +364,10 @@ void Steam_Matchmaking_Servers::server_details(Gameserver *g, gameserveritem_t *
|
|||||||
ip[3] = (g->ip() >> 24) & 0xFF;
|
ip[3] = (g->ip() >> 24) & 0xFF;
|
||||||
snprintf(newip, sizeof(newip), "%d.%d.%d.%d", ip[3], ip[2], ip[1], ip[0]);
|
snprintf(newip, sizeof(newip), "%d.%d.%d.%d", ip[3], ip[2], ip[1], ip[0]);
|
||||||
|
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details connecting to ssq server on %s:%u\n", newip, g->query_port());
|
PRINT_DEBUG(" connecting to ssq server on %s:%u", newip, g->query_port());
|
||||||
SSQ_SERVER *ssq = ssq_server_new(newip, g->query_port());
|
SSQ_SERVER *ssq = ssq_server_new(newip, g->query_port());
|
||||||
if (ssq != NULL && ssq_server_eok(ssq)) {
|
if (ssq != NULL && ssq_server_eok(ssq)) {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details ssq server connection ok\n");
|
PRINT_DEBUG(" ssq server connection ok");
|
||||||
ssq_server_timeout(ssq, (SSQ_TIMEOUT_SELECTOR)(SSQ_TIMEOUT_RECV | SSQ_TIMEOUT_SEND), 1200);
|
ssq_server_timeout(ssq, (SSQ_TIMEOUT_SELECTOR)(SSQ_TIMEOUT_RECV | SSQ_TIMEOUT_SEND), 1200);
|
||||||
|
|
||||||
std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now();
|
std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now();
|
||||||
@ -379,7 +379,7 @@ void Steam_Matchmaking_Servers::server_details(Gameserver *g, gameserveritem_t *
|
|||||||
if (latency < MIN_LATENCY) latency = MIN_LATENCY;
|
if (latency < MIN_LATENCY) latency = MIN_LATENCY;
|
||||||
|
|
||||||
if (ssq_server_eok(ssq)) {
|
if (ssq_server_eok(ssq)) {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details ssq server info ok\n");
|
PRINT_DEBUG(" ssq server info ok");
|
||||||
if (ssq_info_has_steamid(ssq_a2s_info)) g->set_id(ssq_a2s_info->steamid);
|
if (ssq_info_has_steamid(ssq_a2s_info)) g->set_id(ssq_a2s_info->steamid);
|
||||||
g->set_game_description(ssq_a2s_info->game);
|
g->set_game_description(ssq_a2s_info->game);
|
||||||
g->set_mod_dir(ssq_a2s_info->folder);
|
g->set_mod_dir(ssq_a2s_info->folder);
|
||||||
@ -409,12 +409,12 @@ void Steam_Matchmaking_Servers::server_details(Gameserver *g, gameserveritem_t *
|
|||||||
else g->set_appid(ssq_a2s_info->id);
|
else g->set_appid(ssq_a2s_info->id);
|
||||||
g->set_offline(false);
|
g->set_offline(false);
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details ssq server info failed: %s\n", ssq_server_emsg(ssq));
|
PRINT_DEBUG(" ssq server info failed: %s", ssq_server_emsg(ssq));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssq_a2s_info != NULL) ssq_info_free(ssq_a2s_info);
|
if (ssq_a2s_info != NULL) ssq_info_free(ssq_a2s_info);
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details ssq server connection failed: %s\n", (ssq ? ssq_server_emsg(ssq) : "NULL instance"));
|
PRINT_DEBUG(" ssq server connection failed: %s", (ssq ? ssq_server_emsg(ssq) : "NULL instance"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssq != NULL) ssq_server_free(ssq);
|
if (ssq != NULL) ssq_server_free(ssq);
|
||||||
@ -453,7 +453,7 @@ void Steam_Matchmaking_Servers::server_details(Gameserver *g, gameserveritem_t *
|
|||||||
memset(server->m_szGameTags, 0, sizeof(server->m_szGameTags));
|
memset(server->m_szGameTags, 0, sizeof(server->m_szGameTags));
|
||||||
g->tags().copy(server->m_szGameTags, sizeof(server->m_szGameTags) - 1);
|
g->tags().copy(server->m_szGameTags, sizeof(server->m_szGameTags) - 1);
|
||||||
|
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details " "%" PRIu64 "\n", g->id());
|
PRINT_DEBUG(" " "%" PRIu64 "", g->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Matchmaking_Servers::server_details_players(Gameserver *g, Steam_Matchmaking_Servers_Direct_IP_Request *r)
|
void Steam_Matchmaking_Servers::server_details_players(Gameserver *g, Steam_Matchmaking_Servers_Direct_IP_Request *r)
|
||||||
@ -467,43 +467,43 @@ void Steam_Matchmaking_Servers::server_details_players(Gameserver *g, Steam_Matc
|
|||||||
ip[3] = (g->ip() >> 24) & 0xFF;
|
ip[3] = (g->ip() >> 24) & 0xFF;
|
||||||
snprintf(newip, sizeof(newip), "%d.%d.%d.%d", ip[3], ip[2], ip[1], ip[0]);
|
snprintf(newip, sizeof(newip), "%d.%d.%d.%d", ip[3], ip[2], ip[1], ip[0]);
|
||||||
|
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_players connecting to ssq server on %s:%u\n", newip, g->query_port());
|
PRINT_DEBUG(" connecting to ssq server on %s:%u", newip, g->query_port());
|
||||||
SSQ_SERVER *ssq = ssq_server_new(newip, g->query_port());
|
SSQ_SERVER *ssq = ssq_server_new(newip, g->query_port());
|
||||||
if (ssq != NULL && ssq_server_eok(ssq)) {
|
if (ssq != NULL && ssq_server_eok(ssq)) {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_players ssq server connection ok\n");
|
PRINT_DEBUG(" ssq server connection ok");
|
||||||
ssq_server_timeout(ssq, (SSQ_TIMEOUT_SELECTOR)(SSQ_TIMEOUT_RECV | SSQ_TIMEOUT_SEND), 1200);
|
ssq_server_timeout(ssq, (SSQ_TIMEOUT_SELECTOR)(SSQ_TIMEOUT_RECV | SSQ_TIMEOUT_SEND), 1200);
|
||||||
|
|
||||||
uint8_t ssq_a2s_player_count = 0;
|
uint8_t ssq_a2s_player_count = 0;
|
||||||
A2S_PLAYER *ssq_a2s_player = ssq_player(ssq, &ssq_a2s_player_count);
|
A2S_PLAYER *ssq_a2s_player = ssq_player(ssq, &ssq_a2s_player_count);
|
||||||
|
|
||||||
if (ssq_server_eok(ssq)) {
|
if (ssq_server_eok(ssq)) {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_players ssq server players ok\n");
|
PRINT_DEBUG(" ssq server players ok");
|
||||||
for (int i = 0; i < ssq_a2s_player_count; i++) {
|
for (int i = 0; i < ssq_a2s_player_count; i++) {
|
||||||
r->players_response->AddPlayerToList(ssq_a2s_player[i].name, ssq_a2s_player[i].score, ssq_a2s_player[i].duration);
|
r->players_response->AddPlayerToList(ssq_a2s_player[i].name, ssq_a2s_player[i].score, ssq_a2s_player[i].duration);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_players ssq server players failed: %s\n", ssq_server_emsg(ssq));
|
PRINT_DEBUG(" ssq server players failed: %s", ssq_server_emsg(ssq));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssq_a2s_player != NULL) ssq_player_free(ssq_a2s_player, ssq_a2s_player_count);
|
if (ssq_a2s_player != NULL) ssq_player_free(ssq_a2s_player, ssq_a2s_player_count);
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_players ssq server connection failed: %s\n", (ssq ? ssq_server_emsg(ssq) : "NULL instance"));
|
PRINT_DEBUG(" ssq server connection failed: %s", (ssq ? ssq_server_emsg(ssq) : "NULL instance"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssq != NULL) ssq_server_free(ssq);
|
if (ssq != NULL) ssq_server_free(ssq);
|
||||||
} else if (!settings->matchmaking_server_details_via_source_query) { // original behavior
|
} else if (!settings->matchmaking_server_details_via_source_query) { // original behavior
|
||||||
uint32_t number_players = g->num_players();
|
uint32_t number_players = g->num_players();
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_players players: %u\n", number_players);
|
PRINT_DEBUG(" players: %u", number_players);
|
||||||
const auto &players = get_steam_client()->steam_gameserver->get_players();
|
const auto &players = get_steam_client()->steam_gameserver->get_players();
|
||||||
auto player = players->cbegin();
|
auto player = players->cbegin();
|
||||||
for (int i = 0; i < number_players && player != players->end(); ++i, ++player) {
|
for (int i = 0; i < number_players && player != players->end(); ++i, ++player) {
|
||||||
float playtime = static_cast<float>(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - player->second.join_time).count());
|
float playtime = static_cast<float>(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - player->second.join_time).count());
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_players PLAYER [%u] '%s' %u %f\n", i, player->second.name.c_str(), player->second.score, playtime);
|
PRINT_DEBUG(" PLAYER [%u] '%s' %u %f", i, player->second.name.c_str(), player->second.score, playtime);
|
||||||
r->players_response->AddPlayerToList(player->second.name.c_str(), player->second.score, playtime);
|
r->players_response->AddPlayerToList(player->second.name.c_str(), player->second.score, playtime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_players " "%" PRIu64 "\n", g->id());
|
PRINT_DEBUG(" " "%" PRIu64 "", g->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Matchmaking_Servers::server_details_rules(Gameserver *g, Steam_Matchmaking_Servers_Direct_IP_Request *r)
|
void Steam_Matchmaking_Servers::server_details_rules(Gameserver *g, Steam_Matchmaking_Servers_Direct_IP_Request *r)
|
||||||
@ -517,7 +517,7 @@ void Steam_Matchmaking_Servers::server_details_rules(Gameserver *g, Steam_Matchm
|
|||||||
ip[3] = (g->ip() >> 24) & 0xFF;
|
ip[3] = (g->ip() >> 24) & 0xFF;
|
||||||
snprintf(newip, sizeof(newip), "%d.%d.%d.%d", ip[3], ip[2], ip[1], ip[0]);
|
snprintf(newip, sizeof(newip), "%d.%d.%d.%d", ip[3], ip[2], ip[1], ip[0]);
|
||||||
|
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_rules connecting to ssq server on %s:%u\n", newip, g->query_port());
|
PRINT_DEBUG(" connecting to ssq server on %s:%u", newip, g->query_port());
|
||||||
SSQ_SERVER *ssq = ssq_server_new(newip, g->query_port());
|
SSQ_SERVER *ssq = ssq_server_new(newip, g->query_port());
|
||||||
if (ssq != NULL && ssq_server_eok(ssq)) {
|
if (ssq != NULL && ssq_server_eok(ssq)) {
|
||||||
ssq_server_timeout(ssq, (SSQ_TIMEOUT_SELECTOR)(SSQ_TIMEOUT_RECV | SSQ_TIMEOUT_SEND), 1200);
|
ssq_server_timeout(ssq, (SSQ_TIMEOUT_SELECTOR)(SSQ_TIMEOUT_RECV | SSQ_TIMEOUT_SEND), 1200);
|
||||||
@ -526,32 +526,32 @@ void Steam_Matchmaking_Servers::server_details_rules(Gameserver *g, Steam_Matchm
|
|||||||
A2S_RULES *ssq_a2s_rules = ssq_rules(ssq, &ssq_a2s_rules_count);
|
A2S_RULES *ssq_a2s_rules = ssq_rules(ssq, &ssq_a2s_rules_count);
|
||||||
|
|
||||||
if (ssq_server_eok(ssq)) {
|
if (ssq_server_eok(ssq)) {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_rules ssq server rules ok\n");
|
PRINT_DEBUG(" ssq server rules ok");
|
||||||
for (int i = 0; i < ssq_a2s_rules_count; i++) {
|
for (int i = 0; i < ssq_a2s_rules_count; i++) {
|
||||||
r->rules_response->RulesResponded(ssq_a2s_rules[i].name, ssq_a2s_rules[i].value);
|
r->rules_response->RulesResponded(ssq_a2s_rules[i].name, ssq_a2s_rules[i].value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_rules ssq server rules failed: %s\n", ssq_server_emsg(ssq));
|
PRINT_DEBUG(" ssq server rules failed: %s", ssq_server_emsg(ssq));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssq_a2s_rules != NULL) ssq_rules_free(ssq_a2s_rules, ssq_a2s_rules_count);
|
if (ssq_a2s_rules != NULL) ssq_rules_free(ssq_a2s_rules, ssq_a2s_rules_count);
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_rules ssq server connection failed: %s\n", (ssq ? ssq_server_emsg(ssq) : "NULL instance"));
|
PRINT_DEBUG(" ssq server connection failed: %s", (ssq ? ssq_server_emsg(ssq) : "NULL instance"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssq != NULL) ssq_server_free(ssq);
|
if (ssq != NULL) ssq_server_free(ssq);
|
||||||
} else if (!settings->matchmaking_server_details_via_source_query) { // original behavior
|
} else if (!settings->matchmaking_server_details_via_source_query) { // original behavior
|
||||||
int number_rules = (int)g->values().size();
|
int number_rules = (int)g->values().size();
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_rules rules: %i\n", number_rules);
|
PRINT_DEBUG(" rules: %i", number_rules);
|
||||||
auto rule = g->values().begin();
|
auto rule = g->values().begin();
|
||||||
for (int i = 0; i < number_rules; ++i) {
|
for (int i = 0; i < number_rules; ++i) {
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_rules RULE '%s'='%s'\n", rule->first.c_str(), rule->second.c_str());
|
PRINT_DEBUG(" RULE '%s'='%s'", rule->first.c_str(), rule->second.c_str());
|
||||||
r->rules_response->RulesResponded(rule->first.c_str(), rule->second.c_str());
|
r->rules_response->RulesResponded(rule->first.c_str(), rule->second.c_str());
|
||||||
++rule;
|
++rule;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG(" Steam_Matchmaking_Servers::server_details_rules " "%" PRIu64 "\n", g->id());
|
PRINT_DEBUG(" " "%" PRIu64 "", g->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get details on a given server in the list, you can get the valid range of index
|
// Get details on a given server in the list, you can get the valid range of index
|
||||||
@ -559,16 +559,16 @@ void Steam_Matchmaking_Servers::server_details_rules(Gameserver *g, Steam_Matchm
|
|||||||
// ISteamMatchmakingServerListResponse::ServerResponded() callbacks
|
// ISteamMatchmakingServerListResponse::ServerResponded() callbacks
|
||||||
gameserveritem_t *Steam_Matchmaking_Servers::GetServerDetails( HServerListRequest hRequest, int iServer )
|
gameserveritem_t *Steam_Matchmaking_Servers::GetServerDetails( HServerListRequest hRequest, int iServer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::GetServerDetails %p %i\n", hRequest, iServer);
|
PRINT_DEBUG("%p %i", hRequest, iServer);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
std::vector <struct Steam_Matchmaking_Servers_Gameserver> gameservers_filtered;
|
std::vector <struct Steam_Matchmaking_Servers_Gameserver> gameservers_filtered;
|
||||||
auto g = std::begin(requests);
|
auto g = std::begin(requests);
|
||||||
while (g != std::end(requests)) {
|
while (g != std::end(requests)) {
|
||||||
PRINT_DEBUG(" equal? %p %p\n", hRequest, g->id);
|
PRINT_DEBUG(" equal? %p %p", hRequest, g->id);
|
||||||
if (g->id == hRequest) {
|
if (g->id == hRequest) {
|
||||||
gameservers_filtered = g->gameservers_filtered;
|
gameservers_filtered = g->gameservers_filtered;
|
||||||
PRINT_DEBUG(" found %zu\n", gameservers_filtered.size());
|
PRINT_DEBUG(" found %zu", gameservers_filtered.size());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,7 +582,7 @@ gameserveritem_t *Steam_Matchmaking_Servers::GetServerDetails( HServerListReques
|
|||||||
Gameserver *gs = &gameservers_filtered[iServer].server;
|
Gameserver *gs = &gameservers_filtered[iServer].server;
|
||||||
gameserveritem_t *server = new gameserveritem_t(); //TODO: is the new here ok?
|
gameserveritem_t *server = new gameserveritem_t(); //TODO: is the new here ok?
|
||||||
server_details(gs, server);
|
server_details(gs, server);
|
||||||
PRINT_DEBUG(" Returned server details\n");
|
PRINT_DEBUG(" Returned server details");
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,7 +595,7 @@ gameserveritem_t *Steam_Matchmaking_Servers::GetServerDetails( HServerListReques
|
|||||||
// The request handle must be released using ReleaseRequest( hRequest )
|
// The request handle must be released using ReleaseRequest( hRequest )
|
||||||
void Steam_Matchmaking_Servers::CancelQuery( HServerListRequest hRequest )
|
void Steam_Matchmaking_Servers::CancelQuery( HServerListRequest hRequest )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::CancelQuery %p\n", hRequest);
|
PRINT_DEBUG("%p", hRequest);
|
||||||
auto g = std::begin(requests);
|
auto g = std::begin(requests);
|
||||||
while (g != std::end(requests)) {
|
while (g != std::end(requests)) {
|
||||||
if (g->id == hRequest) {
|
if (g->id == hRequest) {
|
||||||
@ -614,14 +614,14 @@ void Steam_Matchmaking_Servers::CancelQuery( HServerListRequest hRequest )
|
|||||||
// is released with ReleaseRequest( hRequest )
|
// is released with ReleaseRequest( hRequest )
|
||||||
void Steam_Matchmaking_Servers::RefreshQuery( HServerListRequest hRequest )
|
void Steam_Matchmaking_Servers::RefreshQuery( HServerListRequest hRequest )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RefreshQuery %p\n", hRequest);
|
PRINT_DEBUG("%p", hRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns true if the list is currently refreshing its server list
|
// Returns true if the list is currently refreshing its server list
|
||||||
bool Steam_Matchmaking_Servers::IsRefreshing( HServerListRequest hRequest )
|
bool Steam_Matchmaking_Servers::IsRefreshing( HServerListRequest hRequest )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::IsRefreshing %p\n", hRequest);
|
PRINT_DEBUG("%p", hRequest);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ bool Steam_Matchmaking_Servers::IsRefreshing( HServerListRequest hRequest )
|
|||||||
// How many servers in the given list, GetServerDetails above takes 0... GetServerCount() - 1
|
// How many servers in the given list, GetServerDetails above takes 0... GetServerCount() - 1
|
||||||
int Steam_Matchmaking_Servers::GetServerCount( HServerListRequest hRequest )
|
int Steam_Matchmaking_Servers::GetServerCount( HServerListRequest hRequest )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::GetServerCount %p\n", hRequest);
|
PRINT_DEBUG("%p", hRequest);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
int size = 0;
|
int size = 0;
|
||||||
auto g = std::begin(requests);
|
auto g = std::begin(requests);
|
||||||
@ -649,7 +649,7 @@ int Steam_Matchmaking_Servers::GetServerCount( HServerListRequest hRequest )
|
|||||||
// Refresh a single server inside of a query (rather than all the servers )
|
// Refresh a single server inside of a query (rather than all the servers )
|
||||||
void Steam_Matchmaking_Servers::RefreshServer( HServerListRequest hRequest, int iServer )
|
void Steam_Matchmaking_Servers::RefreshServer( HServerListRequest hRequest, int iServer )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RefreshServer %p\n", hRequest);
|
PRINT_DEBUG("%p", hRequest);
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,7 +669,7 @@ static HServerQuery new_server_query()
|
|||||||
// Request updated ping time and other details from a single server
|
// Request updated ping time and other details from a single server
|
||||||
HServerQuery Steam_Matchmaking_Servers::PingServer( uint32 unIP, uint16 usPort, ISteamMatchmakingPingResponse *pRequestServersResponse )
|
HServerQuery Steam_Matchmaking_Servers::PingServer( uint32 unIP, uint16 usPort, ISteamMatchmakingPingResponse *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::PingServer %hhu.%hhu.%hhu.%hhu:%hu\n", ((unsigned char *)&unIP)[3], ((unsigned char *)&unIP)[2], ((unsigned char *)&unIP)[1], ((unsigned char *)&unIP)[0], usPort);
|
PRINT_DEBUG("%hhu.%hhu.%hhu.%hhu:%hu", ((unsigned char *)&unIP)[3], ((unsigned char *)&unIP)[2], ((unsigned char *)&unIP)[1], ((unsigned char *)&unIP)[0], usPort);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Steam_Matchmaking_Servers_Direct_IP_Request r;
|
Steam_Matchmaking_Servers_Direct_IP_Request r;
|
||||||
r.id = new_server_query();
|
r.id = new_server_query();
|
||||||
@ -684,7 +684,7 @@ HServerQuery Steam_Matchmaking_Servers::PingServer( uint32 unIP, uint16 usPort,
|
|||||||
// Request the list of players currently playing on a server
|
// Request the list of players currently playing on a server
|
||||||
HServerQuery Steam_Matchmaking_Servers::PlayerDetails( uint32 unIP, uint16 usPort, ISteamMatchmakingPlayersResponse *pRequestServersResponse )
|
HServerQuery Steam_Matchmaking_Servers::PlayerDetails( uint32 unIP, uint16 usPort, ISteamMatchmakingPlayersResponse *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::PlayerDetails %hhu.%hhu.%hhu.%hhu:%hu\n", ((unsigned char *)&unIP)[3], ((unsigned char *)&unIP)[2], ((unsigned char *)&unIP)[1], ((unsigned char *)&unIP)[0], usPort);
|
PRINT_DEBUG("%hhu.%hhu.%hhu.%hhu:%hu", ((unsigned char *)&unIP)[3], ((unsigned char *)&unIP)[2], ((unsigned char *)&unIP)[1], ((unsigned char *)&unIP)[0], usPort);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Steam_Matchmaking_Servers_Direct_IP_Request r;
|
Steam_Matchmaking_Servers_Direct_IP_Request r;
|
||||||
r.id = new_server_query();
|
r.id = new_server_query();
|
||||||
@ -700,7 +700,7 @@ HServerQuery Steam_Matchmaking_Servers::PlayerDetails( uint32 unIP, uint16 usPor
|
|||||||
// Request the list of rules that the server is running (See ISteamGameServer::SetKeyValue() to set the rules server side)
|
// Request the list of rules that the server is running (See ISteamGameServer::SetKeyValue() to set the rules server side)
|
||||||
HServerQuery Steam_Matchmaking_Servers::ServerRules( uint32 unIP, uint16 usPort, ISteamMatchmakingRulesResponse *pRequestServersResponse )
|
HServerQuery Steam_Matchmaking_Servers::ServerRules( uint32 unIP, uint16 usPort, ISteamMatchmakingRulesResponse *pRequestServersResponse )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::ServerRules %hhu.%hhu.%hhu.%hhu:%hu\n", ((unsigned char *)&unIP)[3], ((unsigned char *)&unIP)[2], ((unsigned char *)&unIP)[1], ((unsigned char *)&unIP)[0], usPort);
|
PRINT_DEBUG("%hhu.%hhu.%hhu.%hhu:%hu", ((unsigned char *)&unIP)[3], ((unsigned char *)&unIP)[2], ((unsigned char *)&unIP)[1], ((unsigned char *)&unIP)[0], usPort);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Steam_Matchmaking_Servers_Direct_IP_Request r;
|
Steam_Matchmaking_Servers_Direct_IP_Request r;
|
||||||
r.id = new_server_query();
|
r.id = new_server_query();
|
||||||
@ -718,7 +718,7 @@ HServerQuery Steam_Matchmaking_Servers::ServerRules( uint32 unIP, uint16 usPort,
|
|||||||
// to one of the above calls to avoid crashing when callbacks occur.
|
// to one of the above calls to avoid crashing when callbacks occur.
|
||||||
void Steam_Matchmaking_Servers::CancelServerQuery( HServerQuery hServerQuery )
|
void Steam_Matchmaking_Servers::CancelServerQuery( HServerQuery hServerQuery )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::CancelServerQuery\n");
|
PRINT_DEBUG("Steam_Matchmaking_Servers::CancelServerQuery");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto r = std::find_if(direct_ip_requests.begin(), direct_ip_requests.end(), [&hServerQuery](Steam_Matchmaking_Servers_Direct_IP_Request const& item) { return item.id == hServerQuery; });
|
auto r = std::find_if(direct_ip_requests.begin(), direct_ip_requests.end(), [&hServerQuery](Steam_Matchmaking_Servers_Direct_IP_Request const& item) { return item.id == hServerQuery; });
|
||||||
if (direct_ip_requests.end() == r) return;
|
if (direct_ip_requests.end() == r) return;
|
||||||
@ -727,37 +727,37 @@ void Steam_Matchmaking_Servers::CancelServerQuery( HServerQuery hServerQuery )
|
|||||||
|
|
||||||
void Steam_Matchmaking_Servers::RunCallbacks()
|
void Steam_Matchmaking_Servers::RunCallbacks()
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_Matchmaking_Servers::RunCallbacks\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
{
|
{
|
||||||
auto g = std::begin(gameservers);
|
auto g = std::begin(gameservers);
|
||||||
while (g != std::end(gameservers)) {
|
while (g != std::end(gameservers)) {
|
||||||
if (check_timedout(g->last_recv, SERVER_TIMEOUT)) {
|
if (check_timedout(g->last_recv, SERVER_TIMEOUT)) {
|
||||||
g = gameservers.erase(g);
|
g = gameservers.erase(g);
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::SERVER TIMEOUT\n");
|
PRINT_DEBUG("TIMEOUT");
|
||||||
} else {
|
} else {
|
||||||
++g;
|
++g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::RunCallbacks requests count = %zu, servers count = %zu\n", requests.size(), gameservers.size());
|
PRINT_DEBUG("requests count = %zu, servers count = %zu", requests.size(), gameservers.size());
|
||||||
|
|
||||||
for (auto &r : requests) {
|
for (auto &r : requests) {
|
||||||
if (r.cancelled || r.completed) continue;
|
if (r.cancelled || r.completed) continue;
|
||||||
|
|
||||||
r.gameservers_filtered.clear();
|
r.gameservers_filtered.clear();
|
||||||
for (auto &g : gameservers) {
|
for (auto &g : gameservers) {
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::game_server_check %u==%u | %i==%i\n", g.server.appid(), r.appid, (int)g.type, (int)r.type);
|
PRINT_DEBUG("%u==%u | %i==%i", g.server.appid(), r.appid, (int)g.type, (int)r.type);
|
||||||
if ((g.server.appid() == r.appid) && (g.type == r.type)) {
|
if ((g.server.appid() == r.appid) && (g.type == r.type)) {
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::REQUESTS server found\n");
|
PRINT_DEBUG("server found");
|
||||||
r.gameservers_filtered.push_back(g);
|
r.gameservers_filtered.push_back(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector <struct Steam_Matchmaking_Request> requests_temp(requests);
|
std::vector <struct Steam_Matchmaking_Request> requests_temp(requests);
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::REQUESTS_TEMP %zu\n", requests_temp.size());
|
PRINT_DEBUG("%zu", requests_temp.size());
|
||||||
for (auto &r : requests) {
|
for (auto &r : requests) {
|
||||||
r.completed = true;
|
r.completed = true;
|
||||||
}
|
}
|
||||||
@ -768,7 +768,7 @@ void Steam_Matchmaking_Servers::RunCallbacks()
|
|||||||
|
|
||||||
if (r.callbacks) {
|
if (r.callbacks) {
|
||||||
for (auto &g : r.gameservers_filtered) {
|
for (auto &g : r.gameservers_filtered) {
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::REQUESTS server responded cb %p\n", r.id);
|
PRINT_DEBUG("server responded cb %p", r.id);
|
||||||
r.callbacks->ServerResponded(r.id, i);
|
r.callbacks->ServerResponded(r.id, i);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@ -782,7 +782,7 @@ void Steam_Matchmaking_Servers::RunCallbacks()
|
|||||||
|
|
||||||
if (r.old_callbacks) {
|
if (r.old_callbacks) {
|
||||||
for (auto &g : r.gameservers_filtered) {
|
for (auto &g : r.gameservers_filtered) {
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::old REQUESTS server responded cb %p\n", r.id);
|
PRINT_DEBUG("REQUESTS server responded cb %p", r.id);
|
||||||
r.old_callbacks->ServerResponded(i);
|
r.old_callbacks->ServerResponded(i);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@ -807,9 +807,9 @@ void Steam_Matchmaking_Servers::RunCallbacks()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto &r : direct_ip_requests_temp) {
|
for (auto &r : direct_ip_requests_temp) {
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::dip request: %u:%hu\n", r.ip, r.port);
|
PRINT_DEBUG("request: %u:%hu", r.ip, r.port);
|
||||||
for (auto &g : gameservers) {
|
for (auto &g : gameservers) {
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::server: %u:%u\n", g.server.ip(), g.server.query_port());
|
PRINT_DEBUG("%u:%u", g.server.ip(), g.server.query_port());
|
||||||
uint16 query_port = g.server.query_port();
|
uint16 query_port = g.server.query_port();
|
||||||
if (query_port == 0xFFFF) {
|
if (query_port == 0xFFFF) {
|
||||||
query_port = g.server.port();
|
query_port = g.server.port();
|
||||||
@ -846,7 +846,7 @@ void Steam_Matchmaking_Servers::RunCallbacks()
|
|||||||
void Steam_Matchmaking_Servers::Callback(Common_Message *msg)
|
void Steam_Matchmaking_Servers::Callback(Common_Message *msg)
|
||||||
{
|
{
|
||||||
if (msg->has_gameserver() && msg->gameserver().type() != eFriendsServer) {
|
if (msg->has_gameserver() && msg->gameserver().type() != eFriendsServer) {
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers got SERVER " "%" PRIu64 ", offline:%u\n", msg->gameserver().id(), msg->gameserver().offline());
|
PRINT_DEBUG("got SERVER " "%" PRIu64 ", offline:%u", msg->gameserver().id(), msg->gameserver().offline());
|
||||||
if (msg->gameserver().offline()) {
|
if (msg->gameserver().offline()) {
|
||||||
for (auto &g : gameservers) {
|
for (auto &g : gameservers) {
|
||||||
if (g.server.id() == msg->gameserver().id()) {
|
if (g.server.id() == msg->gameserver().id()) {
|
||||||
@ -873,13 +873,13 @@ void Steam_Matchmaking_Servers::Callback(Common_Message *msg)
|
|||||||
g.server.set_ip(msg->source_ip());
|
g.server.set_ip(msg->source_ip());
|
||||||
g.type = eLANServer;
|
g.type = eLANServer;
|
||||||
gameservers.push_back(g);
|
gameservers.push_back(g);
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers::SERVER ADDED\n");
|
PRINT_DEBUG("ADDED");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->has_gameserver() && msg->gameserver().type() == eFriendsServer) {
|
if (msg->has_gameserver() && msg->gameserver().type() == eFriendsServer) {
|
||||||
PRINT_DEBUG("Steam_Matchmaking_Servers got eFriendsServer SERVER " "%" PRIu64 "\n", msg->gameserver().id());
|
PRINT_DEBUG("got eFriendsServer SERVER " "%" PRIu64 "", msg->gameserver().id());
|
||||||
bool addserver = true;
|
bool addserver = true;
|
||||||
for (auto &g : gameservers_friends) {
|
for (auto &g : gameservers_friends) {
|
||||||
if (g.source_id == msg->source_id()) {
|
if (g.source_id == msg->source_id()) {
|
||||||
|
@ -36,20 +36,20 @@ void Steam_Music::change_playstate(int new_playing)
|
|||||||
|
|
||||||
bool Steam_Music::BIsEnabled()
|
bool Steam_Music::BIsEnabled()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Music::BIsEnabled\n");
|
PRINT_DEBUG_TODO();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_Music::BIsPlaying()
|
bool Steam_Music::BIsPlaying()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Music::BIsPlaying\n");
|
PRINT_DEBUG_TODO();
|
||||||
return playing > 0;
|
return playing > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AudioPlayback_Status Steam_Music::GetPlaybackStatus()
|
AudioPlayback_Status Steam_Music::GetPlaybackStatus()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Music::GetPlaybackStatus\n");
|
PRINT_DEBUG_TODO();
|
||||||
if (playing == 0) {
|
if (playing == 0) {
|
||||||
return AudioPlayback_Idle;
|
return AudioPlayback_Idle;
|
||||||
}
|
}
|
||||||
@ -67,25 +67,25 @@ AudioPlayback_Status Steam_Music::GetPlaybackStatus()
|
|||||||
|
|
||||||
void Steam_Music::Play()
|
void Steam_Music::Play()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Music::Play\n");
|
PRINT_DEBUG_TODO();
|
||||||
change_playstate(2);
|
change_playstate(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Music::Pause()
|
void Steam_Music::Pause()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Music::Pause\n");
|
PRINT_DEBUG_TODO();
|
||||||
change_playstate(1);
|
change_playstate(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Music::PlayPrevious()
|
void Steam_Music::PlayPrevious()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Music::PlayPrevious\n");
|
PRINT_DEBUG_TODO();
|
||||||
change_playstate(2);
|
change_playstate(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Music::PlayNext()
|
void Steam_Music::PlayNext()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Music::PlayNext\n");
|
PRINT_DEBUG_TODO();
|
||||||
change_playstate(2);
|
change_playstate(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ void Steam_Music::PlayNext()
|
|||||||
// volume is between 0.0 and 1.0
|
// volume is between 0.0 and 1.0
|
||||||
void Steam_Music::SetVolume( float flVolume )
|
void Steam_Music::SetVolume( float flVolume )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Music::SetVolume\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
|
||||||
if (flVolume > 1.0)
|
if (flVolume > 1.0)
|
||||||
flVolume = 1.0;
|
flVolume = 1.0;
|
||||||
@ -111,6 +111,6 @@ void Steam_Music::SetVolume( float flVolume )
|
|||||||
|
|
||||||
float Steam_Music::GetVolume()
|
float Steam_Music::GetVolume()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Music::GetVolume\n");
|
PRINT_DEBUG_TODO();
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
@ -20,38 +20,38 @@
|
|||||||
// Service Definition
|
// Service Definition
|
||||||
bool Steam_MusicRemote::RegisterSteamMusicRemote( const char *pchName )
|
bool Steam_MusicRemote::RegisterSteamMusicRemote( const char *pchName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::DeregisterSteamMusicRemote()
|
bool Steam_MusicRemote::DeregisterSteamMusicRemote()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::BIsCurrentMusicRemote()
|
bool Steam_MusicRemote::BIsCurrentMusicRemote()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::BActivationSuccess( bool bValue )
|
bool Steam_MusicRemote::BActivationSuccess( bool bValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Steam_MusicRemote::SetDisplayName( const char *pchDisplayName )
|
bool Steam_MusicRemote::SetDisplayName( const char *pchDisplayName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::SetPNGIcon_64x64( void *pvBuffer, uint32 cbBufferLength )
|
bool Steam_MusicRemote::SetPNGIcon_64x64( void *pvBuffer, uint32 cbBufferLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,37 +59,37 @@ bool Steam_MusicRemote::SetPNGIcon_64x64( void *pvBuffer, uint32 cbBufferLength
|
|||||||
// Abilities for the user interface
|
// Abilities for the user interface
|
||||||
bool Steam_MusicRemote::EnablePlayPrevious(bool bValue)
|
bool Steam_MusicRemote::EnablePlayPrevious(bool bValue)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::EnablePlayNext( bool bValue )
|
bool Steam_MusicRemote::EnablePlayNext( bool bValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::EnableShuffled( bool bValue )
|
bool Steam_MusicRemote::EnableShuffled( bool bValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::EnableLooped( bool bValue )
|
bool Steam_MusicRemote::EnableLooped( bool bValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::EnableQueue( bool bValue )
|
bool Steam_MusicRemote::EnableQueue( bool bValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::EnablePlaylists( bool bValue )
|
bool Steam_MusicRemote::EnablePlaylists( bool bValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,25 +97,25 @@ bool Steam_MusicRemote::EnablePlaylists( bool bValue )
|
|||||||
// Status
|
// Status
|
||||||
bool Steam_MusicRemote::UpdatePlaybackStatus( AudioPlayback_Status nStatus )
|
bool Steam_MusicRemote::UpdatePlaybackStatus( AudioPlayback_Status nStatus )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::UpdateShuffled( bool bValue )
|
bool Steam_MusicRemote::UpdateShuffled( bool bValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::UpdateLooped( bool bValue )
|
bool Steam_MusicRemote::UpdateLooped( bool bValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::UpdateVolume( float flValue )
|
bool Steam_MusicRemote::UpdateVolume( float flValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// volume is between 0.0 and 1.0
|
// volume is between 0.0 and 1.0
|
||||||
@ -123,37 +123,37 @@ bool Steam_MusicRemote::UpdateVolume( float flValue )
|
|||||||
// Current Entry
|
// Current Entry
|
||||||
bool Steam_MusicRemote::CurrentEntryWillChange()
|
bool Steam_MusicRemote::CurrentEntryWillChange()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::CurrentEntryIsAvailable( bool bAvailable )
|
bool Steam_MusicRemote::CurrentEntryIsAvailable( bool bAvailable )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::UpdateCurrentEntryText( const char *pchText )
|
bool Steam_MusicRemote::UpdateCurrentEntryText( const char *pchText )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::UpdateCurrentEntryElapsedSeconds( int nValue )
|
bool Steam_MusicRemote::UpdateCurrentEntryElapsedSeconds( int nValue )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::UpdateCurrentEntryCoverArt( void *pvBuffer, uint32 cbBufferLength )
|
bool Steam_MusicRemote::UpdateCurrentEntryCoverArt( void *pvBuffer, uint32 cbBufferLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::CurrentEntryDidChange()
|
bool Steam_MusicRemote::CurrentEntryDidChange()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,31 +161,31 @@ bool Steam_MusicRemote::CurrentEntryDidChange()
|
|||||||
// Queue
|
// Queue
|
||||||
bool Steam_MusicRemote::QueueWillChange()
|
bool Steam_MusicRemote::QueueWillChange()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::ResetQueueEntries()
|
bool Steam_MusicRemote::ResetQueueEntries()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::SetQueueEntry( int nID, int nPosition, const char *pchEntryText )
|
bool Steam_MusicRemote::SetQueueEntry( int nID, int nPosition, const char *pchEntryText )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::SetCurrentQueueEntry( int nID )
|
bool Steam_MusicRemote::SetCurrentQueueEntry( int nID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::QueueDidChange()
|
bool Steam_MusicRemote::QueueDidChange()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,30 +193,30 @@ bool Steam_MusicRemote::QueueDidChange()
|
|||||||
// Playlist
|
// Playlist
|
||||||
bool Steam_MusicRemote::PlaylistWillChange()
|
bool Steam_MusicRemote::PlaylistWillChange()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::ResetPlaylistEntries()
|
bool Steam_MusicRemote::ResetPlaylistEntries()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::SetPlaylistEntry( int nID, int nPosition, const char *pchEntryText )
|
bool Steam_MusicRemote::SetPlaylistEntry( int nID, int nPosition, const char *pchEntryText )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::SetCurrentPlaylistEntry( int nID )
|
bool Steam_MusicRemote::SetCurrentPlaylistEntry( int nID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_MusicRemote::PlaylistDidChange()
|
bool Steam_MusicRemote::PlaylistDidChange()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__);
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -19,38 +19,38 @@
|
|||||||
|
|
||||||
bool Steam_Parental::BIsParentalLockEnabled()
|
bool Steam_Parental::BIsParentalLockEnabled()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Parental::BIsParentalLockEnabled\n");
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_Parental::BIsParentalLockLocked()
|
bool Steam_Parental::BIsParentalLockLocked()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Parental::BIsParentalLockLocked\n");
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Steam_Parental::BIsAppBlocked( AppId_t nAppID )
|
bool Steam_Parental::BIsAppBlocked( AppId_t nAppID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Parental::BIsAppBlocked\n");
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_Parental::BIsAppInBlockList( AppId_t nAppID )
|
bool Steam_Parental::BIsAppInBlockList( AppId_t nAppID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Parental::BIsAppInBlockList\n");
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Steam_Parental::BIsFeatureBlocked( EParentalFeature eFeature )
|
bool Steam_Parental::BIsFeatureBlocked( EParentalFeature eFeature )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Parental::BIsFeatureBlocked\n");
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_Parental::BIsFeatureInBlockList( EParentalFeature eFeature )
|
bool Steam_Parental::BIsFeatureInBlockList( EParentalFeature eFeature )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Parental::BIsFeatureInBlockList\n");
|
PRINT_DEBUG_TODO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -25,15 +25,20 @@ Steam_Screenshots::Steam_Screenshots(class Local_Storage* local_storage, class S
|
|||||||
|
|
||||||
ScreenshotHandle Steam_Screenshots::create_screenshot_handle()
|
ScreenshotHandle Steam_Screenshots::create_screenshot_handle()
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
static ScreenshotHandle handle = 100;
|
static ScreenshotHandle handle = 100;
|
||||||
return handle++;
|
|
||||||
|
++handle;
|
||||||
|
if (handle < 100) handle = 100;
|
||||||
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes a screenshot to the user's screenshot library given the raw image data, which must be in RGB format.
|
// Writes a screenshot to the user's screenshot library given the raw image data, which must be in RGB format.
|
||||||
// The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
|
// The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
|
||||||
ScreenshotHandle Steam_Screenshots::WriteScreenshot( void *pubRGB, uint32 cubRGB, int nWidth, int nHeight )
|
ScreenshotHandle Steam_Screenshots::WriteScreenshot( void *pubRGB, uint32 cubRGB, int nWidth, int nHeight )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Screenshots::WriteScreenshot\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
char buff[128];
|
char buff[128];
|
||||||
auto now = std::chrono::system_clock::now();
|
auto now = std::chrono::system_clock::now();
|
||||||
@ -60,7 +65,8 @@ ScreenshotHandle Steam_Screenshots::WriteScreenshot( void *pubRGB, uint32 cubRGB
|
|||||||
// JPEG, TGA, and PNG formats are supported.
|
// JPEG, TGA, and PNG formats are supported.
|
||||||
ScreenshotHandle Steam_Screenshots::AddScreenshotToLibrary( const char *pchFilename, const char *pchThumbnailFilename, int nWidth, int nHeight )
|
ScreenshotHandle Steam_Screenshots::AddScreenshotToLibrary( const char *pchFilename, const char *pchThumbnailFilename, int nWidth, int nHeight )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Screenshots::AddScreenshotToLibrary\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (pchFilename == nullptr)
|
if (pchFilename == nullptr)
|
||||||
return INVALID_SCREENSHOT_HANDLE;
|
return INVALID_SCREENSHOT_HANDLE;
|
||||||
@ -91,15 +97,13 @@ ScreenshotHandle Steam_Screenshots::AddScreenshotToLibrary( const char *pchFilen
|
|||||||
// Causes the Steam overlay to take a screenshot. If screenshots are being hooked by the game then a ScreenshotRequested_t callback is sent back to the game instead.
|
// Causes the Steam overlay to take a screenshot. If screenshots are being hooked by the game then a ScreenshotRequested_t callback is sent back to the game instead.
|
||||||
void Steam_Screenshots::TriggerScreenshot()
|
void Steam_Screenshots::TriggerScreenshot()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Screenshots::TriggerScreenshot\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (hooked)
|
if (hooked) {
|
||||||
{
|
|
||||||
ScreenshotRequested_t data;
|
ScreenshotRequested_t data;
|
||||||
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
PRINT_DEBUG(" TODO: Make the overlay take a screenshot");
|
PRINT_DEBUG(" TODO: Make the overlay take a screenshot");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,7 +114,8 @@ void Steam_Screenshots::TriggerScreenshot()
|
|||||||
// in response.
|
// in response.
|
||||||
void Steam_Screenshots::HookScreenshots( bool bHook )
|
void Steam_Screenshots::HookScreenshots( bool bHook )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Screenshots::HookScreenshots\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
hooked = bHook;
|
hooked = bHook;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,11 +123,11 @@ void Steam_Screenshots::HookScreenshots( bool bHook )
|
|||||||
// Sets metadata about a screenshot's location (for example, the name of the map)
|
// Sets metadata about a screenshot's location (for example, the name of the map)
|
||||||
bool Steam_Screenshots::SetLocation( ScreenshotHandle hScreenshot, const char *pchLocation )
|
bool Steam_Screenshots::SetLocation( ScreenshotHandle hScreenshot, const char *pchLocation )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Screenshots::SetLocation\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto it = _screenshots.find(hScreenshot);
|
auto it = _screenshots.find(hScreenshot);
|
||||||
if (it == _screenshots.end())
|
if (it == _screenshots.end()) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
it->second.metadatas["locations"].push_back(pchLocation);
|
it->second.metadatas["locations"].push_back(pchLocation);
|
||||||
local_storage->write_json_file(Local_Storage::screenshots_folder, it->second.screenshot_name + ".json", it->second.metadatas);
|
local_storage->write_json_file(Local_Storage::screenshots_folder, it->second.screenshot_name + ".json", it->second.metadatas);
|
||||||
@ -134,11 +139,11 @@ bool Steam_Screenshots::SetLocation( ScreenshotHandle hScreenshot, const char *p
|
|||||||
// Tags a user as being visible in the screenshot
|
// Tags a user as being visible in the screenshot
|
||||||
bool Steam_Screenshots::TagUser( ScreenshotHandle hScreenshot, CSteamID steamID )
|
bool Steam_Screenshots::TagUser( ScreenshotHandle hScreenshot, CSteamID steamID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Screenshots::TagUser\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto it = _screenshots.find(hScreenshot);
|
auto it = _screenshots.find(hScreenshot);
|
||||||
if (it == _screenshots.end())
|
if (it == _screenshots.end()) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
it->second.metadatas["users"].push_back(uint64_t(steamID.ConvertToUint64()));
|
it->second.metadatas["users"].push_back(uint64_t(steamID.ConvertToUint64()));
|
||||||
local_storage->write_json_file(Local_Storage::screenshots_folder, it->second.screenshot_name + ".json", it->second.metadatas);
|
local_storage->write_json_file(Local_Storage::screenshots_folder, it->second.screenshot_name + ".json", it->second.metadatas);
|
||||||
@ -150,11 +155,11 @@ bool Steam_Screenshots::TagUser( ScreenshotHandle hScreenshot, CSteamID steamID
|
|||||||
// Tags a published file as being visible in the screenshot
|
// Tags a published file as being visible in the screenshot
|
||||||
bool Steam_Screenshots::TagPublishedFile( ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID )
|
bool Steam_Screenshots::TagPublishedFile( ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Screenshots::TagPublishedFile\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto it = _screenshots.find(hScreenshot);
|
auto it = _screenshots.find(hScreenshot);
|
||||||
if (it == _screenshots.end())
|
if (it == _screenshots.end()) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
it->second.metadatas["published_files"].push_back(uint64_t(unPublishedFileID));
|
it->second.metadatas["published_files"].push_back(uint64_t(unPublishedFileID));
|
||||||
local_storage->write_json_file(Local_Storage::screenshots_folder, it->second.screenshot_name + ".json", it->second.metadatas);
|
local_storage->write_json_file(Local_Storage::screenshots_folder, it->second.screenshot_name + ".json", it->second.metadatas);
|
||||||
@ -166,7 +171,9 @@ bool Steam_Screenshots::TagPublishedFile( ScreenshotHandle hScreenshot, Publishe
|
|||||||
// Returns true if the app has hooked the screenshot
|
// Returns true if the app has hooked the screenshot
|
||||||
bool Steam_Screenshots::IsScreenshotsHooked()
|
bool Steam_Screenshots::IsScreenshotsHooked()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Screenshots::IsScreenshotsHooked\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return hooked;
|
return hooked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +185,9 @@ bool Steam_Screenshots::IsScreenshotsHooked()
|
|||||||
// JPEG, TGA, and PNG formats are supported.
|
// JPEG, TGA, and PNG formats are supported.
|
||||||
ScreenshotHandle Steam_Screenshots::AddVRScreenshotToLibrary( EVRScreenshotType eType, const char *pchFilename, const char *pchVRFilename )
|
ScreenshotHandle Steam_Screenshots::AddVRScreenshotToLibrary( EVRScreenshotType eType, const char *pchFilename, const char *pchVRFilename )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Screenshots::AddVRScreenshotToLibrary\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
return INVALID_SCREENSHOT_HANDLE;
|
return INVALID_SCREENSHOT_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,14 +175,13 @@ std::vector<Steam_Leaderboard_Entry> Steam_User_Stats::load_leaderboard_entries(
|
|||||||
++i; // move past this score detail
|
++i; // move past this score detail
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("'%s': user %llu, score %i, details count = %zu",
|
||||||
"Steam_User_Stats::load_leaderboard_entries '%s': user %llu, score %i, details count = %zu\n",
|
|
||||||
name.c_str(), new_entry.steam_id.ConvertToUint64(), new_entry.score, new_entry.score_details.size()
|
name.c_str(), new_entry.steam_id.ConvertToUint64(), new_entry.score, new_entry.score_details.size()
|
||||||
);
|
);
|
||||||
out.push_back(new_entry);
|
out.push_back(new_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_User_Stats::load_leaderboard_entries '%s' total entries = %zu\n", name.c_str(), out.size());
|
PRINT_DEBUG("'%s' total entries = %zu", name.c_str(), out.size());
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +190,7 @@ void Steam_User_Stats::save_my_leaderboard_entry(const Steam_Leaderboard &leader
|
|||||||
auto my_entry = leaderboard.find_recent_entry(settings->get_local_steam_id());
|
auto my_entry = leaderboard.find_recent_entry(settings->get_local_steam_id());
|
||||||
if (!my_entry) return; // we don't have a score entry
|
if (!my_entry) return; // we don't have a score entry
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_User_Stats::save_my_leaderboard_entry saving entries for leaderboard '%s'\n", leaderboard.name.c_str());
|
PRINT_DEBUG("saving entries for leaderboard '%s'", leaderboard.name.c_str());
|
||||||
|
|
||||||
std::vector<uint32_t> output{};
|
std::vector<uint32_t> output{};
|
||||||
|
|
||||||
@ -225,7 +224,7 @@ Steam_Leaderboard_Entry* Steam_User_Stats::update_leaderboard_entry(Steam_Leader
|
|||||||
if (added) { // if we added a new entry then we have to sort and find the target entry again
|
if (added) { // if we added a new entry then we have to sort and find the target entry again
|
||||||
leaderboard.sort_entries();
|
leaderboard.sort_entries();
|
||||||
user_entry = leaderboard.find_recent_entry(entry.steam_id);
|
user_entry = leaderboard.find_recent_entry(entry.steam_id);
|
||||||
PRINT_DEBUG("Steam_User_Stats::update_leaderboard_entry added/updated entry for user %llu\n", entry.steam_id.ConvertToUint64());
|
PRINT_DEBUG("added/updated entry for user %llu", entry.steam_id.ConvertToUint64());
|
||||||
}
|
}
|
||||||
|
|
||||||
return user_entry;
|
return user_entry;
|
||||||
@ -248,7 +247,7 @@ unsigned int Steam_User_Stats::cache_leaderboard_ifneeded(const std::string &nam
|
|||||||
{
|
{
|
||||||
unsigned int board_handle = find_cached_leaderboard(name);
|
unsigned int board_handle = find_cached_leaderboard(name);
|
||||||
if (board_handle) return board_handle;
|
if (board_handle) return board_handle;
|
||||||
// PRINT_DEBUG("Steam_User_Stats::cache_leaderboard_ifneeded cache miss '%s'\n", name.c_str());
|
// PRINT_DEBUG("cache miss '%s'", name.c_str());
|
||||||
|
|
||||||
// create a new entry in-memory and try reading the entries from disk
|
// create a new entry in-memory and try reading the entries from disk
|
||||||
struct Steam_Leaderboard new_board{};
|
struct Steam_Leaderboard new_board{};
|
||||||
@ -264,8 +263,7 @@ unsigned int Steam_User_Stats::cache_leaderboard_ifneeded(const std::string &nam
|
|||||||
cached_leaderboards.push_back(new_board);
|
cached_leaderboards.push_back(new_board);
|
||||||
board_handle = cached_leaderboards.size();
|
board_handle = cached_leaderboards.size();
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("cached a new leaderboard '%s' %i %i",
|
||||||
"Steam_User_Stats::cache_leaderboard_ifneeded cached a new leaderboard '%s' %i %i\n",
|
|
||||||
new_board.name.c_str(), (int)eLeaderboardSortMethod, (int)eLeaderboardDisplayType
|
new_board.name.c_str(), (int)eLeaderboardSortMethod, (int)eLeaderboardDisplayType
|
||||||
);
|
);
|
||||||
return board_handle;
|
return board_handle;
|
||||||
@ -332,7 +330,7 @@ void Steam_User_Stats::request_user_leaderboard_entry(const Steam_Leaderboard &b
|
|||||||
// change stats/achievements without sending back to server
|
// change stats/achievements without sending back to server
|
||||||
bool Steam_User_Stats::clear_stats_internal()
|
bool Steam_User_Stats::clear_stats_internal()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::clear_stats_internal\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
bool notify_server = false;
|
bool notify_server = false;
|
||||||
|
|
||||||
@ -395,7 +393,7 @@ bool Steam_User_Stats::clear_stats_internal()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: PRINT_DEBUG("Steam_User_Stats::clear_stats_internal unhandled type %i\n", (int)stat.second.type); break;
|
default: PRINT_DEBUG("unhandled type %i", (int)stat.second.type); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,7 +402,7 @@ bool Steam_User_Stats::clear_stats_internal()
|
|||||||
|
|
||||||
Steam_User_Stats::InternalSetResult<int32> Steam_User_Stats::set_stat_internal( const char *pchName, int32 nData )
|
Steam_User_Stats::InternalSetResult<int32> Steam_User_Stats::set_stat_internal( const char *pchName, int32 nData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::set_stat_internal <int32> '%s' = %i\n", pchName, nData);
|
PRINT_DEBUG("<int32> '%s' = %i", pchName, nData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Steam_User_Stats::InternalSetResult<int32> result{};
|
Steam_User_Stats::InternalSetResult<int32> result{};
|
||||||
|
|
||||||
@ -448,7 +446,7 @@ Steam_User_Stats::InternalSetResult<int32> Steam_User_Stats::set_stat_internal(
|
|||||||
|
|
||||||
Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo::Stat_Type, float>> Steam_User_Stats::set_stat_internal( const char *pchName, float fData )
|
Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo::Stat_Type, float>> Steam_User_Stats::set_stat_internal( const char *pchName, float fData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::set_stat_internal <float> '%s' = %f\n", pchName, fData);
|
PRINT_DEBUG("<float> '%s' = %f", pchName, fData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo::Stat_Type, float>> result{};
|
Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo::Stat_Type, float>> result{};
|
||||||
|
|
||||||
@ -493,7 +491,7 @@ Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo
|
|||||||
|
|
||||||
Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo::Stat_Type, float>> Steam_User_Stats::update_avg_rate_stat_internal( const char *pchName, float flCountThisSession, double dSessionLength )
|
Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo::Stat_Type, float>> Steam_User_Stats::update_avg_rate_stat_internal( const char *pchName, float flCountThisSession, double dSessionLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::update_avg_rate_stat_internal %s\n", pchName);
|
PRINT_DEBUG("%s", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo::Stat_Type, float>> result{};
|
Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo::Stat_Type, float>> result{};
|
||||||
|
|
||||||
@ -539,7 +537,7 @@ Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo
|
|||||||
|
|
||||||
Steam_User_Stats::InternalSetResult<bool> Steam_User_Stats::set_achievement_internal( const char *pchName )
|
Steam_User_Stats::InternalSetResult<bool> Steam_User_Stats::set_achievement_internal( const char *pchName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::set_achievement_internal '%s'\n", pchName);
|
PRINT_DEBUG("'%s'", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Steam_User_Stats::InternalSetResult<bool> result{};
|
Steam_User_Stats::InternalSetResult<bool> result{};
|
||||||
|
|
||||||
@ -585,7 +583,7 @@ Steam_User_Stats::InternalSetResult<bool> Steam_User_Stats::set_achievement_inte
|
|||||||
|
|
||||||
Steam_User_Stats::InternalSetResult<bool> Steam_User_Stats::clear_achievement_internal( const char *pchName )
|
Steam_User_Stats::InternalSetResult<bool> Steam_User_Stats::clear_achievement_internal( const char *pchName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::clear_achievement_internal '%s'\n", pchName);
|
PRINT_DEBUG("'%s'", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Steam_User_Stats::InternalSetResult<bool> result{};
|
Steam_User_Stats::InternalSetResult<bool> result{};
|
||||||
|
|
||||||
@ -628,7 +626,7 @@ Steam_User_Stats::InternalSetResult<bool> Steam_User_Stats::clear_achievement_in
|
|||||||
|
|
||||||
void Steam_User_Stats::steam_user_stats_network_low_level(void *object, Common_Message *msg)
|
void Steam_User_Stats::steam_user_stats_network_low_level(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_User_Stats::steam_user_stats_network_low_level\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
auto inst = (Steam_User_Stats *)object;
|
auto inst = (Steam_User_Stats *)object;
|
||||||
inst->network_callback_low_level(msg);
|
inst->network_callback_low_level(msg);
|
||||||
@ -636,7 +634,7 @@ void Steam_User_Stats::steam_user_stats_network_low_level(void *object, Common_M
|
|||||||
|
|
||||||
void Steam_User_Stats::steam_user_stats_network_stats(void *object, Common_Message *msg)
|
void Steam_User_Stats::steam_user_stats_network_stats(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_User_Stats::steam_user_stats_network_stats\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
auto inst = (Steam_User_Stats *)object;
|
auto inst = (Steam_User_Stats *)object;
|
||||||
inst->network_callback_stats(msg);
|
inst->network_callback_stats(msg);
|
||||||
@ -644,7 +642,7 @@ void Steam_User_Stats::steam_user_stats_network_stats(void *object, Common_Messa
|
|||||||
|
|
||||||
void Steam_User_Stats::steam_user_stats_network_leaderboards(void *object, Common_Message *msg)
|
void Steam_User_Stats::steam_user_stats_network_leaderboards(void *object, Common_Message *msg)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_User_Stats::steam_user_stats_network_leaderboards\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
auto inst = (Steam_User_Stats *)object;
|
auto inst = (Steam_User_Stats *)object;
|
||||||
inst->network_callback_leaderboards(msg);
|
inst->network_callback_leaderboards(msg);
|
||||||
@ -652,7 +650,7 @@ void Steam_User_Stats::steam_user_stats_network_leaderboards(void *object, Commo
|
|||||||
|
|
||||||
void Steam_User_Stats::steam_user_stats_run_every_runcb(void *object)
|
void Steam_User_Stats::steam_user_stats_run_every_runcb(void *object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("Steam_User_Stats::steam_user_stats_run_every_runcb\n");
|
// PRINT_DEBUG_ENTRY();
|
||||||
|
|
||||||
auto inst = (Steam_User_Stats *)object;
|
auto inst = (Steam_User_Stats *)object;
|
||||||
inst->steam_run_callback();
|
inst->steam_run_callback();
|
||||||
@ -741,7 +739,7 @@ Steam_User_Stats::~Steam_User_Stats()
|
|||||||
STEAM_CALL_BACK( UserStatsReceived_t )
|
STEAM_CALL_BACK( UserStatsReceived_t )
|
||||||
bool Steam_User_Stats::RequestCurrentStats()
|
bool Steam_User_Stats::RequestCurrentStats()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::RequestCurrentStats\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
UserStatsReceived_t data{};
|
UserStatsReceived_t data{};
|
||||||
@ -756,7 +754,7 @@ bool Steam_User_Stats::RequestCurrentStats()
|
|||||||
// Data accessors
|
// Data accessors
|
||||||
bool Steam_User_Stats::GetStat( const char *pchName, int32 *pData )
|
bool Steam_User_Stats::GetStat( const char *pchName, int32 *pData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetStat <int32> '%s' %p\n", pchName, pData);
|
PRINT_DEBUG("<int32> '%s' %p", pchName, pData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchName) return false;
|
if (!pchName) return false;
|
||||||
@ -788,7 +786,7 @@ bool Steam_User_Stats::GetStat( const char *pchName, int32 *pData )
|
|||||||
|
|
||||||
bool Steam_User_Stats::GetStat( const char *pchName, float *pData )
|
bool Steam_User_Stats::GetStat( const char *pchName, float *pData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetStat <float> '%s' %p\n", pchName, pData);
|
PRINT_DEBUG("<float> '%s' %p", pchName, pData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchName) return false;
|
if (!pchName) return false;
|
||||||
@ -822,7 +820,7 @@ bool Steam_User_Stats::GetStat( const char *pchName, float *pData )
|
|||||||
// Set / update data
|
// Set / update data
|
||||||
bool Steam_User_Stats::SetStat( const char *pchName, int32 nData )
|
bool Steam_User_Stats::SetStat( const char *pchName, int32 nData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::SetStat <int32> '%s' = %i\n", pchName, nData);
|
PRINT_DEBUG("<int32> '%s' = %i", pchName, nData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto ret = set_stat_internal(pchName, nData );
|
auto ret = set_stat_internal(pchName, nData );
|
||||||
@ -839,7 +837,7 @@ bool Steam_User_Stats::SetStat( const char *pchName, int32 nData )
|
|||||||
|
|
||||||
bool Steam_User_Stats::SetStat( const char *pchName, float fData )
|
bool Steam_User_Stats::SetStat( const char *pchName, float fData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::SetStat <float> '%s' = %f\n", pchName, fData);
|
PRINT_DEBUG("<float> '%s' = %f", pchName, fData);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto ret = set_stat_internal(pchName, fData);
|
auto ret = set_stat_internal(pchName, fData);
|
||||||
@ -856,7 +854,7 @@ bool Steam_User_Stats::SetStat( const char *pchName, float fData )
|
|||||||
|
|
||||||
bool Steam_User_Stats::UpdateAvgRateStat( const char *pchName, float flCountThisSession, double dSessionLength )
|
bool Steam_User_Stats::UpdateAvgRateStat( const char *pchName, float flCountThisSession, double dSessionLength )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::UpdateAvgRateStat '%s'\n", pchName);
|
PRINT_DEBUG("'%s'", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto ret = update_avg_rate_stat_internal(pchName, flCountThisSession, dSessionLength);
|
auto ret = update_avg_rate_stat_internal(pchName, flCountThisSession, dSessionLength);
|
||||||
@ -875,7 +873,7 @@ bool Steam_User_Stats::UpdateAvgRateStat( const char *pchName, float flCountThis
|
|||||||
// Achievement flag accessors
|
// Achievement flag accessors
|
||||||
bool Steam_User_Stats::GetAchievement( const char *pchName, bool *pbAchieved )
|
bool Steam_User_Stats::GetAchievement( const char *pchName, bool *pbAchieved )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetAchievement '%s'\n", pchName);
|
PRINT_DEBUG("'%s'", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchName) return false;
|
if (!pchName) return false;
|
||||||
@ -904,7 +902,7 @@ bool Steam_User_Stats::GetAchievement( const char *pchName, bool *pbAchieved )
|
|||||||
|
|
||||||
bool Steam_User_Stats::SetAchievement( const char *pchName )
|
bool Steam_User_Stats::SetAchievement( const char *pchName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::SetAchievement '%s'\n", pchName);
|
PRINT_DEBUG("'%s'", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto ret = set_achievement_internal(pchName);
|
auto ret = set_achievement_internal(pchName);
|
||||||
@ -920,7 +918,7 @@ bool Steam_User_Stats::SetAchievement( const char *pchName )
|
|||||||
|
|
||||||
bool Steam_User_Stats::ClearAchievement( const char *pchName )
|
bool Steam_User_Stats::ClearAchievement( const char *pchName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::ClearAchievement '%s'\n", pchName);
|
PRINT_DEBUG("'%s'", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto ret = clear_achievement_internal(pchName);
|
auto ret = clear_achievement_internal(pchName);
|
||||||
@ -940,7 +938,7 @@ bool Steam_User_Stats::ClearAchievement( const char *pchName )
|
|||||||
// began tracking achievement unlock times (December 2009). Time is seconds since January 1, 1970.
|
// began tracking achievement unlock times (December 2009). Time is seconds since January 1, 1970.
|
||||||
bool Steam_User_Stats::GetAchievementAndUnlockTime( const char *pchName, bool *pbAchieved, uint32 *punUnlockTime )
|
bool Steam_User_Stats::GetAchievementAndUnlockTime( const char *pchName, bool *pbAchieved, uint32 *punUnlockTime )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetAchievementAndUnlockTime\n");
|
PRINT_DEBUG("'%s'", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchName) return false;
|
if (!pchName) return false;
|
||||||
@ -977,7 +975,7 @@ bool Steam_User_Stats::GetAchievementAndUnlockTime( const char *pchName, bool *p
|
|||||||
bool Steam_User_Stats::StoreStats()
|
bool Steam_User_Stats::StoreStats()
|
||||||
{
|
{
|
||||||
// no need to exchange data with gameserver, we already do that in run_callback() and on each stat/ach update (immediate mode)
|
// no need to exchange data with gameserver, we already do that in run_callback() and on each stat/ach update (immediate mode)
|
||||||
PRINT_DEBUG("Steam_User_Stats::StoreStats\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
UserStatsStored_t data{};
|
UserStatsStored_t data{};
|
||||||
@ -997,7 +995,7 @@ bool Steam_User_Stats::StoreStats()
|
|||||||
// specified achievement.
|
// specified achievement.
|
||||||
int Steam_User_Stats::GetAchievementIcon( const char *pchName )
|
int Steam_User_Stats::GetAchievementIcon( const char *pchName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_User_Stats::GetAchievementIcon\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchName) return 0;
|
if (!pchName) return 0;
|
||||||
|
|
||||||
@ -1032,7 +1030,7 @@ std::string Steam_User_Stats::get_achievement_icon_name( const char *pchName, bo
|
|||||||
// - "hidden" for retrieving if an achievement is hidden (returns "0" when not hidden, "1" when hidden)
|
// - "hidden" for retrieving if an achievement is hidden (returns "0" when not hidden, "1" when hidden)
|
||||||
const char * Steam_User_Stats::GetAchievementDisplayAttribute( const char *pchName, const char *pchKey )
|
const char * Steam_User_Stats::GetAchievementDisplayAttribute( const char *pchName, const char *pchKey )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetAchievementDisplayAttribute [%s] [%s]\n", pchName, pchKey);
|
PRINT_DEBUG("[%s] [%s]", pchName, pchKey);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchName || !pchKey || !pchKey[0]) return "";
|
if (!pchName || !pchKey || !pchKey[0]) return "";
|
||||||
@ -1065,7 +1063,7 @@ const char * Steam_User_Stats::GetAchievementDisplayAttribute( const char *pchNa
|
|||||||
// Calling this w/ N out of N progress will NOT set the achievement, the game must still do that.
|
// Calling this w/ N out of N progress will NOT set the achievement, the game must still do that.
|
||||||
bool Steam_User_Stats::IndicateAchievementProgress( const char *pchName, uint32 nCurProgress, uint32 nMaxProgress )
|
bool Steam_User_Stats::IndicateAchievementProgress( const char *pchName, uint32 nCurProgress, uint32 nMaxProgress )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::IndicateAchievementProgress %s\n", pchName);
|
PRINT_DEBUG("%s", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchName) return false;
|
if (!pchName) return false;
|
||||||
@ -1121,7 +1119,7 @@ bool Steam_User_Stats::IndicateAchievementProgress( const char *pchName, uint32
|
|||||||
// list of existing achievements compiled into them
|
// list of existing achievements compiled into them
|
||||||
uint32 Steam_User_Stats::GetNumAchievements()
|
uint32 Steam_User_Stats::GetNumAchievements()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetNumAchievements\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return (uint32)defined_achievements.size();
|
return (uint32)defined_achievements.size();
|
||||||
}
|
}
|
||||||
@ -1129,7 +1127,7 @@ uint32 Steam_User_Stats::GetNumAchievements()
|
|||||||
// Get achievement name iAchievement in [0,GetNumAchievements)
|
// Get achievement name iAchievement in [0,GetNumAchievements)
|
||||||
const char * Steam_User_Stats::GetAchievementName( uint32 iAchievement )
|
const char * Steam_User_Stats::GetAchievementName( uint32 iAchievement )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetAchievementName\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (iAchievement >= sorted_achievement_names.size()) {
|
if (iAchievement >= sorted_achievement_names.size()) {
|
||||||
return "";
|
return "";
|
||||||
@ -1148,7 +1146,7 @@ const char * Steam_User_Stats::GetAchievementName( uint32 iAchievement )
|
|||||||
STEAM_CALL_RESULT( UserStatsReceived_t )
|
STEAM_CALL_RESULT( UserStatsReceived_t )
|
||||||
SteamAPICall_t Steam_User_Stats::RequestUserStats( CSteamID steamIDUser )
|
SteamAPICall_t Steam_User_Stats::RequestUserStats( CSteamID steamIDUser )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::RequestUserStats %llu\n", steamIDUser.ConvertToUint64());
|
PRINT_DEBUG("%llu", steamIDUser.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
// Enable this to allow hot reload achievements status
|
// Enable this to allow hot reload achievements status
|
||||||
@ -1168,7 +1166,7 @@ SteamAPICall_t Steam_User_Stats::RequestUserStats( CSteamID steamIDUser )
|
|||||||
// requests stat information for a user, usable after a successful call to RequestUserStats()
|
// requests stat information for a user, usable after a successful call to RequestUserStats()
|
||||||
bool Steam_User_Stats::GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData )
|
bool Steam_User_Stats::GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetUserStat %s %llu\n", pchName, steamIDUser.ConvertToUint64());
|
PRINT_DEBUG("%s %llu", pchName, steamIDUser.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchName) return false;
|
if (!pchName) return false;
|
||||||
@ -1184,7 +1182,7 @@ bool Steam_User_Stats::GetUserStat( CSteamID steamIDUser, const char *pchName, i
|
|||||||
|
|
||||||
bool Steam_User_Stats::GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData )
|
bool Steam_User_Stats::GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetUserStat %s %llu\n", pchName, steamIDUser.ConvertToUint64());
|
PRINT_DEBUG("%s %llu", pchName, steamIDUser.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchName) return false;
|
if (!pchName) return false;
|
||||||
@ -1200,7 +1198,7 @@ bool Steam_User_Stats::GetUserStat( CSteamID steamIDUser, const char *pchName, f
|
|||||||
|
|
||||||
bool Steam_User_Stats::GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved )
|
bool Steam_User_Stats::GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetUserAchievement %s\n", pchName);
|
PRINT_DEBUG("%s", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchName) return false;
|
if (!pchName) return false;
|
||||||
@ -1215,7 +1213,7 @@ bool Steam_User_Stats::GetUserAchievement( CSteamID steamIDUser, const char *pch
|
|||||||
// See notes for GetAchievementAndUnlockTime above
|
// See notes for GetAchievementAndUnlockTime above
|
||||||
bool Steam_User_Stats::GetUserAchievementAndUnlockTime( CSteamID steamIDUser, const char *pchName, bool *pbAchieved, uint32 *punUnlockTime )
|
bool Steam_User_Stats::GetUserAchievementAndUnlockTime( CSteamID steamIDUser, const char *pchName, bool *pbAchieved, uint32 *punUnlockTime )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetUserAchievementAndUnlockTime %s\n", pchName);
|
PRINT_DEBUG("%s", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!pchName) return false;
|
if (!pchName) return false;
|
||||||
@ -1230,7 +1228,7 @@ bool Steam_User_Stats::GetUserAchievementAndUnlockTime( CSteamID steamIDUser, co
|
|||||||
// Reset stats
|
// Reset stats
|
||||||
bool Steam_User_Stats::ResetAllStats( bool bAchievementsToo )
|
bool Steam_User_Stats::ResetAllStats( bool bAchievementsToo )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::ResetAllStats\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
clear_stats_internal();
|
clear_stats_internal();
|
||||||
@ -1252,7 +1250,7 @@ bool Steam_User_Stats::ResetAllStats( bool bAchievementsToo )
|
|||||||
new_stat.set_value_float(stat.second.default_value_float);
|
new_stat.set_value_float(stat.second.default_value_float);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: PRINT_DEBUG("Steam_User_Stats::ResetAllStats unhandled type %i\n", (int)stat.second.type); break;
|
default: PRINT_DEBUG("unhandled type %i", (int)stat.second.type); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1289,7 +1287,7 @@ bool Steam_User_Stats::ResetAllStats( bool bAchievementsToo )
|
|||||||
STEAM_CALL_RESULT(LeaderboardFindResult_t)
|
STEAM_CALL_RESULT(LeaderboardFindResult_t)
|
||||||
SteamAPICall_t Steam_User_Stats::FindOrCreateLeaderboard( const char *pchLeaderboardName, ELeaderboardSortMethod eLeaderboardSortMethod, ELeaderboardDisplayType eLeaderboardDisplayType )
|
SteamAPICall_t Steam_User_Stats::FindOrCreateLeaderboard( const char *pchLeaderboardName, ELeaderboardSortMethod eLeaderboardSortMethod, ELeaderboardDisplayType eLeaderboardDisplayType )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::FindOrCreateLeaderboard '%s'\n", pchLeaderboardName);
|
PRINT_DEBUG("'%s'", pchLeaderboardName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchLeaderboardName) {
|
if (!pchLeaderboardName) {
|
||||||
LeaderboardFindResult_t data{};
|
LeaderboardFindResult_t data{};
|
||||||
@ -1313,7 +1311,7 @@ SteamAPICall_t Steam_User_Stats::FindOrCreateLeaderboard( const char *pchLeaderb
|
|||||||
STEAM_CALL_RESULT( LeaderboardFindResult_t )
|
STEAM_CALL_RESULT( LeaderboardFindResult_t )
|
||||||
SteamAPICall_t Steam_User_Stats::FindLeaderboard( const char *pchLeaderboardName )
|
SteamAPICall_t Steam_User_Stats::FindLeaderboard( const char *pchLeaderboardName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::FindLeaderboard '%s'\n", pchLeaderboardName);
|
PRINT_DEBUG("'%s'", pchLeaderboardName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchLeaderboardName) {
|
if (!pchLeaderboardName) {
|
||||||
LeaderboardFindResult_t data{};
|
LeaderboardFindResult_t data{};
|
||||||
@ -1345,7 +1343,7 @@ SteamAPICall_t Steam_User_Stats::FindLeaderboard( const char *pchLeaderboardName
|
|||||||
// returns the name of a leaderboard
|
// returns the name of a leaderboard
|
||||||
const char * Steam_User_Stats::GetLeaderboardName( SteamLeaderboard_t hSteamLeaderboard )
|
const char * Steam_User_Stats::GetLeaderboardName( SteamLeaderboard_t hSteamLeaderboard )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetLeaderboardName %llu\n", hSteamLeaderboard);
|
PRINT_DEBUG("%llu", hSteamLeaderboard);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return "";
|
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return "";
|
||||||
|
|
||||||
@ -1356,7 +1354,7 @@ const char * Steam_User_Stats::GetLeaderboardName( SteamLeaderboard_t hSteamLead
|
|||||||
// returns the total number of entries in a leaderboard, as of the last request
|
// returns the total number of entries in a leaderboard, as of the last request
|
||||||
int Steam_User_Stats::GetLeaderboardEntryCount( SteamLeaderboard_t hSteamLeaderboard )
|
int Steam_User_Stats::GetLeaderboardEntryCount( SteamLeaderboard_t hSteamLeaderboard )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetLeaderboardEntryCount %llu\n", hSteamLeaderboard);
|
PRINT_DEBUG("%llu", hSteamLeaderboard);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return 0;
|
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return 0;
|
||||||
|
|
||||||
@ -1367,7 +1365,7 @@ int Steam_User_Stats::GetLeaderboardEntryCount( SteamLeaderboard_t hSteamLeaderb
|
|||||||
// returns the sort method of the leaderboard
|
// returns the sort method of the leaderboard
|
||||||
ELeaderboardSortMethod Steam_User_Stats::GetLeaderboardSortMethod( SteamLeaderboard_t hSteamLeaderboard )
|
ELeaderboardSortMethod Steam_User_Stats::GetLeaderboardSortMethod( SteamLeaderboard_t hSteamLeaderboard )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetLeaderboardSortMethod %llu\n", hSteamLeaderboard);
|
PRINT_DEBUG("%llu", hSteamLeaderboard);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return k_ELeaderboardSortMethodNone;
|
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return k_ELeaderboardSortMethodNone;
|
||||||
|
|
||||||
@ -1378,7 +1376,7 @@ ELeaderboardSortMethod Steam_User_Stats::GetLeaderboardSortMethod( SteamLeaderbo
|
|||||||
// returns the display type of the leaderboard
|
// returns the display type of the leaderboard
|
||||||
ELeaderboardDisplayType Steam_User_Stats::GetLeaderboardDisplayType( SteamLeaderboard_t hSteamLeaderboard )
|
ELeaderboardDisplayType Steam_User_Stats::GetLeaderboardDisplayType( SteamLeaderboard_t hSteamLeaderboard )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetLeaderboardDisplayType %llu\n", hSteamLeaderboard);
|
PRINT_DEBUG("%llu", hSteamLeaderboard);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return k_ELeaderboardDisplayTypeNone;
|
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return k_ELeaderboardDisplayTypeNone;
|
||||||
|
|
||||||
@ -1397,7 +1395,7 @@ ELeaderboardDisplayType Steam_User_Stats::GetLeaderboardDisplayType( SteamLeader
|
|||||||
STEAM_CALL_RESULT( LeaderboardScoresDownloaded_t )
|
STEAM_CALL_RESULT( LeaderboardScoresDownloaded_t )
|
||||||
SteamAPICall_t Steam_User_Stats::DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd )
|
SteamAPICall_t Steam_User_Stats::DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::DownloadLeaderboardEntries %llu %i [%i, %i]\n", hSteamLeaderboard, eLeaderboardDataRequest, nRangeStart, nRangeEnd);
|
PRINT_DEBUG("%llu %i [%i, %i]", hSteamLeaderboard, eLeaderboardDataRequest, nRangeStart, nRangeEnd);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return k_uAPICallInvalid; //might return callresult even if hSteamLeaderboard is invalid
|
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return k_uAPICallInvalid; //might return callresult even if hSteamLeaderboard is invalid
|
||||||
|
|
||||||
@ -1424,7 +1422,7 @@ STEAM_CALL_RESULT( LeaderboardScoresDownloaded_t )
|
|||||||
SteamAPICall_t Steam_User_Stats::DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard,
|
SteamAPICall_t Steam_User_Stats::DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard,
|
||||||
STEAM_ARRAY_COUNT_D(cUsers, Array of users to retrieve) CSteamID *prgUsers, int cUsers )
|
STEAM_ARRAY_COUNT_D(cUsers, Array of users to retrieve) CSteamID *prgUsers, int cUsers )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::DownloadLeaderboardEntriesForUsers %i %llu\n", cUsers, cUsers > 0 ? prgUsers[0].ConvertToUint64() : 0);
|
PRINT_DEBUG("%i %llu", cUsers, cUsers > 0 ? prgUsers[0].ConvertToUint64() : 0);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return k_uAPICallInvalid; //might return callresult even if hSteamLeaderboard is invalid
|
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return k_uAPICallInvalid; //might return callresult even if hSteamLeaderboard is invalid
|
||||||
|
|
||||||
@ -1436,7 +1434,7 @@ SteamAPICall_t Steam_User_Stats::DownloadLeaderboardEntriesForUsers( SteamLeader
|
|||||||
const auto &user_steamid = prgUsers[i];
|
const auto &user_steamid = prgUsers[i];
|
||||||
if (!user_steamid.IsValid()) {
|
if (!user_steamid.IsValid()) {
|
||||||
ok = false;
|
ok = false;
|
||||||
PRINT_DEBUG("Steam_User_Stats::DownloadLeaderboardEntriesForUsers bad userid %llu\n", user_steamid.ConvertToUint64());
|
PRINT_DEBUG("bad userid %llu", user_steamid.ConvertToUint64());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (board.find_recent_entry(user_steamid)) ++total_count;
|
if (board.find_recent_entry(user_steamid)) ++total_count;
|
||||||
@ -1445,7 +1443,7 @@ SteamAPICall_t Steam_User_Stats::DownloadLeaderboardEntriesForUsers( SteamLeader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_User_Stats::DownloadLeaderboardEntriesForUsers total count %i\n", total_count);
|
PRINT_DEBUG("total count %i", total_count);
|
||||||
// https://partner.steamgames.com/doc/api/ISteamUserStats#DownloadLeaderboardEntriesForUsers
|
// https://partner.steamgames.com/doc/api/ISteamUserStats#DownloadLeaderboardEntriesForUsers
|
||||||
if (!ok || total_count > 100) return k_uAPICallInvalid;
|
if (!ok || total_count > 100) return k_uAPICallInvalid;
|
||||||
|
|
||||||
@ -1473,7 +1471,7 @@ SteamAPICall_t Steam_User_Stats::DownloadLeaderboardEntriesForUsers( SteamLeader
|
|||||||
// once you've accessed all the entries, the data will be free'd, and the SteamLeaderboardEntries_t handle will become invalid
|
// once you've accessed all the entries, the data will be free'd, and the SteamLeaderboardEntries_t handle will become invalid
|
||||||
bool Steam_User_Stats::GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, LeaderboardEntry_t *pLeaderboardEntry, int32 *pDetails, int cDetailsMax )
|
bool Steam_User_Stats::GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, LeaderboardEntry_t *pLeaderboardEntry, int32 *pDetails, int cDetailsMax )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetDownloadedLeaderboardEntry [%i] (%i) %llu %p %p\n", index, cDetailsMax, hSteamLeaderboardEntries, pLeaderboardEntry, pDetails);
|
PRINT_DEBUG("[%i] (%i) %llu %p %p", index, cDetailsMax, hSteamLeaderboardEntries, pLeaderboardEntry, pDetails);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (hSteamLeaderboardEntries > cached_leaderboards.size() || hSteamLeaderboardEntries <= 0) return false;
|
if (hSteamLeaderboardEntries > cached_leaderboards.size() || hSteamLeaderboardEntries <= 0) return false;
|
||||||
|
|
||||||
@ -1508,7 +1506,7 @@ bool Steam_User_Stats::GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t
|
|||||||
STEAM_CALL_RESULT( LeaderboardScoreUploaded_t )
|
STEAM_CALL_RESULT( LeaderboardScoreUploaded_t )
|
||||||
SteamAPICall_t Steam_User_Stats::UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int32 nScore, const int32 *pScoreDetails, int cScoreDetailsCount )
|
SteamAPICall_t Steam_User_Stats::UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int32 nScore, const int32 *pScoreDetails, int cScoreDetailsCount )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::UploadLeaderboardScore %llu %i\n", hSteamLeaderboard, nScore);
|
PRINT_DEBUG("%llu %i", hSteamLeaderboard, nScore);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return k_uAPICallInvalid; //TODO: might return callresult even if hSteamLeaderboard is invalid
|
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return k_uAPICallInvalid; //TODO: might return callresult even if hSteamLeaderboard is invalid
|
||||||
|
|
||||||
@ -1575,7 +1573,7 @@ SteamAPICall_t Steam_User_Stats::UploadLeaderboardScore( SteamLeaderboard_t hSte
|
|||||||
|
|
||||||
SteamAPICall_t Steam_User_Stats::UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, int32 nScore, int32 *pScoreDetails, int cScoreDetailsCount )
|
SteamAPICall_t Steam_User_Stats::UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, int32 nScore, int32 *pScoreDetails, int cScoreDetailsCount )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("UploadLeaderboardScore old\n");
|
PRINT_DEBUG("old");
|
||||||
return UploadLeaderboardScore(hSteamLeaderboard, k_ELeaderboardUploadScoreMethodKeepBest, nScore, pScoreDetails, cScoreDetailsCount);
|
return UploadLeaderboardScore(hSteamLeaderboard, k_ELeaderboardUploadScoreMethodKeepBest, nScore, pScoreDetails, cScoreDetailsCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1586,7 +1584,7 @@ SteamAPICall_t Steam_User_Stats::UploadLeaderboardScore( SteamLeaderboard_t hSte
|
|||||||
STEAM_CALL_RESULT( LeaderboardUGCSet_t )
|
STEAM_CALL_RESULT( LeaderboardUGCSet_t )
|
||||||
SteamAPICall_t Steam_User_Stats::AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC )
|
SteamAPICall_t Steam_User_Stats::AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::AttachLeaderboardUGC\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
LeaderboardUGCSet_t data{};
|
LeaderboardUGCSet_t data{};
|
||||||
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) {
|
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) {
|
||||||
@ -1605,7 +1603,7 @@ SteamAPICall_t Steam_User_Stats::AttachLeaderboardUGC( SteamLeaderboard_t hSteam
|
|||||||
STEAM_CALL_RESULT( NumberOfCurrentPlayers_t )
|
STEAM_CALL_RESULT( NumberOfCurrentPlayers_t )
|
||||||
SteamAPICall_t Steam_User_Stats::GetNumberOfCurrentPlayers()
|
SteamAPICall_t Steam_User_Stats::GetNumberOfCurrentPlayers()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetNumberOfCurrentPlayers\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
std::random_device rd{};
|
std::random_device rd{};
|
||||||
@ -1625,7 +1623,7 @@ SteamAPICall_t Steam_User_Stats::GetNumberOfCurrentPlayers()
|
|||||||
STEAM_CALL_RESULT( GlobalAchievementPercentagesReady_t )
|
STEAM_CALL_RESULT( GlobalAchievementPercentagesReady_t )
|
||||||
SteamAPICall_t Steam_User_Stats::RequestGlobalAchievementPercentages()
|
SteamAPICall_t Steam_User_Stats::RequestGlobalAchievementPercentages()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::RequestGlobalAchievementPercentages\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
GlobalAchievementPercentagesReady_t data{};
|
GlobalAchievementPercentagesReady_t data{};
|
||||||
@ -1640,7 +1638,7 @@ SteamAPICall_t Steam_User_Stats::RequestGlobalAchievementPercentages()
|
|||||||
// percentages (ie, you haven't called RequestGlobalAchievementPercentages and waited on the callback).
|
// percentages (ie, you haven't called RequestGlobalAchievementPercentages and waited on the callback).
|
||||||
int Steam_User_Stats::GetMostAchievedAchievementInfo( char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved )
|
int Steam_User_Stats::GetMostAchievedAchievementInfo( char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetMostAchievedAchievementInfo\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!pchName) return -1;
|
if (!pchName) return -1;
|
||||||
|
|
||||||
@ -1668,7 +1666,7 @@ int Steam_User_Stats::GetMostAchievedAchievementInfo( char *pchName, uint32 unNa
|
|||||||
// achievement has been iterated.
|
// achievement has been iterated.
|
||||||
int Steam_User_Stats::GetNextMostAchievedAchievementInfo( int iIteratorPrevious, char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved )
|
int Steam_User_Stats::GetNextMostAchievedAchievementInfo( int iIteratorPrevious, char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetNextMostAchievedAchievementInfo\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (iIteratorPrevious < 0) return -1;
|
if (iIteratorPrevious < 0) return -1;
|
||||||
|
|
||||||
@ -1699,7 +1697,7 @@ int Steam_User_Stats::GetNextMostAchievedAchievementInfo( int iIteratorPrevious,
|
|||||||
// Returns the percentage of users who have achieved the specified achievement.
|
// Returns the percentage of users who have achieved the specified achievement.
|
||||||
bool Steam_User_Stats::GetAchievementAchievedPercent( const char *pchName, float *pflPercent )
|
bool Steam_User_Stats::GetAchievementAchievedPercent( const char *pchName, float *pflPercent )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetAchievementAchievedPercent '%s'\n", pchName);
|
PRINT_DEBUG("'%s'", pchName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
auto it = defined_achievements_find(pchName);
|
auto it = defined_achievements_find(pchName);
|
||||||
@ -1721,7 +1719,7 @@ bool Steam_User_Stats::GetAchievementAchievedPercent( const char *pchName, float
|
|||||||
STEAM_CALL_RESULT( GlobalStatsReceived_t )
|
STEAM_CALL_RESULT( GlobalStatsReceived_t )
|
||||||
SteamAPICall_t Steam_User_Stats::RequestGlobalStats( int nHistoryDays )
|
SteamAPICall_t Steam_User_Stats::RequestGlobalStats( int nHistoryDays )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::RequestGlobalStats %i\n", nHistoryDays);
|
PRINT_DEBUG("%i", nHistoryDays);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
GlobalStatsReceived_t data{};
|
GlobalStatsReceived_t data{};
|
||||||
data.m_nGameID = settings->get_local_game_id().ToUint64();
|
data.m_nGameID = settings->get_local_game_id().ToUint64();
|
||||||
@ -1733,13 +1731,15 @@ SteamAPICall_t Steam_User_Stats::RequestGlobalStats( int nHistoryDays )
|
|||||||
// Gets the lifetime totals for an aggregated stat
|
// Gets the lifetime totals for an aggregated stat
|
||||||
bool Steam_User_Stats::GetGlobalStat( const char *pchStatName, int64 *pData )
|
bool Steam_User_Stats::GetGlobalStat( const char *pchStatName, int64 *pData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetGlobalStat %s\n", pchStatName);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_User_Stats::GetGlobalStat( const char *pchStatName, double *pData )
|
bool Steam_User_Stats::GetGlobalStat( const char *pchStatName, double *pData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetGlobalStat %s\n", pchStatName);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1750,13 +1750,15 @@ bool Steam_User_Stats::GetGlobalStat( const char *pchStatName, double *pData )
|
|||||||
// elements actually set.
|
// elements actually set.
|
||||||
int32 Steam_User_Stats::GetGlobalStatHistory( const char *pchStatName, STEAM_ARRAY_COUNT(cubData) int64 *pData, uint32 cubData )
|
int32 Steam_User_Stats::GetGlobalStatHistory( const char *pchStatName, STEAM_ARRAY_COUNT(cubData) int64 *pData, uint32 cubData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetGlobalStatHistory int64 %s\n", pchStatName);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 Steam_User_Stats::GetGlobalStatHistory( const char *pchStatName, STEAM_ARRAY_COUNT(cubData) double *pData, uint32 cubData )
|
int32 Steam_User_Stats::GetGlobalStatHistory( const char *pchStatName, STEAM_ARRAY_COUNT(cubData) double *pData, uint32 cubData )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetGlobalStatHistory double %s\n", pchStatName);
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1765,13 +1767,15 @@ int32 Steam_User_Stats::GetGlobalStatHistory( const char *pchStatName, STEAM_ARR
|
|||||||
// have been made, to show a progress notification to the user.
|
// have been made, to show a progress notification to the user.
|
||||||
bool Steam_User_Stats::GetAchievementProgressLimits( const char *pchName, int32 *pnMinProgress, int32 *pnMaxProgress )
|
bool Steam_User_Stats::GetAchievementProgressLimits( const char *pchName, int32 *pnMinProgress, int32 *pnMaxProgress )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetAchievementProgressLimits int\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_User_Stats::GetAchievementProgressLimits( const char *pchName, float *pfMinProgress, float *pfMaxProgress )
|
bool Steam_User_Stats::GetAchievementProgressLimits( const char *pchName, float *pfMinProgress, float *pfMaxProgress )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_User_Stats::GetAchievementProgressLimits float\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1800,8 +1804,7 @@ void Steam_User_Stats::send_updated_stats()
|
|||||||
// here we send to all gameservers on the network because we don't know the server steamid
|
// here we send to all gameservers on the network because we don't know the server steamid
|
||||||
network->sendToAllGameservers(&msg, true);
|
network->sendToAllGameservers(&msg, true);
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("sent updated stats: %zu stats, %zu achievements",
|
||||||
"Steam_User_Stats::send_updated_stats sent updated stats: %zu stats, %zu achievements\n",
|
|
||||||
new_updates_msg->user_stats().size(), new_updates_msg->user_achievements().size()
|
new_updates_msg->user_stats().size(), new_updates_msg->user_achievements().size()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1819,7 +1822,7 @@ void Steam_User_Stats::steam_run_callback()
|
|||||||
void Steam_User_Stats::network_stats_initial(Common_Message *msg)
|
void Steam_User_Stats::network_stats_initial(Common_Message *msg)
|
||||||
{
|
{
|
||||||
if (!msg->gameserver_stats_messages().has_initial_user_stats()) {
|
if (!msg->gameserver_stats_messages().has_initial_user_stats()) {
|
||||||
PRINT_DEBUG("Steam_User_Stats::network_stats_initial error empty msg\n");
|
PRINT_DEBUG("error empty msg");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1851,7 +1854,7 @@ void Steam_User_Stats::network_stats_initial(Common_Message *msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Steam_User_Stats::network_stats_initial Request_AllUserStats unhandled stat type %i\n", (int)stat.second.type);
|
PRINT_DEBUG("Request_AllUserStats unhandled stat type %i", (int)stat.second.type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1883,8 +1886,7 @@ void Steam_User_Stats::network_stats_initial(Common_Message *msg)
|
|||||||
new_msg.set_dest_id(server_steamid);
|
new_msg.set_dest_id(server_steamid);
|
||||||
network->sendTo(&new_msg, true);
|
network->sendTo(&new_msg, true);
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("server requested all stats, sent %zu stats, %zu achievements",
|
||||||
"Steam_User_Stats::network_stats_initial server requested all stats, sent %zu stats, %zu achievements\n",
|
|
||||||
initial_stats_msg->all_data().user_stats().size(), initial_stats_msg->all_data().user_achievements().size()
|
initial_stats_msg->all_data().user_stats().size(), initial_stats_msg->all_data().user_achievements().size()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1894,7 +1896,7 @@ void Steam_User_Stats::network_stats_initial(Common_Message *msg)
|
|||||||
void Steam_User_Stats::network_stats_updated(Common_Message *msg)
|
void Steam_User_Stats::network_stats_updated(Common_Message *msg)
|
||||||
{
|
{
|
||||||
if (!msg->gameserver_stats_messages().has_update_user_stats()) {
|
if (!msg->gameserver_stats_messages().has_update_user_stats()) {
|
||||||
PRINT_DEBUG("Steam_User_Stats::network_stats_updated error empty msg\n");
|
PRINT_DEBUG("error empty msg");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1921,7 +1923,7 @@ void Steam_User_Stats::network_stats_updated(Common_Message *msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Steam_User_Stats::network_stats_updated UpdateUserStats unhandled stat type %i\n", (int)new_stat.second.stat_type());
|
PRINT_DEBUG("UpdateUserStats unhandled stat type %i", (int)new_stat.second.stat_type());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1935,8 +1937,7 @@ void Steam_User_Stats::network_stats_updated(Common_Message *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("server sent updated user stats, %zu stats, %zu achievements",
|
||||||
"Steam_User_Stats::network_stats_updated server sent updated user stats, %zu stats, %zu achievements\n",
|
|
||||||
new_user_data.user_stats().size(), new_user_data.user_achievements().size()
|
new_user_data.user_stats().size(), new_user_data.user_achievements().size()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1966,7 +1967,7 @@ void Steam_User_Stats::network_callback_stats(Common_Message *msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Steam_User_Stats::network_callback_stats unhandled type %i\n", (int)msg->gameserver_stats_messages().type());
|
PRINT_DEBUG("unhandled type %i", (int)msg->gameserver_stats_messages().type());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1976,8 +1977,7 @@ void Steam_User_Stats::network_callback_stats(Common_Message *msg)
|
|||||||
void Steam_User_Stats::network_leaderboard_update_score(Common_Message *msg, Steam_Leaderboard &board, bool send_score_back)
|
void Steam_User_Stats::network_leaderboard_update_score(Common_Message *msg, Steam_Leaderboard &board, bool send_score_back)
|
||||||
{
|
{
|
||||||
CSteamID sender_steamid((uint64)msg->source_id());
|
CSteamID sender_steamid((uint64)msg->source_id());
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("got score for user %llu on leaderboard '%s' (send our score back=%i)",
|
||||||
"Steam_User_Stats::network_leaderboard_update_score got score for user %llu on leaderboard '%s' (send our score back=%i)\n",
|
|
||||||
(uint64)msg->source_id(), board.name.c_str(), (int)send_score_back
|
(uint64)msg->source_id(), board.name.c_str(), (int)send_score_back
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2003,10 +2003,7 @@ void Steam_User_Stats::network_leaderboard_update_score(Common_Message *msg, Ste
|
|||||||
void Steam_User_Stats::network_leaderboard_send_my_score(Common_Message *msg, const Steam_Leaderboard &board)
|
void Steam_User_Stats::network_leaderboard_send_my_score(Common_Message *msg, const Steam_Leaderboard &board)
|
||||||
{
|
{
|
||||||
CSteamID sender_steamid((uint64)msg->source_id());
|
CSteamID sender_steamid((uint64)msg->source_id());
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("user %llu requested our score for leaderboard '%s'", (uint64)msg->source_id(), board.name.c_str());
|
||||||
"Steam_User_Stats::network_leaderboard_send_my_score user %llu requested our score for leaderboard '%s'\n",
|
|
||||||
(uint64)msg->source_id(), board.name.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
send_my_leaderboard_score(board, &sender_steamid);
|
send_my_leaderboard_score(board, &sender_steamid);
|
||||||
}
|
}
|
||||||
@ -2018,13 +2015,13 @@ void Steam_User_Stats::network_callback_leaderboards(Common_Message *msg)
|
|||||||
if (settings->get_local_game_id().AppID() != msg->leaderboards_messages().appid()) return;
|
if (settings->get_local_game_id().AppID() != msg->leaderboards_messages().appid()) return;
|
||||||
|
|
||||||
if (!msg->leaderboards_messages().has_leaderboard_info()) {
|
if (!msg->leaderboards_messages().has_leaderboard_info()) {
|
||||||
PRINT_DEBUG("Steam_User_Stats::network_callback_leaderboards error empty leaderboard msg\n");
|
PRINT_DEBUG("error empty leaderboard msg");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &board_info_msg = msg->leaderboards_messages().leaderboard_info();
|
const auto &board_info_msg = msg->leaderboards_messages().leaderboard_info();
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_User_Stats::network_callback_leaderboards attempting to cache leaderboard '%s'\n", board_info_msg.board_name().c_str());
|
PRINT_DEBUG("attempting to cache leaderboard '%s'", board_info_msg.board_name().c_str());
|
||||||
unsigned int board_handle = cache_leaderboard_ifneeded(
|
unsigned int board_handle = cache_leaderboard_ifneeded(
|
||||||
board_info_msg.board_name(),
|
board_info_msg.board_name(),
|
||||||
(ELeaderboardSortMethod)board_info_msg.sort_method(),
|
(ELeaderboardSortMethod)board_info_msg.sort_method(),
|
||||||
@ -2048,7 +2045,7 @@ void Steam_User_Stats::network_callback_leaderboards(Common_Message *msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Steam_User_Stats::network_callback_leaderboards unhandled type %i\n", (int)msg->leaderboards_messages().type());
|
PRINT_DEBUG("unhandled type %i", (int)msg->leaderboards_messages().type());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2073,12 +2070,12 @@ void Steam_User_Stats::network_callback_low_level(Common_Message *msg)
|
|||||||
board.remove_entries(steamid);
|
board.remove_entries(steamid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PRINT_DEBUG("Steam_User_Stats::network_callback_low_level removed user %llu\n", (uint64)steamid.ConvertToUint64());
|
// PRINT_DEBUG("removed user %llu", (uint64)steamid.ConvertToUint64());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Steam_User_Stats::network_callback_low_level unknown type %i\n", (int)msg->low_level().type());
|
PRINT_DEBUG("unknown type %i", (int)msg->low_level().type());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,14 +30,14 @@ overlay(overlay)
|
|||||||
// return the number of seconds since the user
|
// return the number of seconds since the user
|
||||||
uint32 Steam_Utils::GetSecondsSinceAppActive()
|
uint32 Steam_Utils::GetSecondsSinceAppActive()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetSecondsSinceAppActive\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now() - startup_time).count();
|
return std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now() - startup_time).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Steam_Utils::GetSecondsSinceComputerActive()
|
uint32 Steam_Utils::GetSecondsSinceComputerActive()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetSecondsSinceComputerActive\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return GetSecondsSinceAppActive() + 2000;
|
return GetSecondsSinceAppActive() + 2000;
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ uint32 Steam_Utils::GetSecondsSinceComputerActive()
|
|||||||
// the universe this client is connecting to
|
// the universe this client is connecting to
|
||||||
EUniverse Steam_Utils::GetConnectedUniverse()
|
EUniverse Steam_Utils::GetConnectedUniverse()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetConnectedUniverse\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_EUniversePublic;
|
return k_EUniversePublic;
|
||||||
}
|
}
|
||||||
@ -55,9 +55,10 @@ EUniverse Steam_Utils::GetConnectedUniverse()
|
|||||||
// Steam server time. Number of seconds since January 1, 1970, GMT (i.e unix time)
|
// Steam server time. Number of seconds since January 1, 1970, GMT (i.e unix time)
|
||||||
uint32 Steam_Utils::GetServerRealTime()
|
uint32 Steam_Utils::GetServerRealTime()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetServerRealTime\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
uint32 server_time = std::chrono::duration_cast<std::chrono::duration<uint32>>(std::chrono::system_clock::now().time_since_epoch()).count();
|
uint32 server_time = std::chrono::duration_cast<std::chrono::duration<uint32>>(std::chrono::system_clock::now().time_since_epoch()).count();
|
||||||
PRINT_DEBUG("Steam_Utils::GetServerRealTime Time %u\n", server_time);
|
PRINT_DEBUG(" Time %u", server_time);
|
||||||
return server_time;
|
return server_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ uint32 Steam_Utils::GetServerRealTime()
|
|||||||
// e.g "US" or "UK".
|
// e.g "US" or "UK".
|
||||||
const char* Steam_Utils::GetIPCountry()
|
const char* Steam_Utils::GetIPCountry()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetIPCountry\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return settings->ip_country.c_str();
|
return settings->ip_country.c_str();
|
||||||
}
|
}
|
||||||
@ -74,7 +75,7 @@ const char* Steam_Utils::GetIPCountry()
|
|||||||
// returns true if the image exists, and valid sizes were filled out
|
// returns true if the image exists, and valid sizes were filled out
|
||||||
bool Steam_Utils::GetImageSize( int iImage, uint32 *pnWidth, uint32 *pnHeight )
|
bool Steam_Utils::GetImageSize( int iImage, uint32 *pnWidth, uint32 *pnHeight )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetImageSize %i\n", iImage);
|
PRINT_DEBUG("%i", iImage);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!iImage || !pnWidth || !pnHeight) return false;
|
if (!iImage || !pnWidth || !pnHeight) return false;
|
||||||
@ -92,7 +93,7 @@ bool Steam_Utils::GetImageSize( int iImage, uint32 *pnWidth, uint32 *pnHeight )
|
|||||||
// the destination buffer size should be 4 * height * width * sizeof(char)
|
// the destination buffer size should be 4 * height * width * sizeof(char)
|
||||||
bool Steam_Utils::GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize )
|
bool Steam_Utils::GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetImageRGBA %i\n", iImage);
|
PRINT_DEBUG("%i", iImage);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
if (!iImage || !pubDest || !nDestBufferSize) return false;
|
if (!iImage || !pubDest || !nDestBufferSize) return false;
|
||||||
@ -109,7 +110,7 @@ bool Steam_Utils::GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize
|
|||||||
// returns the IP of the reporting server for valve - currently only used in Source engine games
|
// returns the IP of the reporting server for valve - currently only used in Source engine games
|
||||||
bool Steam_Utils::GetCSERIPPort( uint32 *unIP, uint16 *usPort )
|
bool Steam_Utils::GetCSERIPPort( uint32 *unIP, uint16 *usPort )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetCSERIPPort\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -118,7 +119,7 @@ bool Steam_Utils::GetCSERIPPort( uint32 *unIP, uint16 *usPort )
|
|||||||
// return the amount of battery power left in the current system in % [0..100], 255 for being on AC power
|
// return the amount of battery power left in the current system in % [0..100], 255 for being on AC power
|
||||||
uint8 Steam_Utils::GetCurrentBatteryPower()
|
uint8 Steam_Utils::GetCurrentBatteryPower()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetCurrentBatteryPower\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
@ -127,7 +128,7 @@ uint8 Steam_Utils::GetCurrentBatteryPower()
|
|||||||
// returns the appID of the current process
|
// returns the appID of the current process
|
||||||
uint32 Steam_Utils::GetAppID()
|
uint32 Steam_Utils::GetAppID()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetAppID\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return settings->get_local_game_id().AppID();
|
return settings->get_local_game_id().AppID();
|
||||||
}
|
}
|
||||||
@ -137,7 +138,7 @@ uint32 Steam_Utils::GetAppID()
|
|||||||
// This position is per-game and if this function is called from outside of a game context it will do nothing.
|
// This position is per-game and if this function is called from outside of a game context it will do nothing.
|
||||||
void Steam_Utils::SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition )
|
void Steam_Utils::SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::SetOverlayNotificationPosition\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
overlay->SetNotificationPosition(eNotificationPosition);
|
overlay->SetNotificationPosition(eNotificationPosition);
|
||||||
}
|
}
|
||||||
@ -147,7 +148,7 @@ void Steam_Utils::SetOverlayNotificationPosition( ENotificationPosition eNotific
|
|||||||
// can be used directly, but more commonly used via the callback dispatch API (see steam_api.h)
|
// can be used directly, but more commonly used via the callback dispatch API (see steam_api.h)
|
||||||
bool Steam_Utils::IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFailed )
|
bool Steam_Utils::IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFailed )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::IsAPICallCompleted %llu\n", hSteamAPICall);
|
PRINT_DEBUG("%llu", hSteamAPICall);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (pbFailed) *pbFailed = false;
|
if (pbFailed) *pbFailed = false;
|
||||||
|
|
||||||
@ -162,18 +163,18 @@ bool Steam_Utils::IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFail
|
|||||||
|
|
||||||
ESteamAPICallFailure Steam_Utils::GetAPICallFailureReason( SteamAPICall_t hSteamAPICall )
|
ESteamAPICallFailure Steam_Utils::GetAPICallFailureReason( SteamAPICall_t hSteamAPICall )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetAPICallFailureReason\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_ESteamAPICallFailureNone;
|
return k_ESteamAPICallFailureNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_Utils::GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed )
|
bool Steam_Utils::GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetAPICallResult %llu %i %i %p\n", hSteamAPICall, cubCallback, iCallbackExpected, pbFailed);
|
PRINT_DEBUG("%llu %i %i %p", hSteamAPICall, cubCallback, iCallbackExpected, pbFailed);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (callback_results->callback_result(hSteamAPICall, pCallback, cubCallback)) {
|
if (callback_results->callback_result(hSteamAPICall, pCallback, cubCallback)) {
|
||||||
if (pbFailed) *pbFailed = false;
|
if (pbFailed) *pbFailed = false;
|
||||||
PRINT_DEBUG("Steam_Utils::GetAPICallResult Succeeded\n");
|
PRINT_DEBUG(" Succeeded");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -184,7 +185,7 @@ bool Steam_Utils::GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallbac
|
|||||||
STEAM_PRIVATE_API(
|
STEAM_PRIVATE_API(
|
||||||
void Steam_Utils::RunFrame()
|
void Steam_Utils::RunFrame()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::RunFrame\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
// Steam_Client *client = get_steam_client();
|
// Steam_Client *client = get_steam_client();
|
||||||
// client ->RunCallbacks(true, false, false);
|
// client ->RunCallbacks(true, false, false);
|
||||||
@ -197,7 +198,7 @@ void Steam_Utils::RunFrame()
|
|||||||
// control how often you do them.
|
// control how often you do them.
|
||||||
uint32 Steam_Utils::GetIPCCallCount()
|
uint32 Steam_Utils::GetIPCCallCount()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Utils::GetIPCCallCount\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
static int i = 0;
|
static int i = 0;
|
||||||
i += 123;
|
i += 123;
|
||||||
@ -211,7 +212,7 @@ uint32 Steam_Utils::GetIPCCallCount()
|
|||||||
// callbacks will occur directly after the API function is called that generated the warning or message
|
// callbacks will occur directly after the API function is called that generated the warning or message
|
||||||
void Steam_Utils::SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction )
|
void Steam_Utils::SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::SetWarningMessageHook\n");
|
PRINT_DEBUG_TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -219,7 +220,7 @@ void Steam_Utils::SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction
|
|||||||
// start & hook the game process, so this function will initially return false while the overlay is loading.
|
// start & hook the game process, so this function will initially return false while the overlay is loading.
|
||||||
bool Steam_Utils::IsOverlayEnabled()
|
bool Steam_Utils::IsOverlayEnabled()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::IsOverlayEnabled\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return overlay->Ready();
|
return overlay->Ready();
|
||||||
}
|
}
|
||||||
@ -236,7 +237,7 @@ bool Steam_Utils::IsOverlayEnabled()
|
|||||||
// refresh the screen with Present or SwapBuffers to allow the overlay to do it's work.
|
// refresh the screen with Present or SwapBuffers to allow the overlay to do it's work.
|
||||||
bool Steam_Utils::BOverlayNeedsPresent()
|
bool Steam_Utils::BOverlayNeedsPresent()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::BOverlayNeedsPresent\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return overlay->NeedPresent();
|
return overlay->NeedPresent();
|
||||||
}
|
}
|
||||||
@ -253,7 +254,7 @@ bool Steam_Utils::BOverlayNeedsPresent()
|
|||||||
STEAM_CALL_RESULT( CheckFileSignature_t )
|
STEAM_CALL_RESULT( CheckFileSignature_t )
|
||||||
SteamAPICall_t Steam_Utils::CheckFileSignature( const char *szFileName )
|
SteamAPICall_t Steam_Utils::CheckFileSignature( const char *szFileName )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::CheckFileSignature '%s'\n", szFileName);
|
PRINT_DEBUG("'%s'", szFileName);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
CheckFileSignature_t data;
|
CheckFileSignature_t data;
|
||||||
data.m_eCheckFileSignature = k_ECheckFileSignatureValidSignature;
|
data.m_eCheckFileSignature = k_ECheckFileSignatureValidSignature;
|
||||||
@ -264,14 +265,14 @@ SteamAPICall_t Steam_Utils::CheckFileSignature( const char *szFileName )
|
|||||||
// Activates the Big Picture text input dialog which only supports gamepad input
|
// Activates the Big Picture text input dialog which only supports gamepad input
|
||||||
bool Steam_Utils::ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText )
|
bool Steam_Utils::ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::ShowGamepadTextInput\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_Utils::ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax )
|
bool Steam_Utils::ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("ShowGamepadTextInput old\n");
|
PRINT_DEBUG("old");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return ShowGamepadTextInput(eInputMode, eLineInputMode, pchDescription, unCharMax, NULL);
|
return ShowGamepadTextInput(eInputMode, eLineInputMode, pchDescription, unCharMax, NULL);
|
||||||
}
|
}
|
||||||
@ -279,14 +280,14 @@ bool Steam_Utils::ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamep
|
|||||||
// Returns previously entered text & length
|
// Returns previously entered text & length
|
||||||
uint32 Steam_Utils::GetEnteredGamepadTextLength()
|
uint32 Steam_Utils::GetEnteredGamepadTextLength()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetEnteredGamepadTextLength\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_Utils::GetEnteredGamepadTextInput( char *pchText, uint32 cchText )
|
bool Steam_Utils::GetEnteredGamepadTextInput( char *pchText, uint32 cchText )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetEnteredGamepadTextInput\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -295,7 +296,7 @@ bool Steam_Utils::GetEnteredGamepadTextInput( char *pchText, uint32 cchText )
|
|||||||
// returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases
|
// returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases
|
||||||
const char* Steam_Utils::GetSteamUILanguage()
|
const char* Steam_Utils::GetSteamUILanguage()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetSteamUILanguage\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return settings->get_language();
|
return settings->get_language();
|
||||||
}
|
}
|
||||||
@ -304,7 +305,7 @@ const char* Steam_Utils::GetSteamUILanguage()
|
|||||||
// returns true if Steam itself is running in VR mode
|
// returns true if Steam itself is running in VR mode
|
||||||
bool Steam_Utils::IsSteamRunningInVR()
|
bool Steam_Utils::IsSteamRunningInVR()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::IsSteamRunningInVR\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -313,7 +314,7 @@ bool Steam_Utils::IsSteamRunningInVR()
|
|||||||
// Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition.
|
// Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition.
|
||||||
void Steam_Utils::SetOverlayNotificationInset( int nHorizontalInset, int nVerticalInset )
|
void Steam_Utils::SetOverlayNotificationInset( int nHorizontalInset, int nVerticalInset )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::SetOverlayNotificationInset\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
overlay->SetNotificationInset(nHorizontalInset, nVerticalInset);
|
overlay->SetNotificationInset(nHorizontalInset, nVerticalInset);
|
||||||
}
|
}
|
||||||
@ -324,7 +325,7 @@ void Steam_Utils::SetOverlayNotificationInset( int nHorizontalInset, int nVertic
|
|||||||
// a game can be added as a non-steam game to the developers library to test this feature
|
// a game can be added as a non-steam game to the developers library to test this feature
|
||||||
bool Steam_Utils::IsSteamInBigPictureMode()
|
bool Steam_Utils::IsSteamInBigPictureMode()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::IsSteamInBigPictureMode\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -333,7 +334,7 @@ bool Steam_Utils::IsSteamInBigPictureMode()
|
|||||||
// ask SteamUI to create and render its OpenVR dashboard
|
// ask SteamUI to create and render its OpenVR dashboard
|
||||||
void Steam_Utils::StartVRDashboard()
|
void Steam_Utils::StartVRDashboard()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::StartVRDashboard\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +342,7 @@ void Steam_Utils::StartVRDashboard()
|
|||||||
// Returns true if the HMD content will be streamed via Steam In-Home Streaming
|
// Returns true if the HMD content will be streamed via Steam In-Home Streaming
|
||||||
bool Steam_Utils::IsVRHeadsetStreamingEnabled()
|
bool Steam_Utils::IsVRHeadsetStreamingEnabled()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::IsVRHeadsetStreamingEnabled\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -354,14 +355,14 @@ bool Steam_Utils::IsVRHeadsetStreamingEnabled()
|
|||||||
// (this is useful for games that have asymmetric multiplayer gameplay)
|
// (this is useful for games that have asymmetric multiplayer gameplay)
|
||||||
void Steam_Utils::SetVRHeadsetStreamingEnabled( bool bEnabled )
|
void Steam_Utils::SetVRHeadsetStreamingEnabled( bool bEnabled )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::SetVRHeadsetStreamingEnabled\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns whether this steam client is a Steam China specific client, vs the global client.
|
// Returns whether this steam client is a Steam China specific client, vs the global client.
|
||||||
bool Steam_Utils::IsSteamChinaLauncher()
|
bool Steam_Utils::IsSteamChinaLauncher()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::IsSteamChinaLauncher\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -370,7 +371,7 @@ bool Steam_Utils::IsSteamChinaLauncher()
|
|||||||
// Returns false if filtering is unavailable for the language the user is currently running in.
|
// Returns false if filtering is unavailable for the language the user is currently running in.
|
||||||
bool Steam_Utils::InitFilterText()
|
bool Steam_Utils::InitFilterText()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::InitFilterText old\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -380,7 +381,7 @@ bool Steam_Utils::InitFilterText()
|
|||||||
// Returns false if filtering is unavailable for the language the user is currently running in.
|
// Returns false if filtering is unavailable for the language the user is currently running in.
|
||||||
bool Steam_Utils::InitFilterText( uint32 unFilterOptions )
|
bool Steam_Utils::InitFilterText( uint32 unFilterOptions )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::InitFilterText\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -393,7 +394,7 @@ bool Steam_Utils::InitFilterText( uint32 unFilterOptions )
|
|||||||
// Returns the number of characters (not bytes) filtered.
|
// Returns the number of characters (not bytes) filtered.
|
||||||
int Steam_Utils::FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilteredText, const char * pchInputMessage, bool bLegalOnly )
|
int Steam_Utils::FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilteredText, const char * pchInputMessage, bool bLegalOnly )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::FilterText old\n");
|
PRINT_DEBUG("old");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return FilterText(k_ETextFilteringContextUnknown, CSteamID(), pchInputMessage, pchOutFilteredText, nByteSizeOutFilteredText );
|
return FilterText(k_ETextFilteringContextUnknown, CSteamID(), pchInputMessage, pchOutFilteredText, nByteSizeOutFilteredText );
|
||||||
}
|
}
|
||||||
@ -407,7 +408,7 @@ int Steam_Utils::FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilter
|
|||||||
// Returns the number of characters (not bytes) filtered
|
// Returns the number of characters (not bytes) filtered
|
||||||
int Steam_Utils::FilterText( ETextFilteringContext eContext, CSteamID sourceSteamID, const char *pchInputMessage, char *pchOutFilteredText, uint32 nByteSizeOutFilteredText )
|
int Steam_Utils::FilterText( ETextFilteringContext eContext, CSteamID sourceSteamID, const char *pchInputMessage, char *pchOutFilteredText, uint32 nByteSizeOutFilteredText )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::FilterText\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!nByteSizeOutFilteredText) return 0;
|
if (!nByteSizeOutFilteredText) return 0;
|
||||||
unsigned len = strlen(pchInputMessage);
|
unsigned len = strlen(pchInputMessage);
|
||||||
@ -426,7 +427,7 @@ int Steam_Utils::FilterText( ETextFilteringContext eContext, CSteamID sourceStea
|
|||||||
// This does NOT tell you if the Steam client is currently connected to Steam via ipv6.
|
// This does NOT tell you if the Steam client is currently connected to Steam via ipv6.
|
||||||
ESteamIPv6ConnectivityState Steam_Utils::GetIPv6ConnectivityState( ESteamIPv6ConnectivityProtocol eProtocol )
|
ESteamIPv6ConnectivityState Steam_Utils::GetIPv6ConnectivityState( ESteamIPv6ConnectivityProtocol eProtocol )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::GetIPv6ConnectivityState\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return k_ESteamIPv6ConnectivityState_Unknown;
|
return k_ESteamIPv6ConnectivityState_Unknown;
|
||||||
}
|
}
|
||||||
@ -434,7 +435,7 @@ ESteamIPv6ConnectivityState Steam_Utils::GetIPv6ConnectivityState( ESteamIPv6Con
|
|||||||
// returns true if currently running on the Steam Deck device
|
// returns true if currently running on the Steam Deck device
|
||||||
bool Steam_Utils::IsSteamRunningOnSteamDeck()
|
bool Steam_Utils::IsSteamRunningOnSteamDeck()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::IsSteamRunningOnSteamDeck %i\n", (int)settings->steam_deck);
|
PRINT_DEBUG("%i", (int)settings->steam_deck);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return settings->steam_deck;
|
return settings->steam_deck;
|
||||||
}
|
}
|
||||||
@ -443,7 +444,7 @@ bool Steam_Utils::IsSteamRunningOnSteamDeck()
|
|||||||
// The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field
|
// The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field
|
||||||
bool Steam_Utils::ShowFloatingGamepadTextInput( EFloatingGamepadTextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight )
|
bool Steam_Utils::ShowFloatingGamepadTextInput( EFloatingGamepadTextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::ShowFloatingGamepadTextInput\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -451,20 +452,20 @@ bool Steam_Utils::ShowFloatingGamepadTextInput( EFloatingGamepadTextInputMode eK
|
|||||||
// In game launchers that don't have controller support you can call this to have Steam Input translate the controller input into mouse/kb to navigate the launcher
|
// In game launchers that don't have controller support you can call this to have Steam Input translate the controller input into mouse/kb to navigate the launcher
|
||||||
void Steam_Utils::SetGameLauncherMode( bool bLauncherMode )
|
void Steam_Utils::SetGameLauncherMode( bool bLauncherMode )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::SetGameLauncherMode\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_Utils::DismissFloatingGamepadTextInput()
|
bool Steam_Utils::DismissFloatingGamepadTextInput()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::DismissFloatingGamepadTextInput\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_Utils::DismissGamepadTextInput()
|
bool Steam_Utils::DismissGamepadTextInput()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Utils::DismissGamepadTextInput\n");
|
PRINT_DEBUG_TODO();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -20,14 +20,16 @@
|
|||||||
// Get a URL suitable for streaming the given Video app ID's video
|
// Get a URL suitable for streaming the given Video app ID's video
|
||||||
void Steam_Video::GetVideoURL( AppId_t unVideoAppID )
|
void Steam_Video::GetVideoURL( AppId_t unVideoAppID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Video::GetVideoURL\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// returns true if user is uploading a live broadcast
|
// returns true if user is uploading a live broadcast
|
||||||
bool Steam_Video::IsBroadcasting( int *pnNumViewers )
|
bool Steam_Video::IsBroadcasting( int *pnNumViewers )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Video::IsBroadcasting\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,11 +38,13 @@ bool Steam_Video::IsBroadcasting( int *pnNumViewers )
|
|||||||
STEAM_CALL_BACK( GetOPFSettingsResult_t )
|
STEAM_CALL_BACK( GetOPFSettingsResult_t )
|
||||||
void Steam_Video::GetOPFSettings( AppId_t unVideoAppID )
|
void Steam_Video::GetOPFSettings( AppId_t unVideoAppID )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Video::GetOPFSettings\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_Video::GetOPFStringForApp( AppId_t unVideoAppID, char *pchBuffer, int32 *pnBufferSize )
|
bool Steam_Video::GetOPFStringForApp( AppId_t unVideoAppID, char *pchBuffer, int32 *pnBufferSize )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Video::GetOPFStringForApp\n");
|
PRINT_DEBUG_TODO();
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ static inline bool ImGuiHelper_BeginListBox(const char* label, int items_count)
|
|||||||
|
|
||||||
void Steam_Overlay::overlay_run_callback(void* object)
|
void Steam_Overlay::overlay_run_callback(void* object)
|
||||||
{
|
{
|
||||||
// PRINT_DEBUG("overlay_run_every_runcb %p\n", object);
|
// PRINT_DEBUG_ENTRY();
|
||||||
Steam_Overlay* _this = reinterpret_cast<Steam_Overlay*>(object);
|
Steam_Overlay* _this = reinterpret_cast<Steam_Overlay*>(object);
|
||||||
_this->steam_run_callback();
|
_this->steam_run_callback();
|
||||||
}
|
}
|
||||||
@ -150,14 +150,14 @@ Steam_Overlay::~Steam_Overlay()
|
|||||||
|
|
||||||
void Steam_Overlay::request_renderer_detector()
|
void Steam_Overlay::request_renderer_detector()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::request_renderer_detector\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
// request renderer detection
|
// request renderer detection
|
||||||
future_renderer = InGameOverlay::DetectRenderer();
|
future_renderer = InGameOverlay::DetectRenderer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Overlay::renderer_detector_delay_thread()
|
void Steam_Overlay::renderer_detector_delay_thread()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::renderer_detector_delay_thread waiting for %i seconds\n", settings->overlay_hook_delay_sec);
|
PRINT_DEBUG("waiting for %i seconds", settings->overlay_hook_delay_sec);
|
||||||
// give games some time to init their renderer (DirectX, OpenGL, etc...)
|
// give games some time to init their renderer (DirectX, OpenGL, etc...)
|
||||||
int timeout_ctr = settings->overlay_hook_delay_sec /*seconds*/ * 1000 /*milli per second*/ / renderer_detector_polling_ms;
|
int timeout_ctr = settings->overlay_hook_delay_sec /*seconds*/ * 1000 /*milli per second*/ / renderer_detector_polling_ms;
|
||||||
while (timeout_ctr > 0 && setup_overlay_called ) {
|
while (timeout_ctr > 0 && setup_overlay_called ) {
|
||||||
@ -167,7 +167,7 @@ void Steam_Overlay::renderer_detector_delay_thread()
|
|||||||
|
|
||||||
// early exit before we get a chance to do anything
|
// early exit before we get a chance to do anything
|
||||||
if (!setup_overlay_called) {
|
if (!setup_overlay_called) {
|
||||||
PRINT_DEBUG("Steam_Overlay::renderer_detector_delay_thread early exit before renderer detection\n");
|
PRINT_DEBUG("early exit before renderer detection");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ void Steam_Overlay::renderer_detector_delay_thread()
|
|||||||
|
|
||||||
void Steam_Overlay::renderer_hook_init_thread()
|
void Steam_Overlay::renderer_hook_init_thread()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::renderer_hook_init_thread\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
int timeout_ctr = settings->overlay_renderer_detector_timeout_sec /*seconds*/ * 1000 /*milli per second*/ / renderer_detector_polling_ms;
|
int timeout_ctr = settings->overlay_renderer_detector_timeout_sec /*seconds*/ * 1000 /*milli per second*/ / renderer_detector_polling_ms;
|
||||||
while (timeout_ctr > 0 && setup_overlay_called && future_renderer.wait_for(std::chrono::milliseconds(renderer_detector_polling_ms)) != std::future_status::ready) {
|
while (timeout_ctr > 0 && setup_overlay_called && future_renderer.wait_for(std::chrono::milliseconds(renderer_detector_polling_ms)) != std::future_status::ready) {
|
||||||
--timeout_ctr;
|
--timeout_ctr;
|
||||||
@ -191,8 +191,7 @@ void Steam_Overlay::renderer_hook_init_thread()
|
|||||||
bool final_chance = (future_renderer.wait_for(std::chrono::milliseconds(1)) == std::future_status::ready) && future_renderer.valid();
|
bool final_chance = (future_renderer.wait_for(std::chrono::milliseconds(1)) == std::future_status::ready) && future_renderer.valid();
|
||||||
// again check for 'setup_overlay_called' to be extra sure that the overlay wasn't deinitialized
|
// again check for 'setup_overlay_called' to be extra sure that the overlay wasn't deinitialized
|
||||||
if (!setup_overlay_called || !final_chance || timeout_ctr <= 0) {
|
if (!setup_overlay_called || !final_chance || timeout_ctr <= 0) {
|
||||||
PRINT_DEBUG(
|
PRINT_DEBUG("failed to detect renderer, ctr=%i, overlay was set up=%i, hook intance state=%i",
|
||||||
"Steam_Overlay::renderer_hook_init_thread failed to detect renderer, ctr=%i, overlay was set up=%i, hook intance state=%i\n",
|
|
||||||
timeout_ctr, (int)setup_overlay_called, (int)final_chance
|
timeout_ctr, (int)setup_overlay_called, (int)final_chance
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@ -201,7 +200,7 @@ void Steam_Overlay::renderer_hook_init_thread()
|
|||||||
// do a one time initialization
|
// do a one time initialization
|
||||||
// std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
// std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
_renderer = future_renderer.get();
|
_renderer = future_renderer.get();
|
||||||
PRINT_DEBUG("Steam_Overlay::renderer_hook_init_thread got renderer %p\n", _renderer);
|
PRINT_DEBUG("got renderer %p", _renderer);
|
||||||
|
|
||||||
// note: make sure to load all relevant strings before creating the font(s), otherwise some glyphs ranges will be missing
|
// note: make sure to load all relevant strings before creating the font(s), otherwise some glyphs ranges will be missing
|
||||||
load_achievements_data();
|
load_achievements_data();
|
||||||
@ -215,12 +214,12 @@ void Steam_Overlay::renderer_hook_init_thread()
|
|||||||
auto overlay_toggle_callback = [this]() { open_overlay_hook(true); };
|
auto overlay_toggle_callback = [this]() { open_overlay_hook(true); };
|
||||||
_renderer->OverlayProc = [this]() { overlay_render_proc(); };
|
_renderer->OverlayProc = [this]() { overlay_render_proc(); };
|
||||||
_renderer->OverlayHookReady = [this](InGameOverlay::OverlayHookState state) {
|
_renderer->OverlayHookReady = [this](InGameOverlay::OverlayHookState state) {
|
||||||
PRINT_DEBUG("Steam_Overlay hook state changed to <%i>\n", (int)state);
|
PRINT_DEBUG("hook state changed to <%i>", (int)state);
|
||||||
overlay_state_hook(state == InGameOverlay::OverlayHookState::Ready || state == InGameOverlay::OverlayHookState::Reset);
|
overlay_state_hook(state == InGameOverlay::OverlayHookState::Ready || state == InGameOverlay::OverlayHookState::Reset);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool started = _renderer->StartHook(overlay_toggle_callback, overlay_toggle_keys, &fonts_atlas);
|
bool started = _renderer->StartHook(overlay_toggle_callback, overlay_toggle_keys, &fonts_atlas);
|
||||||
PRINT_DEBUG("Steam_Overlay::renderer_hook_init_thread started renderer hook (result=%i)\n", (int)started);
|
PRINT_DEBUG("started renderer hook (result=%i)", (int)started);
|
||||||
}
|
}
|
||||||
|
|
||||||
// note: make sure to load all relevant strings before creating the font(s), otherwise some glyphs ranges will be missing
|
// note: make sure to load all relevant strings before creating the font(s), otherwise some glyphs ranges will be missing
|
||||||
@ -307,7 +306,7 @@ void Steam_Overlay::create_fonts()
|
|||||||
font_notif = font_default = font;
|
font_notif = font_default = font;
|
||||||
|
|
||||||
bool res = fonts_atlas.Build();
|
bool res = fonts_atlas.Build();
|
||||||
PRINT_DEBUG("Steam_Overlay::create_fonts created fonts atlas (result=%i)\n", (int)res);
|
PRINT_DEBUG("created fonts atlas (result=%i)", (int)res);
|
||||||
|
|
||||||
reset_LastError();
|
reset_LastError();
|
||||||
}
|
}
|
||||||
@ -359,7 +358,7 @@ void Steam_Overlay::load_audio()
|
|||||||
|
|
||||||
void Steam_Overlay::load_achievements_data()
|
void Steam_Overlay::load_achievements_data()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::load_achievements_data\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Steam_User_Stats* steamUserStats = get_steam_client()->steam_user_stats;
|
Steam_User_Stats* steamUserStats = get_steam_client()->steam_user_stats;
|
||||||
@ -391,7 +390,7 @@ void Steam_Overlay::load_achievements_data()
|
|||||||
if (!setup_overlay_called) return;
|
if (!setup_overlay_called) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Overlay::load_achievements_data count=%u, loaded=%zu\n", achievements_num, achievements.size());
|
PRINT_DEBUG("count=%u, loaded=%zu", achievements_num, achievements.size());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,12 +401,12 @@ void Steam_Overlay::initial_load_achievements_icons()
|
|||||||
if (late_init_ach_icons) return;
|
if (late_init_ach_icons) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Overlay::initial_load_achievements_icons\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
for (auto &ach : achievements) {
|
for (auto &ach : achievements) {
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (!is_ready || !setup_overlay_called) {
|
if (!is_ready || !setup_overlay_called) {
|
||||||
PRINT_DEBUG("Steam_Overlay::initial_load_achievements_icons early exit\n");
|
PRINT_DEBUG("early exit");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -417,7 +416,7 @@ void Steam_Overlay::initial_load_achievements_icons()
|
|||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (!is_ready || !setup_overlay_called) {
|
if (!is_ready || !setup_overlay_called) {
|
||||||
PRINT_DEBUG("Steam_Overlay::initial_load_achievements_icons early exit\n");
|
PRINT_DEBUG("early exit");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -432,7 +431,7 @@ void Steam_Overlay::initial_load_achievements_icons()
|
|||||||
// called initially and when window size is updated
|
// called initially and when window size is updated
|
||||||
void Steam_Overlay::overlay_state_hook(bool ready)
|
void Steam_Overlay::overlay_state_hook(bool ready)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::overlay_state_hook %i\n", (int)ready);
|
PRINT_DEBUG("%i", (int)ready);
|
||||||
|
|
||||||
// NOTE usage of local objects here cause an exception when this is called with false state
|
// NOTE usage of local objects here cause an exception when this is called with false state
|
||||||
// the reason is that by the time this hook is called, the object may have been already destructed
|
// the reason is that by the time this hook is called, the object may have been already destructed
|
||||||
@ -448,7 +447,7 @@ void Steam_Overlay::overlay_state_hook(bool ready)
|
|||||||
// Antichamber may crash here because ImGui Context is null!, no idea why
|
// Antichamber may crash here because ImGui Context is null!, no idea why
|
||||||
bool not_yet = false;
|
bool not_yet = false;
|
||||||
if (ImGui::GetCurrentContext() && late_init_imgui.compare_exchange_weak(not_yet, true)) {
|
if (ImGui::GetCurrentContext() && late_init_imgui.compare_exchange_weak(not_yet, true)) {
|
||||||
PRINT_DEBUG("Steam_Overlay::overlay_state_hook late init ImGui\n");
|
PRINT_DEBUG("late init ImGui");
|
||||||
|
|
||||||
ImGuiIO &io = ImGui::GetIO();
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
// disable loading the default ini file
|
// disable loading the default ini file
|
||||||
@ -482,14 +481,14 @@ void Steam_Overlay::allow_renderer_frame_processing(bool state, bool cleaning_up
|
|||||||
if (new_val == 1) { // only take an action on first request
|
if (new_val == 1) { // only take an action on first request
|
||||||
// allow internal frmae processing
|
// allow internal frmae processing
|
||||||
_renderer->HideOverlayInputs(false);
|
_renderer->HideOverlayInputs(false);
|
||||||
PRINT_DEBUG("Steam_Overlay::allow_renderer_frame_processing enabled frame processing (count=%u)\n", new_val);
|
PRINT_DEBUG("enabled frame processing (count=%u)", new_val);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (renderer_frame_processing_requests > 0) {
|
if (renderer_frame_processing_requests > 0) {
|
||||||
auto new_val = --renderer_frame_processing_requests;
|
auto new_val = --renderer_frame_processing_requests;
|
||||||
if (!new_val || cleaning_up_overlay) { // only take an action when the requests reach 0 or by force
|
if (!new_val || cleaning_up_overlay) { // only take an action when the requests reach 0 or by force
|
||||||
_renderer->HideOverlayInputs(true);
|
_renderer->HideOverlayInputs(true);
|
||||||
PRINT_DEBUG("Steam_Overlay::allow_renderer_frame_processing disabled frame processing (count=%u, force=%i)\n", new_val, (int)cleaning_up_overlay);
|
PRINT_DEBUG("disabled frame processing (count=%u, force=%i)", new_val, (int)cleaning_up_overlay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -509,7 +508,7 @@ void Steam_Overlay::obscure_game_input(bool state) {
|
|||||||
|
|
||||||
// clip the cursor
|
// clip the cursor
|
||||||
_renderer->HideAppInputs(true);
|
_renderer->HideAppInputs(true);
|
||||||
PRINT_DEBUG("Steam_Overlay::obscure_game_input obscured app input (count=%u)\n", new_val);
|
PRINT_DEBUG("obscured app input (count=%u)", new_val);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (obscure_cursor_requests > 0) {
|
if (obscure_cursor_requests > 0) {
|
||||||
@ -525,7 +524,7 @@ void Steam_Overlay::obscure_game_input(bool state) {
|
|||||||
|
|
||||||
// restore the old cursor
|
// restore the old cursor
|
||||||
_renderer->HideAppInputs(false);
|
_renderer->HideAppInputs(false);
|
||||||
PRINT_DEBUG("Steam_Overlay::obscure_game_input restored app input (count=%u)\n", new_val);
|
PRINT_DEBUG("restored app input (count=%u)", new_val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -615,13 +614,13 @@ int find_free_notification_id(std::vector<Notification> const& notifications)
|
|||||||
|
|
||||||
bool Steam_Overlay::submit_notification(notification_type type, const std::string &msg, std::pair<const Friend, friend_window_state> *frd, const std::weak_ptr<uint64_t> &icon)
|
bool Steam_Overlay::submit_notification(notification_type type, const std::string &msg, std::pair<const Friend, friend_window_state> *frd, const std::weak_ptr<uint64_t> &icon)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::submit_notification %i\n", (int)type);
|
PRINT_DEBUG("%i", (int)type);
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (!Ready()) return false;
|
if (!Ready()) return false;
|
||||||
|
|
||||||
int id = find_free_notification_id(notifications);
|
int id = find_free_notification_id(notifications);
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
PRINT_DEBUG("Steam_Overlay::submit_notification error no free id to create a notification window\n");
|
PRINT_DEBUG("error no free id to create a notification window");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,7 +649,7 @@ bool Steam_Overlay::submit_notification(notification_type type, const std::strin
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Steam_Overlay::submit_notification error unhandled type %i\n", (int)type);
|
PRINT_DEBUG("error unhandled type %i", (int)type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,7 +658,7 @@ bool Steam_Overlay::submit_notification(notification_type type, const std::strin
|
|||||||
|
|
||||||
void Steam_Overlay::add_chat_message_notification(std::string const &message)
|
void Steam_Overlay::add_chat_message_notification(std::string const &message)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::add_chat_message_notification '%s'\n", message.c_str());
|
PRINT_DEBUG("'%s'", message.c_str());
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (settings->disable_overlay_friend_notification) return;
|
if (settings->disable_overlay_friend_notification) return;
|
||||||
|
|
||||||
@ -668,23 +667,23 @@ void Steam_Overlay::add_chat_message_notification(std::string const &message)
|
|||||||
|
|
||||||
bool Steam_Overlay::is_friend_joinable(std::pair<const Friend, friend_window_state> &f)
|
bool Steam_Overlay::is_friend_joinable(std::pair<const Friend, friend_window_state> &f)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::is_friend_joinable " "%" PRIu64 "\n", f.first.id());
|
PRINT_DEBUG("%" PRIu64 "", f.first.id());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
Steam_Friends* steamFriends = get_steam_client()->steam_friends;
|
Steam_Friends* steamFriends = get_steam_client()->steam_friends;
|
||||||
|
|
||||||
if (std::string(steamFriends->GetFriendRichPresence((uint64)f.first.id(), "connect")).length() > 0 ) {
|
if (std::string(steamFriends->GetFriendRichPresence((uint64)f.first.id(), "connect")).length() > 0 ) {
|
||||||
PRINT_DEBUG("Steam_Overlay::is_friend_joinable " "%" PRIu64 " true (connect string)\n", f.first.id());
|
PRINT_DEBUG("%" PRIu64 " true (connect string)", f.first.id());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendGameInfo_t friend_game_info{};
|
FriendGameInfo_t friend_game_info{};
|
||||||
steamFriends->GetFriendGamePlayed((uint64)f.first.id(), &friend_game_info);
|
steamFriends->GetFriendGamePlayed((uint64)f.first.id(), &friend_game_info);
|
||||||
if (friend_game_info.m_steamIDLobby.IsValid() && (f.second.window_state & window_state_lobby_invite)) {
|
if (friend_game_info.m_steamIDLobby.IsValid() && (f.second.window_state & window_state_lobby_invite)) {
|
||||||
PRINT_DEBUG("Steam_Overlay::is_friend_joinable " "%" PRIu64 " true (friend in a game)\n", f.first.id());
|
PRINT_DEBUG("%" PRIu64 " true (friend in a game)", f.first.id());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Overlay::is_friend_joinable " "%" PRIu64 " false\n", f.first.id());
|
PRINT_DEBUG("%" PRIu64 " false", f.first.id());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -960,7 +959,7 @@ void Steam_Overlay::build_notifications(int width, int height)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Steam_Overlay::build_notifications error unhandled flags for type %i\n", (int)it->type);
|
PRINT_DEBUG("error unhandled flags for type %i", (int)it->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1007,7 +1006,7 @@ void Steam_Overlay::build_notifications(int width, int height)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Steam_Overlay::build_notifications error unhandled notification for type %i\n", (int)it->type);
|
PRINT_DEBUG("error unhandled notification for type %i", (int)it->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1021,7 +1020,7 @@ void Steam_Overlay::build_notifications(int width, int height)
|
|||||||
// erase all notifications whose visible time exceeded the max
|
// erase all notifications whose visible time exceeded the max
|
||||||
notifications.erase(std::remove_if(notifications.begin(), notifications.end(), [this, &now](Notification &item) {
|
notifications.erase(std::remove_if(notifications.begin(), notifications.end(), [this, &now](Notification &item) {
|
||||||
if ((now - item.start_time) > Notification::show_time) {
|
if ((now - item.start_time) > Notification::show_time) {
|
||||||
PRINT_DEBUG("Steam_Overlay::build_notifications removing a notification\n");
|
PRINT_DEBUG("removing a notification");
|
||||||
allow_renderer_frame_processing(false);
|
allow_renderer_frame_processing(false);
|
||||||
// uncomment this block to restore app input focus
|
// uncomment this block to restore app input focus
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
@ -1038,7 +1037,7 @@ void Steam_Overlay::build_notifications(int width, int height)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINT_DEBUG("Steam_Overlay::build_notifications error unhandled remove for type %i\n", (int)item.type);
|
PRINT_DEBUG("error unhandled remove for type %i", (int)item.type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1058,7 +1057,7 @@ void Steam_Overlay::build_notifications(int width, int height)
|
|||||||
|
|
||||||
void Steam_Overlay::add_auto_accept_invite_notification()
|
void Steam_Overlay::add_auto_accept_invite_notification()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::add_auto_accept_invite_notification\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (!Ready()) return;
|
if (!Ready()) return;
|
||||||
|
|
||||||
@ -1071,7 +1070,7 @@ void Steam_Overlay::add_auto_accept_invite_notification()
|
|||||||
|
|
||||||
void Steam_Overlay::add_invite_notification(std::pair<const Friend, friend_window_state>& wnd_state)
|
void Steam_Overlay::add_invite_notification(std::pair<const Friend, friend_window_state>& wnd_state)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::add_invite_notification\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (settings->disable_overlay_friend_notification) return;
|
if (settings->disable_overlay_friend_notification) return;
|
||||||
if (!Ready()) return;
|
if (!Ready()) return;
|
||||||
@ -1089,10 +1088,10 @@ void Steam_Overlay::invite_friend(uint64 friend_id, class Steam_Friends* steamFr
|
|||||||
std::string connect_str = steamFriends->GetFriendRichPresence(settings->get_local_steam_id(), "connect");
|
std::string connect_str = steamFriends->GetFriendRichPresence(settings->get_local_steam_id(), "connect");
|
||||||
if (connect_str.length() > 0) {
|
if (connect_str.length() > 0) {
|
||||||
steamFriends->InviteUserToGame(friend_id, connect_str.c_str());
|
steamFriends->InviteUserToGame(friend_id, connect_str.c_str());
|
||||||
PRINT_DEBUG("Steam_Overlay sent game invitation to friend with id = %llu\n", friend_id);
|
PRINT_DEBUG("sent game invitation to friend with id = %llu", friend_id);
|
||||||
} else if (settings->get_lobby().IsValid()) {
|
} else if (settings->get_lobby().IsValid()) {
|
||||||
steamMatchmaking->InviteUserToLobby(settings->get_lobby(), friend_id);
|
steamMatchmaking->InviteUserToLobby(settings->get_lobby(), friend_id);
|
||||||
PRINT_DEBUG("Steam_Overlay sent lobby invitation to friend with id = %llu\n", friend_id);
|
PRINT_DEBUG("sent lobby invitation to friend with id = %llu", friend_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1116,7 +1115,7 @@ bool Steam_Overlay::try_load_ach_icon(Overlay_Achievement &ach)
|
|||||||
(void*)img.c_str(),
|
(void*)img.c_str(),
|
||||||
settings->overlay_appearance.icon_size, settings->overlay_appearance.icon_size);
|
settings->overlay_appearance.icon_size, settings->overlay_appearance.icon_size);
|
||||||
if (!ach.icon.expired()) ach.icon_load_trials = Overlay_Achievement::ICON_LOAD_MAX_TRIALS;
|
if (!ach.icon.expired()) ach.icon_load_trials = Overlay_Achievement::ICON_LOAD_MAX_TRIALS;
|
||||||
PRINT_DEBUG("Steam_Overlay::try_load_ach_icon '%s' (result=%i)\n", ach.name.c_str(), (int)!ach.icon.expired());
|
PRINT_DEBUG("'%s' (result=%i)", ach.name.c_str(), (int)!ach.icon.expired());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1144,7 +1143,7 @@ bool Steam_Overlay::try_load_ach_gray_icon(Overlay_Achievement &ach)
|
|||||||
(void*)img.c_str(),
|
(void*)img.c_str(),
|
||||||
settings->overlay_appearance.icon_size, settings->overlay_appearance.icon_size);
|
settings->overlay_appearance.icon_size, settings->overlay_appearance.icon_size);
|
||||||
if (!ach.icon_gray.expired()) ach.icon_gray_load_trials = Overlay_Achievement::ICON_LOAD_MAX_TRIALS;
|
if (!ach.icon_gray.expired()) ach.icon_gray_load_trials = Overlay_Achievement::ICON_LOAD_MAX_TRIALS;
|
||||||
PRINT_DEBUG("Steam_Overlay::try_load_ach_gray_icon '%s' (result=%i)\n", ach.name.c_str(), (int)!ach.icon_gray.expired());
|
PRINT_DEBUG("'%s' (result=%i)", ach.name.c_str(), (int)!ach.icon_gray.expired());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1633,7 +1632,7 @@ void Steam_Overlay::steam_run_callback()
|
|||||||
// if variable == true, then set it to false and return true (because state was changed) in that case
|
// if variable == true, then set it to false and return true (because state was changed) in that case
|
||||||
bool yes_clicked = true;
|
bool yes_clicked = true;
|
||||||
if (invite_all_friends_clicked.compare_exchange_weak(yes_clicked, false)) {
|
if (invite_all_friends_clicked.compare_exchange_weak(yes_clicked, false)) {
|
||||||
PRINT_DEBUG("Steam_Overlay will send invitations to [%zu] friends if they're using the same app\n", friends.size());
|
PRINT_DEBUG("Steam_Overlay will send invitations to [%zu] friends if they're using the same app", friends.size());
|
||||||
uint32 current_appid = settings->get_local_game_id().AppID();
|
uint32 current_appid = settings->get_local_game_id().AppID();
|
||||||
for (auto &fr : friends) {
|
for (auto &fr : friends) {
|
||||||
if (fr.first.appid() == current_appid) { // friend is playing the same game
|
if (fr.first.appid() == current_appid) { // friend is playing the same game
|
||||||
@ -1647,7 +1646,7 @@ void Steam_Overlay::steam_run_callback()
|
|||||||
|
|
||||||
void Steam_Overlay::SetupOverlay()
|
void Steam_Overlay::SetupOverlay()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::SetupOverlay\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (settings->disable_overlay) return;
|
if (settings->disable_overlay) return;
|
||||||
|
|
||||||
@ -1666,7 +1665,7 @@ void Steam_Overlay::SetupOverlay()
|
|||||||
|
|
||||||
void Steam_Overlay::UnSetupOverlay()
|
void Steam_Overlay::UnSetupOverlay()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::UnSetupOverlay\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
|
|
||||||
bool already_called = true;
|
bool already_called = true;
|
||||||
@ -1693,7 +1692,7 @@ void Steam_Overlay::UnSetupOverlay()
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (_renderer) {
|
if (_renderer) {
|
||||||
PRINT_DEBUG("Steam_Overlay::UnSetupOverlay will free any images resources\n");
|
PRINT_DEBUG("will free any images resources");
|
||||||
for (auto &ach : achievements) {
|
for (auto &ach : achievements) {
|
||||||
if (!ach.icon.expired()) {
|
if (!ach.icon.expired()) {
|
||||||
_renderer->ReleaseImageResource(ach.icon);
|
_renderer->ReleaseImageResource(ach.icon);
|
||||||
@ -1718,13 +1717,13 @@ bool Steam_Overlay::Ready() const
|
|||||||
|
|
||||||
bool Steam_Overlay::NeedPresent() const
|
bool Steam_Overlay::NeedPresent() const
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::NeedPresent\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
return !settings->disable_overlay;
|
return !settings->disable_overlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Overlay::SetNotificationPosition(ENotificationPosition eNotificationPosition)
|
void Steam_Overlay::SetNotificationPosition(ENotificationPosition eNotificationPosition)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Overlay::SetNotificationPosition %i\n", (int)eNotificationPosition);
|
PRINT_DEBUG("TODO %i", (int)eNotificationPosition);
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (settings->disable_overlay) return;
|
if (settings->disable_overlay) return;
|
||||||
|
|
||||||
@ -1733,7 +1732,7 @@ void Steam_Overlay::SetNotificationPosition(ENotificationPosition eNotificationP
|
|||||||
|
|
||||||
void Steam_Overlay::SetNotificationInset(int nHorizontalInset, int nVerticalInset)
|
void Steam_Overlay::SetNotificationInset(int nHorizontalInset, int nVerticalInset)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Overlay::SetNotificationInset x=%i y=%i\n", nHorizontalInset, nVerticalInset);
|
PRINT_DEBUG("TODO x=%i y=%i", nHorizontalInset, nVerticalInset);
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (settings->disable_overlay) return;
|
if (settings->disable_overlay) return;
|
||||||
|
|
||||||
@ -1743,7 +1742,7 @@ void Steam_Overlay::SetNotificationInset(int nHorizontalInset, int nVerticalInse
|
|||||||
|
|
||||||
void Steam_Overlay::OpenOverlayInvite(CSteamID lobbyId)
|
void Steam_Overlay::OpenOverlayInvite(CSteamID lobbyId)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Overlay::OpenOverlayInvite %llu\n", lobbyId.ConvertToUint64());
|
PRINT_DEBUG("TODO %llu", lobbyId.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (!Ready()) return;
|
if (!Ready()) return;
|
||||||
|
|
||||||
@ -1752,13 +1751,13 @@ void Steam_Overlay::OpenOverlayInvite(CSteamID lobbyId)
|
|||||||
|
|
||||||
void Steam_Overlay::OpenOverlay(const char* pchDialog)
|
void Steam_Overlay::OpenOverlay(const char* pchDialog)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Overlay::OpenOverlay '%s'\n", pchDialog);
|
PRINT_DEBUG("TODO '%s'", pchDialog);
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (!Ready()) return;
|
if (!Ready()) return;
|
||||||
|
|
||||||
// TODO: Show pages depending on pchDialog
|
// TODO: Show pages depending on pchDialog
|
||||||
if ((strncmp(pchDialog, "Friends", sizeof("Friends") - 1) == 0) && (settings->overlayAutoAcceptInvitesCount() > 0)) {
|
if ((strncmp(pchDialog, "Friends", sizeof("Friends") - 1) == 0) && (settings->overlayAutoAcceptInvitesCount() > 0)) {
|
||||||
PRINT_DEBUG("Steam_Overlay won't open overlay's friends list because some friends are defined in the auto accept list\n");
|
PRINT_DEBUG("won't open overlay's friends list because some friends are defined in the auto accept list");
|
||||||
add_auto_accept_invite_notification();
|
add_auto_accept_invite_notification();
|
||||||
} else {
|
} else {
|
||||||
ShowOverlay(true);
|
ShowOverlay(true);
|
||||||
@ -1767,7 +1766,7 @@ void Steam_Overlay::OpenOverlay(const char* pchDialog)
|
|||||||
|
|
||||||
void Steam_Overlay::OpenOverlayWebpage(const char* pchURL)
|
void Steam_Overlay::OpenOverlayWebpage(const char* pchURL)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("TODO Steam_Overlay::OpenOverlayWebpage '%s'\n", pchURL);
|
PRINT_DEBUG("TODO '%s'", pchURL);
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (!Ready()) return;
|
if (!Ready()) return;
|
||||||
|
|
||||||
@ -1788,7 +1787,7 @@ void Steam_Overlay::ShowOverlay(bool state)
|
|||||||
show_overlay = state;
|
show_overlay = state;
|
||||||
overlay_state_changed = true;
|
overlay_state_changed = true;
|
||||||
|
|
||||||
PRINT_DEBUG("Steam_Overlay::ShowOverlay %i\n", (int)state);
|
PRINT_DEBUG("%i", (int)state);
|
||||||
|
|
||||||
Steam_Overlay::allow_renderer_frame_processing(state);
|
Steam_Overlay::allow_renderer_frame_processing(state);
|
||||||
Steam_Overlay::obscure_game_input(state);
|
Steam_Overlay::obscure_game_input(state);
|
||||||
@ -1797,7 +1796,7 @@ void Steam_Overlay::ShowOverlay(bool state)
|
|||||||
|
|
||||||
void Steam_Overlay::SetLobbyInvite(Friend friendId, uint64 lobbyId)
|
void Steam_Overlay::SetLobbyInvite(Friend friendId, uint64 lobbyId)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::SetLobbyInvite " "%" PRIu64 " %llu\n", friendId.id(), lobbyId);
|
PRINT_DEBUG("%" PRIu64 " %llu", friendId.id(), lobbyId);
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (!Ready()) return;
|
if (!Ready()) return;
|
||||||
|
|
||||||
@ -1816,7 +1815,7 @@ void Steam_Overlay::SetLobbyInvite(Friend friendId, uint64 lobbyId)
|
|||||||
|
|
||||||
void Steam_Overlay::SetRichInvite(Friend friendId, const char* connect_str)
|
void Steam_Overlay::SetRichInvite(Friend friendId, const char* connect_str)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::SetRichInvite " "%" PRIu64 " '%s'\n", friendId.id(), connect_str);
|
PRINT_DEBUG("%" PRIu64 " '%s'", friendId.id(), connect_str);
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (!Ready()) return;
|
if (!Ready()) return;
|
||||||
|
|
||||||
@ -1835,7 +1834,7 @@ void Steam_Overlay::SetRichInvite(Friend friendId, const char* connect_str)
|
|||||||
|
|
||||||
void Steam_Overlay::FriendConnect(Friend _friend)
|
void Steam_Overlay::FriendConnect(Friend _friend)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::FriendConnect " "%" PRIu64 "\n", _friend.id());
|
PRINT_DEBUG("%" PRIu64 "", _friend.id());
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (settings->disable_overlay) return;
|
if (settings->disable_overlay) return;
|
||||||
|
|
||||||
@ -1852,13 +1851,13 @@ void Steam_Overlay::FriendConnect(Friend _friend)
|
|||||||
memset(item.chat_input, 0, max_chat_len);
|
memset(item.chat_input, 0, max_chat_len);
|
||||||
item.joinable = false;
|
item.joinable = false;
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG("Steam_Overlay::FriendConnect error no free id to create a friend window\n");
|
PRINT_DEBUG("error no free id to create a friend window");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steam_Overlay::FriendDisconnect(Friend _friend)
|
void Steam_Overlay::FriendDisconnect(Friend _friend)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::FriendDisconnect " "%" PRIu64 "\n", _friend.id());
|
PRINT_DEBUG("%" PRIu64 "", _friend.id());
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (settings->disable_overlay) return;
|
if (settings->disable_overlay) return;
|
||||||
|
|
||||||
@ -1874,7 +1873,7 @@ void Steam_Overlay::FriendDisconnect(Friend _friend)
|
|||||||
// show a notification when the user unlocks an achievement
|
// show a notification when the user unlocks an achievement
|
||||||
void Steam_Overlay::AddAchievementNotification(nlohmann::json const& ach)
|
void Steam_Overlay::AddAchievementNotification(nlohmann::json const& ach)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Overlay::AddAchievementNotification\n");
|
PRINT_DEBUG_ENTRY();
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
if (!Ready()) return;
|
if (!Ready()) return;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
extern "C" __declspec( dllexport ) void *CreateInterface( const char *pName, int *pReturnCode )
|
extern "C" __declspec( dllexport ) void *CreateInterface( const char *pName, int *pReturnCode )
|
||||||
{
|
{
|
||||||
//PRINT_DEBUG("steamclient CreateInterface %s\n", pName);
|
//PRINT_DEBUG("%s", pName);
|
||||||
HMODULE steam_api = LoadLibraryA(DLL_NAME);
|
HMODULE steam_api = LoadLibraryA(DLL_NAME);
|
||||||
void *(__stdcall* create_interface)(const char*) = (void * (__stdcall *)(const char*))GetProcAddress(steam_api, "SteamInternal_CreateInterface");
|
void *(__stdcall* create_interface)(const char*) = (void * (__stdcall *)(const char*))GetProcAddress(steam_api, "SteamInternal_CreateInterface");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user