From 8576d149d3459af3c2c6309ad5a9e09fbd0050d2 Mon Sep 17 00:00:00 2001 From: otavepto Date: Sat, 6 Apr 2024 07:49:07 +0200 Subject: [PATCH] remove functions names prefixes in debug logs --- dll/auth.cpp | 8 +- dll/base.cpp | 45 +- dll/dll.cpp | 533 ++++++++++++------- dll/dll/appticket.h | 2 +- dll/dll/auth.h | 42 +- dll/dll/base.h | 16 +- dll/dll/steam_HTMLsurface.h | 112 ++-- dll/dll/steam_controller.h | 138 ++--- dll/dll/steam_friends.h | 275 ++++++---- dll/dll/steam_game_coordinator.h | 13 +- dll/dll/steam_gamesearch.h | 46 +- dll/dll/steam_inventory.h | 119 +++-- dll/dll/steam_masterserver_updater.h | 46 +- dll/dll/steam_matchmaking.h | 183 ++++--- dll/dll/steam_networking.h | 100 ++-- dll/dll/steam_networking_messages.h | 24 +- dll/dll/steam_networking_sockets.h | 251 +++++---- dll/dll/steam_networking_socketsserialized.h | 39 +- dll/dll/steam_networking_utils.h | 182 ++++--- dll/dll/steam_parties.h | 40 +- dll/dll/steam_remote_storage.h | 180 +++---- dll/dll/steam_remoteplay.h | 20 +- dll/dll/steam_tv.h | 25 +- dll/dll/steam_ugc.h | 218 ++++---- dll/dll/steam_unified_messages.h | 19 +- dll/dll/steam_user.h | 82 +-- dll/local_storage.cpp | 26 +- dll/network.cpp | 168 +++--- dll/source_query.cpp | 8 +- dll/steam_applist.cpp | 10 +- dll/steam_gameserver.cpp | 128 ++--- dll/steam_gameserverstats.cpp | 63 +-- dll/steam_http.cpp | 84 +-- dll/steam_matchmaking_servers.cpp | 138 ++--- dll/steam_music.cpp | 18 +- dll/steam_musicremote.cpp | 64 +-- dll/steam_parental.cpp | 12 +- dll/steam_screenshots.cpp | 51 +- dll/steam_user_stats.cpp | 177 +++--- dll/steam_utils.cpp | 89 ++-- dll/steam_video.cpp | 12 +- overlay_experimental/steam_overlay.cpp | 115 ++-- steamclient/steamclient.cpp | 2 +- 43 files changed, 2148 insertions(+), 1775 deletions(-) diff --git a/dll/auth.cpp b/dll/auth.cpp index 75af6c0b..25430b00 100644 --- a/dll/auth.cpp +++ b/dll/auth.cpp @@ -26,7 +26,7 @@ static uint32_t get_ticket_count() { 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->Callback(msg); @@ -301,7 +301,7 @@ void Auth_Manager::Callback(Common_Message *msg) } if (msg->low_level().type() == Low_Level::DISCONNECT) { - PRINT_DEBUG("TICKET DISCONNECT\n"); + PRINT_DEBUG("TICKET DISCONNECT"); auto t = std::begin(inbound); while (t != std::end(inbound)) { 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->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(); auto t = std::begin(inbound); while (t != std::end(inbound)) { 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); t = inbound.erase(t); } else { diff --git a/dll/base.cpp b/dll/base.cpp index a6a7503c..f98aad40 100644 --- a/dll/base.cpp +++ b/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 while (BCryptGenRandom(NULL, (PUCHAR) buf, (ULONG) size, BCRYPT_USE_SYSTEM_PREFERRED_RNG) < 0) { - PRINT_DEBUG("BCryptGenRandom ERROR\n"); + PRINT_DEBUG("ERROR"); Sleep(100); } @@ -313,13 +313,13 @@ void set_whitelist_ips(uint32_t *from, uint32_t *to, unsigned num_ips) whitelist_ips.clear(); for (unsigned i = 0; i < num_ips; ++i) { 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("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("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", ((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_to = ntohl(to[i]); if (ip_a.ip_to < ip_a.ip_from) 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); } } @@ -332,7 +332,7 @@ static bool is_whitelist_ip(unsigned char *ip) for (auto &i : whitelist_ips) { 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; } } @@ -342,7 +342,7 @@ static bool is_whitelist_ip(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 (ip[0] == 127) 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 zeroes[16] = {}; 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)) || ((ip[0] == 0xFE) && ((ip[1] & 0xC0) == 0x80))) 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; } @@ -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_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) { - PRINT_DEBUG("Mine_SendTo\n"); +static int WINAPI Mine_SendTo( SOCKET s, const char *buf, int len, int flags, const sockaddr *to, int tolen) +{ + PRINT_DEBUG_ENTRY(); if (is_lan_ip(to, tolen)) { return Real_SendTo( s, buf, len, flags, to, tolen ); } 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 ) { - PRINT_DEBUG("Mine_Connect\n"); + PRINT_DEBUG_ENTRY(); if (is_lan_ip(addr, namelen)) { return Real_Connect(s, addr, namelen); } 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) { - PRINT_DEBUG("Mine_WSAConnect\n"); + PRINT_DEBUG_ENTRY(); if (is_lan_ip(addr, namelen)) { return Real_WSAConnect(s, addr, namelen, lpCallerData, lpCalleeData, lpSQOS, lpGQOS); } else { @@ -441,7 +442,7 @@ inline bool file_exists (const std::string& name) { HMODULE (WINAPI *Real_GetModuleHandleA)(LPCSTR lpModuleName) = GetModuleHandleA; HMODULE WINAPI Mine_GetModuleHandleA(LPCSTR lpModuleName) { - PRINT_DEBUG("Mine_GetModuleHandleA %s\n", lpModuleName); + PRINT_DEBUG("%s", lpModuleName); if (!lpModuleName) return Real_GetModuleHandleA(lpModuleName); std::string in(lpModuleName); if (in == std::string(DLL_NAME)) { @@ -474,12 +475,12 @@ static void load_dll() path += "crack"; //path += PATH_SEPARATOR; path += DLL_NAME; - PRINT_DEBUG("Crack file %s\n", path.c_str()); + PRINT_DEBUG("Crack file %s", path.c_str()); if (file_exists(path)) { redirect_crackdll(); crack_dll_handle = LoadLibraryW(utf8_decode(path).c_str()); 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 (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())) { - 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) { bool (__stdcall* restart_app)(uint32) = (bool (__stdcall *)(uint32))GetProcAddress(crack_dll_handle, "SteamAPI_RestartAppIfNecessary"); if (restart_app) { - PRINT_DEBUG("Call crack SteamAPI_RestartAppIfNecessary\n"); + PRINT_DEBUG("Calling crack SteamAPI_RestartAppIfNecessary"); redirect_crackdll(); bool ret = restart_app(unOwnAppID); unredirect_crackdll(); @@ -531,7 +532,7 @@ bool crack_SteamAPI_Init() if (crack_dll_handle) { bool (__stdcall* init_app)() = (bool (__stdcall *)())GetProcAddress(crack_dll_handle, "SteamAPI_Init"); if (init_app) { - PRINT_DEBUG("Call crack SteamAPI_Init\n"); + PRINT_DEBUG("Calling crack SteamAPI_Init"); redirect_crackdll(); bool ret = init_app(); unredirect_crackdll(); @@ -555,7 +556,7 @@ HINTERNET WINAPI Mine_WinHttpConnect( IN INTERNET_PORT nServerPort, IN DWORD dwReserved ) { - PRINT_DEBUG("Mine_WinHttpConnect %ls %u\n", pswzServerName, nServerPort); + PRINT_DEBUG("%ls %u", pswzServerName, nServerPort); struct sockaddr_in ip4; struct sockaddr_in6 ip6; ip4.sin_family = AF_INET; @@ -587,7 +588,7 @@ HINTERNET WINAPI Mine_WinHttpOpenRequest( IN LPCWSTR *ppwszAcceptTypes, 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) { dwFlags ^= WINHTTP_FLAG_SECURE; } @@ -602,7 +603,7 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD dwReason, LPVOID ) { switch ( dwReason ) { 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")) { - PRINT_DEBUG("Hooking lan only functions\n"); + PRINT_DEBUG("Hooking lan only functions"); DetourTransactionBegin(); DetourUpdateThread( GetCurrentThread() ); DetourAttach( &(PVOID &)Real_SendTo, Mine_SendTo ); diff --git a/dll/dll.cpp b/dll/dll.cpp index f8972f40..5f0c87d6 100644 --- a/dll/dll.cpp +++ b/dll/dll.cpp @@ -51,10 +51,10 @@ static bool try_load_steam_interfaces(std::string interfaces_path) return false; } - PRINT_DEBUG("Trying to parse steam interfaces from file: %s\n", interfaces_path.c_str()); + PRINT_DEBUG("Trying to parse old steam interfaces from '%s'", interfaces_path.c_str()); for( std::string line; getline( input, line ); ) { - PRINT_DEBUG("line: %s\n", line.c_str()); + PRINT_DEBUG(" line: %s", line.c_str()); line.erase(std::remove(line.begin(), line.end(), ' '), line.end()); line.erase(std::remove(line.begin(), line.end(), '\n'), line.end()); line.erase(std::remove(line.begin(), line.end(), '\r'), line.end()); @@ -97,7 +97,7 @@ static bool try_load_steam_interfaces(std::string interfaces_path) #undef REPLACE_WITH_FILE - PRINT_DEBUG("NOT REPLACED %s\n", line.c_str()); + PRINT_DEBUG(" NOT REPLACED %s", line.c_str()); } return true; @@ -110,34 +110,34 @@ static void load_old_interface_versions() if (!try_load_steam_interfaces(Local_Storage::get_game_settings_path() + "steam_interfaces.txt") && !try_load_steam_interfaces(Local_Storage::get_program_path() + "steam_interfaces.txt")) { - PRINT_DEBUG("Couldn't load steam_interfaces.txt\n"); + PRINT_DEBUG("Couldn't load steam_interfaces.txt"); } - PRINT_DEBUG("Old interfaces:\n"); - PRINT_DEBUG(" client: %s\n", old_client); - PRINT_DEBUG(" gameserver stats: %s\n", old_gameserver_stats); - PRINT_DEBUG(" gameserver: %s\n", old_gameserver); - PRINT_DEBUG(" matchmaking servers: %s\n", old_matchmaking_servers); - PRINT_DEBUG(" matchmaking: %s\n", old_matchmaking); - PRINT_DEBUG(" user: %s\n", old_user); - PRINT_DEBUG(" friends: %s\n", old_friends); - PRINT_DEBUG(" utils: %s\n", old_utils); - PRINT_DEBUG(" userstats: %s\n", old_userstats); - PRINT_DEBUG(" apps: %s\n", old_apps); - PRINT_DEBUG(" networking: %s\n", old_networking); - PRINT_DEBUG(" remote storage: %s\n", old_remote_storage_interface); - PRINT_DEBUG(" screenshots: %s\n", old_screenshots); - PRINT_DEBUG(" http: %s\n", old_http); - PRINT_DEBUG(" unified messages: %s\n", old_unified_messages); - PRINT_DEBUG(" controller %s\n", old_controller); - PRINT_DEBUG(" ugc: %s\n", old_ugc_interface); - PRINT_DEBUG(" applist: %s\n", old_applist); - PRINT_DEBUG(" music: %s\n", old_music); - PRINT_DEBUG(" music remote: %s\n", old_music_remote); - PRINT_DEBUG(" html surface: %s\n", old_html_surface); - PRINT_DEBUG(" inventory: %s\n", old_inventory); - PRINT_DEBUG(" video: %s\n", old_video); - PRINT_DEBUG(" masterserver updater: %s\n", old_masterserver_updater); + PRINT_DEBUG("Old interfaces:"); + PRINT_DEBUG(" client: %s", old_client); + PRINT_DEBUG(" gameserver stats: %s", old_gameserver_stats); + PRINT_DEBUG(" gameserver: %s", old_gameserver); + PRINT_DEBUG(" matchmaking servers: %s", old_matchmaking_servers); + PRINT_DEBUG(" matchmaking: %s", old_matchmaking); + PRINT_DEBUG(" user: %s", old_user); + PRINT_DEBUG(" friends: %s", old_friends); + PRINT_DEBUG(" utils: %s", old_utils); + PRINT_DEBUG(" userstats: %s", old_userstats); + PRINT_DEBUG(" apps: %s", old_apps); + PRINT_DEBUG(" networking: %s", old_networking); + PRINT_DEBUG(" remote storage: %s", old_remote_storage_interface); + PRINT_DEBUG(" screenshots: %s", old_screenshots); + PRINT_DEBUG(" http: %s", old_http); + PRINT_DEBUG(" unified messages: %s", old_unified_messages); + PRINT_DEBUG(" controller %s", old_controller); + PRINT_DEBUG(" ugc: %s", old_ugc_interface); + PRINT_DEBUG(" applist: %s", old_applist); + PRINT_DEBUG(" music: %s", old_music); + PRINT_DEBUG(" music remote: %s", old_music_remote); + PRINT_DEBUG(" html surface: %s", old_html_surface); + PRINT_DEBUG(" inventory: %s", old_inventory); + PRINT_DEBUG(" video: %s", old_video); + PRINT_DEBUG(" masterserver updater: %s", old_masterserver_updater); reset_LastError(); loaded = true; @@ -146,7 +146,7 @@ static void load_old_interface_versions() //steam_api_internal.h STEAMAPI_API HSteamUser SteamAPI_GetHSteamUser() { - PRINT_DEBUG("SteamAPI_GetHSteamUser\n"); + PRINT_DEBUG_ENTRY(); if (!get_steam_client()->user_logged_in) return 0; return CLIENT_HSTEAMUSER; } @@ -245,7 +245,7 @@ static void *create_client_interface(const char *ver) STEAMAPI_API void * S_CALLTYPE SteamInternal_CreateInterface( const char *ver ) { - PRINT_DEBUG("SteamInternal_CreateInterface %s\n", ver); + PRINT_DEBUG("%s", ver); if (!get_steam_client()->user_logged_in && !get_steam_client()->IsServerInit()) return NULL; return create_client_interface(ver); @@ -256,10 +256,10 @@ struct ContextInitData { void (*pFn)(void* pCtx); uintp counter; CSteamAPIContex STEAMAPI_API void * S_CALLTYPE SteamInternal_ContextInit( void *pContextInitData ) { - //PRINT_DEBUG("SteamInternal_ContextInit\n"); + //PRINT_DEBUG_ENTRY(); struct ContextInitData *contextInitData = (struct ContextInitData *)pContextInitData; if (contextInitData->counter != global_counter) { - PRINT_DEBUG("SteamInternal_ContextInit initializing\n"); + PRINT_DEBUG("initializing"); contextInitData->pFn(&contextInitData->ctx); contextInitData->counter = global_counter; } @@ -280,7 +280,7 @@ STEAMAPI_API void * S_CALLTYPE SteamInternal_ContextInit( void *pContextInitData // FatalError( "Failed to init Steam. %s", errMsg ); STEAMAPI_API ESteamAPIInitResult S_CALLTYPE SteamInternal_SteamAPI_Init( const char *pszInternalCheckInterfaceVersions, SteamErrMsg *pOutErrMsg ) { - PRINT_DEBUG("SteamInternal_SteamAPI_Init: %s\n", pszInternalCheckInterfaceVersions); + PRINT_DEBUG("%s", pszInternalCheckInterfaceVersions); if (SteamAPI_Init()) { return ESteamAPIInitResult::k_ESteamAPIInitResult_OK; } @@ -294,7 +294,7 @@ STEAMAPI_API ESteamAPIInitResult S_CALLTYPE SteamInternal_SteamAPI_Init( const c STEAMAPI_API ESteamAPIInitResult S_CALLTYPE SteamAPI_InitFlat( SteamErrMsg *pOutErrMsg ) { - PRINT_DEBUG("SteamAPI_InitFlat\n"); + PRINT_DEBUG_ENTRY(); if (SteamAPI_Init()) { return ESteamAPIInitResult::k_ESteamAPIInitResult_OK; } @@ -311,7 +311,7 @@ STEAMAPI_API ESteamAPIInitResult S_CALLTYPE SteamAPI_InitFlat( SteamErrMsg *pOut static HSteamPipe user_steam_pipe; STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_Init() { - PRINT_DEBUG("SteamAPI_Init called\n"); + PRINT_DEBUG_ENTRY(); if (user_steam_pipe) return true; #ifdef EMU_EXPERIMENTAL_BUILD crack_SteamAPI_Init(); @@ -327,7 +327,7 @@ STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_Init() //TODO: not sure if this is the right signature for this function. STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_InitAnonymousUser() { - PRINT_DEBUG("SteamAPI_InitAnonymousUser called\n"); + PRINT_DEBUG_ENTRY(); return SteamAPI_Init(); } @@ -352,11 +352,20 @@ static ISteamInventory *old_inventory_instance; static ISteamVideo *old_video_instance; static ISteamParentalSettings *old_parental_instance; static ISteamUnifiedMessages *old_unified_instance; +static ISteamGameServer *old_gameserver_instance; +static ISteamUtils *old_gamserver_utils_instance; +static ISteamNetworking *old_gamserver_networking_instance; +static ISteamGameServerStats *old_gamserver_stats_instance; +static ISteamHTTP *old_gamserver_http_instance; +static ISteamInventory *old_gamserver_inventory_instance; +static ISteamUGC *old_gamserver_ugc_instance; +static ISteamApps *old_gamserver_apps_instance; +static ISteamMasterServerUpdater *old_gamserver_masterupdater_instance; // SteamAPI_Shutdown should be called during process shutdown if possible. STEAMAPI_API void S_CALLTYPE SteamAPI_Shutdown() { - PRINT_DEBUG("SteamAPI_Shutdown\n"); + PRINT_DEBUG_ENTRY(); get_steam_client()->clientShutdown(); get_steam_client()->BReleaseSteamPipe(user_steam_pipe); get_steam_client()->BShutdownIfAllPipesClosed(); @@ -400,7 +409,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_Shutdown() // since the DRM wrapper will ensure that your application was launched properly through Steam. STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID ) { - PRINT_DEBUG("SteamAPI_RestartAppIfNecessary %u\n", unOwnAppID); + PRINT_DEBUG("%u", unOwnAppID); #ifdef EMU_EXPERIMENTAL_BUILD crack_SteamAPI_RestartAppIfNecessary(unOwnAppID); #endif @@ -414,40 +423,40 @@ STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_RestartAppIfNecessary( uint32 unOwnA // program never needs to explicitly call this function. STEAMAPI_API void S_CALLTYPE SteamAPI_ReleaseCurrentThreadMemory() { - PRINT_DEBUG("SteamAPI_ReleaseCurrentThreadMemory\n"); + PRINT_DEBUG_ENTRY(); } // crash dump recording functions STEAMAPI_API void S_CALLTYPE SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID ) { - PRINT_DEBUG("SteamAPI_WriteMiniDump\n"); + PRINT_DEBUG_ENTRY(); } STEAMAPI_API void S_CALLTYPE SteamAPI_SetMiniDumpComment( const char *pchMsg ) { - PRINT_DEBUG("SteamAPI_SetMiniDumpComment: %s\n", pchMsg); + PRINT_DEBUG("%s", pchMsg); } //----------------------------------------------------------------------------------------------------------------------------------------------------------// -// steam callback and call-result helpers +// steam callback and call-result helpers // -// The following macros and classes are used to register your application for -// callbacks and call-results, which are delivered in a predictable manner. +// The following macros and classes are used to register your application for +// callbacks and call-results, which are delivered in a predictable manner. // -// STEAM_CALLBACK macros are meant for use inside of a C++ class definition. -// They map a Steam notification callback directly to a class member function -// which is automatically prototyped as "void func( callback_type *pParam )". +// STEAM_CALLBACK macros are meant for use inside of a C++ class definition. +// They map a Steam notification callback directly to a class member function +// which is automatically prototyped as "void func( callback_type *pParam )". // -// CCallResult is used with specific Steam APIs that return "result handles". -// The handle can be passed to a CCallResult object's Set function, along with -// an object pointer and member-function pointer. The member function will -// be executed once the results of the Steam API call are available. +// CCallResult is used with specific Steam APIs that return "result handles". +// The handle can be passed to a CCallResult object's Set function, along with +// an object pointer and member-function pointer. The member function will +// be executed once the results of the Steam API call are available. // -// CCallback and CCallbackManual classes can be used instead of STEAM_CALLBACK -// macros if you require finer control over registration and unregistration. +// CCallback and CCallbackManual classes can be used instead of STEAM_CALLBACK +// macros if you require finer control over registration and unregistration. // -// Callbacks and call-results are queued automatically and are only -// delivered/executed when your application calls SteamAPI_RunCallbacks(). +// Callbacks and call-results are queued automatically and are only +// delivered/executed when your application calls SteamAPI_RunCallbacks(). //----------------------------------------------------------------------------------------------------------------------------------------------------------// // SteamAPI_RunCallbacks is safe to call from multiple threads simultaneously, @@ -456,7 +465,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_SetMiniDumpComment( const char *pchMsg ) // and call SteamAPI_ReleaseCurrentThreadMemory regularly on other threads. STEAMAPI_API void S_CALLTYPE SteamAPI_RunCallbacks() { - PRINT_DEBUG("SteamAPI_RunCallbacks\n"); + PRINT_DEBUG_ENTRY(); get_steam_client()->RunCallbacks(true, false); //std::this_thread::sleep_for(std::chrono::microseconds(1)); //fixes resident evil revelations lagging. (Seems to work fine without this right now, commenting out) } @@ -467,25 +476,25 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_RunCallbacks() // The optional fourth 'var' param exists only for backwards-compatibility // and can be ignored. //#define STEAM_CALLBACK( thisclass, func, .../*callback_type, [deprecated] var*/ ) \ -// _STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) ) +// _STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) ) // Declares a callback function and a named CCallbackManual variable which // has Register and Unregister functions instead of automatic registration. -//#define STEAM_CALLBACK_MANUAL( thisclass, func, callback_type, var ) \ -// CCallbackManual< thisclass, callback_type > var; void func( callback_type *pParam ) +//#define STEAM_CALLBACK_MANUAL( thisclass, func, callback_type, var ) \ +// CCallbackManual< thisclass, callback_type > var; void func( callback_type *pParam ) // Internal functions used by the utility CCallback objects to receive callbacks STEAMAPI_API void S_CALLTYPE SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback ) { - PRINT_DEBUG("SteamAPI_RegisterCallback %p %u funct:%u\n", pCallback, iCallback, pCallback->GetICallback()); + PRINT_DEBUG("%p %u funct:%u", pCallback, iCallback, pCallback->GetICallback()); std::lock_guard lock(global_mutex); get_steam_client()->RegisterCallback(pCallback, iCallback); } STEAMAPI_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *pCallback ) { - PRINT_DEBUG("SteamAPI_UnregisterCallback %p\n", pCallback); + PRINT_DEBUG("%p", pCallback); std::lock_guard lock(global_mutex); if (!steamclient_instance) return; get_steam_client()->UnregisterCallback(pCallback); @@ -494,7 +503,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *p // Internal functions used by the utility CCallResult objects to receive async call results STEAMAPI_API void S_CALLTYPE SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ) { - PRINT_DEBUG("SteamAPI_RegisterCallResult\n"); + PRINT_DEBUG_ENTRY(); if (!hAPICall) return; @@ -503,7 +512,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_RegisterCallResult( class CCallbackBase *p STEAMAPI_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ) { - PRINT_DEBUG("SteamAPI_UnregisterCallResult\n"); + PRINT_DEBUG_ENTRY(); if (!hAPICall) return; @@ -513,26 +522,26 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase STEAMAPI_API void *S_CALLTYPE SteamInternal_FindOrCreateUserInterface( HSteamUser hSteamUser, const char *pszVersion ) { - PRINT_DEBUG("SteamInternal_FindOrCreateUserInterface %i %s\n", hSteamUser, pszVersion); + PRINT_DEBUG("%i %s", hSteamUser, pszVersion); return get_steam_client()->GetISteamGenericInterface(hSteamUser, SteamAPI_GetHSteamPipe(), pszVersion); } STEAMAPI_API void *S_CALLTYPE SteamInternal_FindOrCreateGameServerInterface( HSteamUser hSteamUser, const char *pszVersion ) { - PRINT_DEBUG("SteamInternal_FindOrCreateGameServerInterface %i %s\n", hSteamUser, pszVersion); + PRINT_DEBUG("%i %s", hSteamUser, pszVersion); return get_steam_client()->GetISteamGenericInterface(hSteamUser, SteamGameServer_GetHSteamPipe(), pszVersion); } //----------------------------------------------------------------------------------------------------------------------------------------------------------// -// steamclient.dll private wrapper functions +// steamclient.dll private wrapper functions // -// The following functions are part of abstracting API access to the steamclient.dll, but should only be used in very specific cases +// The following functions are part of abstracting API access to the steamclient.dll, but should only be used in very specific cases //----------------------------------------------------------------------------------------------------------------------------------------------------------// // SteamAPI_IsSteamRunning() returns true if Steam is currently running STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_IsSteamRunning() { - PRINT_DEBUG("SteamAPI_IsSteamRunning\n"); + PRINT_DEBUG_ENTRY(); return true; } @@ -540,7 +549,7 @@ STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_IsSteamRunning() // NOT THREADSAFE - do not call from multiple threads simultaneously. STEAMAPI_API void Steam_RunCallbacks( HSteamPipe hSteamPipe, bool bGameServerCallbacks ) { - PRINT_DEBUG("Steam_RunCallbacks\n"); + PRINT_DEBUG_ENTRY(); SteamAPI_RunCallbacks(); @@ -551,13 +560,13 @@ STEAMAPI_API void Steam_RunCallbacks( HSteamPipe hSteamPipe, bool bGameServerCal // register the callback funcs to use to interact with the steam dll STEAMAPI_API void Steam_RegisterInterfaceFuncs( void *hModule ) { - PRINT_DEBUG("Steam_RegisterInterfaceFuncs\n"); + PRINT_DEBUG_ENTRY(); } // returns the HSteamUser of the last user to dispatch a callback STEAMAPI_API HSteamUser Steam_GetHSteamUserCurrent() { - PRINT_DEBUG("Steam_GetHSteamUserCurrent\n"); + PRINT_DEBUG_ENTRY(); //TODO return SteamAPI_GetHSteamUser(); } @@ -566,7 +575,7 @@ STEAMAPI_API HSteamUser Steam_GetHSteamUserCurrent() // DEPRECATED - implementation is Windows only, and the path returned is a UTF-8 string which must be converted to UTF-16 for use with Win32 APIs STEAMAPI_API const char *SteamAPI_GetSteamInstallPath() { - PRINT_DEBUG("SteamAPI_GetSteamInstallPath\n"); + PRINT_DEBUG_ENTRY(); static char steam_folder[1024]; std::string path = Local_Storage::get_program_path(); strcpy(steam_folder, path.c_str()); @@ -577,26 +586,26 @@ STEAMAPI_API const char *SteamAPI_GetSteamInstallPath() // returns the pipe we are communicating to Steam with STEAMAPI_API HSteamPipe SteamAPI_GetHSteamPipe() { - PRINT_DEBUG("SteamAPI_GetHSteamPipe\n"); + PRINT_DEBUG_ENTRY(); return user_steam_pipe; } // sets whether or not Steam_RunCallbacks() should do a try {} catch (...) {} around calls to issuing callbacks STEAMAPI_API void SteamAPI_SetTryCatchCallbacks( bool bTryCatchCallbacks ) { - PRINT_DEBUG("SteamAPI_SetTryCatchCallbacks\n"); + PRINT_DEBUG_ENTRY(); } // backwards compat export, passes through to SteamAPI_ variants STEAMAPI_API HSteamPipe GetHSteamPipe() { - PRINT_DEBUG("GetHSteamPipe\n"); + PRINT_DEBUG_ENTRY(); return SteamAPI_GetHSteamPipe(); } STEAMAPI_API HSteamUser GetHSteamUser() { - PRINT_DEBUG("GetHSteamUser\n"); + PRINT_DEBUG_ENTRY(); return SteamAPI_GetHSteamUser(); } @@ -604,13 +613,13 @@ STEAMAPI_API HSteamUser GetHSteamUser() // exists only for backwards compat with code written against older SDKs STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_InitSafe() { - PRINT_DEBUG("SteamAPI_InitSafe\n"); + PRINT_DEBUG_ENTRY(); SteamAPI_Init(); return true; } STEAMAPI_API ISteamClient *SteamClient() { - PRINT_DEBUG("SteamClient()\n"); + PRINT_DEBUG_ENTRY(); load_old_interface_versions(); if (!get_steam_client()->user_logged_in) return NULL; return (ISteamClient *)SteamInternal_CreateInterface(old_client); @@ -618,47 +627,207 @@ STEAMAPI_API ISteamClient *SteamClient() { #define CACHE_OLDSTEAM_INSTANCE(variable, get_func) { if (variable) return variable; else return variable = (get_func); } -STEAMAPI_API ISteamUser *SteamUser() { PRINT_DEBUG("SteamUser()\n"); CACHE_OLDSTEAM_INSTANCE(old_user_instance, get_steam_client_old()->GetISteamUser(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_user)) } -STEAMAPI_API ISteamFriends *SteamFriends() { PRINT_DEBUG("SteamFriends()\n"); CACHE_OLDSTEAM_INSTANCE(old_friends_interface, get_steam_client_old()->GetISteamFriends(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_friends )) } -STEAMAPI_API ISteamUtils *SteamUtils() { PRINT_DEBUG("SteamUtils()\n"); CACHE_OLDSTEAM_INSTANCE(old_utils_interface, get_steam_client_old()->GetISteamUtils(SteamAPI_GetHSteamPipe(), old_utils)) } -STEAMAPI_API ISteamMatchmaking *SteamMatchmaking() { PRINT_DEBUG("SteamMatchmaking()\n"); CACHE_OLDSTEAM_INSTANCE(old_matchmaking_instance, get_steam_client_old()->GetISteamMatchmaking(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_matchmaking)) } -STEAMAPI_API ISteamUserStats *SteamUserStats() { PRINT_DEBUG("SteamUserStats()\n"); CACHE_OLDSTEAM_INSTANCE(old_userstats_instance, get_steam_client_old()->GetISteamUserStats(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_userstats)) } -STEAMAPI_API ISteamApps *SteamApps() { PRINT_DEBUG("SteamApps()\n"); CACHE_OLDSTEAM_INSTANCE(old_apps_instance, get_steam_client_old()->GetISteamApps(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_apps)) } -STEAMAPI_API ISteamMatchmakingServers *SteamMatchmakingServers() { PRINT_DEBUG("SteamMatchmakingServers()\n"); CACHE_OLDSTEAM_INSTANCE(old_matchmakingservers_instance, get_steam_client_old()->GetISteamMatchmakingServers(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_matchmaking_servers)) } -STEAMAPI_API ISteamNetworking *SteamNetworking() { PRINT_DEBUG("SteamNetworking()\n"); CACHE_OLDSTEAM_INSTANCE(old_networking_instance, get_steam_client_old()->GetISteamNetworking(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_networking)) } -STEAMAPI_API ISteamRemoteStorage *SteamRemoteStorage() { PRINT_DEBUG("SteamRemoteStorage()\n"); CACHE_OLDSTEAM_INSTANCE(old_remotestorage_instance, get_steam_client_old()->GetISteamRemoteStorage(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_remote_storage_interface)) } -STEAMAPI_API ISteamScreenshots *SteamScreenshots() { PRINT_DEBUG("SteamScreenshots()\n"); CACHE_OLDSTEAM_INSTANCE(old_screenshots_instance, get_steam_client_old()->GetISteamScreenshots(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_screenshots)) } -STEAMAPI_API ISteamHTTP *SteamHTTP() { PRINT_DEBUG("SteamHTTP()\n"); CACHE_OLDSTEAM_INSTANCE(old_http_instance, get_steam_client_old()->GetISteamHTTP(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_http)) } -STEAMAPI_API ISteamController *SteamController() { PRINT_DEBUG("SteamController()\n"); CACHE_OLDSTEAM_INSTANCE(old_controller_instance, get_steam_client_old()->GetISteamController(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_controller)) } -STEAMAPI_API ISteamUGC *SteamUGC() { PRINT_DEBUG("SteamUGC()\n"); CACHE_OLDSTEAM_INSTANCE(old_ugc_instance, get_steam_client_old()->GetISteamUGC(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_ugc_interface )) } -STEAMAPI_API ISteamAppList *SteamAppList() { PRINT_DEBUG("SteamAppList()\n"); CACHE_OLDSTEAM_INSTANCE(old_applist_instance, get_steam_client_old()->GetISteamAppList(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_applist)) } -STEAMAPI_API ISteamMusic *SteamMusic() { PRINT_DEBUG("SteamMusic()\n"); CACHE_OLDSTEAM_INSTANCE(old_music_instance, get_steam_client_old()->GetISteamMusic(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_music)) } -STEAMAPI_API ISteamMusicRemote *SteamMusicRemote() { PRINT_DEBUG("SteamMusicRemote()\n"); CACHE_OLDSTEAM_INSTANCE(old_musicremote_instance, get_steam_client_old()->GetISteamMusicRemote(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_music_remote)) } -STEAMAPI_API ISteamHTMLSurface *SteamHTMLSurface() { PRINT_DEBUG("SteamHTMLSurface()\n"); CACHE_OLDSTEAM_INSTANCE(old_htmlsurface_instance, get_steam_client_old()->GetISteamHTMLSurface(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_html_surface)) } -STEAMAPI_API ISteamInventory *SteamInventory() { PRINT_DEBUG("SteamInventory()\n"); CACHE_OLDSTEAM_INSTANCE(old_inventory_instance, get_steam_client_old()->GetISteamInventory(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_inventory)) } -STEAMAPI_API ISteamVideo *SteamVideo() { PRINT_DEBUG("SteamVideo()\n"); CACHE_OLDSTEAM_INSTANCE(old_video_instance, get_steam_client_old()->GetISteamVideo(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_video)) } -STEAMAPI_API ISteamParentalSettings *SteamParentalSettings() { PRINT_DEBUG("SteamParentalSettings()\n"); CACHE_OLDSTEAM_INSTANCE(old_parental_instance, get_steam_client_old()->GetISteamParentalSettings(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), "")) } -STEAMAPI_API ISteamUnifiedMessages *SteamUnifiedMessages() { PRINT_DEBUG("SteamUnifiedMessages()\n"); CACHE_OLDSTEAM_INSTANCE(old_unified_instance, get_steam_client_old()->GetISteamUnifiedMessages(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_unified_messages)) } +STEAMAPI_API ISteamUser *SteamUser() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_user_instance, get_steam_client_old()->GetISteamUser(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_user)) +} + +STEAMAPI_API ISteamFriends *SteamFriends() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_friends_interface, get_steam_client_old()->GetISteamFriends(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_friends )) +} + +STEAMAPI_API ISteamUtils *SteamUtils() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_utils_interface, get_steam_client_old()->GetISteamUtils(SteamAPI_GetHSteamPipe(), old_utils)) +} + +STEAMAPI_API ISteamMatchmaking *SteamMatchmaking() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_matchmaking_instance, get_steam_client_old()->GetISteamMatchmaking(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_matchmaking)) +} + +STEAMAPI_API ISteamUserStats *SteamUserStats() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_userstats_instance, get_steam_client_old()->GetISteamUserStats(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_userstats)) +} + +STEAMAPI_API ISteamApps *SteamApps() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_apps_instance, get_steam_client_old()->GetISteamApps(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_apps)) +} + +STEAMAPI_API ISteamMatchmakingServers *SteamMatchmakingServers() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_matchmakingservers_instance, get_steam_client_old()->GetISteamMatchmakingServers(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_matchmaking_servers)) +} + +STEAMAPI_API ISteamNetworking *SteamNetworking() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_networking_instance, get_steam_client_old()->GetISteamNetworking(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_networking)) +} + +STEAMAPI_API ISteamRemoteStorage *SteamRemoteStorage() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_remotestorage_instance, get_steam_client_old()->GetISteamRemoteStorage(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_remote_storage_interface)) +} + +STEAMAPI_API ISteamScreenshots *SteamScreenshots() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_screenshots_instance, get_steam_client_old()->GetISteamScreenshots(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_screenshots)) +} + +STEAMAPI_API ISteamHTTP *SteamHTTP() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_http_instance, get_steam_client_old()->GetISteamHTTP(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_http)) +} + +STEAMAPI_API ISteamController *SteamController() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_controller_instance, get_steam_client_old()->GetISteamController(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_controller)) +} + +STEAMAPI_API ISteamUGC *SteamUGC() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_ugc_instance, get_steam_client_old()->GetISteamUGC(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_ugc_interface )) +} + +STEAMAPI_API ISteamAppList *SteamAppList() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_applist_instance, get_steam_client_old()->GetISteamAppList(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_applist)) +} + +STEAMAPI_API ISteamMusic *SteamMusic() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_music_instance, get_steam_client_old()->GetISteamMusic(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_music)) +} + +STEAMAPI_API ISteamMusicRemote *SteamMusicRemote() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_musicremote_instance, get_steam_client_old()->GetISteamMusicRemote(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_music_remote)) +} + +STEAMAPI_API ISteamHTMLSurface *SteamHTMLSurface() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_htmlsurface_instance, get_steam_client_old()->GetISteamHTMLSurface(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_html_surface)) +} + +STEAMAPI_API ISteamInventory *SteamInventory() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_inventory_instance, get_steam_client_old()->GetISteamInventory(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_inventory)) +} + +STEAMAPI_API ISteamVideo *SteamVideo() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_video_instance, get_steam_client_old()->GetISteamVideo(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_video)) +} + +STEAMAPI_API ISteamParentalSettings *SteamParentalSettings() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_parental_instance, get_steam_client_old()->GetISteamParentalSettings(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), "")) +} + +STEAMAPI_API ISteamUnifiedMessages *SteamUnifiedMessages() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_unified_instance, get_steam_client_old()->GetISteamUnifiedMessages(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), old_unified_messages)) +} + +STEAMAPI_API ISteamGameServer *SteamGameServer() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_gameserver_instance, get_steam_clientserver_old()->GetISteamGameServer(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_gameserver )) +} + +STEAMAPI_API ISteamUtils *SteamGameServerUtils() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_gamserver_utils_instance, get_steam_clientserver_old()->GetISteamUtils(SteamGameServer_GetHSteamPipe(), old_utils )) +} + +STEAMAPI_API ISteamNetworking *SteamGameServerNetworking() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_gamserver_networking_instance, get_steam_clientserver_old()->GetISteamNetworking(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_networking )) +} + +STEAMAPI_API ISteamGameServerStats *SteamGameServerStats() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_gamserver_stats_instance, get_steam_clientserver_old()->GetISteamGameServerStats(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_gameserver_stats )) +} + +STEAMAPI_API ISteamHTTP *SteamGameServerHTTP() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_gamserver_http_instance, get_steam_clientserver_old()->GetISteamHTTP(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_http )) +} + +STEAMAPI_API ISteamInventory *SteamGameServerInventory() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_gamserver_inventory_instance, get_steam_clientserver_old()->GetISteamInventory(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_inventory )) +} + +STEAMAPI_API ISteamUGC *SteamGameServerUGC() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_gamserver_ugc_instance, get_steam_clientserver_old()->GetISteamUGC(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_ugc_interface )) +} + +STEAMAPI_API ISteamApps *SteamGameServerApps() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_gamserver_apps_instance, get_steam_clientserver_old()->GetISteamApps(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_apps )) +} + +STEAMAPI_API ISteamMasterServerUpdater *SteamMasterServerUpdater() +{ + PRINT_DEBUG_ENTRY(); + CACHE_OLDSTEAM_INSTANCE(old_gamserver_masterupdater_instance, get_steam_clientserver_old()->GetISteamMasterServerUpdater(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_masterserver_updater)) +} + +#undef CACHE_OLDSTEAM_INSTANCE //Gameserver stuff STEAMAPI_API void * S_CALLTYPE SteamGameServerInternal_CreateInterface( const char *ver ) { - PRINT_DEBUG("SteamGameServerInternal_CreateInterface %s\n", ver); + PRINT_DEBUG("%s", ver); return SteamInternal_CreateInterface(ver); } static HSteamPipe server_steam_pipe; STEAMAPI_API HSteamPipe S_CALLTYPE SteamGameServer_GetHSteamPipe() { - PRINT_DEBUG("SteamGameServer_GetHSteamPipe\n"); + PRINT_DEBUG_ENTRY(); return server_steam_pipe; } STEAMAPI_API HSteamUser S_CALLTYPE SteamGameServer_GetHSteamUser() { - PRINT_DEBUG("SteamGameServer_GetHSteamUser\n"); + PRINT_DEBUG_ENTRY(); if (!get_steam_client()->server_init) return 0; return SERVER_HSTEAMUSER; } @@ -667,14 +836,14 @@ STEAMAPI_API HSteamUser S_CALLTYPE SteamGameServer_GetHSteamUser() //STEAMAPI_API steam_bool S_CALLTYPE SteamGameServer_InitSafe(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString ) STEAMAPI_API steam_bool S_CALLTYPE SteamGameServer_InitSafe( uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 unknown, EServerMode eServerMode, void *unknown1, void *unknown2, void *unknown3 ) { - PRINT_DEBUG("SteamGameServer_InitSafe called\n"); + PRINT_DEBUG_ENTRY(); const char *pchVersionString; EServerMode serverMode; uint16 usQueryPort; load_old_interface_versions(); bool logon_anon = false; if (strcmp(old_gameserver, "SteamGameServer010") == 0 || strstr(old_gameserver, "SteamGameServer00") == old_gameserver) { - PRINT_DEBUG("Old game server init safe\n"); + PRINT_DEBUG("Old game server init safe"); pchVersionString = (char *)unknown3; memcpy(&serverMode, &unknown1, sizeof(serverMode)); memcpy(&usQueryPort, (char *)&eServerMode, sizeof(usQueryPort)); @@ -697,7 +866,7 @@ STEAMAPI_API ISteamClient *SteamGameServerClient(); STEAMAPI_API steam_bool S_CALLTYPE SteamInternal_GameServer_Init( uint32 unIP, uint16 usPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString ) { - PRINT_DEBUG("SteamInternal_GameServer_Init %X %hu %hu %hu %u %s\n", unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString); + PRINT_DEBUG("%X %hu %hu %hu %u %s", unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString); if (!server_steam_pipe) { load_old_interface_versions(); get_steam_client()->CreateLocalUser(&server_steam_pipe, k_EAccountTypeGameServer); @@ -713,7 +882,7 @@ STEAMAPI_API steam_bool S_CALLTYPE SteamInternal_GameServer_Init( uint32 unIP, u STEAMAPI_API ESteamAPIInitResult S_CALLTYPE SteamInternal_GameServer_Init_V2( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString, const char *pszInternalCheckInterfaceVersions, SteamErrMsg *pOutErrMsg ) { - PRINT_DEBUG("SteamInternal_GameServer_Init_V2 %u %hu %hu %u %s %s\n", unIP, usGamePort, usQueryPort, eServerMode, pchVersionString, pszInternalCheckInterfaceVersions); + PRINT_DEBUG("%u %hu %hu %u %s %s", unIP, usGamePort, usQueryPort, eServerMode, pchVersionString, pszInternalCheckInterfaceVersions); if (SteamInternal_GameServer_Init(unIP, 0, usGamePort, usQueryPort, eServerMode, pchVersionString)) { return ESteamAPIInitResult::k_ESteamAPIInitResult_OK; } @@ -735,14 +904,14 @@ STEAMAPI_API ESteamAPIInitResult S_CALLTYPE SteamInternal_GameServer_Init_V2( ui //STEAMAPI_API steam_bool SteamGameServer_Init( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString ); STEAMAPI_API steam_bool SteamGameServer_Init( uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 unknown, EServerMode eServerMode, void *unknown1, void *unknown2, void *unknown3 ) { - PRINT_DEBUG("SteamGameServer_Init called\n"); + PRINT_DEBUG_ENTRY(); const char *pchVersionString; EServerMode serverMode; uint16 usQueryPort; load_old_interface_versions(); bool logon_anon = false; if (strcmp(old_gameserver, "SteamGameServer010") == 0 || strstr(old_gameserver, "SteamGameServer00") == old_gameserver) { - PRINT_DEBUG("Old game server init\n"); + PRINT_DEBUG("Old game server init"); pchVersionString = (char *)unknown3; memcpy(&serverMode, &unknown1, sizeof(serverMode)); memcpy(&usQueryPort, (char *)&eServerMode, sizeof(usQueryPort)); @@ -761,19 +930,9 @@ STEAMAPI_API steam_bool SteamGameServer_Init( uint32 unIP, uint16 usSteamPort, u return ret; } -static ISteamGameServer *old_gameserver_instance; -static ISteamUtils *old_gamserver_utils_instance; -static ISteamNetworking *old_gamserver_networking_instance; -static ISteamGameServerStats *old_gamserver_stats_instance; -static ISteamHTTP *old_gamserver_http_instance; -static ISteamInventory *old_gamserver_inventory_instance; -static ISteamUGC *old_gamserver_ugc_instance; -static ISteamApps *old_gamserver_apps_instance; -static ISteamMasterServerUpdater *old_gamserver_masterupdater_instance; - STEAMAPI_API void SteamGameServer_Shutdown() { - PRINT_DEBUG("SteamGameServer_Shutdown\n"); + PRINT_DEBUG_ENTRY(); get_steam_client()->serverShutdown(); get_steam_client()->BReleaseSteamPipe(server_steam_pipe); get_steam_client()->BShutdownIfAllPipesClosed(); @@ -797,39 +956,29 @@ STEAMAPI_API void SteamGameServer_Shutdown() STEAMAPI_API void SteamGameServer_RunCallbacks() { - PRINT_DEBUG("SteamGameServer_RunCallbacks\n"); + PRINT_DEBUG_ENTRY(); get_steam_client()->RunCallbacks(false, true); } STEAMAPI_API steam_bool SteamGameServer_BSecure() { - PRINT_DEBUG("SteamGameServer_BSecure\n"); + PRINT_DEBUG_ENTRY(); return get_steam_client()->steam_gameserver->BSecure(); } STEAMAPI_API uint64 SteamGameServer_GetSteamID() { - PRINT_DEBUG("SteamGameServer_GetSteamID\n"); + PRINT_DEBUG_ENTRY(); return get_steam_client()->steam_gameserver->GetSteamID().ConvertToUint64(); } -STEAMAPI_API ISteamClient *SteamGameServerClient() { - PRINT_DEBUG("SteamGameServerClient()\n"); +STEAMAPI_API ISteamClient *SteamGameServerClient() +{ + PRINT_DEBUG_ENTRY(); if (!get_steam_clientserver_old()->IsServerInit()) return NULL; return (ISteamClient *)SteamInternal_CreateInterface(old_client); } -STEAMAPI_API ISteamGameServer *SteamGameServer() { PRINT_DEBUG("SteamGameServer()\n"); CACHE_OLDSTEAM_INSTANCE(old_gameserver_instance, get_steam_clientserver_old()->GetISteamGameServer(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_gameserver )) } -STEAMAPI_API ISteamUtils *SteamGameServerUtils() { PRINT_DEBUG("SteamGameServerUtils()\n"); CACHE_OLDSTEAM_INSTANCE(old_gamserver_utils_instance, get_steam_clientserver_old()->GetISteamUtils(SteamGameServer_GetHSteamPipe(), old_utils )) } -STEAMAPI_API ISteamNetworking *SteamGameServerNetworking() { PRINT_DEBUG("SteamGameServerNetworking()\n"); CACHE_OLDSTEAM_INSTANCE(old_gamserver_networking_instance, get_steam_clientserver_old()->GetISteamNetworking(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_networking )) } -STEAMAPI_API ISteamGameServerStats *SteamGameServerStats() { PRINT_DEBUG("SteamGameServerStats()\n"); CACHE_OLDSTEAM_INSTANCE(old_gamserver_stats_instance, get_steam_clientserver_old()->GetISteamGameServerStats(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_gameserver_stats )) } -STEAMAPI_API ISteamHTTP *SteamGameServerHTTP() { PRINT_DEBUG("SteamGameServerHTTP()\n"); CACHE_OLDSTEAM_INSTANCE(old_gamserver_http_instance, get_steam_clientserver_old()->GetISteamHTTP(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_http )) } -STEAMAPI_API ISteamInventory *SteamGameServerInventory() { PRINT_DEBUG("SteamGameServerInventory()\n"); CACHE_OLDSTEAM_INSTANCE(old_gamserver_inventory_instance, get_steam_clientserver_old()->GetISteamInventory(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_inventory )) } -STEAMAPI_API ISteamUGC *SteamGameServerUGC() { PRINT_DEBUG("SteamGameServerUGC()\n"); CACHE_OLDSTEAM_INSTANCE(old_gamserver_ugc_instance, get_steam_clientserver_old()->GetISteamUGC(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_ugc_interface )) } -STEAMAPI_API ISteamApps *SteamGameServerApps() { PRINT_DEBUG("SteamGameServerApps()\n"); CACHE_OLDSTEAM_INSTANCE(old_gamserver_apps_instance, get_steam_clientserver_old()->GetISteamApps(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_apps )) } - -STEAMAPI_API ISteamMasterServerUpdater *SteamMasterServerUpdater() {PRINT_DEBUG("SteamMasterServerUpdater()\n"); CACHE_OLDSTEAM_INSTANCE(old_gamserver_masterupdater_instance, get_steam_clientserver_old()->GetISteamMasterServerUpdater(SteamGameServer_GetHSteamUser(), SteamGameServer_GetHSteamPipe(), old_masterserver_updater)) } - STEAMAPI_API uint32 SteamGameServer_GetIPCCallCount() { return get_steam_client()->GetIPCCallCount(); @@ -838,12 +987,12 @@ STEAMAPI_API uint32 SteamGameServer_GetIPCCallCount() STEAMAPI_API void S_CALLTYPE SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMAPI_API void S_CALLTYPE SteamAPI_SetBreakpadAppID( uint32 unAppID ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } struct cb_data { @@ -855,7 +1004,7 @@ static std::queue server_cb; static void cb_add_queue_server(std::vector result, int callback) { - PRINT_DEBUG("cb_add_queue_server adding callback=%i, size=%zu\n", callback, result.size()); + PRINT_DEBUG("adding callback=%i, size=%zu", callback, result.size()); struct cb_data cb{}; cb.cb_id = callback; cb.result = result; @@ -864,7 +1013,7 @@ static void cb_add_queue_server(std::vector result, int callback) static void cb_add_queue_client(std::vector result, int callback) { - PRINT_DEBUG("cb_add_queue_client adding callback=%i, m_iCallback=%i\n", callback, ((SteamAPICallCompleted_t *)&result[0])->m_iCallback); + PRINT_DEBUG("adding callback=%i, m_iCallback=%i", callback, ((SteamAPICallCompleted_t *)&result[0])->m_iCallback); struct cb_data cb{}; cb.cb_id = callback; cb.result = result; @@ -878,7 +1027,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_ManualDispatch_Init() static std::atomic_bool manual_dispatch_called = false; bool not_yet = false; if (manual_dispatch_called.compare_exchange_weak(not_yet, true)) { - PRINT_DEBUG("SteamAPI_ManualDispatch_Init\n"); + PRINT_DEBUG_ENTRY(); Steam_Client *steam_client = get_steam_client(); steam_client->callback_results_server->setCbAll(&cb_add_queue_server); steam_client->callback_results_client->setCbAll(&cb_add_queue_client); @@ -888,7 +1037,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_ManualDispatch_Init() /// Perform certain periodic actions that need to be performed. STEAMAPI_API void S_CALLTYPE SteamAPI_ManualDispatch_RunFrame( HSteamPipe hSteamPipe ) { - PRINT_DEBUG("SteamAPI_ManualDispatch_RunFrame %i\n", hSteamPipe); + PRINT_DEBUG("%i", hSteamPipe); Steam_Client *steam_client = get_steam_client(); auto it = steam_client->steam_pipes.find(hSteamPipe); if (steam_client->steam_pipes.end() == it) { @@ -896,9 +1045,9 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_ManualDispatch_RunFrame( HSteamPipe hSteam } if (it->second == Steam_Pipe::SERVER) { - steam_client->RunCallbacks(false, true, false); + steam_client->RunCallbacks(false, true); } else if (it->second == Steam_Pipe::CLIENT) { - steam_client->RunCallbacks(true, false, false); + steam_client->RunCallbacks(true, false); } } @@ -907,7 +1056,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_ManualDispatch_RunFrame( HSteamPipe hSteam /// (after dispatching the callback) before calling SteamAPI_ManualDispatch_GetNextCallback again. STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSteamPipe hSteamPipe, CallbackMsg_t *pCallbackMsg ) { - PRINT_DEBUG("SteamAPI_ManualDispatch_GetNextCallback %i %p\n", hSteamPipe, pCallbackMsg); + PRINT_DEBUG("%i %p", hSteamPipe, pCallbackMsg); Steam_Client *steam_client = get_steam_client(); if (!steam_client->steamclient_server_inited) { while(!server_cb.empty()) server_cb.pop(); @@ -915,7 +1064,7 @@ STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSte auto it = steam_client->steam_pipes.find(hSteamPipe); if (steam_client->steam_pipes.end() == it) { - PRINT_DEBUG("SteamAPI_ManualDispatch_GetNextCallback error invalid hSteamPipe\n"); + PRINT_DEBUG("error invalid hSteamPipe"); return false; } @@ -928,12 +1077,12 @@ STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSte q = &client_cb; m_hSteamUser = CLIENT_HSTEAMUSER; } else { - PRINT_DEBUG("SteamAPI_ManualDispatch_GetNextCallback error invalid steam pipe type\n"); + PRINT_DEBUG("error invalid steam pipe type"); return false; } if (q->empty()) { - PRINT_DEBUG("SteamAPI_ManualDispatch_GetNextCallback error queue is empty\n"); + PRINT_DEBUG("error queue is empty"); return false; } @@ -942,18 +1091,18 @@ STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSte pCallbackMsg->m_iCallback = q->front().cb_id; pCallbackMsg->m_pubParam = (uint8 *)&(q->front().result[0]); pCallbackMsg->m_cubParam = q->front().result.size(); - PRINT_DEBUG("SteamAPI_ManualDispatch_GetNextCallback cb number %i\n", q->front().cb_id); + PRINT_DEBUG("cb number %i", q->front().cb_id); return true; } - PRINT_DEBUG("SteamAPI_ManualDispatch_GetNextCallback error nullptr pCallbackMsg\n"); + PRINT_DEBUG("error nullptr pCallbackMsg"); return false; } /// You must call this after dispatching the callback, if SteamAPI_ManualDispatch_GetNextCallback returns true. STEAMAPI_API void S_CALLTYPE SteamAPI_ManualDispatch_FreeLastCallback( HSteamPipe hSteamPipe ) { - PRINT_DEBUG("SteamAPI_ManualDispatch_FreeLastCallback %i\n", hSteamPipe); + PRINT_DEBUG("%i", hSteamPipe); std::queue *q = NULL; Steam_Client *steam_client = get_steam_client(); auto it = steam_client->steam_pipes.find(hSteamPipe); @@ -976,7 +1125,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_ManualDispatch_FreeLastCallback( HSteamPip /// only call this in a handler for SteamAPICallCompleted_t callback. STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ) { - PRINT_DEBUG("SteamAPI_ManualDispatch_GetAPICallResult %i %llu %i %i\n", hSteamPipe, hSteamAPICall, cubCallback, iCallbackExpected); + PRINT_DEBUG("%i %llu %i %i", hSteamPipe, hSteamAPICall, cubCallback, iCallbackExpected); Steam_Client *steam_client = get_steam_client(); if (!steam_client->steam_pipes.count(hSteamPipe)) { return false; @@ -1040,7 +1189,7 @@ STEAMAPI_API void VR_Shutdown() STEAMAPI_API steam_bool SteamAPI_RestartApp( uint32 appid ) { - PRINT_DEBUG("SteamAPI_RestartApp %u\n", appid); + PRINT_DEBUG("%u", appid); return SteamAPI_RestartAppIfNecessary(appid); } @@ -1108,217 +1257,217 @@ SteamMasterServerUpdater STEAMCLIENT_API steam_bool Steam_BGetCallback( HSteamPipe hSteamPipe, CallbackMsg_t *pCallbackMsg ) { - PRINT_DEBUG("Steam_BGetCallback %i\n", hSteamPipe); + PRINT_DEBUG("%i", hSteamPipe); SteamAPI_ManualDispatch_Init(); Steam_Client *steam_client = get_steam_client(); - steam_client->RunCallbacks(true, true, false); + steam_client->RunCallbacks(true, true); return SteamAPI_ManualDispatch_GetNextCallback( hSteamPipe, pCallbackMsg ); } STEAMCLIENT_API void Steam_FreeLastCallback( HSteamPipe hSteamPipe ) { - PRINT_DEBUG("Steam_FreeLastCallback %i\n", hSteamPipe); + PRINT_DEBUG("Steam_FreeLastCallback %i", hSteamPipe); SteamAPI_ManualDispatch_FreeLastCallback( hSteamPipe ); } STEAMCLIENT_API steam_bool Steam_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void* pCallback, int cubCallback, int iCallbackExpected, bool* pbFailed ) { - PRINT_DEBUG("Steam_GetAPICallResult %i %llu %i %i\n", hSteamPipe, hSteamAPICall, cubCallback, iCallbackExpected); + PRINT_DEBUG("%i %llu %i %i", hSteamPipe, hSteamAPICall, cubCallback, iCallbackExpected); return SteamAPI_ManualDispatch_GetAPICallResult(hSteamPipe, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed); } STEAMCLIENT_API void *CreateInterface( const char *pName, int *pReturnCode ) { - PRINT_DEBUG("CreateInterface %s %p\n", pName, pReturnCode); + PRINT_DEBUG("%s %p", pName, pReturnCode); return create_client_interface(pName); } STEAMCLIENT_API void Breakpad_SteamMiniDumpInit( uint32 a, const char *b, const char *c ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API void Breakpad_SteamSetAppID( uint32 unAppID ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API void Breakpad_SteamSetSteamID( uint64 ulSteamID ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API void Breakpad_SteamWriteMiniDumpSetComment( const char *pchMsg ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API void Breakpad_SteamWriteMiniDumpUsingExceptionInfoWithBuildId( int a, int b ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API bool Steam_BConnected( HSteamUser hUser, HSteamPipe hSteamPipe ) { - PRINT_DEBUG("%s\n", __FUNCTION__); + PRINT_DEBUG_ENTRY(); return true; } STEAMCLIENT_API bool Steam_BLoggedOn( HSteamUser hUser, HSteamPipe hSteamPipe ) { - PRINT_DEBUG("%s\n", __FUNCTION__); + PRINT_DEBUG_ENTRY(); return true; } STEAMCLIENT_API bool Steam_BReleaseSteamPipe( HSteamPipe hSteamPipe ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } STEAMCLIENT_API HSteamUser Steam_ConnectToGlobalUser( HSteamPipe hSteamPipe ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return 0; } STEAMCLIENT_API HSteamUser Steam_CreateGlobalUser( HSteamPipe *phSteamPipe ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return 0; } STEAMCLIENT_API HSteamUser Steam_CreateLocalUser( HSteamPipe *phSteamPipe, EAccountType eAccountType ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return 0; } STEAMCLIENT_API HSteamPipe Steam_CreateSteamPipe() { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return 0; } STEAMCLIENT_API bool Steam_GSBLoggedOn( void *phSteamHandle ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } STEAMCLIENT_API bool Steam_GSBSecure( void *phSteamHandle) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } STEAMCLIENT_API bool Steam_GSGetSteam2GetEncryptionKeyToSendToNewClient( void *phSteamHandle, void *pvEncryptionKey, uint32 *pcbEncryptionKey, uint32 cbMaxEncryptionKey ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } STEAMCLIENT_API uint64 Steam_GSGetSteamID() { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return 0; } STEAMCLIENT_API void Steam_GSLogOff( void *phSteamHandle ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API void Steam_GSLogOn( void *phSteamHandle ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API bool Steam_GSRemoveUserConnect( void *phSteamHandle, uint32 unUserID ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } STEAMCLIENT_API bool Steam_GSSendSteam2UserConnect( void *phSteamHandle, uint32 unUserID, const void *pvRawKey, uint32 unKeyLen, uint32 unIPPublic, uint16 usPort, const void *pvCookie, uint32 cubCookie ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } STEAMCLIENT_API bool Steam_GSSendSteam3UserConnect( void *phSteamHandle, uint64 steamID, uint32 unIPPublic, const void *pvCookie, uint32 cubCookie ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } STEAMCLIENT_API bool Steam_GSSendUserDisconnect( void *phSteamHandle, uint64 ulSteamID, uint32 unUserID ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } STEAMCLIENT_API bool Steam_GSSendUserStatusResponse( void *phSteamHandle, uint64 ulSteamID, int nSecondsConnected, int nSecondsSinceLast ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } STEAMCLIENT_API bool Steam_GSSetServerType( void *phSteamHandle, int32 nAppIdServed, uint32 unServerFlags, uint32 unGameIP, uint32 unGamePort, const char *pchGameDir, const char *pchVersion ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } STEAMCLIENT_API void Steam_GSSetSpawnCount( void *phSteamHandle, uint32 ucSpawn ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API bool Steam_GSUpdateStatus( void *phSteamHandle, int cPlayers, int cPlayersMax, int cBotPlayers, const char *pchServerName, const char *pchMapName ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } STEAMCLIENT_API void* Steam_GetGSHandle( HSteamUser hUser, HSteamPipe hSteamPipe ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return NULL; } STEAMCLIENT_API int Steam_InitiateGameConnection( HSteamUser hUser, HSteamPipe hSteamPipe, void *pBlob, int cbMaxBlob, uint64 steamID, int nGameAppID, uint32 unIPServer, uint16 usPortServer, bool bSecure ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return 0; } STEAMCLIENT_API void Steam_LogOff( HSteamUser hUser, HSteamPipe hSteamPipe ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API void Steam_LogOn( HSteamUser hUser, HSteamPipe hSteamPipe, uint64 ulSteamID ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API void Steam_ReleaseThreadLocalMemory(bool thread_exit) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API void Steam_ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API void Steam_SetLocalIPBinding( uint32 unIP, uint16 usLocalPort ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } STEAMCLIENT_API void Steam_TerminateGameConnection( HSteamUser hUser, HSteamPipe hSteamPipe, uint32 unIPServer, uint16 usPortServer ) { - PRINT_DEBUG("TODO dll::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } diff --git a/dll/dll/appticket.h b/dll/dll/appticket.h index a813ca59..6694a750 100644 --- a/dll/dll/appticket.h +++ b/dll/dll/appticket.h @@ -337,7 +337,7 @@ public: 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 lock(global_mutex); return 0; diff --git a/dll/dll/auth.h b/dll/dll/auth.h index f8f35b36..6a525018 100644 --- a/dll/dll/auth.h +++ b/dll/dll/auth.h @@ -52,7 +52,7 @@ static std::vector sign_auth_data(const std::string &private_key_conten // we nedd a live object until the printf does its job, hence this special handling std::string err_msg(256, 0); 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 return signature; @@ -75,7 +75,7 @@ static std::vector sign_auth_data(const std::string &private_key_conten // we nedd a live object until the printf does its job, hence this special handling std::string err_msg(256, 0); 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 return signature; @@ -102,7 +102,7 @@ static std::vector sign_auth_data(const std::string &private_key_conten // we nedd a live object until the printf does its job, hence this special handling std::string err_msg(256, 0); 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 return signature; @@ -116,7 +116,7 @@ static std::vector sign_auth_data(const std::string &private_key_conten mbedtls_ctr_drbg_free(&ctr_drbg_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; } @@ -131,11 +131,11 @@ static std::vector sign_auth_data(const std::string &private_key_conten mbedtls_ctr_drbg_free(&ctr_drbg_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; } - 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); // finally sign the computed hash using RSA and PKCS#1 padding @@ -159,14 +159,14 @@ static std::vector sign_auth_data(const std::string &private_key_conten // we nedd a live object until the printf does its job, hence this special handling std::string err_msg(256, 0); 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 } #ifndef EMU_RELEASE_BUILD // 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); - 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 return signature; @@ -179,7 +179,7 @@ struct DLC { std::vector 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 const uint16_t dlcs_licenses_count = (uint16_t)Licenses.size(); @@ -209,7 +209,7 @@ struct DLC { #undef SER_VAR - PRINT_DEBUG("AUTH::DLC::SER final size = %zu\n", buffer.size()); + PRINT_DEBUG("final size = %zu", buffer.size()); return buffer; } }; @@ -255,13 +255,12 @@ public: #endif PRINT_DEBUG( - "AUTH::AppTicketGC::SER Token:\n" " GCToken: " "%" PRIu64 "\n" " user steam_id: " "%" PRIu64 "\n" " ticketGenDate: %u\n" " ExternalIP: 0x%08X, InternalIP: 0x%08X\n" " TimeSinceStartup: %u, TicketGeneratedCount: %u\n" - " SER size = %zu\n", + " SER size = %zu", GCToken, steam_id, @@ -297,7 +296,7 @@ public: #ifndef EMU_RELEASE_BUILD // 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); - 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 return buffer; @@ -321,7 +320,6 @@ struct AppTicket { const uint64_t steam_id = id.ConvertToUint64(); PRINT_DEBUG( - "AUTH::AppTicket::SER:\n" " Version: %u\n" " user steam_id: " "%" PRIu64 "\n" " AppId: %u\n" @@ -385,7 +383,7 @@ struct AppTicket { licenses_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 buffer; 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 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 @@ -461,7 +459,7 @@ struct AppTicket { { // 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); - 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 @@ -512,7 +510,6 @@ struct Auth_Data { const uint64_t steam_id = id.ConvertToUint64(); PRINT_DEBUG( - "AUTH::Auth_Data::SER:\n" " HasGC: %u\n" " user steam_id: " "%" 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; - PRINT_DEBUG( - "AUTH::Auth_Data::SER size without sig len = %zu, size with sig len (final size) = %zu\n", + PRINT_DEBUG("size without sig len = %zu, size with sig len (final size) = %zu", total_size_without_siglen, 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 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 @@ -616,12 +612,12 @@ struct Auth_Data { { // 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); - 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 } 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 diff --git a/dll/dll/base.h b/dll/dll/base.h index 6a070c32..e5dfaaf1 100644 --- a/dll/dll/base.h +++ b/dll/dll/base.h @@ -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) { - 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; }); if (cb_result != callresults.end()) { if (cb_result->reserved) { @@ -203,7 +203,7 @@ public: return callresults.back().api_call; } - PRINT_DEBUG("addCallResult ERROR\n"); + PRINT_DEBUG("ERROR"); return k_uAPICallInvalid; } @@ -241,7 +241,7 @@ public: if (callresults[index].has_cb()) { std::vector temp_cbs = callresults[index].callbacks; 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(); //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. @@ -251,7 +251,7 @@ public: } //COULD BE DELETED SO DON'T TOUCH CB global_mutex.lock(); - PRINT_DEBUG("callresult done\n"); + PRINT_DEBUG("callresult done"); } } @@ -264,7 +264,7 @@ public: data.m_cubParam = result.size(); 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. SteamAPICallCompleted_t temp = data; 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); while (c != std::end(callresults)) { if (c->to_delete) { if (c->timed_out()) { - PRINT_DEBUG("runCallResults removed callresult %i\n", c->iCallback); + PRINT_DEBUG("removed callresult %i", c->iCallback); c = callresults.erase(c); } else { ++c; @@ -322,7 +322,7 @@ public: } void addCallBack(int iCallback, class CCallbackBase *cb) { - PRINT_DEBUG("addCallBack %i\n", iCallback); + PRINT_DEBUG("%i", iCallback); if (iCallback == SteamAPICallCompleted_t::k_iCallback) { results->addCallCompleted(cb); CCallbackMgr::SetRegister(cb, iCallback); diff --git a/dll/dll/steam_HTMLsurface.h b/dll/dll/steam_HTMLsurface.h index 3b10b262..59860c5d 100644 --- a/dll/dll/steam_HTMLsurface.h +++ b/dll/dll/steam_HTMLsurface.h @@ -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 bool Init() { - PRINT_DEBUG("Steam_HTMLsurface::Init\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return true; } bool Shutdown() { - PRINT_DEBUG("Steam_HTMLsurface::Shutdown\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return true; } @@ -68,7 +70,7 @@ bool Shutdown() STEAM_CALL_RESULT( HTML_BrowserReady_t ) SteamAPICall_t CreateBrowser( const char *pchUserAgent, const char *pchUserCSS ) { - PRINT_DEBUG("Steam_HTMLsurface::CreateBrowser\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); HTML_BrowserReady_t data; 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 void RemoveBrowser( HHTMLBrowser unBrowserHandle ) { - PRINT_DEBUG("Steam_HTMLsurface::RemoveBrowser\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // Navigate to this URL, results in a HTML_StartRequest_t as the request commences 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 lock(global_mutex); static char url[256]; 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 void SetSize( HHTMLBrowser unBrowserHandle, uint32 unWidth, uint32 unHeight ) { - PRINT_DEBUG("Steam_HTMLsurface::SetSize\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // Stop the load of the current html page void StopLoad( HHTMLBrowser unBrowserHandle ) { - PRINT_DEBUG("Steam_HTMLsurface::StopLoad\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // Reload (most likely from local cache) the current page void Reload( HHTMLBrowser unBrowserHandle ) { - PRINT_DEBUG("Steam_HTMLsurface::Reload\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // navigate back in the page history void GoBack( HHTMLBrowser unBrowserHandle ) { - PRINT_DEBUG("Steam_HTMLsurface::GoBack\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // navigate forward in the page history void GoForward( HHTMLBrowser unBrowserHandle ) { - PRINT_DEBUG("Steam_HTMLsurface::GoForward\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // add this header to any url requests from this browser void AddHeader( HHTMLBrowser unBrowserHandle, const char *pchKey, const char *pchValue ) { - PRINT_DEBUG("Steam_HTMLsurface::AddHeader\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // run this javascript script in the currently loaded page void ExecuteJavascript( HHTMLBrowser unBrowserHandle, const char *pchScript ) { - PRINT_DEBUG("Steam_HTMLsurface::ExecuteJavascript\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // Mouse click and mouse movement commands void MouseUp( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) { - PRINT_DEBUG("Steam_HTMLsurface::MouseUp\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } void MouseDown( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) { - PRINT_DEBUG("Steam_HTMLsurface::MouseDown\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } void MouseDoubleClick( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) { - PRINT_DEBUG("Steam_HTMLsurface::MouseDoubleClick\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // x and y are relative to the HTML bounds void MouseMove( HHTMLBrowser unBrowserHandle, int x, int y ) { - PRINT_DEBUG("Steam_HTMLsurface::MouseMove\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // nDelta is pixels of scroll void MouseWheel( HHTMLBrowser unBrowserHandle, int32 nDelta ) { - PRINT_DEBUG("Steam_HTMLsurface::MouseWheel\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // keyboard interactions, native keycode is the key code value from your OS void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers, bool bIsSystemKey = false ) { - PRINT_DEBUG("Steam_HTMLsurface::KeyDown\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers) { - PRINT_DEBUG("Steam_HTMLsurface::KeyDown old\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); KeyDown(unBrowserHandle, nNativeKeyCode, eHTMLKeyModifiers, false); } void KeyUp( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) { - PRINT_DEBUG("Steam_HTMLsurface::KeyUp\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); } // cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press) void KeyChar( HHTMLBrowser unBrowserHandle, uint32 cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers ) { - PRINT_DEBUG("Steam_HTMLsurface::KeyChar\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // programmatically scroll this many pixels on the page void SetHorizontalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) { - PRINT_DEBUG("Steam_HTMLsurface::SetHorizontalScroll\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } void SetVerticalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) { - PRINT_DEBUG("Steam_HTMLsurface::SetVerticalScroll\n"); + PRINT_DEBUG_TODO(); + std::lock_guard 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 void SetKeyFocus( HHTMLBrowser unBrowserHandle, bool bHasKeyFocus ) { - PRINT_DEBUG("Steam_HTMLsurface::SetKeyFocus\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // open the current pages html code in the local editor of choice, used for debugging void ViewSource( HHTMLBrowser unBrowserHandle ) { - PRINT_DEBUG("Steam_HTMLsurface::ViewSource\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // copy the currently selected text on the html page to the local clipboard void CopyToClipboard( HHTMLBrowser unBrowserHandle ) { - PRINT_DEBUG("Steam_HTMLsurface::CopyToClipboard\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // paste from the local clipboard to the current html page void PasteFromClipboard( HHTMLBrowser unBrowserHandle ) { - PRINT_DEBUG("Steam_HTMLsurface::PasteFromClipboard\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // 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 ) { - PRINT_DEBUG("Steam_HTMLsurface::Find\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // cancel a currently running find void StopFind( HHTMLBrowser unBrowserHandle ) { - PRINT_DEBUG("Steam_HTMLsurface::StopFind\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // return details about the link at position x,y on the current page void GetLinkAtPosition( HHTMLBrowser unBrowserHandle, int x, int y ) { - PRINT_DEBUG("Steam_HTMLsurface::GetLinkAtPosition\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // 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 ) { - PRINT_DEBUG("Steam_HTMLsurface::SetCookie\n"); + PRINT_DEBUG_TODO(); + std::lock_guard 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) void SetPageScaleFactor( HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY ) { - PRINT_DEBUG("Steam_HTMLsurface::SetPageScaleFactor\n"); + PRINT_DEBUG_TODO(); + std::lock_guard 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()". void SetBackgroundMode( HHTMLBrowser unBrowserHandle, bool bBackgroundMode ) { - PRINT_DEBUG("Steam_HTMLsurface::SetBackgroundMode\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } @@ -298,12 +329,14 @@ void SetBackgroundMode( HHTMLBrowser unBrowserHandle, bool bBackgroundMode ) // Specifies the ratio between physical and logical pixels. void SetDPIScalingFactor( HHTMLBrowser unBrowserHandle, float flDPIScaling ) { - PRINT_DEBUG("Steam_HTMLsurface::SetDPIScalingFactor\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } void OpenDeveloperTools( HHTMLBrowser unBrowserHandle ) { - PRINT_DEBUG("Steam_HTMLsurface::OpenDeveloperTools\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // CALLBACKS @@ -317,7 +350,8 @@ void OpenDeveloperTools( HHTMLBrowser unBrowserHandle ) // allowed in your HTML surface. void AllowStartRequest( HHTMLBrowser unBrowserHandle, bool bAllowed ) { - PRINT_DEBUG("Steam_HTMLsurface::AllowStartRequest\n"); + PRINT_DEBUG_TODO(); + std::lock_guard 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 void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult ) { - PRINT_DEBUG("Steam_HTMLsurface::JSDialogResponse\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } @@ -333,7 +368,8 @@ void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult ) STEAM_IGNOREATTR() void FileLoadDialogResponse( HHTMLBrowser unBrowserHandle, const char **pchSelectedFiles ) { - PRINT_DEBUG("Steam_HTMLsurface::FileLoadDialogResponse\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } }; diff --git a/dll/dll/steam_controller.h b/dll/dll/steam_controller.h index ed76aa2b..aa957ef5 100644 --- a/dll/dll/steam_controller.h +++ b/dll/dll/steam_controller.h @@ -219,7 +219,7 @@ public ISteamInput controller_maps[action_handle_num].active_analog[analog_handle_num].second = source_mode; } 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; } } @@ -269,7 +269,7 @@ static void background_rumble(Rumble_Thread_Data *data) 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->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 bool Init(bool bExplicitlyCallRunFrame) { - PRINT_DEBUG("Steam_Controller::Init() %u\n", bExplicitlyCallRunFrame); + PRINT_DEBUG("%u", bExplicitlyCallRunFrame); std::lock_guard lock(global_mutex); if (disabled || initialized) { return true; @@ -329,7 +329,7 @@ bool Init(bool bExplicitlyCallRunFrame) bool Init( const char *pchAbsolutePathToControllerConfigVDF ) { - PRINT_DEBUG("Steam_Controller::Init() old\n"); + PRINT_DEBUG("old"); return Init(); } @@ -340,7 +340,7 @@ bool Init() bool Shutdown() { - PRINT_DEBUG("Steam_Controller::Shutdown()\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (disabled || !initialized) { return true; @@ -360,7 +360,7 @@ bool Shutdown() 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 @@ -368,14 +368,14 @@ void SetOverrideMode( const char *pchMode ) // configurations inside of the game depot instead of using the Steam Workshop bool SetInputActionManifestFilePath( const char *pchInputActionManifestAbsolutePath ) { - PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); //TODO SteamInput005 return false; } bool BWaitForData( bool bWaitForever, uint32 unTimeout ) { - PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); //TODO SteamInput005 return false; } @@ -385,7 +385,7 @@ bool BWaitForData( bool bWaitForever, uint32 unTimeout ) // SteamInput()->RunFrame() or SteamAPI_RunCallbacks() before this to update the data stream bool BNewDataAvailable() { - PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); //TODO SteamInput005 return false; } @@ -395,7 +395,7 @@ bool BNewDataAvailable() // callback when you enable them void EnableDeviceCallbacks() { - PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); //TODO SteamInput005 return; } @@ -405,7 +405,7 @@ void EnableDeviceCallbacks() // Note: this is called within either SteamInput()->RunFrame or by SteamAPI_RunCallbacks void EnableActionEventCallbacks( SteamInputActionEventCallbackPointer pCallback ) { - PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); //TODO SteamInput005 return; } @@ -415,7 +415,7 @@ void EnableActionEventCallbacks( SteamInputActionEventCallbackPointer pCallback // possible latency, you call this directly before reading controller state. void RunFrame(bool bReservedValue) { - // PRINT_DEBUG("Steam_Controller::RunFrame()\n"); + PRINT_DEBUG_ENTRY(); if (disabled || !initialized) { return; } @@ -430,7 +430,7 @@ void RunFrame() bool GetControllerState( uint32 unControllerIndex, SteamControllerState001_t *pState ) { - PRINT_DEBUG("Steam_Controller::GetControllerState()\n"); + PRINT_DEBUG_TODO(); return false; } @@ -439,7 +439,7 @@ bool GetControllerState( uint32 unControllerIndex, SteamControllerState001_t *pS // Returns the number of handles written to handlesOut int GetConnectedControllers( ControllerHandle_t *handlesOut ) { - PRINT_DEBUG("Steam_Controller::GetConnectedControllers\n"); + PRINT_DEBUG_ENTRY(); if (!handlesOut) return 0; if (disabled) { return 0; @@ -451,7 +451,7 @@ int GetConnectedControllers( ControllerHandle_t *handlesOut ) if (GamepadIsConnected(GAMEPAD_2)) {*handlesOut = GAMEPAD_2 + 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; } @@ -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 bool ShowBindingPanel( ControllerHandle_t controllerHandle ) { - PRINT_DEBUG("Steam_Controller::ShowBindingPanel\n"); + PRINT_DEBUG_TODO(); 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. ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName ) { - PRINT_DEBUG("Steam_Controller::GetActionSetHandle %s\n", pszActionSetName); + PRINT_DEBUG("%s", pszActionSetName); if (!pszActionSetName) return 0; 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); }); @@ -477,7 +477,7 @@ ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName ) auto set_handle = action_handles.find(upper_action_name); 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; } @@ -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. 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) { for (auto & c: controllers) { c.second.activate_action_set(actionSetHandle, controller_maps); @@ -503,7 +503,7 @@ void ActivateActionSet( ControllerHandle_t controllerHandle, ControllerActionSet ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle ) { //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); if (controller == controllers.end()) return 0; @@ -513,22 +513,22 @@ ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHa 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 ) { - PRINT_DEBUG("Steam_Controller::DeactivateActionSetLayer\n"); + PRINT_DEBUG_TODO(); } void DeactivateAllActionSetLayers( ControllerHandle_t controllerHandle ) { - PRINT_DEBUG("Steam_Controller::DeactivateAllActionSetLayers\n"); + PRINT_DEBUG_TODO(); } int GetActiveActionSetLayers( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t *handlesOut ) { - PRINT_DEBUG("Steam_Controller::GetActiveActionSetLayers\n"); + PRINT_DEBUG_TODO(); 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. ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName ) { - PRINT_DEBUG("Steam_Controller::GetDigitalActionHandle %s\n", pszActionName); + PRINT_DEBUG("%s", pszActionName); if (!pszActionName) return 0; 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); }); @@ -550,7 +550,7 @@ ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionNam 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; } @@ -558,7 +558,7 @@ ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionNam // Returns the current state of the supplied digital game action 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; digitalData.bActive = 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 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]; int ret = GetDigitalActionOrigins(controllerHandle, actionSetHandle, digitalActionHandle, origins ); 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 ) { - PRINT_DEBUG("Steam_Controller::GetDigitalActionOrigins steaminput\n"); + PRINT_DEBUG_ENTRY(); auto controller = controllers.find(inputHandle); 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 const char *GetStringForDigitalActionName( InputDigitalActionHandle_t eActionHandle ) { - PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); //TODO SteamInput005 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. ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName ) { - PRINT_DEBUG("Steam_Controller::GetAnalogActionHandle %s\n", pszActionName); + PRINT_DEBUG("%s", pszActionName); if (!pszActionName) return 0; 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); }); @@ -772,7 +772,7 @@ ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName // Returns the current state of these supplied analog game action 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); 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 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]; int ret = GetAnalogActionOrigins(controllerHandle, actionSetHandle, analogActionHandle, origins ); 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 ) { - PRINT_DEBUG("Steam_Controller::GetAnalogActionOrigins steaminput\n"); + PRINT_DEBUG_ENTRY(); auto controller = controllers.find(inputHandle); 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 ) { - PRINT_DEBUG("Steam_Controller::StopAnalogActionMomentum %llu %llu\n", controllerHandle, eAction); + PRINT_DEBUG("%llu %llu", controllerHandle, eAction); } // Trigger a haptic pulse on a controller 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 void Legacy_TriggerHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) { - PRINT_DEBUG("%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); TriggerHapticPulse(inputHandle, eTargetPad, usDurationMicroSec ); } void TriggerHapticPulse( uint32 unControllerIndex, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) { - PRINT_DEBUG("Steam_Controller::TriggerHapticPulse old\n"); + PRINT_DEBUG("old"); TriggerHapticPulse(unControllerIndex, eTargetPad, usDurationMicroSec ); } @@ -909,12 +909,12 @@ void TriggerHapticPulse( uint32 unControllerIndex, ESteamControllerPad eTargetPa // 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 ) { - 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 ) { - PRINT_DEBUG("%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); 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 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. 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); 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 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); //TODO trigger impulse rumbles } @@ -960,14 +960,14 @@ void TriggerVibrationExtended( InputHandle_t inputHandle, unsigned short usLeftS // Set the controller LED color on supported controllers. 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 int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle ) { - PRINT_DEBUG("Steam_Controller::GetGamepadIndexForController\n"); + PRINT_DEBUG_ENTRY(); auto controller = controllers.find(ulControllerHandle); 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 ControllerHandle_t GetControllerForGamepadIndex( int nIndex ) { - PRINT_DEBUG("Steam_Controller::GetControllerForGamepadIndex %i\n", nIndex); + PRINT_DEBUG("%i", nIndex); ControllerHandle_t out = nIndex + 1; auto controller = controllers.find(out); if (controller == controllers.end()) return 0; @@ -989,7 +989,7 @@ ControllerHandle_t GetControllerForGamepadIndex( int nIndex ) // Returns raw motion data from the specified controller ControllerMotionData_t GetMotionData( ControllerHandle_t controllerHandle ) { - PRINT_DEBUG("Steam_Controller::GetMotionData\n"); + PRINT_DEBUG_TODO(); ControllerMotionData_t 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 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; } 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; } @@ -1013,20 +1013,20 @@ bool ShowAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerAna // Returns a localized string (from Steam's language setting) for the specified origin const char *GetStringForActionOrigin( EControllerActionOrigin eOrigin ) { - PRINT_DEBUG("Steam_Controller::GetStringForActionOrigin\n"); + PRINT_DEBUG_TODO(); return "Button String"; } const char *GetStringForActionOrigin( EInputActionOrigin eOrigin ) { - PRINT_DEBUG("Steam_Controller::GetStringForActionOrigin steaminput\n"); + PRINT_DEBUG_TODO(); return "Button String"; } // 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 ) { - PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); //TODO SteamInput005 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 const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin ) { - PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin %i\n", eOrigin); + PRINT_DEBUG("%i", eOrigin); if (steamcontroller_glyphs.empty()) { std::string dir = settings->glyphs_directory; @@ -1076,7 +1076,7 @@ const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin ) const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin ) { - PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin steaminput %i\n", eOrigin); + PRINT_DEBUG("steaminput %i", eOrigin); if (steaminput_glyphs.empty()) { std::string dir = settings->glyphs_directory; 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. const char *GetGlyphPNGForActionOrigin( EInputActionOrigin eOrigin, ESteamInputGlyphSize eSize, uint32 unFlags ) { - PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); //TODO SteamInput005 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. const char *GetGlyphSVGForActionOrigin( EInputActionOrigin eOrigin, uint32 unFlags ) { - PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); //TODO SteamInput005 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 const char *GetGlyphForActionOrigin_Legacy( EInputActionOrigin eOrigin ) { - PRINT_DEBUG("%s\n", __FUNCTION__); + PRINT_DEBUG_ENTRY(); return GetGlyphForActionOrigin(eOrigin); } // Returns the input type for a particular handle ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle ) { - PRINT_DEBUG("Steam_Controller::GetInputTypeForHandle %llu\n", controllerHandle); + PRINT_DEBUG("%llu", controllerHandle); auto controller = controllers.find(controllerHandle); if (controller == controllers.end()) return k_ESteamInputType_Unknown; return k_ESteamInputType_XBox360Controller; @@ -1150,37 +1150,37 @@ ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle ) const char *GetStringForXboxOrigin( EXboxOrigin eOrigin ) { - PRINT_DEBUG("Steam_Controller::GetStringForXboxOrigin\n"); + PRINT_DEBUG_TODO(); return ""; } const char *GetGlyphForXboxOrigin( EXboxOrigin eOrigin ) { - PRINT_DEBUG("Steam_Controller::GetGlyphForXboxOrigin\n"); + PRINT_DEBUG_TODO(); return ""; } EControllerActionOrigin GetActionOriginFromXboxOrigin_( ControllerHandle_t controllerHandle, EXboxOrigin eOrigin ) { - PRINT_DEBUG("Steam_Controller::GetActionOriginFromXboxOrigin\n"); + PRINT_DEBUG_TODO(); return k_EControllerActionOrigin_None; } EInputActionOrigin GetActionOriginFromXboxOrigin( InputHandle_t inputHandle, EXboxOrigin eOrigin ) { - PRINT_DEBUG("Steam_Controller::GetActionOriginFromXboxOrigin steaminput\n"); + PRINT_DEBUG_TODO(); return k_EInputActionOrigin_None; } EControllerActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, EControllerActionOrigin eSourceOrigin ) { - PRINT_DEBUG("Steam_Controller::TranslateActionOrigin\n"); + PRINT_DEBUG_TODO(); return k_EControllerActionOrigin_None; } 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) return eSourceOrigin; @@ -1190,19 +1190,19 @@ EInputActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, bool GetControllerBindingRevision( ControllerHandle_t controllerHandle, int *pMajor, int *pMinor ) { - PRINT_DEBUG("Steam_Controller::GetControllerBindingRevision\n"); + PRINT_DEBUG_TODO(); return false; } bool GetDeviceBindingRevision( InputHandle_t inputHandle, int *pMajor, int *pMinor ) { - PRINT_DEBUG("Steam_Controller::GetDeviceBindingRevision\n"); + PRINT_DEBUG_TODO(); return false; } uint32 GetRemotePlaySessionID( InputHandle_t inputHandle ) { - PRINT_DEBUG("Steam_Controller::GetRemotePlaySessionID\n"); + PRINT_DEBUG_TODO(); 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 uint16 GetSessionInputConfigurationSettings() { - PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return 0; } // Set the trigger effect for a DualSense controller void SetDualSenseTriggerEffect( InputHandle_t inputHandle, const ScePadTriggerEffectParam *pParam ) { - PRINT_DEBUG("TODO Steam_Controller::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); } void RunCallbacks() diff --git a/dll/dll/steam_friends.h b/dll/dll/steam_friends.h index 78ae04a5..4382e884 100644 --- a/dll/dll/steam_friends.h +++ b/dll/dll/steam_friends.h @@ -202,7 +202,7 @@ struct Avatar_Numbers add_friend_avatars(CSteamID id) public: 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->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) { - // PRINT_DEBUG("Steam_Friends::steam_friends_run_every_runcb\n"); + // PRINT_DEBUG_ENTRY(); Steam_Friends *steam_friends = (Steam_Friends *)object; steam_friends->RunCallbacks(); @@ -258,7 +258,7 @@ static bool ok_friend_flags(int iFriendFlags) // off; it will eventually be free'd or re-allocated const char *GetPersonaName() { - PRINT_DEBUG("Steam_Friends::GetPersonaName\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); const char *local_name = settings->get_local_name(); @@ -275,7 +275,7 @@ const char *GetPersonaName() STEAM_CALL_RESULT( SetPersonaNameResponse_t ) SteamAPICall_t SetPersonaName( const char *pchPersonaName ) { - PRINT_DEBUG("Steam_Friends::SetPersonaName\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); SetPersonaNameResponse_t data; data.m_bSuccess = true; @@ -288,14 +288,16 @@ SteamAPICall_t SetPersonaName( const char *pchPersonaName ) void SetPersonaName_old( const char *pchPersonaName ) { - PRINT_DEBUG("Steam_Friends::SetPersonaName old\n"); + PRINT_DEBUG("old"); + std::lock_guard lock(global_mutex); SetPersonaName(pchPersonaName); } // gets the status of the current user EPersonaState GetPersonaState() { - PRINT_DEBUG("Steam_Friends::GetPersonaState\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); 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 int GetFriendCount( int iFriendFlags ) { - PRINT_DEBUG("Steam_Friends::GetFriendCount %i\n", iFriendFlags); + PRINT_DEBUG("%i", iFriendFlags); std::lock_guard lock(global_mutex); int count = 0; if (ok_friend_flags(iFriendFlags)) count = friends.size(); - PRINT_DEBUG("count %i\n", count); + PRINT_DEBUG("count %i", count); return count; } int GetFriendCount( EFriendFlags eFriendFlags ) { - PRINT_DEBUG("Steam_Friends::GetFriendCount old\n"); + PRINT_DEBUG("old"); + std::lock_guard lock(global_mutex); 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 CSteamID GetFriendByIndex( int iFriend, int iFriendFlags ) { - PRINT_DEBUG("Steam_Friends::GetFriendByIndex\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); CSteamID id = k_steamIDNil; 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 ) { - PRINT_DEBUG("Steam_Friends::GetFriendByIndex old\n"); + PRINT_DEBUG("old"); + std::lock_guard lock(global_mutex); return GetFriendByIndex(iFriend, (int)eFriendFlags ); } // returns a relationship to a user EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend ) { - PRINT_DEBUG("Steam_Friends::GetFriendRelationship %llu\n", steamIDFriend.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDFriend.ConvertToUint64()); std::lock_guard lock(global_mutex); if (steamIDFriend == settings->get_local_steam_id()) return k_EFriendRelationshipNone; //Real steam behavior 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 EPersonaState GetFriendPersonaState( CSteamID steamIDFriend ) { - PRINT_DEBUG("Steam_Friends::GetFriendPersonaState %llu\n", steamIDFriend.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDFriend.ConvertToUint64()); std::lock_guard lock(global_mutex); EPersonaState state = k_EPersonaStateOffline; if (steamIDFriend == settings->get_local_steam_id() || find_friend(steamIDFriend)) { @@ -373,7 +377,7 @@ EPersonaState GetFriendPersonaState( CSteamID steamIDFriend ) // const char *GetFriendPersonaName( CSteamID steamIDFriend ) { - PRINT_DEBUG("Steam_Friends::GetFriendPersonaName %llu\n", steamIDFriend.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDFriend.ConvertToUint64()); std::lock_guard lock(global_mutex); const char *name = "Unknown User"; if (steamIDFriend == settings->get_local_steam_id()) { @@ -383,7 +387,7 @@ const char *GetFriendPersonaName( CSteamID steamIDFriend ) if (f) name = f->name().c_str(); } - PRINT_DEBUG("Steam_Friends::GetFriendPersonaName returned '%s'\n", name); + PRINT_DEBUG("returned '%s'", 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 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 lock(global_mutex); bool ret = false; 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) { pFriendGameInfo->m_gameID = settings->get_local_game_id(); pFriendGameInfo->m_unGameIP = 0; @@ -409,7 +413,7 @@ bool GetFriendGamePlayed( CSteamID steamIDFriend, STEAM_OUT_STRUCT() FriendGameI } else { Friend *f = find_friend(steamIDFriend); 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) { pFriendGameInfo->m_gameID = CGameID(f->appid()); 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 ) { - PRINT_DEBUG("Steam_Friends::GetFriendGamePlayed old\n"); + PRINT_DEBUG("old"); std::lock_guard lock(global_mutex); FriendGameInfo_t 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 const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName ) { - PRINT_DEBUG("Steam_Friends::GetFriendPersonaNameHistory\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); const char *ret = ""; if (iPersonaName == 0) ret = GetFriendPersonaName(steamIDFriend); @@ -456,7 +460,8 @@ const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaNam // friends steam level int GetFriendSteamLevel( CSteamID steamIDFriend ) { - PRINT_DEBUG("Steam_Friends::GetFriendSteamLevel\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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. const char *GetPlayerNickname( CSteamID steamIDPlayer ) { - PRINT_DEBUG("Steam_Friends::GetPlayerNickname\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return NULL; } @@ -473,35 +479,40 @@ const char *GetPlayerNickname( CSteamID steamIDPlayer ) // returns the number of friends groups int GetFriendsGroupCount() { - PRINT_DEBUG("Steam_Friends::GetFriendsGroupCount\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } // returns the friends group ID for the given index (invalid indices return k_FriendsGroupID_Invalid) FriendsGroupID_t GetFriendsGroupIDByIndex( int iFG ) { - PRINT_DEBUG("Steam_Friends::GetFriendsGroupIDByIndex\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_FriendsGroupID_Invalid; } // returns the name for the given friends group (NULL in the case of invalid friends group IDs) const char *GetFriendsGroupName( FriendsGroupID_t friendsGroupID ) { - PRINT_DEBUG("Steam_Friends::GetFriendsGroupName\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return NULL; } // returns the number of members in a given friends group int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID ) { - PRINT_DEBUG("Steam_Friends::GetFriendsGroupMembersCount\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } // 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 ) { - PRINT_DEBUG("Steam_Friends::GetFriendsGroupMembersList\n"); + PRINT_DEBUG_TODO(); + std::lock_guard 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 bool HasFriend( CSteamID steamIDFriend, int iFriendFlags ) { - PRINT_DEBUG("Steam_Friends::HasFriend\n"); - bool ret = false; + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); + bool ret = false; if (ok_friend_flags(iFriendFlags)) if (find_friend(steamIDFriend)) ret = true; return ret; @@ -519,14 +530,16 @@ bool HasFriend( CSteamID steamIDFriend, int iFriendFlags ) bool HasFriend( CSteamID steamIDFriend, EFriendFlags eFriendFlags ) { - PRINT_DEBUG("Steam_Friends::HasFriend old\n"); + PRINT_DEBUG("old"); + std::lock_guard lock(global_mutex); return HasFriend(steamIDFriend, (int)eFriendFlags ); } // clan (group) iteration and access functions int GetClanCount() { - PRINT_DEBUG("Steam_Friends::GetClanCount\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); int counter = 0; for (auto &c : settings->subscribed_groups_clans) counter++; return counter; @@ -534,7 +547,8 @@ int GetClanCount() CSteamID GetClanByIndex( int iClan ) { - PRINT_DEBUG("Steam_Friends::GetClanByIndex\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); int counter = 0; for (auto &c : settings->subscribed_groups_clans) { if (counter == iClan) return c.id; @@ -545,7 +559,8 @@ CSteamID GetClanByIndex( int iClan ) const char *GetClanName( CSteamID steamIDClan ) { - PRINT_DEBUG("Steam_Friends::GetClanName\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); for (auto &c : settings->subscribed_groups_clans) { 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 ) { - PRINT_DEBUG("Steam_Friends::GetClanTag\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); for (auto &c : settings->subscribed_groups_clans) { 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 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 lock(global_mutex); 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 SteamAPICall_t DownloadClanActivityCounts( STEAM_ARRAY_COUNT(cClansToRequest) CSteamID *psteamIDClans, int cClansToRequest ) { - PRINT_DEBUG("Steam_Friends::DownloadClanActivityCounts\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 int GetFriendCountFromSource( CSteamID steamIDSource ) { - PRINT_DEBUG("Steam_Friends::GetFriendCountFromSource %llu\n", steamIDSource.ConvertToUint64()); + PRINT_DEBUG("TODO %llu", steamIDSource.ConvertToUint64()); + std::lock_guard lock(global_mutex); //TODO return 0; } CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend ) { - PRINT_DEBUG("Steam_Friends::GetFriendFromSourceByIndex\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 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 lock(global_mutex); if (steamIDUser == settings->get_local_steam_id()) { 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) void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking ) { - PRINT_DEBUG("Steam_Friends::SetInGameVoiceSpeaking\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } @@ -628,7 +649,8 @@ void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking ) // valid options are "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements" void ActivateGameOverlay( const char *pchDialog ) { - PRINT_DEBUG("Steam_Friends::ActivateGameOverlay %s\n", pchDialog); + PRINT_DEBUG("%s", pchDialog); + std::lock_guard lock(global_mutex); 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 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 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/ 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 lock(global_mutex); overlay->OpenOverlayWebpage(pchURL); } void ActivateGameOverlayToWebPage( const char *pchURL ) { - PRINT_DEBUG("Steam_Friends::ActivateGameOverlayToWebPage old\n"); + PRINT_DEBUG("old"); + std::lock_guard lock(global_mutex); ActivateGameOverlayToWebPage( pchURL, k_EActivateGameOverlayToWebPageMode_Default ); } // activates game overlay to store page for app void ActivateGameOverlayToStore( AppId_t nAppID, EOverlayToStoreFlag eFlag ) { - PRINT_DEBUG("Steam_Friends::ActivateGameOverlayToStore\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } void ActivateGameOverlayToStore( AppId_t nAppID) { - PRINT_DEBUG("Steam_Friends::ActivateGameOverlayToStore old\n"); + PRINT_DEBUG("old"); + std::lock_guard lock(global_mutex); } // Mark a target user as 'played with'. This is a client-side only feature that requires that the calling user is // in game void SetPlayedWith( CSteamID steamIDUserPlayedWith ) { - PRINT_DEBUG("Steam_Friends::SetPlayedWith\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // activates game overlay to open the invite dialog. Invitations will be sent for the provided lobby. void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby ) { - PRINT_DEBUG("Steam_Friends::ActivateGameOverlayInviteDialog\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); 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 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. std::lock_guard lock(global_mutex); 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 int GetMediumFriendAvatar( CSteamID steamIDFriend ) { - PRINT_DEBUG("Steam_Friends::GetMediumFriendAvatar\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); struct Avatar_Numbers numbers = add_friend_avatars(steamIDFriend); 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 int GetLargeFriendAvatar( CSteamID steamIDFriend ) { - PRINT_DEBUG("Steam_Friends::GetLargeFriendAvatar\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); struct Avatar_Numbers numbers = add_friend_avatars(steamIDFriend); return numbers.large; @@ -723,7 +752,8 @@ int GetLargeFriendAvatar( CSteamID steamIDFriend ) int GetFriendAvatar( CSteamID steamIDFriend, int eAvatarSize ) { - PRINT_DEBUG("Steam_Friends::GetFriendAvatar\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); if (eAvatarSize == k_EAvatarSize32x32) { return GetSmallFriendAvatar(steamIDFriend); } else if (eAvatarSize == k_EAvatarSize64x64) { @@ -737,7 +767,8 @@ int GetFriendAvatar( CSteamID steamIDFriend, int eAvatarSize ) int GetFriendAvatar(CSteamID steamIDFriend) { - PRINT_DEBUG("Steam_Friends::GetFriendAvatar old\n"); + PRINT_DEBUG("old"); + std::lock_guard lock(global_mutex); 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 bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly ) { - PRINT_DEBUG("Steam_Friends::RequestUserInformation\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); //persona_change(steamIDUser, k_EPersonaChangeName); //We already know everything @@ -765,7 +796,8 @@ bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly ) STEAM_CALL_RESULT( ClanOfficerListResponse_t ) SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan ) { - PRINT_DEBUG("Steam_Friends::RequestClanOfficerList\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } @@ -775,21 +807,24 @@ SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan ) // returns the steamID of the clan owner CSteamID GetClanOwner( CSteamID steamIDClan ) { - PRINT_DEBUG("Steam_Friends::GetClanOwner\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_steamIDNil; } // returns the number of officers in a clan (including the owner) int GetClanOfficerCount( CSteamID steamIDClan ) { - PRINT_DEBUG("Steam_Friends::GetClanOfficerCount\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } // returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount) CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer ) { - PRINT_DEBUG("Steam_Friends::GetClanOfficerByIndex\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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. uint32 GetUserRestrictions() { - PRINT_DEBUG("Steam_Friends::GetUserRestrictions\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_nUserRestrictionNone; } EUserRestriction GetUserRestrictions_old() { - PRINT_DEBUG("Steam_Friends::GetUserRestrictions old\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_nUserRestrictionNone; } @@ -820,7 +857,7 @@ EUserRestriction GetUserRestrictions_old() // and GetFriendRichPresenceKeyByIndex() (typically only used for debugging) 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 lock(global_mutex); if (pchValue) { auto prev_value = (*us.mutable_rich_presence()).find(pchKey); @@ -841,7 +878,7 @@ bool SetRichPresence( const char *pchKey, const char *pchValue ) void ClearRichPresence() { - PRINT_DEBUG("Steam_Friends::ClearRichPresence\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); us.mutable_rich_presence()->clear(); resend_friend_data(); @@ -850,7 +887,7 @@ void ClearRichPresence() 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 lock(global_mutex); 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(); } - PRINT_DEBUG("Steam_Friends::GetFriendRichPresence returned '%s'\n", value); + PRINT_DEBUG("returned '%s'", value); return value; } int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend ) { - PRINT_DEBUG("Steam_Friends::GetFriendRichPresenceKeyCount\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); int num = 0; @@ -890,7 +927,7 @@ int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend ) const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey ) { - PRINT_DEBUG("Steam_Friends::GetFriendRichPresenceKeyByIndex\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); const char *key = ""; @@ -914,7 +951,7 @@ const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey ) // Requests rich presence for a specific user. void RequestFriendRichPresence( CSteamID steamIDFriend ) { - PRINT_DEBUG("Steam_Friends::RequestFriendRichPresence\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); Friend *f = find_friend(steamIDFriend); 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 bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) { - PRINT_DEBUG("Steam_Friends::InviteUserToGame\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); Friend *f = find_friend(steamIDFriend); if (!f) return false; @@ -949,25 +986,29 @@ bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) // GetFriendCoplayTime() returns as a unix time int GetCoplayFriendCount() { - PRINT_DEBUG("Steam_Friends::GetCoplayFriendCount\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } CSteamID GetCoplayFriend( int iCoplayFriend ) { - PRINT_DEBUG("Steam_Friends::GetCoplayFriend\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_steamIDNil; } int GetFriendCoplayTime( CSteamID steamIDFriend ) { - PRINT_DEBUG("Steam_Friends::GetFriendCoplayTime\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } AppId_t GetFriendCoplayGame( CSteamID steamIDFriend ) { - PRINT_DEBUG("Steam_Friends::GetFriendCoplayGame\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } @@ -979,7 +1020,7 @@ AppId_t GetFriendCoplayGame( CSteamID steamIDFriend ) STEAM_CALL_RESULT( JoinClanChatRoomCompletionResult_t ) 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 std::lock_guard lock(global_mutex); JoinClanChatRoomCompletionResult_t data; @@ -990,37 +1031,43 @@ SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan ) bool LeaveClanChatRoom( CSteamID steamIDClan ) { - PRINT_DEBUG("Steam_Friends::LeaveClanChatRoom\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } int GetClanChatMemberCount( CSteamID steamIDClan ) { - PRINT_DEBUG("Steam_Friends::GetClanChatMemberCount\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser ) { - PRINT_DEBUG("Steam_Friends::GetChatMemberByIndex\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_steamIDNil; } bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText ) { - PRINT_DEBUG("Steam_Friends::SendClanChatMessage\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } 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 lock(global_mutex); return 0; } bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser ) { - PRINT_DEBUG("Steam_Friends::IsClanChatAdmin\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -1028,19 +1075,22 @@ bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser ) // interact with the Steam (game overlay / desktop) bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat ) { - PRINT_DEBUG("Steam_Friends::IsClanChatWindowOpenInSteam\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat ) { - PRINT_DEBUG("Steam_Friends::OpenClanChatWindowInSteam\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return true; } bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat ) { - PRINT_DEBUG("Steam_Friends::CloseClanChatWindowInSteam\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return true; } @@ -1049,19 +1099,22 @@ bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat ) // this is so you can show P2P chats inline in the game bool SetListenForFriendsMessages( bool bInterceptEnabled ) { - PRINT_DEBUG("Steam_Friends::SetListenForFriendsMessages\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return true; } bool ReplyToFriendMessage( CSteamID steamIDFriend, const char *pchMsgToSend ) { - PRINT_DEBUG("Steam_Friends::ReplyToFriendMessage\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType ) { - PRINT_DEBUG("Steam_Friends::GetFriendMessage\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } @@ -1070,46 +1123,52 @@ int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int STEAM_CALL_RESULT( FriendsGetFollowerCount_t ) SteamAPICall_t GetFollowerCount( CSteamID steamID ) { - PRINT_DEBUG("Steam_Friends::GetFollowerCount\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } STEAM_CALL_RESULT( FriendsIsFollowing_t ) SteamAPICall_t IsFollowing( CSteamID steamID ) { - PRINT_DEBUG("Steam_Friends::IsFollowing\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } STEAM_CALL_RESULT( FriendsEnumerateFollowingList_t ) SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex ) { - PRINT_DEBUG("Steam_Friends::EnumerateFollowingList\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } bool IsClanPublic( CSteamID steamIDClan ) { - PRINT_DEBUG("Steam_Friends::IsClanPublic\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } bool IsClanOfficialGameGroup( CSteamID steamIDClan ) { - PRINT_DEBUG("Steam_Friends::IsClanOfficialGameGroup\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } int GetNumChatsWithUnreadPriorityMessages() { - PRINT_DEBUG("Steam_Friends::GetNumChatsWithUnreadPriorityMessages\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } 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 @@ -1117,14 +1176,16 @@ void ActivateGameOverlayRemotePlayTogetherInviteDialog( CSteamID steamIDLobby ) // ActivateGameOverlayToWebPage() must have been called with k_EActivateGameOverlayToWebPageMode_Modal bool RegisterProtocolInOverlayBrowser( const char *pchProtocol ) { - PRINT_DEBUG("Steam_Friends::RegisterProtocolInOverlayBrowser\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } // 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 ) { - PRINT_DEBUG("Steam_Friends::ActivateGameOverlayInviteDialogConnectString\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // Steam Community items equipped by a user on their profile @@ -1132,38 +1193,42 @@ void ActivateGameOverlayInviteDialogConnectString( const char *pchConnectString STEAM_CALL_RESULT( EquippedProfileItems_t ) SteamAPICall_t RequestEquippedProfileItems( CSteamID steamID ) { - PRINT_DEBUG("Steam_Friends::RequestEquippedProfileItems\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } bool BHasEquippedProfileItem( CSteamID steamID, ECommunityProfileItemType itemType ) { - PRINT_DEBUG("Steam_Friends::BHasEquippedProfileItem\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } const char *GetProfileItemPropertyString( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop ) { - PRINT_DEBUG("Steam_Friends::GetProfileItemPropertyString\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return ""; } uint32 GetProfileItemPropertyUint( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop ) { - PRINT_DEBUG("Steam_Friends::GetProfileItemPropertyUint\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } void RunCallbacks() { - // PRINT_DEBUG("Steam_Friends::RunCallbacks\n"); + // PRINT_DEBUG_ENTRY(); if (settings->get_lobby() != lobby_id) { lobby_id = settings->get_lobby(); resend_friend_data(); } if (modified) { - PRINT_DEBUG("Steam_Friends::RunCallbacks sending modified data\n"); + PRINT_DEBUG("sending modified data"); Common_Message msg; msg.set_source_id(settings->get_local_steam_id().ConvertToUint64()); Friend *f = new Friend(us); @@ -1182,7 +1247,7 @@ void Callback(Common_Message *msg) { if (msg->has_low_level()) { if (msg->low_level().type() == Low_Level::DISCONNECT) { - PRINT_DEBUG("Steam_Friends Disconnect\n"); + PRINT_DEBUG("Disconnect"); uint64 id = msg->source_id(); auto f = std::find_if(friends.begin(), friends.end(), [&id](Friend const& item) { return item.id() == id; }); if (friends.end() != f) { @@ -1193,7 +1258,7 @@ void Callback(Common_Message *msg) } 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_; msg_.set_source_id(settings->get_local_steam_id().ConvertToUint64()); msg_.set_dest_id(msg->source_id()); @@ -1211,7 +1276,7 @@ void Callback(Common_Message *msg) } 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()); if (!f) { 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->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()); if (f) { LobbyInvite_t data; @@ -1263,7 +1328,7 @@ void Callback(Common_Message *msg) } 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 if (overlay->Ready() && !settings->hasOverlayAutoAcceptInviteFromFriend(msg->source_id())) { diff --git a/dll/dll/steam_game_coordinator.h b/dll/dll/steam_game_coordinator.h index 2d20cff4..a4a87274 100644 --- a/dll/dll/steam_game_coordinator.h +++ b/dll/dll/steam_game_coordinator.h @@ -41,7 +41,7 @@ void push_incoming(std::string message) public: 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_gamecoordinator->Callback(msg); @@ -49,7 +49,7 @@ static void steam_callback(void *object, Common_Message *msg) 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_gamecoordinator->RunCallbacks(); @@ -76,7 +76,8 @@ Steam_Game_Coordinator(class Settings *settings, class Networking *network, clas // sends a message to the Game Coordinator 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 lock(global_mutex); if (protobuf_mask & unMsgType) { uint32 message_type = (~protobuf_mask) & unMsgType; 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 bool IsMessageAvailable( uint32 *pcubMsgSize ) { - PRINT_DEBUG("Steam_Game_Coordinator::IsMessageAvailable\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); if (outgoing_messages.size()) { if (pcubMsgSize) *pcubMsgSize = outgoing_messages.front().size(); return true; @@ -110,7 +112,8 @@ bool IsMessageAvailable( uint32 *pcubMsgSize ) // and the message remains at the head of the queue. EGCResults RetrieveMessage( uint32 *punMsgType, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) { - PRINT_DEBUG("Steam_Game_Coordinator::RetrieveMessage\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); if (outgoing_messages.size()) { if (outgoing_messages.front().size() > cubDest) { return k_EGCResultBufferTooSmall; diff --git a/dll/dll/steam_gamesearch.h b/dll/dll/steam_gamesearch.h index ada10e0b..f688952c 100644 --- a/dll/dll/steam_gamesearch.h +++ b/dll/dll/steam_gamesearch.h @@ -31,7 +31,7 @@ public ISteamGameSearch public: 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_gamesearch->Callback(msg); @@ -39,7 +39,7 @@ static void steam_callback(void *object, Common_Message *msg) 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_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 EGameSearchErrorCode_t AddGameSearchParams( const char *pchKeyToFind, const char *pchValuesToFind ) { - PRINT_DEBUG("Steam_Game_Search::AddGameSearchParams\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 EGameSearchErrorCode_t SearchForGameWithLobby( CSteamID steamIDLobby, int nPlayerMin, int nPlayerMax ) { - PRINT_DEBUG("Steam_Game_Search::SearchForGameWithLobby\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 EGameSearchErrorCode_t SearchForGameSolo( int nPlayerMin, int nPlayerMax ) { - PRINT_DEBUG("Steam_Game_Search::SearchForGameSolo\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 EGameSearchErrorCode_t AcceptGame() { - PRINT_DEBUG("Steam_Game_Search::AcceptGame\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_EGameSearchErrorCode_Failed_Offline; } EGameSearchErrorCode_t DeclineGame() { - PRINT_DEBUG("Steam_Game_Search::DeclineGame\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_EGameSearchErrorCode_Failed_Offline; } @@ -112,7 +117,8 @@ EGameSearchErrorCode_t DeclineGame() // after receiving GameStartedByHostCallback_t get connection details to server EGameSearchErrorCode_t RetrieveConnectionDetails( CSteamID steamIDHost, char *pchConnectionDetails, int cubConnectionDetails ) { - PRINT_DEBUG("Steam_Game_Search::RetrieveConnectionDetails\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_EGameSearchErrorCode_Failed_Offline; } @@ -120,7 +126,8 @@ EGameSearchErrorCode_t RetrieveConnectionDetails( CSteamID steamIDHost, char *pc // leaves queue if still waiting EGameSearchErrorCode_t EndGameSearch() { - PRINT_DEBUG("Steam_Game_Search::EndGameSearch\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 EGameSearchErrorCode_t SetGameHostParams( const char *pchKey, const char *pchValue ) { - PRINT_DEBUG("Steam_Game_Search::SetGameHostParams\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 EGameSearchErrorCode_t SetConnectionDetails( const char *pchConnectionDetails, int cubConnectionDetails ) { - PRINT_DEBUG("Steam_Game_Search::SetConnectionDetails\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 EGameSearchErrorCode_t RequestPlayersForGame( int nPlayerMin, int nPlayerMax, int nMaxTeamSize ) { - PRINT_DEBUG("Steam_Game_Search::RequestPlayersForGame\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 ) EGameSearchErrorCode_t HostConfirmGameStart( uint64 ullUniqueGameID ) { - PRINT_DEBUG("Steam_Game_Search::HostConfirmGameStart\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 EGameSearchErrorCode_t CancelRequestPlayersForGame() { - PRINT_DEBUG("Steam_Game_Search::CancelRequestPlayersForGame\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 EGameSearchErrorCode_t SubmitPlayerResult( uint64 ullUniqueGameID, CSteamID steamIDPlayer, EPlayerResult_t EPlayerResult ) { - PRINT_DEBUG("Steam_Game_Search::SubmitPlayerResult\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_EGameSearchErrorCode_Failed_Offline; } @@ -187,7 +200,8 @@ EGameSearchErrorCode_t SubmitPlayerResult( uint64 ullUniqueGameID, CSteamID stea // any future requests will provide a new ullUniqueGameID EGameSearchErrorCode_t EndGame( uint64 ullUniqueGameID ) { - PRINT_DEBUG("Steam_Game_Search::EndGame\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_EGameSearchErrorCode_Failed_Offline; } diff --git a/dll/dll/steam_inventory.h b/dll/dll/steam_inventory.h index 927a7ab9..cbd1521b 100644 --- a/dll/dll/steam_inventory.h +++ b/dll/dll/steam_inventory.h @@ -92,7 +92,7 @@ struct Steam_Inventory_Requests *get_inventory_result(SteamInventoryResult_t res void read_items_db() { 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); } @@ -103,7 +103,7 @@ void read_inventory_db() { // Try to load a default one 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); } } @@ -112,7 +112,7 @@ public: 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; 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.) EResult GetResultStatus( SteamInventoryResult_t resultHandle ) { - PRINT_DEBUG("Steam_Inventory::GetResultStatus\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); struct Steam_Inventory_Requests *request = get_inventory_result(resultHandle); if (!request) return k_EResultInvalidParam; @@ -172,7 +172,7 @@ bool GetResultItems( SteamInventoryResult_t resultHandle, STEAM_OUT_ARRAY_COUNT( punOutItemsArraySize,Output array) SteamItemDetails_t *pOutItemsArray, uint32 *punOutItemsArraySize ) { - PRINT_DEBUG("Steam_Inventory::GetResultItems\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); struct Steam_Inventory_Requests *request = get_inventory_result(resultHandle); 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; } @@ -257,7 +257,8 @@ bool GetResultItemProperty( SteamInventoryResult_t resultHandle, const char *pchPropertyName, STEAM_OUT_STRING_COUNT( punValueBufferSizeOut ) char *pchValueBuffer, uint32 *punValueBufferSizeOut ) { - PRINT_DEBUG("Steam_Inventory::GetResultItemProperty\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); //TODO 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.) uint32 GetResultTimestamp( SteamInventoryResult_t resultHandle ) { - PRINT_DEBUG("Steam_Inventory::GetResultTimestamp\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); struct Steam_Inventory_Requests *request = get_inventory_result(resultHandle); 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.) bool CheckResultSteamID( SteamInventoryResult_t resultHandle, CSteamID steamIDExpected ) { - PRINT_DEBUG("Steam_Inventory::CheckResultSteamID %llu\n", steamIDExpected.ConvertToUint64()); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); //TODO 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.) void DestroyResult( SteamInventoryResult_t resultHandle ) { - PRINT_DEBUG("Steam_Inventory::DestroyResult\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard 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; }); 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.) bool GetAllItems( SteamInventoryResult_t *pResultHandle ) { - PRINT_DEBUG("Steam_Inventory::GetAllItems\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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.) 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 lock(global_mutex); if (pResultHandle) { 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. 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 lock(global_mutex); //TODO 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)); if (!punOutBufferSize) return false; - PRINT_DEBUG(" Size %u\n", *punOutBufferSize); + PRINT_DEBUG(" Size %u", *punOutBufferSize); if (!pOutBuffer) { *punOutBufferSize = sizeof(buffer); 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. 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 lock(global_mutex); //TODO if (pOutResultHandle) { @@ -439,7 +441,8 @@ bool DeserializeResult( SteamInventoryResult_t *pOutResultHandle, STEAM_BUFFER_C // 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 ) { - PRINT_DEBUG("Steam_Inventory::GenerateItems\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); 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).) bool GrantPromoItems( SteamInventoryResult_t *pResultHandle ) { - PRINT_DEBUG("Steam_Inventory::GrantPromoItems\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. bool AddPromoItem( SteamInventoryResult_t *pResultHandle, SteamItemDef_t itemDef ) { - PRINT_DEBUG("Steam_Inventory::AddPromoItem\n"); + PRINT_DEBUG_ENTRY(); //TODO std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_Inventory::AddPromoItems\n"); + PRINT_DEBUG_ENTRY(); //TODO std::lock_guard lock(global_mutex); 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.) 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 lock(global_mutex); auto it = user_items.find(std::to_string(itemConsume)); @@ -504,7 +507,7 @@ bool ConsumeItem( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t i try { uint32 current = it->get(); - PRINT_DEBUG("Steam_Inventory::ConsumeItem previous %u\n", current); + PRINT_DEBUG("previous %u", current); if (current < unQuantity) unQuantity = current; uint32 result = current - unQuantity; 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(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 lock(global_mutex); return false; } @@ -552,7 +556,8 @@ bool ExchangeItems( SteamInventoryResult_t *pResultHandle, // 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 ) { - PRINT_DEBUG("Steam_Inventory::TransferItemQuantity\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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. ) void SendItemDropHeartbeat() { - PRINT_DEBUG("Steam_Inventory::SendItemDropHeartbeat\n"); + PRINT_DEBUG_TODO(); + std::lock_guard 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.) 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 std::lock_guard lock(global_mutex); 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(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 lock(global_mutex); 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.) bool LoadItemDefinitions() { - PRINT_DEBUG("Steam_Inventory::LoadItemDefinitions\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (!item_definitions_loaded) { @@ -643,12 +650,12 @@ bool GetItemDefinitionIDs( 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 ) { - PRINT_DEBUG("Steam_Inventory::GetItemDefinitionIDs %p\n", pItemDefIDs); + PRINT_DEBUG("%p", pItemDefIDs); std::lock_guard lock(global_mutex); if (!punItemDefIDsArraySize) return false; - PRINT_DEBUG(" array_size %u\n", *punItemDefIDsArraySize); + PRINT_DEBUG(" array_size %u", *punItemDefIDsArraySize); if (!item_definitions_loaded) return false; @@ -681,7 +688,7 @@ bool GetItemDefinitionIDs( bool GetItemDefinitionProperty( SteamItemDef_t iDefinition, const char *pchPropertyName, 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 lock(global_mutex); auto item = defined_items.find(std::to_string(iDefinition)); @@ -728,7 +735,7 @@ bool GetItemDefinitionProperty( SteamItemDef_t iDefinition, const char *pchPrope else { *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; } } @@ -779,7 +786,8 @@ bool GetItemDefinitionProperty( SteamItemDef_t iDefinition, const char *pchPrope STEAM_CALL_RESULT( SteamInventoryEligiblePromoItemDefIDs_t ) SteamAPICall_t RequestEligiblePromoItemDefinitionsIDs( CSteamID steamID ) { - PRINT_DEBUG("Steam_Inventory::RequestEligiblePromoItemDefinitionsIDs\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } @@ -792,7 +800,8 @@ bool GetEligiblePromoItemDefinitionIDs( 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 ) { - PRINT_DEBUG("Steam_Inventory::GetEligiblePromoItemDefinitionIDs\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -805,7 +814,8 @@ bool GetEligiblePromoItemDefinitionIDs( 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 ) { - PRINT_DEBUG("Steam_Inventory::StartPurchase\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } @@ -814,7 +824,7 @@ SteamAPICall_t StartPurchase( STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDe STEAM_CALL_RESULT( SteamInventoryRequestPricesResult_t ) SteamAPICall_t RequestPrices() { - PRINT_DEBUG("Steam_Inventory::RequestPrices\n"); + PRINT_DEBUG_ENTRY(); SteamInventoryRequestPricesResult_t data; data.m_result = k_EResultOK; 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. uint32 GetNumItemsWithPrices() { - PRINT_DEBUG("Steam_Inventory::GetNumItemsWithPrices\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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, uint32 unArrayLength ) { - PRINT_DEBUG("Steam_Inventory::GetItemsWithPrices\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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, uint32 unArrayLength ) { - PRINT_DEBUG("Steam_Inventory::GetItemsWithPrices old\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return GetItemsWithPrices(pArrayItemDefs, pPrices, NULL, unArrayLength); } bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pCurrentPrice, uint64 *pBasePrice ) { - PRINT_DEBUG("Steam_Inventory::GetItemPrice\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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. bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pPrice ) { - PRINT_DEBUG("Steam_Inventory::GetItemPrice old\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return GetItemPrice(iDefinition, pPrice, NULL); } @@ -866,52 +881,60 @@ bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pPrice ) // Create a request to update properties on items SteamInventoryUpdateHandle_t StartUpdateProperties() { - PRINT_DEBUG("Steam_Inventory::StartUpdateProperties\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } // Remove the property on the item bool RemoveProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName ) { - PRINT_DEBUG("Steam_Inventory::RemoveProperty\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } // Accessor methods to set properties on items 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 lock(global_mutex); return false; } 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 lock(global_mutex); return false; } 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 lock(global_mutex); return false; } 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 lock(global_mutex); return false; } // Submit the update request by handle bool SubmitUpdateProperties( SteamInventoryUpdateHandle_t handle, SteamInventoryResult_t * pResultHandle ) { - PRINT_DEBUG("Steam_Inventory::SubmitUpdateProperties\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } bool InspectItem( SteamInventoryResult_t *pResultHandle, const char *pchItemToken ) { - PRINT_DEBUG("Steam_Inventory::InspectItem\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } diff --git a/dll/dll/steam_masterserver_updater.h b/dll/dll/steam_masterserver_updater.h index e5bfa8c6..813d3373 100644 --- a/dll/dll/steam_masterserver_updater.h +++ b/dll/dll/steam_masterserver_updater.h @@ -29,7 +29,7 @@ public ISteamMasterServerUpdater public: 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_masterserverupdater->Callback(msg); @@ -37,7 +37,7 @@ static void steam_callback(void *object, Common_Message *msg) 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_masterserverupdater->RunCallbacks(); @@ -65,7 +65,8 @@ Steam_Masterserver_Updater(class Settings *settings, class Networking *network, // you want it to be active (default: off). void SetActive( bool bActive ) { - PRINT_DEBUG("Steam_Masterserver_Updater::SetActive\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } @@ -74,7 +75,8 @@ void SetActive( bool bActive ) // Some mods change this. void SetHeartbeatInterval( int iHeartbeatInterval ) { - PRINT_DEBUG("Steam_Masterserver_Updater::SetHeartbeatInterval\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } @@ -96,7 +98,8 @@ void SetHeartbeatInterval( int iHeartbeatInterval ) // it's for us. bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort ) { - PRINT_DEBUG("Steam_Masterserver_Updater::HandleIncomingPacket\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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. int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) { - PRINT_DEBUG("Steam_Masterserver_Updater::GetNextOutgoingPacket\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } @@ -125,21 +129,24 @@ void SetBasicServerData( bool bPasswordProtected, const char *pGameDescription ) { - PRINT_DEBUG("Steam_Masterserver_Updater::SetBasicServerData\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // Call this to clear the whole list of key/values that are sent in rules queries. void ClearAllKeyValues() { - PRINT_DEBUG("Steam_Masterserver_Updater::ClearAllKeyValues\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // Call this to add/update a key/value pair. 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 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. void NotifyShutdown() { - PRINT_DEBUG("Steam_Masterserver_Updater::NotifyShutdown\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } @@ -156,7 +164,8 @@ void NotifyShutdown() // Only returns true once per request. bool WasRestartRequested() { - PRINT_DEBUG("Steam_Masterserver_Updater::WasRestartRequested\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -164,7 +173,8 @@ bool WasRestartRequested() // Force it to request a heartbeat from the master servers. void ForceHeartbeat() { - PRINT_DEBUG("Steam_Masterserver_Updater::ForceHeartbeat\n"); + PRINT_DEBUG_TODO(); + std::lock_guard 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. bool AddMasterServer( const char *pServerAddress ) { - PRINT_DEBUG("Steam_Masterserver_Updater::AddMasterServer\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return true; } bool RemoveMasterServer( const char *pServerAddress ) { - PRINT_DEBUG("Steam_Masterserver_Updater::RemoveMasterServer\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return true; } int GetNumMasterServers() { - PRINT_DEBUG("Steam_Masterserver_Updater::GetNumMasterServers\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } @@ -193,7 +206,8 @@ int GetNumMasterServers() // Returns the # of bytes written to pOut. int GetMasterServerAddress( int iServer, char *pOut, int outBufferSize ) { - PRINT_DEBUG("Steam_Masterserver_Updater::GetMasterServerAddress\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } diff --git a/dll/dll/steam_matchmaking.h b/dll/dll/steam_matchmaking.h index 16e60d08..229d0438 100644 --- a/dll/dll/steam_matchmaking.h +++ b/dll/dll/steam_matchmaking.h @@ -123,11 +123,11 @@ Lobby *get_lobby(CSteamID id) void send_lobby_data() { - PRINT_DEBUG("Steam_MatchMaking::Sending lobbies %zu\n", lobbies.size()); + PRINT_DEBUG("lobbies %zu", lobbies.size()); for(auto & l: lobbies) { 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(); msg.set_source_id(settings->get_local_steam_id().ConvertToUint64()); 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) { - 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{}; 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); if (l && l->owner() == settings->get_local_steam_id().ConvertToUint64()) { 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(); msg.set_source_id(settings->get_local_steam_id().ConvertToUint64()); msg.set_allocated_lobby(new Lobby(*l)); @@ -265,7 +265,7 @@ void remove_lobbies() auto g = std::begin(lobbies); while (g != std::end(lobbies)) { 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()); g = lobbies.erase(g); } else { @@ -290,7 +290,7 @@ void on_self_enter_leave_lobby(CSteamID id, int type, bool leaving) public: 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->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) { - // PRINT_DEBUG("Steam_MatchMaking::steam_matchmaking_run_every_runcb\n"); + // PRINT_DEBUG_ENTRY(); Steam_Matchmaking *steam_matchmaking = (Steam_Matchmaking *)object; 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 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"; unsigned long long file_size = file_size_(file_path); if (file_size) { @@ -366,7 +366,7 @@ int GetFavoriteGameCount() // *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 ) { - PRINT_DEBUG("Steam_MatchMaking::GetFavoriteGame\n"); + PRINT_DEBUG_ENTRY(); 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 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; 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 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; 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 ) SteamAPICall_t RequestLobbyList() { - PRINT_DEBUG("Steam_MatchMaking::RequestLobbyList\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); filtered_lobbies.clear(); @@ -561,7 +561,7 @@ void RequestLobbyList_OLD() // these are cleared on each call to RequestLobbyList() 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; std::lock_guard lock(global_mutex); @@ -577,7 +577,7 @@ void AddRequestLobbyListStringFilter( const char *pchKeyToMatch, const char *pch // numerical comparison 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 lock(global_mutex); struct Filter_Values fv; 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 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 lock(global_mutex); @@ -600,7 +600,7 @@ void AddRequestLobbyListNearValueFilter( const char *pchKeyToMatch, int nValueTo // returns only lobbies with the specified number of slots available void AddRequestLobbyListFilterSlotsAvailable( int nSlotsAvailable ) { - PRINT_DEBUG("Steam_MatchMaking::AddRequestLobbyListFilterSlotsAvailable %i\n", nSlotsAvailable); + PRINT_DEBUG("%i", nSlotsAvailable); std::lock_guard 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) void AddRequestLobbyListDistanceFilter( ELobbyDistanceFilter eLobbyDistanceFilter ) { - PRINT_DEBUG("Steam_MatchMaking::AddRequestLobbyListDistanceFilter %i\n", eLobbyDistanceFilter); + PRINT_DEBUG("%i", eLobbyDistanceFilter); std::lock_guard 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 void AddRequestLobbyListResultCountFilter( int cMaxResults ) { - PRINT_DEBUG("Steam_MatchMaking::AddRequestLobbyListResultCountFilter %i\n", cMaxResults); + PRINT_DEBUG("%i", cMaxResults); std::lock_guard lock(global_mutex); filter_max_results = cMaxResults; @@ -627,7 +627,7 @@ void AddRequestLobbyListResultCountFilter( int cMaxResults ) void AddRequestLobbyListCompatibleMembersFilter( CSteamID steamIDLobby ) { - PRINT_DEBUG("Steam_MatchMaking::AddRequestLobbyListCompatibleMembersFilter\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); @@ -645,7 +645,7 @@ void AddRequestLobbyListNumericalFilter( const char *pchKeyToMatch, int nValueTo void AddRequestLobbyListSlotsAvailableFilter() { - PRINT_DEBUG("TODO Steam_MatchMaking::AddRequestLobbyListSlotsAvailableFilter\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); } @@ -656,11 +656,11 @@ void AddRequestLobbyListSlotsAvailableFilter() // the returned CSteamID::IsValid() will be false if iLobby is out of range CSteamID GetLobbyByIndex( int iLobby ) { - PRINT_DEBUG("Steam_MatchMaking::GetLobbyByIndex %i\n", iLobby); + PRINT_DEBUG("%i", iLobby); std::lock_guard lock(global_mutex); CSteamID id = k_steamIDNil; 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; } @@ -670,7 +670,7 @@ static bool enter_lobby(Lobby *lobby, CSteamID id) Lobby_Member *member = lobby->add_members(); 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; } @@ -747,7 +747,7 @@ void Create_pending_lobbies() STEAM_CALL_RESULT( LobbyCreated_t ) 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 lock(global_mutex); struct Pending_Creates p_c; p_c.api_id = callback_results->reserveCallResult(); @@ -780,12 +780,12 @@ void CreateLobby( bool bPrivate ) STEAM_CALL_RESULT( LobbyEnter_t ) SteamAPICall_t JoinLobby( CSteamID steamIDLobby ) { - PRINT_DEBUG("Steam_MatchMaking::JoinLobby %llu\n", steamIDLobby.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64()); std::lock_guard lock(global_mutex); 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()) { - PRINT_DEBUG("Steam_MatchMaking::JoinLobby already found in pending joins list\n"); + PRINT_DEBUG("already found in pending joins list"); return pj->api_id; } @@ -799,7 +799,7 @@ SteamAPICall_t JoinLobby( CSteamID steamIDLobby ) message->set_type(Lobby_Messages::JOIN); 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; } @@ -812,22 +812,22 @@ void JoinLobby_OLD( CSteamID steamIDLobby ) // other users in the lobby will be notified by a LobbyChatUpdate_t callback void LeaveLobby( CSteamID steamIDLobby ) { - PRINT_DEBUG("Steam_MatchMaking::LeaveLobby\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); - PRINT_DEBUG("Steam_MatchMaking::LeaveLobby pass mutex\n"); + PRINT_DEBUG("pass mutex"); Lobby *lobby = get_lobby(steamIDLobby); if (lobby) { if (!lobby->deleted()) { on_self_enter_leave_lobby((uint64)lobby->room_id(), lobby->type(), true); self_lobby_member_data.erase(lobby->room_id()); 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()); Lobby_Messages *message = new Lobby_Messages(); message->set_type(Lobby_Messages::LEAVE); send_owner_packet(steamIDLobby, message); } else { - PRINT_DEBUG("Steam_MatchMaking::LeaveLobby owner\n"); + PRINT_DEBUG("owner"); Lobby_Messages *message = new Lobby_Messages(); 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> bool InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee ) { - PRINT_DEBUG("Steam_MatchMaking::InviteUserToLobby\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); if (!lobby) return false; @@ -881,13 +881,13 @@ bool InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee ) // returns the number of users in the specified lobby int GetNumLobbyMembers( CSteamID steamIDLobby ) { - PRINT_DEBUG("Steam_MatchMaking::GetNumLobbyMembers %llu\n", steamIDLobby.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64()); std::lock_guard lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); int ret = 0; if (lobby) ret = lobby->members().size(); - PRINT_DEBUG("Steam_MatchMaking::GetNumLobbyMembers count=%i\n", ret); + PRINT_DEBUG("count=%i", 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 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 lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); CSteamID id = k_steamIDNil; 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; } @@ -911,7 +911,7 @@ CSteamID GetLobbyMemberByIndex( CSteamID steamIDLobby, int iMember ) // "" will be returned if no value is set, or if steamIDLobby is invalid 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 lock(global_mutex); 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(); } - PRINT_DEBUG("Steam_MatchMaking::GetLobbyData returned '%s'\n", ret); + PRINT_DEBUG("returned '%s'", 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 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 lock(global_mutex); if (!pchKey) return false; 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 int GetLobbyDataCount( CSteamID steamIDLobby ) { - PRINT_DEBUG("Steam_MatchMaking::GetLobbyDataCount %llu\n", steamIDLobby.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64()); std::lock_guard lock(global_mutex); 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()) 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 lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); @@ -999,7 +999,7 @@ bool GetLobbyDataByIndex( CSteamID steamIDLobby, int iLobbyData, char *pchKey, i pchValue[cchValueBufferSize - 1] = 0; } - PRINT_DEBUG("Steam_MatchMaking::GetLobbyDataByIndex ret '%s'='%s'\n", pchKey, pchValue); + PRINT_DEBUG("ret '%s'='%s'", pchKey, pchValue); ret = true; } @@ -1011,7 +1011,7 @@ bool GetLobbyDataByIndex( CSteamID steamIDLobby, int iLobbyData, char *pchKey, i // removes a metadata key from the lobby bool DeleteLobbyData( CSteamID steamIDLobby, const char *pchKey ) { - PRINT_DEBUG("Steam_MatchMaking::DeleteLobbyData '%s'\n", pchKey); + PRINT_DEBUG("'%s'", pchKey); std::lock_guard lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); 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 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 lock(global_mutex); 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; } // Sets per-user metadata (for the local user implicitly) 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; char 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 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 lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); 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 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 lock(global_mutex); if (iChatID >= chat_entries.size() || iChatID < 0 || cubData < 0) 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) { cubData = chat_entries[iChatID].message.size(); 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; } } @@ -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 bool RequestLobbyData( CSteamID steamIDLobby ) { - PRINT_DEBUG("Steam_MatchMaking::RequestLobbyData %llu\n", steamIDLobby.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64()); std::lock_guard lock(global_mutex); 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 void SetLobbyGameServer( CSteamID steamIDLobby, uint32 unGameServerIP, uint16 unGameServerPort, CSteamID steamIDGameServer ) { - PRINT_DEBUG( - "Steam_MatchMaking::SetLobbyGameServer %llu %llu %hhu.%hhu.%hhu.%hhu:%hu\n", + PRINT_DEBUG("%llu %llu %hhu.%hhu.%hhu.%hhu:%hu", steamIDLobby.ConvertToUint64(), steamIDGameServer.ConvertToUint64(), ((unsigned char *)&unGameServerIP)[3], ((unsigned char *)&unGameServerIP)[2], ((unsigned char *)&unGameServerIP)[1], ((unsigned char *)&unGameServerIP)[0], unGameServerPort ); std::lock_guard 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 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 lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); 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 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 lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); 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 int GetLobbyMemberLimit( CSteamID steamIDLobby ) { - PRINT_DEBUG("Steam_MatchMaking::GetLobbyMemberLimit %llu\n", steamIDLobby.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64()); std::lock_guard lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); int limit = 0; if (lobby) limit = lobby->member_limit(); - PRINT_DEBUG(" limit %i\n", limit); + PRINT_DEBUG(" limit %i", limit); return limit; } void SetLobbyVoiceEnabled( CSteamID steamIDLobby, bool bVoiceEnabled ) { - PRINT_DEBUG("Steam_MatchMaking::SetLobbyVoiceEnabled\n"); + PRINT_DEBUG_ENTRY(); } // 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 bool SetLobbyType( CSteamID steamIDLobby, ELobbyType eLobbyType ) { - PRINT_DEBUG("Steam_MatchMaking::SetLobbyType %i\n", eLobbyType); + PRINT_DEBUG("%i", eLobbyType); std::lock_guard lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); 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 bool SetLobbyJoinable( CSteamID steamIDLobby, bool bLobbyJoinable ) { - PRINT_DEBUG("Steam_MatchMaking::SetLobbyJoinable %u\n", bLobbyJoinable); + PRINT_DEBUG("%u", bLobbyJoinable); std::lock_guard lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); 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 CSteamID GetLobbyOwner( CSteamID steamIDLobby ) { - PRINT_DEBUG("Steam_MatchMaking::GetLobbyOwner %llu\n", steamIDLobby.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64()); std::lock_guard lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); if (!lobby || lobby->deleted()) return k_steamIDNil; @@ -1314,7 +1313,7 @@ CSteamID GetLobbyOwner( CSteamID steamIDLobby ) // filters don't apply to lobbies (currently) bool RequestFriendsLobbies() { - PRINT_DEBUG("Steam_MatchMaking::RequestFriendsLobbies\n"); + PRINT_DEBUG_ENTRY(); RequestFriendsLobbiesResponse_t data = {}; callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); return true; @@ -1322,7 +1321,7 @@ bool RequestFriendsLobbies() float GetLobbyDistance( CSteamID steamIDLobby ) { - PRINT_DEBUG("Steam_MatchMaking::GetLobbyDistance %llu\n", steamIDLobby.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDLobby.ConvertToUint64()); return 0.0; } @@ -1331,7 +1330,7 @@ float GetLobbyDistance( CSteamID steamIDLobby ) // after completion, the local user will no longer be the owner bool SetLobbyOwner( CSteamID steamIDLobby, CSteamID steamIDNewOwner ) { - PRINT_DEBUG("Steam_MatchMaking::SetLobbyOwner\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); Lobby *lobby = get_lobby(steamIDLobby); 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 bool SetLinkedLobby( CSteamID steamIDLobby, CSteamID steamIDLobbyDependent ) { - PRINT_DEBUG("Steam_MatchMaking::SetLinkedLobby\n"); + PRINT_DEBUG_ENTRY(); return false; } @@ -1372,47 +1371,47 @@ void RunCallbacks() RunBackground(); if (searching) { - PRINT_DEBUG("Steam_MatchMaking::Searching for lobbies %zu\n", lobbies.size()); + PRINT_DEBUG("for lobbies %zu", lobbies.size()); for(auto & l: lobbies) { 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) { - 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); if (value != l.values().end()) { //TODO: eComparisonType 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 (value->second == f.value_string) { - PRINT_DEBUG("Steam_MatchMaking Equal (non-int)\n"); + PRINT_DEBUG("Equal (non-int)"); //use = use; } else { - PRINT_DEBUG("Steam_MatchMaking Not Equal (non-int)\n"); + PRINT_DEBUG("Not Equal (non-int)"); use = false; } } 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 { try { - PRINT_DEBUG("Steam_MatchMaking %s\n", value->second.c_str()); + PRINT_DEBUG("%s", value->second.c_str()); int compare_to = 0; //TODO: check if this is how real steam behaves if (value->second.size()) { 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 (compare_to == f.value_int) { - PRINT_DEBUG("Steam_MatchMaking Equal (int)\n"); + PRINT_DEBUG("Equal (int)"); //use = use; } else { - PRINT_DEBUG("Steam_MatchMaking Not Equal (int)\n"); + PRINT_DEBUG("Not Equal (int)"); use = false; } } 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 (...) { //Same case as if the key is not in the lobby? @@ -1421,7 +1420,7 @@ void RunCallbacks() //TODO: add more comparisons } } else { - PRINT_DEBUG("Steam_MatchMaking Compare Key not in lobby\n"); + PRINT_DEBUG("Compare Key not in lobby"); if (f.eComparisonType == k_ELobbyComparisonEqual) { //If the key is not in the lobby do we take it into account? 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 (filtered_lobbies.size() >= filter_max_results_copy) { searching = false; @@ -1443,7 +1442,7 @@ void RunCallbacks() } 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; data.m_nLobbiesMatching = filtered_lobbies.size(); 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); while (g != std::end(pending_joins)) { if (!g->message_sent) { - PRINT_DEBUG("Steam_MatchMaking resending join lobby\n"); + PRINT_DEBUG("resending join lobby"); Lobby_Messages *message = new Lobby_Messages(); message->set_type(Lobby_Messages::JOIN); g->message_sent = send_owner_packet(g->lobby_id, message); @@ -1463,7 +1462,7 @@ void RunCallbacks() Lobby *lobby = get_lobby(g->lobby_id); 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{}; data.m_ulSteamIDLobby = lobby->room_id(); data.m_rgfChatPermissions = 0; //Unused - Always 0 @@ -1473,7 +1472,7 @@ void RunCallbacks() callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); g = pending_joins.erase(g); } 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{}; data.m_ulSteamIDLobby = lobby->room_id(); data.m_rgfChatPermissions = 0; //Unused - Always 0 @@ -1484,7 +1483,7 @@ void RunCallbacks() g = pending_joins.erase(g); trigger_lobby_dataupdate((uint64)lobby->room_id(), (uint64)lobby->room_id(), true); } 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{}; data.m_ulSteamIDLobby = g->lobby_id.ConvertToUint64(); data.m_rgfChatPermissions = 0; //Unused - Always 0 @@ -1522,7 +1521,7 @@ void RunCallbacks() void Callback(Common_Message *msg) { 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()) { Lobby *lobby = get_lobby((uint64)msg->lobby().room_id()); if (!lobby) { @@ -1609,24 +1608,24 @@ void Callback(Common_Message *msg) 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()); if (lobby && !lobby->deleted()) { bool we_are_in_lobby = !!get_lobby_member(lobby, settings->get_local_steam_id()); if (lobby->owner() == settings->get_local_steam_id().ConvertToUint64()) { 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())) { 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) { - 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()); if (member) { 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); if (result == member->values().end()) { (*member->mutable_values())[p.first] = p.second; @@ -1641,19 +1640,19 @@ void Callback(Common_Message *msg) } 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()); 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) { - PRINT_DEBUG("Steam_MatchMaking LOBBY MESSAGE: CHANGE OWNER\n"); + PRINT_DEBUG("LOBBY MESSAGE: CHANGE OWNER"); 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 (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) { struct Chat_Entry entry{}; entry.type = k_EChatEntryTypeChatMsg; diff --git a/dll/dll/steam_networking.h b/dll/dll/steam_networking.h index 721694e1..457448de 100644 --- a/dll/dll/steam_networking.h +++ b/dll/dll/steam_networking.h @@ -221,7 +221,7 @@ void remove_killed_connection_sockets() public: 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->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) { - // PRINT_DEBUG("steam_networking_run_every_runcp\n"); + // PRINT_DEBUG_ENTRY(); Steam_Networking *steam_networking = (Steam_Networking *)object; steam_networking->RunCallbacks(); @@ -246,7 +246,7 @@ Steam_Networking(class Settings *settings, class Networking *network, class Stea 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() @@ -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 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 lock(global_mutex); bool reliable = false; 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); 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; } 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); } // 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) { - PRINT_DEBUG("Steam_Networking::IsP2PPacketAvailable channel: %i\n", nChannel); + PRINT_DEBUG("channel: %i", nChannel); std::lock_guard lock(messages_mutex); //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 //this->network->Run(); //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) { if (connection_exists((uint64)msg.source_id()) && msg.mutable_network()->channel() == nChannel && msg.network().processed()) { uint32 size = msg.mutable_network()->data().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; } } - PRINT_DEBUG("Steam_Networking::IsP2PPacketAvailable (not available)\n"); + PRINT_DEBUG("(not available)"); if (pcubMsgSize) *pcubMsgSize = 0; return false; } bool IsP2PPacketAvailable( uint32 *pcubMsgSize) { - PRINT_DEBUG("Steam_Networking::IsP2PPacketAvailable old\n"); + PRINT_DEBUG("old"); 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 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 lock(messages_mutex); //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 @@ -348,7 +348,7 @@ bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID //RunCallbacks(); bool read = false; - PRINT_DEBUG("Number messages %zu\n", messages.size()); + PRINT_DEBUG("Number messages %zu", messages.size()); auto msg = std::begin(messages); while (msg != std::end(messages)) { 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; memcpy(pubDest, msg->network().data().data(), msg_size); -#ifndef EMU_RELEASE_BUILD - for (int i = 0; i < msg_size; ++i) { - PRINT_DEBUG("%02hhX", ((char*)pubDest)[i]); - }PRINT_DEBUG("\n"); -#endif + PRINT_DEBUG("%s", + common_helpers::uint8_vector_to_hex_string(std::vector((uint8_t*)pubDest, (uint8_t*)pubDest + msg_size)).c_str()); + *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); 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) { - PRINT_DEBUG("Steam_Networking::ReadP2PPacket old\n"); + PRINT_DEBUG("old"); 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) bool AcceptP2PSessionWithUser( CSteamID steamIDRemote ) { - PRINT_DEBUG("Steam_Networking::AcceptP2PSessionWithUser %llu\n", steamIDRemote.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDRemote.ConvertToUint64()); std::lock_guard lock(global_mutex); struct Steam_Networking_Connection *conn = get_or_create_connection(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 bool CloseP2PSessionWithUser( CSteamID steamIDRemote ) { - PRINT_DEBUG("Steam_Networking::CloseP2PSessionWithUser %llu\n", steamIDRemote.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDRemote.ConvertToUint64()); std::lock_guard lock(global_mutex); if (!connection_exists(steamIDRemote)) { @@ -420,7 +418,7 @@ bool CloseP2PSessionWithUser( CSteamID steamIDRemote ) // user will trigger a P2PSessionRequest_t callback bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel ) { - PRINT_DEBUG("Steam_Networking::CloseP2PChannelWithUser\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (!connection_exists(steamIDRemote)) { return false; @@ -442,7 +440,7 @@ bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel ) // returns false if no connection exists to the specified user bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionState ) { - PRINT_DEBUG("Steam_Networking::GetP2PSessionState %llu\n", steamIDRemote.ConvertToUint64()); + PRINT_DEBUG("%llu", steamIDRemote.ConvertToUint64()); std::lock_guard lock(global_mutex); if (!connection_exists(steamIDRemote) && (steamIDRemote != settings->get_local_steam_id())) { if (pConnectionState) { @@ -456,7 +454,7 @@ bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionS pConnectionState->m_nRemotePort = 0; } - PRINT_DEBUG("No Connection\n"); + PRINT_DEBUG("No Connection"); return false; } @@ -471,7 +469,7 @@ bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionS pConnectionState->m_nRemotePort = 12345; } - PRINT_DEBUG("Connection\n"); + PRINT_DEBUG("Connection"); return true; } @@ -483,7 +481,7 @@ bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionS // P2P packet relay is allowed by default bool AllowP2PPacketRelay( bool bAllow ) { - PRINT_DEBUG("Steam_Networking::AllowP2PPacketRelay %u\n", bAllow); + PRINT_DEBUG("%u", bAllow); 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 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 lock(global_mutex); for (auto & c : listen_sockets) { 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 ) { - 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 return CreateListenSocket(nVirtualP2PPort, nIP.m_unIPv4, nPort, bAllowUseOfPacketRelay); } 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); } @@ -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 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 lock(global_mutex); //TODO: nTimeoutSec 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 ) { - PRINT_DEBUG("Steam_Networking::CreateP2PConnectionSocket old\n"); + PRINT_DEBUG("old"); return CreateP2PConnectionSocket(steamIDTarget, nVirtualPort, nTimeoutSec, true); } 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 lock(global_mutex); //TODO: nTimeoutSec 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 ) { - 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 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 bool DestroySocket( SNetSocket_t hSocket, bool bNotifyRemoteEnd ) { - PRINT_DEBUG("Steam_Networking::DestroySocket\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); struct steam_connection_socket *socket = get_connection_socket(hSocket); 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 bool DestroyListenSocket( SNetListenSocket_t hSocket, bool bNotifyRemoteEnd ) { - PRINT_DEBUG("Steam_Networking::DestroyListenSocket\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); auto c = std::begin(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) bool SendDataOnSocket( SNetSocket_t hSocket, void *pubData, uint32 cubData, bool bReliable ) { - PRINT_DEBUG("Steam_Networking::SendDataOnSocket\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); struct steam_connection_socket *socket = get_connection_socket(hSocket); 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 bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize ) { - PRINT_DEBUG("Steam_Networking::IsDataAvailableOnSocket\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); struct steam_connection_socket *socket = get_connection_socket(hSocket); if (!socket) { @@ -659,7 +657,7 @@ bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize ) // returns false if no data is available bool RetrieveDataFromSocket( SNetSocket_t hSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) { - PRINT_DEBUG("Steam_Networking::RetrieveDataFromSocket\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); struct steam_connection_socket *socket = get_connection_socket(hSocket); 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 bool IsDataAvailable( SNetListenSocket_t hListenSocket, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) { - PRINT_DEBUG("Steam_Networking::IsDataAvailable\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 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 lock(global_mutex); 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 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 lock(global_mutex); struct steam_connection_socket *socket = get_connection_socket(hSocket); 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 ) { - PRINT_DEBUG("Steam_Networking::GetSocketInfo\n"); + PRINT_DEBUG_ENTRY(); //TODO: ipv6 uint32 *ip_remote = NULL; 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 bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16 *pnPort ) { - PRINT_DEBUG("Steam_Networking::GetListenSocketInfo_old\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard 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;}); 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 ) { - PRINT_DEBUG("Steam_Networking::GetListenSocketInfo\n"); + PRINT_DEBUG_ENTRY(); //TODO: ipv6 uint32 *ip = NULL; if (pnIP) { @@ -809,7 +807,7 @@ bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, SteamIPAddress_t *pn // returns true to describe how the socket ended up connecting ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) { - PRINT_DEBUG("Steam_Networking::GetSocketConnectionType\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); struct steam_connection_socket *socket = get_connection_socket(hSocket); if (!socket || socket->status != SOCKET_CONNECTED) return k_ESNetSocketConnectionTypeNotConnected; @@ -820,7 +818,7 @@ ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) // max packet size, in bytes int GetMaxPacketSize( SNetSocket_t hSocket ) { - PRINT_DEBUG("Steam_Networking::GetMaxPacketSize\n"); + PRINT_DEBUG_ENTRY(); return 1500; } @@ -907,11 +905,11 @@ void RunCallbacks() void Callback(Common_Message *msg) { if (msg->has_network()) { - PRINT_DEBUG( - "Steam_Networking: got msg from: " "%" PRIu64 " to: " "%" PRIu64 " size %zu type %u | messages %p: %zu\n", + PRINT_DEBUG("got msg from: " "%" PRIu64 " to: " "%" PRIu64 " size %zu type %u | messages %p: %zu", 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(msg->network().data().begin(), msg->network().data().end()) ).c_str()); + PRINT_DEBUG("msg data: '%s'", + common_helpers::uint8_vector_to_hex_string(std::vector(msg->network().data().begin(), msg->network().data().end())).c_str()); if (msg->network().type() == Network_pb::DATA) { unprocessed_messages.push_back(Common_Message(*msg)); @@ -932,7 +930,7 @@ void Callback(Common_Message *msg) } 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) { for (auto & listen : listen_sockets) { if (listen.nPort == msg->network_old().port()) { diff --git a/dll/dll/steam_networking_messages.h b/dll/dll/steam_networking_messages.h index 4ef776c0..8e946d62 100644 --- a/dll/dll/steam_networking_messages.h +++ b/dll/dll/steam_networking_messages.h @@ -51,7 +51,7 @@ public: 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->Callback(msg); @@ -59,7 +59,7 @@ static void steam_callback(void *object, Common_Message *msg) 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->RunCallbacks(); @@ -170,7 +170,7 @@ std::map::iterator find_or_create_message_co /// - See SendMessageToConnection::SendMessageToConnection for more 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 lock(global_mutex); const SteamNetworkingIPAddr *ip = identityRemote.GetIPAddr(); bool reliable = false; @@ -184,10 +184,10 @@ EResult SendMessageToUser( const SteamNetworkingIdentity &identityRemote, const } 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 } 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 return k_EResultNoConnection; //TODO } 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()! int ReceiveMessagesOnChannel( int nLocalChannel, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) { - PRINT_DEBUG("Steam_Networking_Messages::ReceiveMessagesOnChannel\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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; } @@ -278,7 +278,7 @@ int ReceiveMessagesOnChannel( int nLocalChannel, SteamNetworkingMessage_t **ppOu /// Calling SendMessage() on the other user, this implicitly accepts any pending session request. bool AcceptSessionWithUser( const SteamNetworkingIdentity &identityRemote ) { - PRINT_DEBUG("Steam_Networking_Messages::AcceptSessionWithUser\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); auto conn = connections.find(identityRemote.GetSteamID()); 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. bool CloseSessionWithUser( const SteamNetworkingIdentity &identityRemote ) { - PRINT_DEBUG("Steam_Networking_Messages::CloseSessionWithUser\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); auto conn = connections.find(identityRemote.GetSteamID()); if (conn == connections.end()) { @@ -322,7 +322,7 @@ bool CloseSessionWithUser( const SteamNetworkingIdentity &identityRemote ) /// callback bool CloseChannelWithUser( const SteamNetworkingIdentity &identityRemote, int nLocalChannel ) { - PRINT_DEBUG("Steam_Networking_Messages::CloseChannelWithUser\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); //TODO return false; @@ -339,7 +339,7 @@ bool CloseChannelWithUser( const SteamNetworkingIdentity &identityRemote, int nL /// indefinitely to obtain the reason for failure. ESteamNetworkingConnectionState GetSessionConnectionInfo( const SteamNetworkingIdentity &identityRemote, SteamNetConnectionInfo_t *pConnectionInfo, SteamNetConnectionRealTimeStatus_t *pQuickStatus ) { - PRINT_DEBUG("Steam_Networking_Messages::GetSessionConnectionInfo\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); auto conn = connections.find(identityRemote.GetSteamID()); if (conn == connections.end()) { @@ -418,7 +418,7 @@ void Callback(Common_Message *msg) } 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) { SteamNetworkingIdentity identity; identity.SetSteamID64(msg->source_id()); diff --git a/dll/dll/steam_networking_sockets.h b/dll/dll/steam_networking_sockets.h index 295a80eb..2c1bb765 100644 --- a/dll/dll/steam_networking_sockets.h +++ b/dll/dll/steam_networking_sockets.h @@ -94,7 +94,7 @@ public ISteamNetworkingSockets public: 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_networkingsockets->Callback(msg); @@ -102,7 +102,7 @@ static void steam_callback(void *object, Common_Message *msg) 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_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. 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 lock(global_mutex); 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. HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress ) { - PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketIP old\n"); + PRINT_DEBUG("old"); std::lock_guard lock(global_mutex); return new_listen_socket(SNS_DISABLED_PORT, localAddress.m_port); } HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr *localAddress ) { - PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketIP old1\n"); + PRINT_DEBUG("old1"); std::lock_guard lock(global_mutex); return new_listen_socket(SNS_DISABLED_PORT, localAddress->m_port); } HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) { - PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketIP\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return new_listen_socket(SNS_DISABLED_PORT, localAddress.m_port); } @@ -371,7 +371,7 @@ HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddre /// man-in-the-middle attacks. HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address ) { - PRINT_DEBUG("Steam_Networking_Sockets::ConnectByIPAddress old\n"); + PRINT_DEBUG("old"); std::lock_guard lock(global_mutex); SteamNetworkingIdentity ip_id; ip_id.SetIPAddr(address); @@ -382,7 +382,7 @@ HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address ) HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr *address ) { - PRINT_DEBUG("Steam_Networking_Sockets::ConnectByIPAddress old1\n"); + PRINT_DEBUG("old1"); std::lock_guard lock(global_mutex); SteamNetworkingIdentity ip_id; ip_id.SetIPAddr(*address); @@ -393,7 +393,7 @@ HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr *address ) 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 lock(global_mutex); SteamNetworkingIdentity ip_id; ip_id.SetIPAddr(address); @@ -414,14 +414,14 @@ HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address, in /// when your app initializes HSteamListenSocket CreateListenSocketP2P( int nVirtualPort ) { - PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketP2P old %i\n", nVirtualPort); + PRINT_DEBUG("old %i", nVirtualPort); std::lock_guard lock(global_mutex); return new_listen_socket(nVirtualPort, SNS_DISABLED_PORT); } 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 std::lock_guard lock(global_mutex); return new_listen_socket(nVirtualPort, SNS_DISABLED_PORT); @@ -440,16 +440,16 @@ HSteamListenSocket CreateListenSocketP2P( int nVirtualPort, int nOptions, const /// when your app initializes 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 lock(global_mutex); const SteamNetworkingIPAddr *ip = identityRemote.GetIPAddr(); 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 } 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 } else { return k_HSteamNetConnection_Invalid; @@ -462,13 +462,13 @@ HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, i HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity *identityRemote, int nVirtualPort ) { - PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2P old1\n"); + PRINT_DEBUG("old1"); return ConnectP2P(*identityRemote, nVirtualPort); } 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 return ConnectP2P(identityRemote, nVirtualPort); } @@ -484,14 +484,16 @@ HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, i //#ifndef STEAMNETWORKINGSOCKETS_OPENSOURCE HSteamNetConnection ConnectBySteamID( CSteamID steamIDTarget, int nVirtualPort ) { - PRINT_DEBUG("Steam_Networking_Sockets::ConnectBySteamID\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_HSteamNetConnection_Invalid; } //#endif HSteamNetConnection ConnectByIPv4Address( uint32 nIP, uint16 nPort ) { - PRINT_DEBUG("Steam_Networking_Sockets::ConnectByIPv4Address\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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.) EResult AcceptConnection( HSteamNetConnection hConn ) { - PRINT_DEBUG("Steam_Networking_Sockets::AcceptConnection %u\n", hConn); + PRINT_DEBUG("%u", hConn); std::lock_guard lock(global_mutex); auto connect_socket = s->connect_sockets.find(hConn); @@ -568,7 +570,7 @@ EResult AcceptConnection( HSteamNetConnection hConn ) /// ignored. 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 lock(global_mutex); 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. bool CloseListenSocket( HSteamListenSocket hSocket, const char *pszNotifyRemoteReason ) { - PRINT_DEBUG("Steam_Networking_Sockets::CloseListenSocket old\n"); + PRINT_DEBUG("old"); + std::lock_guard lock(global_mutex); return false; } @@ -612,7 +615,7 @@ bool CloseListenSocket( HSteamListenSocket hSocket, const char *pszNotifyRemoteR /// socket are closed ungracefully. bool CloseListenSocket( HSteamListenSocket hSocket ) { - PRINT_DEBUG("Steam_Networking_Sockets::CloseListenSocket\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard 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;}); @@ -641,7 +644,7 @@ bool CloseListenSocket( HSteamListenSocket hSocket ) /// Set connection user data. Returns false if the handle is invalid. bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData ) { - PRINT_DEBUG("Steam_Networking_Sockets::SetConnectionUserData\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); auto connect_socket = s->connect_sockets.find(hPeer); 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. int64 GetConnectionUserData( HSteamNetConnection hPeer ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionUserData\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); auto connect_socket = s->connect_sockets.find(hPeer); 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 void SetConnectionName( HSteamNetConnection hPeer, const char *pszName ) { - PRINT_DEBUG("Steam_Networking_Sockets::SetConnectionName\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } /// Fetch connection name. Returns false if handle is invalid bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionName\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -703,7 +708,8 @@ bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen ) /// work without any changes. 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 lock(global_mutex); return k_EResultFail; } @@ -746,7 +752,7 @@ EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, u /// (See k_ESteamNetworkingConfig_SendBufferSize) 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 lock(global_mutex); 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 ) { - 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); } @@ -819,7 +825,8 @@ EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, u /// failure codes. void SendMessages( int nMessages, SteamNetworkingMessage_t *const *pMessages, int64 *pOutMessageNumberOrResult ) { - PRINT_DEBUG("Steam_Networking_Sockets::SendMessages\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); for (int i = 0; i < nMessages; ++i) { 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); @@ -845,7 +852,8 @@ void SendMessages( int nMessages, SteamNetworkingMessage_t *const *pMessages, in /// on the next transmission time (often that means right now). EResult FlushMessagesOnConnection( HSteamNetConnection hConn ) { - PRINT_DEBUG("Steam_Networking_Sockets::FlushMessagesOnConnection\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_EResultOK; } @@ -882,7 +890,7 @@ SteamNetworkingMessage_t *get_steam_message_connection(HSteamNetConnection hConn pMsg->m_pfnRelease = &delete_steam_message; pMsg->m_nChannel = 0; 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; } @@ -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. 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 lock(global_mutex); if (!ppOutMessages || !nMaxMessages) return 0; - std::lock_guard lock(global_mutex); SteamNetworkingMessage_t *msg = NULL; int messages = 0; while (messages < nMaxMessages && (msg = get_steam_message_connection(hConn))) { @@ -914,7 +922,7 @@ int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessa ++messages; } - PRINT_DEBUG("messages %u\n", messages); + PRINT_DEBUG("messages %u", messages); return messages; } @@ -928,10 +936,10 @@ int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessa /// messages is relevant!) 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 lock(global_mutex); if (!ppOutMessages || !nMaxMessages) return 0; - std::lock_guard lock(global_mutex); SteamNetworkingMessage_t *msg = NULL; int messages = 0; @@ -953,11 +961,10 @@ int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMe /// Returns basic information about the high-level state of the connection. bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionInfo\n"); - if (!pInfo) - return false; - + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); + if (!pInfo) return false; + auto connect_socket = s->connect_sockets.find(hConn); 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 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 lock(global_mutex); auto connect_socket = s->connect_sockets.find(hConn); 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. int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage001_t **ppOutMessages, int nMaxMessages ) { - PRINT_DEBUG("Steam_Networking_Sockets::ReceiveMessagesOnConnection\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return -1; } @@ -1045,7 +1053,8 @@ int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessa /// messages is relevant!) int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMessage001_t **ppOutMessages, int nMaxMessages ) { - PRINT_DEBUG("Steam_Networking_Sockets::ReceiveMessagesOnListenSocket\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return -1; } @@ -1053,7 +1062,8 @@ int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMe /// Returns information about the specified connection. bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo001_t *pInfo ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionInfo001\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -1062,7 +1072,7 @@ bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo001_t * /// to the user in game. bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetQuickConnectionStatus\n"); + PRINT_DEBUG_ENTRY(); if (!pStats) 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. int GetDetailedConnectionStatus( HSteamNetConnection hConn, char *pszBuf, int cbBuf ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetDetailedConnectionStatus\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return -1; } @@ -1089,7 +1100,8 @@ int GetDetailedConnectionStatus( HSteamNetConnection hConn, char *pszBuf, int cb /// An IPv6 address of ::ffff:0000:0000 means "any IPv4" bool GetListenSocketAddress( HSteamListenSocket hSocket, SteamNetworkingIPAddr *address ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetListenSocketAddress\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -1102,7 +1114,7 @@ bool GetListenSocketAddress( HSteamListenSocket hSocket, SteamNetworkingIPAddr * /// and may not be reachable by a general host on the Internet. bool GetListenSocketInfo( HSteamListenSocket hSocket, uint32 *pnIP, uint16 *pnPort ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetListenSocketInfo\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); struct Listen_Socket *socket = get_connection_socket(hSocket); 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. 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); } @@ -1157,9 +1169,9 @@ bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection /// actual bound loopback port. Otherwise, the port will be zero. 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); - if (!pOutConnection1 || !pOutConnection1) return false; + PRINT_DEBUG("%u %p %p", bUseNetworkLoopback, pIdentity1, pIdentity2); std::lock_guard lock(global_mutex); + if (!pOutConnection1 || !pOutConnection1) return false; SteamNetworkingIdentity remote_identity; remote_identity.SetSteamID(settings->get_local_steam_id()); @@ -1241,7 +1253,7 @@ bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection /// SteamNetworkingMessage_t::m_idxLane EResult ConfigureConnectionLanes( HSteamNetConnection hConn, int nNumLanes, const int *pLanePriorities, const uint16 *pLaneWeights ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); auto connect_socket = s->connect_sockets.find(hConn); 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.) bool GetIdentity( SteamNetworkingIdentity *pIdentity ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetIdentity\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); if (!pIdentity) return false; pIdentity->SetSteamID(settings->get_local_steam_id()); return true; @@ -1288,7 +1301,8 @@ bool GetIdentity( SteamNetworkingIdentity *pIdentity ) /// Returns the current value that would be returned from GetAuthenticationStatus. ESteamNetworkingAvailability InitAuthentication() { - PRINT_DEBUG("Steam_Networking_Sockets::InitAuthentication\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_ESteamNetworkingAvailability_Current; } @@ -1301,7 +1315,8 @@ ESteamNetworkingAvailability InitAuthentication() /// details, pass non-NULL to receive them. ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStatus_t *pDetails ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetAuthenticationStatus\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_ESteamNetworkingAvailability_Current; } @@ -1310,7 +1325,7 @@ ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStat /// You should destroy the poll group when you are done using DestroyPollGroup HSteamNetPollGroup CreatePollGroup() { - PRINT_DEBUG("Steam_Networking_Sockets::CreatePollGroup\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); static HSteamNetPollGroup poll_group_counter; ++poll_group_counter; @@ -1327,7 +1342,7 @@ HSteamNetPollGroup CreatePollGroup() /// Returns false if passed an invalid poll group handle. bool DestroyPollGroup( HSteamNetPollGroup hPollGroup ) { - PRINT_DEBUG("Steam_Networking_Sockets::DestroyPollGroup\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); auto group = s->poll_groups.find(hPollGroup); if (group == s->poll_groups.end()) { @@ -1361,7 +1376,7 @@ bool DestroyPollGroup( HSteamNetPollGroup hPollGroup ) /// is invalid (and not k_HSteamNetPollGroup_Invalid). 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 lock(global_mutex); auto connect_socket = s->connect_sockets.find(hConn); if (connect_socket == s->connect_sockets.end()) { @@ -1407,7 +1422,7 @@ bool SetConnectionPollGroup( HSteamNetConnection hConn, HSteamNetPollGroup hPoll /// other connections.) 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 lock(global_mutex); auto group = s->poll_groups.find(hPollGroup); 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; } @@ -1442,7 +1457,8 @@ int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMe /// See stamdatagram_ticketgen.h for more details. bool ReceivedRelayAuthTicket( const void *pvTicket, int cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket ) { - PRINT_DEBUG("Steam_Networking_Sockets::ReceivedRelayAuthTicket\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -1455,7 +1471,7 @@ bool ReceivedRelayAuthTicket( const void *pvTicket, int cbTicket, SteamDatagramR /// call ConnectToHostedDedicatedServer to connect to the server. int FindRelayAuthTicketForServer( CSteamID steamID, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) { - PRINT_DEBUG("Steam_Networking_Sockets::FindRelayAuthTicketForServer old\n"); + PRINT_DEBUG("old"); return 0; } @@ -1467,13 +1483,14 @@ int FindRelayAuthTicketForServer( CSteamID steamID, int nVirtualPort, SteamDatag /// call ConnectToHostedDedicatedServer to connect to the server. int FindRelayAuthTicketForServer( const SteamNetworkingIdentity *identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) { - PRINT_DEBUG("Steam_Networking_Sockets::FindRelayAuthTicketForServer old1\n"); + PRINT_DEBUG("old1"); return 0; } int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) { - PRINT_DEBUG("Steam_Networking_Sockets::FindRelayAuthTicketForServer\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } @@ -1488,13 +1505,15 @@ int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameSer /// when your app initializes HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort ) { - PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer old\n"); + PRINT_DEBUG("old"); + std::lock_guard lock(global_mutex); return k_HSteamListenSocket_Invalid; } HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity *identityTarget, int nVirtualPort ) { - PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer old1\n"); + PRINT_DEBUG("old1"); + std::lock_guard lock(global_mutex); 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. HSteamNetConnection ConnectToHostedDedicatedServer( CSteamID steamIDTarget, int nVirtualPort ) { - PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer older\n"); + PRINT_DEBUG("older"); + std::lock_guard lock(global_mutex); return k_HSteamListenSocket_Invalid; } 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 lock(global_mutex); return k_HSteamListenSocket_Invalid; } @@ -1523,7 +1544,8 @@ HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentit /// Returns the value of the SDR_LISTEN_PORT environment variable. uint16 GetHostedDedicatedServerPort() { - PRINT_DEBUG("Steam_Networking_Sockets::GetHostedDedicatedServerPort\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); //TODO? return 27054; } @@ -1533,7 +1555,8 @@ uint16 GetHostedDedicatedServerPort() /// center code. Returns 0 otherwise. SteamNetworkingPOPID GetHostedDedicatedServerPOPID() { - PRINT_DEBUG("Steam_Networking_Sockets::GetHostedDedicatedServerPOPID\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } @@ -1558,7 +1581,7 @@ SteamNetworkingPOPID GetHostedDedicatedServerPOPID() /// Returns false if the SDR_LISTEN_PORT environment variable is not set. bool GetHostedDedicatedServerAddress001( SteamDatagramHostedAddress *pRouting ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetHostedDedicatedServerAddress002 %p\n", pRouting); + PRINT_DEBUG("%p", pRouting); return GetHostedDedicatedServerAddress(pRouting) == k_EResultOK; } @@ -1590,7 +1613,7 @@ bool GetHostedDedicatedServerAddress001( SteamDatagramHostedAddress *pRouting ) /// directly share it with clients. virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRouting ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetHostedDedicatedServerAddress %p\n", pRouting); + PRINT_DEBUG("%p", pRouting); std::lock_guard lock(global_mutex); pRouting->SetDevAddress(network->getOwnIP(), 27054); return k_EResultOK; @@ -1603,7 +1626,7 @@ virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRo /// Note that this call MUST be made through the SteamNetworkingSocketsGameServer() interface HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort ) { - PRINT_DEBUG("Steam_Networking_Sockets::CreateHostedDedicatedServerListenSocket old %i\n", nVirtualPort); + PRINT_DEBUG("old %i", nVirtualPort); std::lock_guard lock(global_mutex); return new_listen_socket(nVirtualPort, SNS_DISABLED_PORT); } @@ -1619,7 +1642,7 @@ HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort ) /// setting the options "immediately" after creation. 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 std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionDebugText\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -1644,14 +1668,16 @@ bool GetConnectionDebugText( HSteamNetConnection hConn, char *pOut, int nOutCCH // Returns the value or -1 is eConfigValue is invalid int32 GetConfigurationValue( ESteamNetworkingConfigurationValue eConfigValue ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetConfigurationValue\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return -1; } // Returns true if successfully set 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 lock(global_mutex); 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 const char *GetConfigurationValueName( ESteamNetworkingConfigurationValue eConfigValue ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetConfigurationValueName\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return NULL; } @@ -1671,13 +1698,15 @@ const char *GetConfigurationValueName( ESteamNetworkingConfigurationValue eConfi // returns -1 if the eConfigValue is invalid int32 GetConfigurationString( ESteamNetworkingConfigurationString eConfigString, char *pDest, int32 destSize ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetConfigurationString\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return -1; } bool SetConfigurationString( ESteamNetworkingConfigurationString eConfigString, const char *pString ) { - PRINT_DEBUG("Steam_Networking_Sockets::SetConfigurationString\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 const char *GetConfigurationStringName( ESteamNetworkingConfigurationString eConfigString ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetConfigurationStringName\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return NULL; } @@ -1696,14 +1726,16 @@ const char *GetConfigurationStringName( ESteamNetworkingConfigurationString eCon // Returns the value or -1 is eConfigValue is invalid int32 GetConnectionConfigurationValue( HSteamNetConnection hConn, ESteamNetworkingConnectionConfigurationValue eConfigValue ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionConfigurationValue\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return -1; } // Returns true if successfully set bool SetConnectionConfigurationValue( HSteamNetConnection hConn, ESteamNetworkingConnectionConfigurationValue eConfigValue, int32 nValue ) { - PRINT_DEBUG("Steam_Networking_Sockets::SetConnectionConfigurationValue\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -1739,7 +1771,8 @@ bool SetConnectionConfigurationValue( HSteamNetConnection hConn, ESteamNetworkin /// and don't share it directly with clients. EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *pLoginInfo, int *pcbSignedBlob, void *pBlob ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetGameCoordinatorServerLogin\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_EResultFail; } @@ -1785,7 +1818,8 @@ EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin * /// setting the options "immediately" after creation. 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 lock(global_mutex); //return ConnectP2PCustomSignaling(pSignaling, pPeerIdentity, 0, nOptions, pOptions); 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( 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 lock(global_mutex); return k_HSteamNetConnection_Invalid; } @@ -1828,13 +1863,15 @@ HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionSignali /// to call ISteamNetworkingUtils::InitRelayNetworkAccess() when your app initializes bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingCustomSignalingRecvContext *pContext ) { - PRINT_DEBUG("Steam_Networking_Sockets::ReceivedP2PCustomSignal old\n"); + PRINT_DEBUG("old"); + std::lock_guard lock(global_mutex); return false; } bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingSignalingRecvContext *pContext ) { - PRINT_DEBUG("Steam_Networking_Sockets::ReceivedP2PCustomSignal\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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. bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg ) { - PRINT_DEBUG("Steam_Networking_Sockets::GetCertificateRequest\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -1859,7 +1897,8 @@ bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &er /// SteamDatagram_CreateCert. bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg ) { - PRINT_DEBUG("Steam_Networking_Sockets::SetCertificate\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -1873,7 +1912,8 @@ bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkin /// a new user can sign in. void ResetIdentity( const SteamNetworkingIdentity *pIdentity ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // @@ -1938,7 +1978,8 @@ void ResetIdentity( const SteamNetworkingIdentity *pIdentity ) /// use CreateFakeUDPPort. bool BeginAsyncRequestFakeIP( int nNumPorts ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -1947,7 +1988,8 @@ bool BeginAsyncRequestFakeIP( int nNumPorts ) /// Make sure and check SteamNetworkingFakeIPResult_t::m_eResult void GetFakeIP( int idxFirstPort, SteamNetworkingFakeIPResult_t *pInfo ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } /// 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. HSteamListenSocket CreateListenSocketP2PFakeIP( int idxFakePort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 EResult GetRemoteFakeIPForConnection( HSteamNetConnection hConn, SteamNetworkingIPAddr *pOutAddr ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_EResultNone; } @@ -2005,7 +2049,8 @@ EResult GetRemoteFakeIPForConnection( HSteamNetConnection hConn, SteamNetworking /// assign a FakeIP from its own locally-controlled namespace. ISteamNetworkingFakeUDPPort *CreateFakeUDPPort( int idxFakeServerPort ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return NULL; } @@ -2015,12 +2060,14 @@ ISteamNetworkingFakeUDPPort *CreateFakeUDPPort( int idxFakeServerPort ) // to minimize potential changes in timing when that change happens. void RunCallbacks( ISteamNetworkingSocketsCallbacks *pCallbacks ) { - PRINT_DEBUG("Steam_Networking_Sockets:RunCallbacks\n"); + // PRINT_DEBUG_ENTRY(); } void RunCallbacks() { + // PRINT_DEBUG_ENTRY(); + //TODO: timeout unaccepted connections after a few seconds or so auto current_time = std::chrono::steady_clock::now(); auto socket_conn = std::begin(s->connect_sockets); @@ -2038,6 +2085,8 @@ void RunCallbacks() void Callback(Common_Message *msg) { + // PRINT_DEBUG_ENTRY(); + if (msg->has_low_level()) { if (msg->low_level().type() == Low_Level::CONNECT) { @@ -2055,7 +2104,7 @@ void Callback(Common_Message *msg) } 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) { int virtual_port = msg->networking_sockets().virtual_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()); if (connect_socket != s->connect_sockets.end()) { 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()); } } 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();}); 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()); } } diff --git a/dll/dll/steam_networking_socketsserialized.h b/dll/dll/steam_networking_socketsserialized.h index f961f436..7a8837c1 100644 --- a/dll/dll/steam_networking_socketsserialized.h +++ b/dll/dll/steam_networking_socketsserialized.h @@ -32,7 +32,7 @@ public ISteamNetworkingSocketsSerialized005 public: 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_networkingsockets->Callback(msg); @@ -40,7 +40,7 @@ static void steam_callback(void *object, Common_Message *msg) 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_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 ) { - PRINT_DEBUG("Steam_Networking_Sockets_Serialized::SendP2PRendezvous\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } 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 lock(global_mutex); } SteamAPICall_t GetCertAsync() { - PRINT_DEBUG("Steam_Networking_Sockets_Serialized::GetCertAsync\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); struct SteamNetworkingSocketsCert_t data = {}; data.m_eResult = k_EResultOK; @@ -86,53 +88,62 @@ SteamAPICall_t GetCertAsync() 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 lock(global_mutex); return 0; } int GetNetworkConfigJSON( void *buf, uint32 cbBuf ) { - PRINT_DEBUG("Steam_Networking_Sockets_Serialized::GetNetworkConfigJSON old\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return GetNetworkConfigJSON(buf, cbBuf, ""); } void CacheRelayTicket( const void *pTicket, uint32 cbTicket ) { - PRINT_DEBUG("Steam_Networking_Sockets_Serialized::CacheRelayTicket\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } uint32 GetCachedRelayTicketCount() { - PRINT_DEBUG("Steam_Networking_Sockets_Serialized::GetCachedRelayTicketCount\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } int GetCachedRelayTicket( uint32 idxTicket, void *buf, uint32 cbBuf ) { - PRINT_DEBUG("Steam_Networking_Sockets_Serialized::GetCachedRelayTicket\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } void PostConnectionStateMsg( const void *pMsg, uint32 cbMsg ) { - PRINT_DEBUG("Steam_Networking_Sockets_Serialized::PostConnectionStateMsg\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } 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 lock(global_mutex); return false; } bool BAllowDirectConnectToPeer(SteamNetworkingIdentity const &identity) { - PRINT_DEBUG("Steam_Networking_Sockets_Serialized::BAllowDirectConnectToPeer\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return true; } int BeginAsyncRequestFakeIP(int a) { - PRINT_DEBUG("Steam_Networking_Sockets_Serialized::BeginAsyncRequestFakeIP\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return true; } diff --git a/dll/dll/steam_networking_utils.h b/dll/dll/steam_networking_utils.h index 0e49fcf1..e83fb146 100644 --- a/dll/dll/steam_networking_utils.h +++ b/dll/dll/steam_networking_utils.h @@ -36,7 +36,7 @@ public ISteamNetworkingUtils public: 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_networkingutils->Callback(msg); @@ -44,7 +44,7 @@ static void steam_callback(void *object, Common_Message *msg) 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_networkingutils->RunCallbacks(); @@ -101,7 +101,8 @@ static void delete_steam_message(SteamNetworkingMessage_t *pMsg) /// counting and ownership. SteamNetworkingMessage_t *AllocateMessage( int cbAllocateBuffer ) { - PRINT_DEBUG("Steam_Networking_Utils::AllocateMessage\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); SteamNetworkingMessage_t *pMsg = new SteamNetworkingMessage_t(); pMsg->m_pfnFreeData = &free_steam_message_data; pMsg->m_pfnRelease = &delete_steam_message; @@ -117,7 +118,8 @@ SteamNetworkingMessage_t *AllocateMessage( int cbAllocateBuffer ) bool InitializeRelayAccess() { - PRINT_DEBUG("Steam_Networking_Utils::InitializeRelayAccess\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); init_relay = true; return relay_initialized; } @@ -143,7 +145,7 @@ SteamRelayNetworkStatus_t get_network_status() /// more details, you can pass a non-NULL value. ESteamNetworkingAvailability GetRelayNetworkStatus( SteamRelayNetworkStatus_t *pDetails ) { - PRINT_DEBUG("Steam_Networking_Utils::GetRelayNetworkStatus %p\n", pDetails); + PRINT_DEBUG("TODO %p", pDetails); std::lock_guard lock(global_mutex); //TODO: check if this is how real steam returns it @@ -161,7 +163,8 @@ ESteamNetworkingAvailability GetRelayNetworkStatus( SteamRelayNetworkStatus_t *p float GetLocalPingLocation( SteamNetworkPingLocation_t &result ) { - PRINT_DEBUG("Steam_Networking_Utils::GetLocalPingLocation\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); if (relay_initialized) { result.m_data[2] = 123; result.m_data[8] = 67; @@ -173,36 +176,40 @@ float GetLocalPingLocation( SteamNetworkPingLocation_t &result ) int EstimatePingTimeBetweenTwoLocations( const SteamNetworkPingLocation_t &location1, const SteamNetworkPingLocation_t &location2 ) { - PRINT_DEBUG("Steam_Networking_Utils::EstimatePingTimeBetweenTwoLocations\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); //return k_nSteamNetworkingPing_Unknown; - return 10; + return 2; } int EstimatePingTimeFromLocalHost( const SteamNetworkPingLocation_t &remoteLocation ) { - PRINT_DEBUG("Steam_Networking_Utils::EstimatePingTimeFromLocalHost\n"); - return 10; + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); + return 2; } void ConvertPingLocationToString( const SteamNetworkPingLocation_t &location, char *pszBuf, int cchBufSize ) { - PRINT_DEBUG("Steam_Networking_Utils::ConvertPingLocationToString\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); strncpy(pszBuf, "fra=10+2", cchBufSize); } bool ParsePingLocationString( const char *pszString, SteamNetworkPingLocation_t &result ) { - PRINT_DEBUG("Steam_Networking_Utils::ParsePingLocationString\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return true; } bool CheckPingDataUpToDate( float flMaxAgeSeconds ) { - PRINT_DEBUG("Steam_Networking_Utils::CheckPingDataUpToDate %f\n", flMaxAgeSeconds); + PRINT_DEBUG("TODO %f", flMaxAgeSeconds); init_relay = true; return relay_initialized; } @@ -210,35 +217,40 @@ bool CheckPingDataUpToDate( float flMaxAgeSeconds ) bool IsPingMeasurementInProgress() { - PRINT_DEBUG("Steam_Networking_Utils::IsPingMeasurementInProgress\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } int GetPingToDataCenter( SteamNetworkingPOPID popID, SteamNetworkingPOPID *pViaRelayPoP ) { - PRINT_DEBUG("Steam_Networking_Utils::GetPingToDataCenter\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } int GetDirectPingToPOP( SteamNetworkingPOPID popID ) { - PRINT_DEBUG("Steam_Networking_Utils::GetDirectPingToPOP\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } int GetPOPCount() { - PRINT_DEBUG("Steam_Networking_Utils::GetPOPCount\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } int GetPOPList( SteamNetworkingPOPID *list, int nListSz ) { - PRINT_DEBUG("Steam_Networking_Utils::GetPOPList\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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. SteamNetworkingMicroseconds GetLocalTimestamp() { - PRINT_DEBUG("Steam_Networking_Utils::GetLocalTimestamp\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); return std::chrono::duration_cast(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. void SetDebugOutputFunction( ESteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc ) { - PRINT_DEBUG("Steam_Networking_Utils::SetDebugOutputFunction %i\n", eDetailLevel); + PRINT_DEBUG("%i", eDetailLevel); + std::lock_guard lock(global_mutex); if (eDetailLevel != k_ESteamNetworkingSocketsDebugOutputType_None) { debug_function = pfnFunc; } @@ -309,7 +323,8 @@ void SetDebugOutputFunction( ESteamNetworkingSocketsDebugOutputType eDetailLevel // inline bool IsFakeIPv4( uint32 nIPv4 ) { return GetIPv4FakeIPType( nIPv4 ) > k_ESteamNetworkingFakeIPType_NotFake; } ESteamNetworkingFakeIPType GetIPv4FakeIPType( uint32 nIPv4 ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_ESteamNetworkingFakeIPType_NotFake; } @@ -327,7 +342,8 @@ ESteamNetworkingFakeIPType GetIPv4FakeIPType( uint32 nIPv4 ) /// indefinitely. EResult GetRealIdentityForFakeIP( const SteamNetworkingIPAddr &fakeIP, SteamNetworkingIdentity *pOutRealIdentity ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_EResultNoMatch; } @@ -358,7 +374,8 @@ bool SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworking bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj, 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 lock(global_mutex); return true; } @@ -373,7 +390,8 @@ bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigS ESteamNetworkingGetConfigValueResult GetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj, ESteamNetworkingConfigDataType *pOutDataType, void *pResult, size_t *cbResult ) { - PRINT_DEBUG("Steam_Networking_Utils::GetConfigValue\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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. 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 lock(global_mutex); //TODO flat api return false; } @@ -394,7 +413,8 @@ bool GetConfigValueInfo( ESteamNetworkingConfigValue eValue, const char **pOutNa /// if you do not need them. const char *GetConfigValueInfo( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigDataType *pOutDataType, ESteamNetworkingConfigScope *pOutScope ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); //TODO flat api return NULL; } @@ -402,7 +422,8 @@ const char *GetConfigValueInfo( ESteamNetworkingConfigValue eValue, ESteamNetwor /// Return the lowest numbered configuration value available in the current environment. ESteamNetworkingConfigValue GetFirstConfigValue() { - PRINT_DEBUG("Steam_Networking_Utils::GetFirstConfigValue\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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. ESteamNetworkingConfigValue IterateGenericEditableConfigValues( ESteamNetworkingConfigValue eCurrent, bool bEnumerateDevVars ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_ESteamNetworkingConfig_Invalid; } @@ -425,47 +447,36 @@ ESteamNetworkingConfigValue IterateGenericEditableConfigValues( ESteamNetworking // inline methods. void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr &addr, char *buf, size_t cbBuf, bool bWithPort ) { - PRINT_DEBUG("Steam_Networking_Utils::SteamNetworkingIPAddr_ToString\n"); - if (buf == nullptr || cbBuf == 0) - return; + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); + if (buf == nullptr || cbBuf == 0) return; - char buffer[64]; // Its enought for ipv4 & ipv6 + port - std::string str_addr; - if (addr.IsIPv4()) - { + char buffer[64]{}; // enough for ipv4 & ipv6 + port + std::string str_addr{}; + if (addr.IsIPv4()) { in_addr ipv4_addr; ipv4_addr.s_addr = htonl(addr.GetIPv4()); - if (inet_ntop(AF_INET, &ipv4_addr, buffer, sizeof(buffer) / sizeof(*buffer)) != nullptr) - { - if (bWithPort) - { + if (inet_ntop(AF_INET, &ipv4_addr, buffer, sizeof(buffer) / sizeof(*buffer)) != nullptr) { + if (bWithPort) { str_addr = buffer; str_addr += ':'; str_addr += std::to_string(addr.m_port); - } - else - { + } else { str_addr = buffer; } } - } - else - { - in6_addr ipv6_addr; + } else { + in6_addr ipv6_addr{}; 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 (bWithPort) - { + if (inet_ntop(AF_INET6, &ipv6_addr, buffer, sizeof(buffer) / sizeof(*buffer)) != nullptr) { + if (bWithPort) { str_addr = '['; str_addr += buffer; str_addr += "]:"; str_addr += std::to_string(addr.m_port); - } - else - { + } else { str_addr = buffer; } } @@ -478,18 +489,17 @@ void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr &addr, char *bu bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr ) { - PRINT_DEBUG("Steam_Networking_Utils::SteamNetworkingIPAddr_ParseString\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); bool valid = false; - if (pAddr == nullptr || pszStr == nullptr) - return valid; + if (pAddr == nullptr || pszStr == nullptr) return valid; std::string str(pszStr); size_t pos = str.find(':'); - if (pos != std::string::npos) - {// Try ipv4 with port + if (pos != std::string::npos) {// Try ipv4 with port in_addr ipv4_addr; std::string tmp(str); tmp[pos] = 0; @@ -501,9 +511,7 @@ bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char valid = true; 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; if (inet_pton(AF_INET, str.c_str(), &ipv4_addr) == 1) { @@ -512,8 +520,7 @@ bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char } } - if (!valid) - {// Try ipv6 + if (!valid) {// Try ipv6 addrinfo* info = nullptr; addrinfo hints = {}; hints.ai_family = AF_INET6; @@ -523,58 +530,46 @@ bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char size_t sep_pos = 0; std::string ip; int sep_count = 0; - for (int i = 0; i < str.length(); ++i) - { - if (str[i] == ':') - { + for (int i = 0; i < str.length(); ++i) { + if (str[i] == ':') { sep_pos = i; ++sep_count; } } - if (sep_count == 8) - { + + if (sep_count == 8) { ip = std::move(std::string(str.begin(), str.begin() + sep_pos)); - } - else - { + } else { 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; size_t pos = str.find(']'); 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())); - } - else if (sep_count == 8) - { + } else if (sep_count == 8) { str_port = std::move(std::string(str.begin() + sep_pos + 1, str.end())); } - try - { + + try { int port = std::stoi(str_port); - if (port >= 0 && port <= 65535) - { + if (port >= 0 && port <= 65535) { pAddr->SetIPv6(maddr->sin6_addr.s6_addr, port); valid = true; } } - catch(...) - { } + catch(...) { } } - if (info) - { + if (info) { freeaddrinfo(info); } } - if (!valid) - { + if (!valid) { pAddr->Clear(); } @@ -583,14 +578,16 @@ bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char ESteamNetworkingFakeIPType SteamNetworkingIPAddr_GetFakeIPType( const SteamNetworkingIPAddr &addr ) { - PRINT_DEBUG("TODO: %s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return k_ESteamNetworkingFakeIPType_NotFake; } 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 lock(global_mutex); if (buf == nullptr) return; @@ -654,7 +651,8 @@ void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity, bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, const char *pszStr ) { - PRINT_DEBUG("Steam_Networking_Utils::SteamNetworkingIdentity_ParseString\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); bool valid = false; if (pIdentity == nullptr) { diff --git a/dll/dll/steam_parties.h b/dll/dll/steam_parties.h index 4a3437bb..8a02308a 100644 --- a/dll/dll/steam_parties.h +++ b/dll/dll/steam_parties.h @@ -31,7 +31,7 @@ public ISteamParties public: 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->Callback(msg); @@ -39,7 +39,7 @@ static void steam_callback(void *object, Common_Message *msg) 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->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 uint32 GetNumActiveBeacons() { - PRINT_DEBUG("Steam_Parties::GetNumActiveBeacons\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } PartyBeaconID_t GetBeaconByIndex( uint32 unIndex ) { - PRINT_DEBUG("Steam_Parties::GetBeaconByIndex\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_Parties::GetBeaconDetails\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -92,7 +95,8 @@ bool GetBeaconDetails( PartyBeaconID_t ulBeaconID, CSteamID *pSteamIDBeaconOwner STEAM_CALL_RESULT( JoinPartyCallback_t ) SteamAPICall_t JoinParty( PartyBeaconID_t ulBeaconID ) { - PRINT_DEBUG("Steam_Parties::JoinParty\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } @@ -103,13 +107,15 @@ SteamAPICall_t JoinParty( PartyBeaconID_t ulBeaconID ) // Get a list of possible beacon locations bool GetNumAvailableBeaconLocations( uint32 *puNumLocations ) { - PRINT_DEBUG("Steam_Parties::GetNumAvailableBeaconLocations\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } bool GetAvailableBeaconLocations( SteamPartyBeaconLocation_t *pLocationList, uint32 uMaxNumLocations ) { - PRINT_DEBUG("Steam_Parties::GetAvailableBeaconLocations\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -121,7 +127,8 @@ bool GetAvailableBeaconLocations( SteamPartyBeaconLocation_t *pLocationList, uin STEAM_CALL_RESULT( CreateBeaconCallback_t ) 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 lock(global_mutex); return 0; } @@ -131,7 +138,8 @@ SteamAPICall_t CreateBeacon( uint32 unOpenSlots, SteamPartyBeaconLocation_t *pBe // Steam will manage the remaining open slots automatically. void OnReservationCompleted( PartyBeaconID_t ulBeacon, CSteamID steamIDUser ) { - PRINT_DEBUG("Steam_Parties::OnReservationCompleted\n"); + PRINT_DEBUG_TODO(); + std::lock_guard 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. void CancelReservation( PartyBeaconID_t ulBeacon, CSteamID steamIDUser ) { - PRINT_DEBUG("Steam_Parties::CancelReservation\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } @@ -149,7 +158,8 @@ void CancelReservation( PartyBeaconID_t ulBeacon, CSteamID steamIDUser ) STEAM_CALL_RESULT( ChangeNumOpenSlotsCallback_t ) SteamAPICall_t ChangeNumOpenSlots( PartyBeaconID_t ulBeacon, uint32 unOpenSlots ) { - PRINT_DEBUG("Steam_Parties::ChangeNumOpenSlots\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return 0; } @@ -157,7 +167,8 @@ SteamAPICall_t ChangeNumOpenSlots( PartyBeaconID_t ulBeacon, uint32 unOpenSlots // Turn off the beacon. bool DestroyBeacon( PartyBeaconID_t ulBeacon ) { - PRINT_DEBUG("Steam_Parties::DestroyBeacon\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -165,7 +176,8 @@ bool DestroyBeacon( PartyBeaconID_t ulBeacon ) // Utils 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 lock(global_mutex); return false; } diff --git a/dll/dll/steam_remote_storage.h b/dll/dll/steam_remote_storage.h index 59b2920b..fe4d73ba 100644 --- a/dll/dll/steam_remote_storage.h +++ b/dll/dll/steam_remote_storage.h @@ -56,7 +56,7 @@ static void copy_file(const std::string &src_filepath, const std::string &dst_fi { 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); 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 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 lock(global_mutex); 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); - 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; } 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 lock(global_mutex); if (!pchFile || !pchFile[0] || !pvData || !cubDataToRead) return 0; int read_data = local_storage->get_data(Local_Storage::remote_storage_folder, pchFile, (char* )pvData, cubDataToRead); if (read_data < 0) read_data = 0; - PRINT_DEBUG(" Read %i\n", read_data); + PRINT_DEBUG(" Read %i", read_data); return read_data; } STEAM_CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t ) 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 lock(global_mutex); 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 ) 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 lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_Remote_Storage::FileReadAsyncComplete\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (!pvBuffer) return false; @@ -214,7 +214,7 @@ bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cub bool FileForget( const char *pchFile ) { - PRINT_DEBUG("Steam_Remote_Storage::FileForget\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (!pchFile || !pchFile[0]) return false; @@ -223,7 +223,7 @@ bool FileForget( const char *pchFile ) bool FileDelete( const char *pchFile ) { - PRINT_DEBUG("Steam_Remote_Storage::FileDelete\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (!pchFile || !pchFile[0]) return false; @@ -233,7 +233,7 @@ bool FileDelete( const char *pchFile ) STEAM_CALL_RESULT( RemoteStorageFileShareResult_t ) SteamAPICall_t FileShare( const char *pchFile ) { - PRINT_DEBUG("Steam_Remote_Storage::FileShare\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (!pchFile || !pchFile[0]) return k_uAPICallInvalid; @@ -252,7 +252,7 @@ SteamAPICall_t FileShare( const char *pchFile ) bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform ) { - PRINT_DEBUG("Steam_Remote_Storage::SetSyncPlatforms\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (!pchFile || !pchFile[0]) return false; @@ -263,7 +263,7 @@ bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStorag // file operations that cause network IO UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile ) { - PRINT_DEBUG("Steam_Remote_Storage::FileWriteStreamOpen\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_Remote_Storage::FileWriteStreamWriteChunk\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (!pvData || cubData < 0) return false; @@ -292,7 +292,7 @@ bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const vo bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle ) { - PRINT_DEBUG("Steam_Remote_Storage::FileWriteStreamClose\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard 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; }); if (stream_writes.end() == request) @@ -305,7 +305,7 @@ bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle ) bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle ) { - PRINT_DEBUG("Steam_Remote_Storage::FileWriteStreamCancel\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard 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; }); if (stream_writes.end() == request) @@ -318,7 +318,7 @@ bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle ) // file information bool FileExists( const char *pchFile ) { - PRINT_DEBUG("Steam_Remote_Storage::FileExists %s\n", pchFile); + PRINT_DEBUG("%s", pchFile); std::lock_guard lock(global_mutex); if (!pchFile || !pchFile[0]) return false; @@ -327,7 +327,7 @@ bool FileExists( const char *pchFile ) bool FilePersisted( const char *pchFile ) { - PRINT_DEBUG("Steam_Remote_Storage::FilePersisted\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (!pchFile || !pchFile[0]) return false; @@ -336,7 +336,7 @@ bool FilePersisted( const char *pchFile ) int32 GetFileSize( const char *pchFile ) { - PRINT_DEBUG("Steam_Remote_Storage::GetFileSize %s\n", pchFile); + PRINT_DEBUG("%s", pchFile); std::lock_guard lock(global_mutex); if (!pchFile || !pchFile[0]) return 0; @@ -345,7 +345,7 @@ int32 GetFileSize( const char *pchFile ) int64 GetFileTimestamp( const char *pchFile ) { - PRINT_DEBUG("Steam_Remote_Storage::GetFileTimestamp '%s'\n", pchFile); + PRINT_DEBUG("'%s'", pchFile); std::lock_guard lock(global_mutex); if (!pchFile || !pchFile[0]) return 0; @@ -354,7 +354,7 @@ int64 GetFileTimestamp( const char *pchFile ) ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile ) { - PRINT_DEBUG("Steam_Remote_Storage::GetSyncPlatforms\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return k_ERemoteStoragePlatformAll; @@ -364,22 +364,22 @@ ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile ) // iteration int32 GetFileCount() { - PRINT_DEBUG("Steam_Remote_Storage::GetFileCount\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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; } const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes ) { - PRINT_DEBUG("Steam_Remote_Storage::GetFileNameAndSize %i\n", iFile); + PRINT_DEBUG("%i", iFile); std::lock_guard lock(global_mutex); static char output_filename[MAX_FILENAME_LENGTH]; 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; } else { return ""; @@ -390,7 +390,7 @@ const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes ) // configuration management bool GetQuota( uint64 *pnTotalBytes, uint64 *puAvailableBytes ) { - PRINT_DEBUG("Steam_Remote_Storage::GetQuota\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); uint64 quota = 2 << 26; @@ -401,7 +401,7 @@ bool GetQuota( uint64 *pnTotalBytes, uint64 *puAvailableBytes ) bool GetQuota( int32 *pnTotalBytes, int32 *puAvailableBytes ) { - PRINT_DEBUG("Steam_Remote_Storage::GetQuota\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); uint64 quota = 2 << 26; @@ -412,7 +412,7 @@ bool GetQuota( int32 *pnTotalBytes, int32 *puAvailableBytes ) bool IsCloudEnabledForAccount() { - PRINT_DEBUG("Steam_Remote_Storage::IsCloudEnabledForAccount\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return true; @@ -420,7 +420,7 @@ bool IsCloudEnabledForAccount() bool IsCloudEnabledForApp() { - PRINT_DEBUG("Steam_Remote_Storage::IsCloudEnabledForApp\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return steam_cloud_enabled; @@ -428,7 +428,7 @@ bool IsCloudEnabledForApp() bool IsCloudEnabledThisApp() { - PRINT_DEBUG("Steam_Remote_Storage::IsCloudEnabledThisApp\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return steam_cloud_enabled; @@ -436,7 +436,7 @@ bool IsCloudEnabledThisApp() void SetCloudEnabledForApp( bool bEnabled ) { - PRINT_DEBUG("Steam_Remote_Storage::SetCloudEnabledForApp\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); steam_cloud_enabled = bEnabled; @@ -444,7 +444,7 @@ void SetCloudEnabledForApp( bool bEnabled ) bool SetCloudEnabledThisApp( bool bEnabled ) { - PRINT_DEBUG("Steam_Remote_Storage::SetCloudEnabledThisApp\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); steam_cloud_enabled = bEnabled; @@ -459,7 +459,7 @@ bool SetCloudEnabledThisApp( bool bEnabled ) STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t ) SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority ) { - PRINT_DEBUG("Steam_Remote_Storage::UGCDownload %llu\n", hContent); + PRINT_DEBUG("%llu", hContent); std::lock_guard lock(global_mutex); if (hContent == k_UGCHandleInvalid) return k_uAPICallInvalid; @@ -510,7 +510,7 @@ SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority ) STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t ) SteamAPICall_t UGCDownload( UGCHandle_t hContent ) { - PRINT_DEBUG("Steam_Remote_Storage::UGCDownload old\n"); + PRINT_DEBUG("old"); 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 bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected ) { - PRINT_DEBUG("Steam_Remote_Storage::GetUGCDownloadProgress\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -527,7 +527,7 @@ bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int bool GetUGCDownloadProgress( UGCHandle_t hContent, uint32 *pnBytesDownloaded, uint32 *pnBytesExpected ) { - PRINT_DEBUG("Steam_Remote_Storage::GetUGCDownloadProgress old\n"); + PRINT_DEBUG("old"); std::lock_guard lock(global_mutex); 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 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 lock(global_mutex); 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. 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 lock(global_mutex); 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: { - 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); 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::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_name = f.mod_query_info.is_primary_file ? 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); - 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; } break; 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? 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 (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 ) { - PRINT_DEBUG("Steam_Remote_Storage::UGCRead old\n"); + PRINT_DEBUG("old"); std::lock_guard lock(global_mutex); 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) { - PRINT_DEBUG("Steam_Remote_Storage::UGCRead old2\n"); + PRINT_DEBUG("old2"); std::lock_guard lock(global_mutex); 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() int32 GetCachedUGCCount() { - PRINT_DEBUG("Steam_Remote_Storage::GetCachedUGCCount\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return 0; @@ -644,7 +644,7 @@ int32 GetCachedUGCCount() UGCHandle_t GetCachedUGCHandle( int32 iCachedContent ) { - PRINT_DEBUG("Steam_Remote_Storage::GetCachedUGCHandle\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 void GetFileListFromServer() { - PRINT_DEBUG("Steam_Remote_Storage::GetFileListFromServer\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); } @@ -666,7 +666,7 @@ void GetFileListFromServer() // Indicate this file should be downloaded in the next sync bool FileFetch( const char *pchFile ) { - PRINT_DEBUG("Steam_Remote_Storage::FileFetch\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return true; @@ -675,7 +675,7 @@ bool FileFetch( const char *pchFile ) // Indicate this file should be persisted in the next sync bool FilePersist( const char *pchFile ) { - PRINT_DEBUG("Steam_Remote_Storage::FilePersist\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 bool SynchronizeToClient() { - PRINT_DEBUG("Steam_Remote_Storage::SynchronizeToClient\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); } @@ -692,7 +692,7 @@ bool SynchronizeToClient() // Upload any requested files to the Cloud - results in a RemoteStorageAppSyncedServer_t callback bool SynchronizeToServer() { - PRINT_DEBUG("Steam_Remote_Storage::SynchronizeToServer\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); } @@ -700,7 +700,7 @@ bool SynchronizeToServer() // Reset any fetch/persist/etc requests bool ResetFileRequestState() { - PRINT_DEBUG("Steam_Remote_Storage::ResetFileRequestState\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); } @@ -711,7 +711,7 @@ bool ResetFileRequestState() 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 ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::PublishWorkshopFile\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_uAPICallInvalid; @@ -719,7 +719,7 @@ SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewF PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t unPublishedFileId ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::CreatePublishedFileUpdateRequest\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_PublishedFileUpdateHandleInvalid; @@ -727,7 +727,7 @@ PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const char *pchFile ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFileFile\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::PublishFile\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::PublishWorkshopFile old\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_uAPICallInvalid; @@ -751,7 +751,7 @@ SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewF SteamAPICall_t UpdatePublishedFile( RemoteStorageUpdatePublishedFileRequest_t updatePublishedFileRequest ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFile\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_uAPICallInvalid; @@ -759,7 +759,7 @@ SteamAPICall_t UpdatePublishedFile( RemoteStorageUpdatePublishedFileRequest_t up bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, const char *pchPreviewFile ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFilePreviewFile\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; @@ -767,7 +767,7 @@ bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, c bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const char *pchTitle ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFileTitle\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; @@ -775,7 +775,7 @@ bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const c bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchDescription ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFileDescription\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; @@ -783,7 +783,7 @@ bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, c bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFileVisibility\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; @@ -791,7 +791,7 @@ bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ER bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::UpdatePublishedFileTags\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; @@ -800,7 +800,7 @@ bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamPar STEAM_CALL_RESULT( RemoteStorageUpdatePublishedFileResult_t ) SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::CommitPublishedFileUpdate %llu\n", updateHandle); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_uAPICallInvalid; @@ -812,7 +812,7 @@ SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHand STEAM_CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t ) 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 is this implementation correct? std::lock_guard lock(global_mutex); @@ -864,14 +864,14 @@ SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uin STEAM_CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t ) SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::GetPublishedFileDetails old\n"); + PRINT_DEBUG_TODO(); return GetPublishedFileDetails(unPublishedFileId, 0); } STEAM_CALL_RESULT( RemoteStorageDeletePublishedFileResult_t ) SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::DeletePublishedFile %llu\n", unPublishedFileId); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_uAPICallInvalid; @@ -881,7 +881,7 @@ SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t ) 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? std::lock_guard lock(global_mutex); RemoteStorageEnumerateUserPublishedFilesResult_t data{}; @@ -910,7 +910,7 @@ SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex ) auto mod = settings->getMod(modId); data.m_rgPublishedFileId[iterated] = modId; iterated++; - PRINT_DEBUG(" EnumerateUserPublishedFiles file %llu\n", modId); + PRINT_DEBUG(" EnumerateUserPublishedFiles file %llu", modId); } data.m_nResultsReturned = iterated; } @@ -921,7 +921,7 @@ SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex ) STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t ) SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::SubscribePublishedFile %llu\n", unPublishedFileId); + PRINT_DEBUG("TODO %llu", unPublishedFileId); std::lock_guard lock(global_mutex); if (unPublishedFileId == k_PublishedFileIdInvalid) return k_uAPICallInvalid; @@ -943,7 +943,7 @@ STEAM_CALL_RESULT( RemoteStorageEnumerateUserSubscribedFilesResult_t ) SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) { // https://partner.steamgames.com/doc/api/ISteamRemoteStorage - PRINT_DEBUG("Steam_Remote_Storage::EnumerateUserSubscribedFiles %u\n", unStartIndex); + PRINT_DEBUG("%u", unStartIndex); std::lock_guard lock(global_mutex); // Get ready for a working but bad implementation - Detanup01 RemoteStorageEnumerateUserSubscribedFilesResult_t data{}; @@ -963,7 +963,7 @@ SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) data.m_rgPublishedFileId[iterated] = modId; data.m_rgRTimeSubscribed[iterated] = time; iterated++; - PRINT_DEBUG(" EnumerateUserSubscribedFiles file %llu\n", modId); + PRINT_DEBUG(" EnumerateUserSubscribedFiles file %llu", modId); } data.m_nResultsReturned = iterated; } @@ -974,7 +974,7 @@ SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t ) SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::UnsubscribePublishedFile %llu\n", unPublishedFileId); + PRINT_DEBUG("TODO %llu", unPublishedFileId); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_Remote_Storage::UpdatePublishedFileSetChangeDescription\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -1003,7 +1003,7 @@ bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t update STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t ) SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::GetPublishedItemVoteDetails\n"); + PRINT_DEBUG_TODO(); // TODO s this implementation correct? std::lock_guard lock(global_mutex); 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, // 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? std::lock_guard lock(global_mutex); if (unPublishedFileId == k_PublishedFileIdInvalid) return k_uAPICallInvalid; @@ -1053,7 +1053,7 @@ SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId, STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t ) SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) { - PRINT_DEBUG("Steam_Remote_Storage::GetUserPublishedItemVoteDetails\n"); + PRINT_DEBUG_ENTRY(); // TODO is this implementation correct? std::lock_guard lock(global_mutex); @@ -1084,7 +1084,7 @@ SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFil STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t ) 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 lock(global_mutex); RemoteStorageEnumerateUserPublishedFilesResult_t data{}; data.m_eResult = k_EResultOK; @@ -1097,14 +1097,14 @@ SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStar STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t ) 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); } 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 ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::PublishVideo\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_uAPICallInvalid; } @@ -1112,7 +1112,7 @@ SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char * 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 ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::PublishVideo old\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_uAPICallInvalid; } @@ -1120,7 +1120,7 @@ SteamAPICall_t PublishVideo(const char *pchFileName, const char *pchPreviewFile, STEAM_CALL_RESULT( RemoteStorageSetUserPublishedFileActionResult_t ) SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::SetUserPublishedFileAction\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_uAPICallInvalid; } @@ -1128,7 +1128,7 @@ SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, STEAM_CALL_RESULT( RemoteStorageEnumeratePublishedFilesByUserActionResult_t ) SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex ) { - PRINT_DEBUG("TODO Steam_Remote_Storage::EnumeratePublishedFilesByUserAction\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_uAPICallInvalid; } @@ -1137,7 +1137,7 @@ SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, STEAM_CALL_RESULT( RemoteStorageEnumerateWorkshopFilesResult_t ) 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? std::lock_guard lock(global_mutex); RemoteStorageEnumerateWorkshopFilesResult_t data{}; @@ -1152,7 +1152,7 @@ SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumer STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t ) 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? std::lock_guard lock(global_mutex); //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 int32 GetLocalFileChangeCount() { - PRINT_DEBUG("GetLocalFileChangeCount\n"); + PRINT_DEBUG("GetLocalFileChangeCount"); std::lock_guard lock(global_mutex); return 0; @@ -1213,7 +1213,7 @@ int32 GetLocalFileChangeCount() const char *GetLocalFileChange( int iFile, ERemoteStorageLocalFileChange *pEChangeType, ERemoteStorageFilePathType *pEFilePathType ) { - PRINT_DEBUG("GetLocalFileChange\n"); + PRINT_DEBUG("GetLocalFileChange"); std::lock_guard lock(global_mutex); return ""; @@ -1223,7 +1223,7 @@ const char *GetLocalFileChange( int iFile, ERemoteStorageLocalFileChange *pEChan // operations - for example, writing a game save that requires updating two files. bool BeginFileWriteBatch() { - PRINT_DEBUG("BeginFileWriteBatch\n"); + PRINT_DEBUG("BeginFileWriteBatch"); std::lock_guard lock(global_mutex); return true; @@ -1231,7 +1231,7 @@ bool BeginFileWriteBatch() bool EndFileWriteBatch() { - PRINT_DEBUG("EndFileWriteBatch\n"); + PRINT_DEBUG("EndFileWriteBatch"); std::lock_guard lock(global_mutex); return true; diff --git a/dll/dll/steam_remoteplay.h b/dll/dll/steam_remoteplay.h index 66f09c41..74e8e725 100644 --- a/dll/dll/steam_remoteplay.h +++ b/dll/dll/steam_remoteplay.h @@ -30,7 +30,7 @@ public ISteamRemotePlay public: 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->Callback(msg); @@ -38,7 +38,7 @@ static void steam_callback(void *object, Common_Message *msg) 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->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 uint32 GetSessionCount() { - PRINT_DEBUG("Steam_RemotePlay::GetSessionCount\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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. uint32 GetSessionID( int iSessionIndex ) { - PRINT_DEBUG("Steam_RemotePlay::GetSessionID\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return 0; } @@ -81,7 +81,7 @@ uint32 GetSessionID( int iSessionIndex ) // Get the SteamID of the connected user CSteamID GetSessionSteamID( uint32 unSessionID ) { - PRINT_DEBUG("Steam_RemotePlay::GetSessionSteamID\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_steamIDNil; } @@ -90,7 +90,7 @@ CSteamID GetSessionSteamID( uint32 unSessionID ) // This returns NULL if the sessionID is not valid const char *GetSessionClientName( uint32 unSessionID ) { - PRINT_DEBUG("Steam_RemotePlay::GetSessionClientName\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return NULL; } @@ -98,7 +98,7 @@ const char *GetSessionClientName( uint32 unSessionID ) // Get the form factor of the session client device ESteamDeviceFormFactor GetSessionClientFormFactor( uint32 unSessionID ) { - PRINT_DEBUG("Steam_RemotePlay::GetSessionClientFormFactor\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_ESteamDeviceFormFactorUnknown; } @@ -107,7 +107,7 @@ ESteamDeviceFormFactor GetSessionClientFormFactor( uint32 unSessionID ) // This is set to 0x0 if the resolution is not available bool BGetSessionClientResolution( uint32 unSessionID, int *pnResolutionX, int *pnResolutionY ) { - PRINT_DEBUG("Steam_RemotePlay::BGetSessionClientResolution\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); if (pnResolutionX) *pnResolutionX = 0; if (pnResolutionY) *pnResolutionY = 0; @@ -116,7 +116,7 @@ bool BGetSessionClientResolution( uint32 unSessionID, int *pnResolutionX, int *p bool BStartRemotePlayTogether( bool bShowOverlay ) { - PRINT_DEBUG("Steam_RemotePlay::BStartRemotePlayTogether: %d\n", (int)bShowOverlay); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; } @@ -125,7 +125,7 @@ bool BStartRemotePlayTogether( bool bShowOverlay ) // This returns false if the invite can't be sent bool BSendRemotePlayTogetherInvite( CSteamID steamIDFriend ) { - PRINT_DEBUG("Steam_RemotePlay::BSendRemotePlayTogetherInvite\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; } diff --git a/dll/dll/steam_tv.h b/dll/dll/steam_tv.h index 2005518d..485fd7bd 100644 --- a/dll/dll/steam_tv.h +++ b/dll/dll/steam_tv.h @@ -31,7 +31,7 @@ public ISteamTV public: 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_parties->Callback(msg); @@ -39,7 +39,7 @@ static void steam_callback(void *object, Common_Message *msg) 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_parties->RunCallbacks(); @@ -65,39 +65,46 @@ Steam_TV(class Settings *settings, class Networking *network, class SteamCallRes bool IsBroadcasting(int *pnNumViewers) { - PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } void AddBroadcastGameData(const char * pchKey, const char * pchValue) { - PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } void RemoveBroadcastGameData(const char * pchKey) { - PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } 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 lock(global_mutex); } void RemoveTimelineMarker() { - PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } 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 lock(global_mutex); return 0; } void RemoveRegion(uint32 unRegionHandle) { - PRINT_DEBUG("TODO Steam_TV::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } void RunCallbacks() diff --git a/dll/dll/steam_ugc.h b/dll/dll/steam_ugc.h index 17a7788c..c981643e 100644 --- a/dll/dll/steam_ugc.h +++ b/dll/dll/steam_ugc.h @@ -70,7 +70,7 @@ UGCQueryHandle_t new_ugc_query( query.return_all_subscribed = return_all_subscribed; query.return_only = return_only; 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; } @@ -82,7 +82,7 @@ void set_details(PublishedFileId_t id, SteamUGCDetails_t *pDetails) pDetails->m_nPublishedFileId = 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; auto mod = settings->getMod(id); @@ -115,7 +115,7 @@ void set_details(PublishedFileId_t id, SteamUGCDetails_t *pDetails) // TODO should we enable this? // pDetails->m_unNumChildren = mod.numChildren; } else { - PRINT_DEBUG(" mod isn't installed, returning failure\n"); + PRINT_DEBUG(" mod isn't installed, returning failure"); pDetails->m_eResult = k_EResultFail; } } @@ -139,7 +139,7 @@ void read_ugc_favorites() { unsigned long long fav_id = std::stoull(line); 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(...) { } } @@ -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. 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 lock(global_mutex); 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. 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 lock(global_mutex); 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. 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 lock(global_mutex); 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) 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 lock(global_mutex); if (!pvecPublishedFileID) return k_UGCQueryHandleInvalid; @@ -227,7 +227,7 @@ UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedF #ifndef EMU_RELEASE_BUILD for (const auto &id : only) { - PRINT_DEBUG(" Steam_UGC::CreateQueryUGCDetailsRequest file ID = %llu\n", id); + PRINT_DEBUG(" file ID = %llu", id); } #endif @@ -239,7 +239,7 @@ UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedF STEAM_CALL_RESULT( SteamUGCQueryCompleted_t ) SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) { - PRINT_DEBUG("Steam_UGC::SendQueryUGCRequest %llu\n", handle); + PRINT_DEBUG("%llu", handle); std::lock_guard lock(global_mutex); 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 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 lock(global_mutex); if (handle == k_UGCQueryHandleInvalid) return false; @@ -344,7 +344,7 @@ std::optional get_query_ugc_tag(UGCQueryHandle_t handle, uint32 ind uint32 GetQueryUGCNumTags( UGCQueryHandle_t handle, uint32 index ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCNumTags\n"); + PRINT_DEBUG_TODO(); // TODO is this correct? std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCTag\n"); + PRINT_DEBUG_TODO(); // TODO is this correct? std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCTagDisplayName\n"); + PRINT_DEBUG_TODO(); // TODO is this correct? std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_UGC::GetQueryUGCPreviewURL\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); //TODO: escape simulator tries downloading this url and unsubscribes if it fails 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; 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); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCMetadata\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCChildren\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCStatistic\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCStatistic old\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCNumAdditionalPreviews\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCAdditionalPreview\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCAdditionalPreview old\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCNumKeyValueTags\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCKeyValueTag\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCKeyValueTag2\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::GetQueryUGCContentDescriptors\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) { - PRINT_DEBUG("Steam_UGC::ReleaseQueryUGCRequest %llu\n", handle); + PRINT_DEBUG("%llu", handle); std::lock_guard lock(global_mutex); if (handle == k_UGCQueryHandleInvalid) return false; @@ -557,7 +557,7 @@ bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) // Options to set for querying UGC bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) { - PRINT_DEBUG("TODO Steam_UGC::AddRequiredTag\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::AddRequiredTagGroup\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::AddExcludedTag\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::SetReturnOnlyIDs\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); if (handle == k_UGCQueryHandleInvalid) return false; @@ -607,7 +607,7 @@ bool SetReturnOnlyIDs( UGCQueryHandle_t handle, bool bReturnOnlyIDs ) bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags ) { - PRINT_DEBUG("TODO Steam_UGC::SetReturnKeyValueTags\n"); + PRINT_DEBUG_TODO(); 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; }); @@ -619,7 +619,7 @@ bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags ) bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) { - PRINT_DEBUG("TODO Steam_UGC::SetReturnLongDescription\n"); + PRINT_DEBUG_TODO(); 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; }); @@ -631,7 +631,7 @@ bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescript bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata ) { - PRINT_DEBUG("TODO Steam_UGC::SetReturnMetadata %i\n", (int)bReturnMetadata); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); if (handle == k_UGCQueryHandleInvalid) return false; @@ -644,7 +644,7 @@ bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata ) bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren ) { - PRINT_DEBUG("TODO Steam_UGC::SetReturnChildren\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); if (handle == k_UGCQueryHandleInvalid) return false; @@ -657,7 +657,7 @@ bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren ) bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditionalPreviews ) { - PRINT_DEBUG("TODO Steam_UGC::SetReturnAdditionalPreviews\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); if (handle == k_UGCQueryHandleInvalid) return false; @@ -670,7 +670,7 @@ bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditiona bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) { - PRINT_DEBUG("TODO Steam_UGC::SetReturnTotalOnly\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); if (handle == k_UGCQueryHandleInvalid) return false; @@ -683,7 +683,7 @@ bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) bool SetReturnPlaytimeStats( UGCQueryHandle_t handle, uint32 unDays ) { - PRINT_DEBUG("TODO Steam_UGC::SetReturnPlaytimeStats\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::SetLanguage\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::SetAllowCachedResponse\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); if (handle == k_UGCQueryHandleInvalid) return false; @@ -723,7 +723,7 @@ bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) // Options only for querying user UGC bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) { - PRINT_DEBUG("TODO Steam_UGC::SetCloudFileNameFilter\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); if (handle == k_UGCQueryHandleInvalid) return false; @@ -737,7 +737,7 @@ bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFil // Options only for querying all UGC bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag ) { - PRINT_DEBUG("TODO Steam_UGC::SetMatchAnyTag\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::SetSearchText\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::SetRankedByTrendDays\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::AddRequiredKeyValueTag\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::SetTimeCreatedDateRange\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("TODO Steam_UGC::SetTimeUpdatedDateRange\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); if (handle == k_UGCQueryHandleInvalid) return false; @@ -813,7 +813,7 @@ bool SetTimeUpdatedDateRange( UGCQueryHandle_t handle, RTime32 rtStart, RTime32 // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) { - PRINT_DEBUG("Steam_UGC::RequestUGCDetails %llu\n", nPublishedFileID); + PRINT_DEBUG("%llu", nPublishedFileID); std::lock_guard lock(global_mutex); SteamUGCRequestUGCDetailsResult_t data{}; @@ -824,7 +824,7 @@ SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unM SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID ) { - PRINT_DEBUG("Steam_UGC::RequestUGCDetails old\n"); + PRINT_DEBUG("old"); return RequestUGCDetails(nPublishedFileID, 0); } @@ -833,7 +833,7 @@ SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID ) STEAM_CALL_RESULT( CreateItemResult_t ) SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) { - PRINT_DEBUG("Steam_UGC::CreateItem\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return k_uAPICallInvalid; @@ -843,7 +843,7 @@ SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID ) { - PRINT_DEBUG("Steam_UGC::StartItemUpdate\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return k_UGCUpdateHandleInvalid; @@ -853,7 +853,7 @@ UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPu bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle ) { - PRINT_DEBUG("Steam_UGC::SetItemTitle\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -863,7 +863,7 @@ bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle ) bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription ) { - PRINT_DEBUG("Steam_UGC::SetItemDescription\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -873,7 +873,7 @@ bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription ) bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage ) { - PRINT_DEBUG("Steam_UGC::SetItemUpdateLanguage\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -883,7 +883,7 @@ bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage ) bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData ) { - PRINT_DEBUG("Steam_UGC::SetItemMetadata\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -893,7 +893,7 @@ bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData ) bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility ) { - PRINT_DEBUG("Steam_UGC::SetItemVisibility\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -903,7 +903,7 @@ bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVis bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags ) { - PRINT_DEBUG("Steam_UGC::SetItemTags old\n"); + PRINT_DEBUG("old"); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_UGC::SetItemTags\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -920,7 +920,7 @@ bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder ) { - PRINT_DEBUG("Steam_UGC::SetItemContent\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -930,7 +930,7 @@ bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder ) bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile ) { - PRINT_DEBUG("Steam_UGC::SetItemPreview\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -939,7 +939,7 @@ bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile ) bool SetAllowLegacyUpload( UGCUpdateHandle_t handle, bool bAllowLegacyUpload ) { - PRINT_DEBUG("Steam_UGC::SetAllowLegacyUpload\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -947,7 +947,7 @@ bool SetAllowLegacyUpload( UGCUpdateHandle_t handle, bool bAllowLegacyUpload ) bool RemoveAllItemKeyValueTags( UGCUpdateHandle_t handle ) { - PRINT_DEBUG("Steam_UGC::RemoveAllItemKeyValueTags\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -956,7 +956,7 @@ bool RemoveAllItemKeyValueTags( UGCUpdateHandle_t handle ) bool RemoveItemKeyValueTags( UGCUpdateHandle_t handle, const char *pchKey ) { - PRINT_DEBUG("Steam_UGC::RemoveItemKeyValueTags\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_UGC::AddItemKeyValueTag\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_UGC::AddItemPreviewFile\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -986,7 +986,7 @@ bool AddItemPreviewFile( UGCUpdateHandle_t handle, const char *pszPreviewFile, E bool AddItemPreviewVideo( UGCUpdateHandle_t handle, const char *pszVideoID ) { - PRINT_DEBUG("Steam_UGC::AddItemPreviewVideo\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -996,7 +996,7 @@ bool AddItemPreviewVideo( UGCUpdateHandle_t handle, const char *pszVideoID ) bool UpdateItemPreviewFile( UGCUpdateHandle_t handle, uint32 index, const char *pszPreviewFile ) { - PRINT_DEBUG("Steam_UGC::UpdateItemPreviewFile\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_UGC::UpdateItemPreviewVideo\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; @@ -1016,7 +1016,7 @@ bool UpdateItemPreviewVideo( UGCUpdateHandle_t handle, uint32 index, const char 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 lock(global_mutex); return false; @@ -1025,7 +1025,7 @@ bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index ) 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 lock(global_mutex); return false; @@ -1033,7 +1033,7 @@ bool AddContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID des 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 lock(global_mutex); return false; @@ -1042,7 +1042,7 @@ bool RemoveContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID STEAM_CALL_RESULT( SubmitItemUpdateResult_t ) SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) { - PRINT_DEBUG("Steam_UGC::SubmitItemUpdate\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_UGC::GetItemUpdateProgress\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return k_EItemUpdateStatusInvalid; @@ -1064,7 +1064,7 @@ EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBy STEAM_CALL_RESULT( SetUserItemVoteResult_t ) SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp ) { - PRINT_DEBUG("Steam_UGC::SetUserItemVote\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 ) SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID ) { - PRINT_DEBUG("Steam_UGC::GetUserItemVote\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 ) 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 lock(global_mutex); 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 @@ -1128,7 +1128,7 @@ SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedF STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t ) SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) { - PRINT_DEBUG("Steam_UGC::RemoveItemFromFavorites\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 @@ -1153,7 +1153,7 @@ SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPubli STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t ) SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) { - PRINT_DEBUG("Steam_UGC::SubscribeItem %llu\n", nPublishedFileID); + PRINT_DEBUG("%llu", nPublishedFileID); std::lock_guard lock(global_mutex); RemoteStorageSubscribePublishedFileResult_t data; @@ -1171,7 +1171,7 @@ SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t ) SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID ) { - PRINT_DEBUG("Steam_UGC::UnsubscribeItem %llu\n", nPublishedFileID); + PRINT_DEBUG("%llu", nPublishedFileID); std::lock_guard lock(global_mutex); RemoteStorageUnsubscribePublishedFileResult_t data; @@ -1189,17 +1189,17 @@ SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID ) uint32 GetNumSubscribedItems() { - PRINT_DEBUG("Steam_UGC::GetNumSubscribedItems\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard 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(); } // number of subscribed items 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 lock(global_mutex); if ((size_t)cMaxEntries > 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 uint32 GetItemState( PublishedFileId_t nPublishedFileID ) { - PRINT_DEBUG("Steam_UGC::GetItemState %llu\n", nPublishedFileID); + PRINT_DEBUG("%llu", nPublishedFileID); std::lock_guard lock(global_mutex); if (ugc_bridge->has_subbed_mod(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; } - PRINT_DEBUG(" mod is subscribed\n"); + PRINT_DEBUG(" mod is subscribed"); return k_EItemStateSubscribed; } - PRINT_DEBUG(" mod isn't found\n"); + PRINT_DEBUG(" mod isn't found"); 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) 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 lock(global_mutex); if (!cchFolderSize) 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 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; } @@ -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 memset(pchFolder, 0, cchFolderSize); mod.path.copy(pchFolder, cchFolderSize - 1); - PRINT_DEBUG(" copied mod path: '%s'\n", pchFolder); + PRINT_DEBUG(" copied mod path: '%s'", pchFolder); } 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 bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) { - PRINT_DEBUG("Steam_UGC::GetItemDownloadInfo %llu\n", nPublishedFileID); + PRINT_DEBUG("%llu", nPublishedFileID); std::lock_guard lock(global_mutex); 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 { - PRINT_DEBUG("Steam_UGC::GetItemInstallInfo old\n"); + PRINT_DEBUG("old"); return GetItemInstallInfo(nPublishedFileID, punSizeOnDisk, pchFolder, cchFolderSize, (uint32*) nullptr); } 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 lock(global_mutex); bool res = GetItemDownloadInfo(nPublishedFileID, punBytesDownloaded, punBytesTotal); 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 { - PRINT_DEBUG("Steam_UGC::GetItemInstallInfo older\n"); + PRINT_DEBUG("older"); 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. bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority ) { - PRINT_DEBUG("Steam_UGC::DownloadItem\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFolder ) { - PRINT_DEBUG("Steam_UGC::BInitWorkshopForGameServer\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 void SuspendDownloads( bool bSuspend ) { - PRINT_DEBUG("Steam_UGC::SuspendDownloads\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); } @@ -1334,7 +1334,7 @@ void SuspendDownloads( bool bSuspend ) STEAM_CALL_RESULT( StartPlaytimeTrackingResult_t ) SteamAPICall_t StartPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) { - PRINT_DEBUG("Steam_UGC::StartPlaytimeTracking\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); StopPlaytimeTrackingResult_t data; data.m_eResult = k_EResultOK; @@ -1344,7 +1344,7 @@ SteamAPICall_t StartPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, ui STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t ) SteamAPICall_t StopPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) { - PRINT_DEBUG("Steam_UGC::StopPlaytimeTracking\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); StopPlaytimeTrackingResult_t data; data.m_eResult = k_EResultOK; @@ -1354,7 +1354,7 @@ SteamAPICall_t StopPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uin STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t ) SteamAPICall_t StopPlaytimeTrackingForAllItems() { - PRINT_DEBUG("Steam_UGC::StopPlaytimeTrackingForAllItems\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); StopPlaytimeTrackingResult_t data; data.m_eResult = k_EResultOK; @@ -1366,7 +1366,7 @@ SteamAPICall_t StopPlaytimeTrackingForAllItems() STEAM_CALL_RESULT( AddUGCDependencyResult_t ) SteamAPICall_t AddDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) { - PRINT_DEBUG("Steam_UGC::AddDependency\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (nParentPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid; @@ -1377,7 +1377,7 @@ SteamAPICall_t AddDependency( PublishedFileId_t nParentPublishedFileID, Publishe STEAM_CALL_RESULT( RemoveUGCDependencyResult_t ) SteamAPICall_t RemoveDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) { - PRINT_DEBUG("Steam_UGC::RemoveDependency\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (nParentPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid; @@ -1390,7 +1390,7 @@ SteamAPICall_t RemoveDependency( PublishedFileId_t nParentPublishedFileID, Publi STEAM_CALL_RESULT( AddAppDependencyResult_t ) SteamAPICall_t AddAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) { - PRINT_DEBUG("Steam_UGC::AddAppDependency\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 ) SteamAPICall_t RemoveAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) { - PRINT_DEBUG("Steam_UGC::RemoveAppDependency\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (nPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid; @@ -1414,7 +1414,7 @@ SteamAPICall_t RemoveAppDependency( PublishedFileId_t nPublishedFileID, AppId_t STEAM_CALL_RESULT( GetAppDependenciesResult_t ) SteamAPICall_t GetAppDependencies( PublishedFileId_t nPublishedFileID ) { - PRINT_DEBUG("Steam_UGC::GetAppDependencies\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (nPublishedFileID == k_PublishedFileIdInvalid) return k_uAPICallInvalid; @@ -1427,7 +1427,7 @@ SteamAPICall_t GetAppDependencies( PublishedFileId_t nPublishedFileID ) STEAM_CALL_RESULT( DeleteItemResult_t ) SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) { - PRINT_DEBUG("Steam_UGC::DeleteItem\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 bool ShowWorkshopEULA() { - PRINT_DEBUG("ShowWorkshopEULA\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; @@ -1448,7 +1448,7 @@ bool ShowWorkshopEULA() STEAM_CALL_RESULT( WorkshopEULAStatus_t ) SteamAPICall_t GetWorkshopEULAStatus() { - PRINT_DEBUG("GetWorkshopEULAStatus\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_uAPICallInvalid; @@ -1457,7 +1457,7 @@ SteamAPICall_t GetWorkshopEULAStatus() // Return the user's community content descriptor preferences uint32 GetUserContentDescriptorPreferences( EUGCContentDescriptorID *pvecDescriptors, uint32 cMaxEntries ) { - PRINT_DEBUG("GetWorkshopEULAStatus\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return 0; diff --git a/dll/dll/steam_unified_messages.h b/dll/dll/steam_unified_messages.h index 35debbeb..f7672d2b 100644 --- a/dll/dll/steam_unified_messages.h +++ b/dll/dll/steam_unified_messages.h @@ -29,7 +29,7 @@ public ISteamUnifiedMessages public: 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_steamunifiedmessages->Callback(msg); @@ -37,7 +37,7 @@ static void steam_callback(void *object, Common_Message *msg) 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_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). 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 lock(global_mutex); 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. bool GetMethodResponseInfo( ClientUnifiedMessageHandle hHandle, uint32 *punResponseSize, EResult *peResult ) { - PRINT_DEBUG("Steam_Unified_Messages::GetMethodResponseInfo\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); 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). bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle, void *pResponseBuffer, uint32 unResponseBufferSize, bool bAutoRelease ) { - PRINT_DEBUG("Steam_Unified_Messages::GetMethodResponseData\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -89,7 +92,8 @@ bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle, void *pResponseB // Releases the message and its corresponding allocated memory. bool ReleaseMethod( ClientUnifiedMessageHandle hHandle ) { - PRINT_DEBUG("Steam_Unified_Messages::ReleaseMethod\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -98,7 +102,8 @@ bool ReleaseMethod( ClientUnifiedMessageHandle hHandle ) // Returns true if the notification was sent successfully. bool SendNotification( const char *pchServiceNotification, const void *pNotificationBuffer, uint32 unNotificationBufferSize ) { - PRINT_DEBUG("Steam_Unified_Messages::SendNotification\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } diff --git a/dll/dll/steam_user.h b/dll/dll/steam_user.h index 4e4bc1ad..bf0cd769 100644 --- a/dll/dll/steam_user.h +++ b/dll/dll/steam_user.h @@ -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 HSteamUser GetHSteamUser() { - PRINT_DEBUG("Steam_User::GetHSteamUser\n"); + PRINT_DEBUG_ENTRY(); return CLIENT_HSTEAMUSER; } @@ -77,7 +77,7 @@ HSteamUser GetHSteamUser() // The Steam client will automatically be trying to recreate the connection as often as possible. bool BLoggedOn() { - PRINT_DEBUG("Steam_User::BLoggedOn\n"); + PRINT_DEBUG_ENTRY(); 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 CSteamID GetSteamID() { - PRINT_DEBUG("Steam_User::GetSteamID\n"); + PRINT_DEBUG_ENTRY(); CSteamID id = settings->get_local_steam_id(); return id; @@ -112,7 +112,7 @@ CSteamID GetSteamID() 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 lock(global_mutex); if (cbMaxAuthBlob < INITIATE_GAME_CONNECTION_TICKET_SIZE) 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 ) { - PRINT_DEBUG("InitiateGameConnection old\n"); + PRINT_DEBUG_ENTRY(); 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 void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer ) { - PRINT_DEBUG("Steam_User::TerminateGameConnection\n"); + PRINT_DEBUG_TODO(); } // Legacy functions @@ -139,19 +139,19 @@ void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer ) // used by only a few games to track usage events void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo) { - PRINT_DEBUG("Steam_User::TrackAppUsageEvent\n"); + PRINT_DEBUG_TODO(); } 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. // this will usually be something like "C:\Progam Files\Steam\userdata\\\local" bool GetUserDataFolder( char *pchBuffer, int cubBuffer ) { - PRINT_DEBUG("Steam_User::GetUserDataFolder\n"); + PRINT_DEBUG_ENTRY(); if (!cubBuffer) return false; 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 void StartVoiceRecording( ) { - PRINT_DEBUG("Steam_User::StartVoiceRecording\n"); + PRINT_DEBUG_ENTRY(); last_get_voice = std::chrono::high_resolution_clock::now(); recording = true; //TODO:fix @@ -175,7 +175,7 @@ void StartVoiceRecording( ) // k_eVoiceResultNotRecording void StopVoiceRecording( ) { - PRINT_DEBUG("Steam_User::StopVoiceRecording\n"); + PRINT_DEBUG_ENTRY(); recording = false; } @@ -185,7 +185,7 @@ void StopVoiceRecording( ) // below for further explanation of "uncompressed" data. EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed_Deprecated, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated ) { - PRINT_DEBUG("Steam_User::GetAvailableVoice\n"); + PRINT_DEBUG_ENTRY(); if (pcbCompressed) *pcbCompressed = 0; if (pcbUncompressed_Deprecated) *pcbUncompressed_Deprecated = 0; if (!recording) return k_EVoiceResultNotRecording; @@ -198,7 +198,7 @@ EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed_D EVoiceResult GetAvailableVoice(uint32 *pcbCompressed, uint32 *pcbUncompressed) { - PRINT_DEBUG("GetAvailableVoice old\n"); + PRINT_DEBUG("old"); return GetAvailableVoice(pcbCompressed, pcbUncompressed, 11025); } @@ -225,7 +225,7 @@ EVoiceResult GetAvailableVoice(uint32 *pcbCompressed, uint32 *pcbUncompressed) // 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 ) { - PRINT_DEBUG("Steam_User::GetVoice\n"); + PRINT_DEBUG_ENTRY(); if (!recording) return k_EVoiceResultNotRecording; double seconds = std::chrono::duration_cast>(std::chrono::high_resolution_clock::now() - last_get_voice).count(); if (bWantCompressed) { @@ -236,7 +236,7 @@ EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBuf } if (bWantUncompressed_Deprecated) { - PRINT_DEBUG("Steam_User::GetVoice Wanted Uncompressed\n"); + PRINT_DEBUG("Wanted Uncompressed"); } 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 ) { - PRINT_DEBUG("GetVoice old\n"); + PRINT_DEBUG("old"); return GetVoice(bWantCompressed, pDestBuffer, cbDestBufferSize, nBytesWritten, bWantUncompressed, pUncompressedDestBuffer, cbUncompressedDestBufferSize, nUncompressBytesWritten, 11025); } 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); } @@ -263,7 +263,7 @@ EVoiceResult GetCompressedVoice( void *pDestBuffer, uint32 cbDestBufferSize, uin // 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 ) { - PRINT_DEBUG("Steam_User::DecompressVoice\n"); + PRINT_DEBUG_ENTRY(); if (!recording) return k_EVoiceResultNotRecording; uint32 uncompressed = (double)cbCompressed * ((double)nDesiredSampleRate / 8192.0); 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 ) { - PRINT_DEBUG("DecompressVoice old\n"); + PRINT_DEBUG("old"); return DecompressVoice(pCompressed, cbCompressed, pDestBuffer, cbDestBufferSize, nBytesWritten, 11025); } 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); } @@ -294,7 +294,7 @@ EVoiceResult DecompressVoice( void *pCompressed, uint32 cbCompressed, void *pDes // which is usually 48000 or 44100. uint32 GetVoiceOptimalSampleRate() { - PRINT_DEBUG("Steam_User::GetVoiceOptimalSampleRate\n"); + PRINT_DEBUG_ENTRY(); 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 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 lock(global_mutex); 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 HAuthTicket GetAuthTicketForWebApi( const char *pchIdentity ) { - PRINT_DEBUG("Steam_User::GetAuthTicketForWebApi %s\n", pchIdentity); + PRINT_DEBUG("%s", pchIdentity); std::lock_guard lock(global_mutex); 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 ) 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 lock(global_mutex); 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 void EndAuthSession( CSteamID steamID ) { - PRINT_DEBUG("Steam_User::EndAuthSession\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 void CancelAuthTicket( HAuthTicket hAuthTicket ) { - PRINT_DEBUG("Steam_User::CancelAuthTicket\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) { - PRINT_DEBUG("Steam_User::UserHasLicenseForApp\n"); + PRINT_DEBUG_ENTRY(); 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. bool BIsBehindNAT() { - PRINT_DEBUG("Steam_User::BIsBehindNAT\n"); + PRINT_DEBUG_ENTRY(); return false; } @@ -377,7 +377,7 @@ bool BIsBehindNAT() // uint32 unIPServer, uint16 usPortServer - the IP address of the game server void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer ) { - PRINT_DEBUG("Steam_User::AdvertiseGame\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); Gameserver *server = new Gameserver(); server->set_id(steamIDGameServer.ConvertToUint64()); @@ -403,7 +403,7 @@ void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPort STEAM_CALL_RESULT( EncryptedAppTicketResponse_t ) SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude ) { - PRINT_DEBUG("Steam_User::RequestEncryptedAppTicket %i\n", cbDataToInclude); + PRINT_DEBUG("%i", cbDataToInclude); std::lock_guard lock(global_mutex); EncryptedAppTicketResponse_t data; data.m_eResult = k_EResultOK; @@ -452,7 +452,7 @@ SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToIncl // retrieve a finished ticket 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(); if (!cbMaxTicket) { 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) int GetGameBadgeLevel( int nSeries, bool bFoil ) { - PRINT_DEBUG("Steam_User::GetGameBadgeLevel\n"); + PRINT_DEBUG_ENTRY(); return 0; } // gets the Steam Level of the user, as shown on their profile int GetPlayerSteamLevel() { - PRINT_DEBUG("Steam_User::GetPlayerSteamLevel\n"); + PRINT_DEBUG_ENTRY(); return 100; } @@ -497,42 +497,42 @@ int GetPlayerSteamLevel() STEAM_CALL_RESULT( StoreAuthURLResponse_t ) SteamAPICall_t RequestStoreAuthURL( const char *pchRedirectURL ) { - PRINT_DEBUG("Steam_User::RequestStoreAuthURL\n"); + PRINT_DEBUG_ENTRY(); return 0; } // gets whether the users phone number is verified bool BIsPhoneVerified() { - PRINT_DEBUG("Steam_User::BIsPhoneVerified\n"); + PRINT_DEBUG_ENTRY(); return true; } // gets whether the user has two factor enabled on their account bool BIsTwoFactorEnabled() { - PRINT_DEBUG("Steam_User::BIsTwoFactorEnabled\n"); + PRINT_DEBUG_ENTRY(); return true; } // gets whether the users phone number is identifying bool BIsPhoneIdentifying() { - PRINT_DEBUG("Steam_User::BIsPhoneIdentifying\n"); + PRINT_DEBUG_ENTRY(); return false; } // gets whether the users phone number is awaiting (re)verification bool BIsPhoneRequiringVerification() { - PRINT_DEBUG("Steam_User::BIsPhoneRequiringVerification\n"); + PRINT_DEBUG_ENTRY(); return false; } STEAM_CALL_RESULT( MarketEligibilityResponse_t ) SteamAPICall_t GetMarketEligibility() { - PRINT_DEBUG("Steam_User::GetMarketEligibility\n"); + PRINT_DEBUG_ENTRY(); return 0; } @@ -540,7 +540,7 @@ SteamAPICall_t GetMarketEligibility() STEAM_CALL_RESULT( DurationControl_t ) SteamAPICall_t GetDurationControl() { - PRINT_DEBUG("Steam_User::GetDurationControl\n"); + PRINT_DEBUG_ENTRY(); return 0; } @@ -549,7 +549,7 @@ SteamAPICall_t GetDurationControl() // playtime limits. bool BSetDurationControlOnlineState( EDurationControlOnlineState eNewState ) { - PRINT_DEBUG("Steam_User::BSetDurationControlOnlineState\n"); + PRINT_DEBUG_ENTRY(); return false; } diff --git a/dll/local_storage.cpp b/dll/local_storage.cpp index ed5eaa0b..8c593fdd 100644 --- a/dll/local_storage.cpp +++ b/dll/local_storage.cpp @@ -734,7 +734,7 @@ bool Local_Storage::update_save_filenames(std::string folder) for (auto &f : files) { 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)); if (path != to && !file_exists(folder, to)) { //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); 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) { - 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)); // If there is a file and we opened it - if (inventory_file) - { + if (inventory_file) { inventory_file.seekg(0, std::ios::end); size_t size = inventory_file.tellg(); std::string buffer(size, '\0'); @@ -770,15 +769,13 @@ bool Local_Storage::load_json(std::string full_path, nlohmann::json& json) try { 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; } 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 - { - PRINT_DEBUG("Couldn't open file \"%s\" to read json\n", full_path.c_str()); + } else { + PRINT_DEBUG("Couldn't open file '%s' to read json", full_path.c_str()); } reset_LastError(); @@ -807,13 +804,12 @@ bool Local_Storage::write_json_file(std::string folder, std::string const&file, create_directory(inv_path); 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; 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(); return false; @@ -845,7 +841,7 @@ std::string Local_Storage::load_image_resized(std::string const& image_path, std int width = 0; int height = 0; 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) { std::vector out_resized(resized_img_size); stbir_resize_uint8(img, width, height, 0, (unsigned char*)&out_resized[0], resolution, resolution, 0, 4); diff --git a/dll/network.cpp b/dll/network.cpp index 04fe0a99..ed71c57e 100644 --- a/dll/network.cpp +++ b/dll/network.cpp @@ -251,7 +251,7 @@ static void run_at_startup() #if defined(STEAM_WIN32) WSADATA wsaData; if (WSAStartup(MAKEWORD(2, 2), &wsaData) != NO_ERROR) { - PRINT_DEBUG("Networking WSAStartup error\n"); + PRINT_DEBUG("Networking WSAStartup error"); 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) { - 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; size_t addrsize = 0; 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; 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); std::vector 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) { @@ -353,12 +353,11 @@ static bool send_broadcasts(sock_t sock, uint16 port, char *data, unsigned long * Sends to custom IPs the broadcast packet * 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) { send_packet_to(sock, addr, data, length); } - - PRINT_DEBUG("end custom broadcasts\n"); + PRINT_DEBUG("end custom broadcasts"); 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); return true; } 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); } @@ -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)) { kill_tcp_socket(socket); - PRINT_DEBUG("TCP SOCKET HEARTBEAT TIMEOUT\n"); + PRINT_DEBUG("TCP SOCKET HEARTBEAT TIMEOUT"); } } @@ -517,7 +516,7 @@ std::set Networking::resolve_ip(std::string dns) if (getaddrinfo(dns.c_str(), NULL, NULL, &result) == 0) { 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 - 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) { struct sockaddr_in *ipv4 = (struct sockaddr_in *)res->ai_addr; uint32 ip; @@ -536,62 +535,62 @@ std::set Networking::resolve_ip(std::string dns) void Networking::do_callbacks_message(Common_Message *msg) { if (msg->has_network() || msg->has_network_old()) { - PRINT_DEBUG("Networking has_network\n"); + PRINT_DEBUG("has_network"); run_callbacks(CALLBACK_ID_NETWORKING, msg); } if (msg->has_lobby()) { - PRINT_DEBUG("Networking has_lobby\n"); + PRINT_DEBUG("has_lobby"); run_callbacks(CALLBACK_ID_LOBBY, msg); } if (msg->has_lobby_messages()) { - PRINT_DEBUG("Networking has_lobby_messages\n"); + PRINT_DEBUG("has_lobby_messages"); run_callbacks(CALLBACK_ID_LOBBY, msg); } if (msg->has_gameserver()) { - PRINT_DEBUG("Networking has_gameserver\n"); + PRINT_DEBUG("has_gameserver"); run_callbacks(CALLBACK_ID_GAMESERVER, msg); } if (msg->has_friend_()) { - PRINT_DEBUG("Networking has_friend_\n"); + PRINT_DEBUG("has_friend_"); run_callbacks(CALLBACK_ID_FRIEND, msg); } if (msg->has_auth_ticket()) { - PRINT_DEBUG("Networking has_auth_ticket\n"); + PRINT_DEBUG("has_auth_ticket"); run_callbacks(CALLBACK_ID_AUTH_TICKET, msg); } if (msg->has_friend_messages()) { - PRINT_DEBUG("Networking has_friend_messages\n"); + PRINT_DEBUG("has_friend_messages"); run_callbacks(CALLBACK_ID_FRIEND_MESSAGES, msg); } if (msg->has_networking_sockets()) { - PRINT_DEBUG("Networking has_networking_sockets\n"); + PRINT_DEBUG("has_networking_sockets"); run_callbacks(CALLBACK_ID_NETWORKING_SOCKETS, msg); } if (msg->has_steam_messages()) { - PRINT_DEBUG("Networking has_steam_messages\n"); + PRINT_DEBUG("has_steam_messages"); run_callbacks(CALLBACK_ID_STEAM_MESSAGES, msg); } if (msg->has_networking_messages()) { - PRINT_DEBUG("Networking has_networking_messages\n"); + PRINT_DEBUG("has_networking_messages"); run_callbacks(CALLBACK_ID_NETWORKING_MESSAGES, msg); } 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); } if (msg->has_leaderboards_messages()) { - PRINT_DEBUG("Networking has_leaderboards_messages\n"); + PRINT_DEBUG("has_leaderboards_messages"); 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()) 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); if (connection->connected) { 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.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); 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()) { conn = new_connection((uint64)msg->source_id(), msg->announce().appid()); if (!conn) return false; - PRINT_DEBUG( - "Networking::handle_announce new connection created: user %llu, appid %u\n", - (uint64)msg->source_id(), msg->announce().appid() - ); + PRINT_DEBUG("new connection created: user %llu, appid %u", (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.port = htons(msg->announce().tcp_port()); 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()); - 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()) { Common_Message msg_ = create_announce(true); @@ -781,7 +777,7 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set run_at_startup(); 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)) { int broadcast = 1; setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&broadcast, sizeof(broadcast)); @@ -791,7 +787,7 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set for (unsigned i = 0; i < 1000; ++i) { udp_port = port + i; if (bind_socket(sock, udp_port)) { - PRINT_DEBUG("UDP successful\n"); + PRINT_DEBUG("UDP successful"); udp_socket = sock; break; } else { @@ -803,14 +799,14 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set } if (!is_socket_valid(udp_socket)) { - PRINT_DEBUG("UDP: could not bind socket\n"); + PRINT_DEBUG("UDP: could not bind socket"); } } 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); - PRINT_DEBUG("TCP socket: %u\n", sock); + PRINT_DEBUG("TCP socket: %u", sock); if (is_socket_valid(sock) && set_socket_nonblocking(sock)) { buffers_set(sock); //socket_reuseaddr(sock); @@ -819,14 +815,14 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set tcp_port = port + i; if (bind_socket(sock, tcp_port)) { if ((listen(sock, NUM_TCP_WAITING) == 0)) { - PRINT_DEBUG("TCP successful\n"); + PRINT_DEBUG("TCP successful"); tcp_socket = sock; break; } else { int error = 0; socklen_t len = sizeof(error); 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 { int error = 0; @@ -836,24 +832,24 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set } if (!is_socket_valid(udp_socket)) { - PRINT_DEBUG("TCP: could not bind or listen\n"); + PRINT_DEBUG("TCP: could not bind or listen"); } } 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) { - PRINT_DEBUG("CURL successful\n"); + PRINT_DEBUG("CURL successful"); } 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)) { - 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; } - PRINT_DEBUG("Networking::Networking ADDED ID %llu\n", (uint64)id.ConvertToUint64()); + PRINT_DEBUG("ADDED ID %llu", (uint64)id.ConvertToUint64()); ids.push_back(id); reset_last_error(); @@ -879,13 +875,13 @@ Networking::~Networking() Common_Message Networking::create_announce(bool request) { Announce *announce = new Announce(); - PRINT_DEBUG("Networking:: ids length %zu\n", ids.size()); + PRINT_DEBUG("ids length %zu", ids.size()); if (request) { announce->set_type(Announce::PING); } else { announce->set_type(Announce::PONG); 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) { Announce_Other_Peers *peer = announce->add_peers(); peer->set_id(conn.ids[0].ConvertToUint64()); @@ -910,16 +906,15 @@ void Networking::send_announce_broadcasts() Common_Message msg = create_announce(true); size_t size = msg.ByteSizeLong(); - char *buffer = new char[size]; - msg.SerializeToArray(buffer, size); - send_broadcasts(udp_socket, htons(DEFAULT_PORT), buffer, size, &this->custom_broadcasts); + std::vector buffer(size); + msg.SerializeToArray(&buffer[0], size); + send_broadcasts(udp_socket, htons(DEFAULT_PORT), &buffer[0], size, &this->custom_broadcasts); 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(); - PRINT_DEBUG("Networking:: sent broadcasts\n"); + PRINT_DEBUG("sent broadcasts"); } void Networking::Run() @@ -932,8 +927,8 @@ void Networking::Run() return; } - //PRINT_DEBUG("Networking::Run() %lf\n", time_extra); - // PRINT_DEBUG("Networking::Run()\n"); + //PRINT_DEBUG("%lf", time_extra); + // PRINT_DEBUG_ENTRY(); if (check_timedout(last_broadcast, BROADCAST_INTERVAL)) { send_announce_broadcasts(); } @@ -943,38 +938,35 @@ void Networking::Run() int len; 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(); sockaddr_in addr; addr.sin_family = AF_INET; 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)); 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_port = htons(ip_port.port); 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) { - 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; if (msg.ParseFromArray(data, len)) { if (msg.source_id()) { if (msg.has_announce()) { handle_announce(&msg, ip_port); - } else - - if (msg.has_low_level()) { + } else if (msg.has_low_level()) { handle_low_level_udp(&msg, ip_port); - } else - - { + } else { msg.set_source_ip(ntohl(ip_port.ip)); msg.set_source_port(ntohs(ip_port.port)); 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 local_send_copy = local_send; local_send.clear(); @@ -1000,9 +992,9 @@ void Networking::Run() socklen_t addrlen = sizeof(addr); #endif sock_t sock; - PRINT_DEBUG("ACCEPTING\n"); + PRINT_DEBUG("ACCEPTING"); 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; #if defined(STEAM_WIN32) int addrlen = sizeof(addr); @@ -1014,17 +1006,17 @@ void Networking::Run() ip_port.port = addr_in->sin_port; struct TCP_Socket socket; if (set_socket_nonblocking(sock)) { - PRINT_DEBUG("SET NONBLOCK\n"); + PRINT_DEBUG("SET NONBLOCK"); disable_nagle(sock); socket.sock = sock; socket.received_data = true; socket.last_heartbeat_received = std::chrono::high_resolution_clock::now(); 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); while (conn != std::end(accepted)) { bool deleted = false; @@ -1038,7 +1030,7 @@ void Networking::Run() connection->tcp_socket_incoming = *conn; conn = accepted.erase(conn); deleted = true; - PRINT_DEBUG("TCP REPLACED\n"); + PRINT_DEBUG("TCP REPLACED"); //TODO: add other ids? } else { //Don't allow connection from unknown @@ -1046,7 +1038,7 @@ void Networking::Run() kill_tcp_socket(*conn); conn = accepted.erase(conn); deleted = true; - PRINT_DEBUG("TCP UNKNOWN\n"); + PRINT_DEBUG("TCP UNKNOWN"); } } } @@ -1055,7 +1047,7 @@ void Networking::Run() kill_tcp_socket(*conn); conn = accepted.erase(conn); deleted = true; - PRINT_DEBUG("TCP TIMEOUT\n"); + PRINT_DEBUG("TCP TIMEOUT"); } 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) { if (!is_tcp_socket_valid(conn.tcp_socket_outgoing)) { sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); 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); connect_socket(sock, conn.tcp_ip_port); 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_incoming); @@ -1095,7 +1087,7 @@ void Networking::Run() if (i != c.ids.end()) { c.ids.erase(i); 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_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; 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 handle_tcp(&msg, conn.tcp_socket_outgoing); conn.last_received = std::chrono::high_resolution_clock::now(); } 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 handle_tcp(&msg, conn.tcp_socket_incoming); 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_incoming, time_extra); @@ -1141,7 +1133,7 @@ void Networking::Run() kill_tcp_socket(conn->tcp_socket_outgoing); kill_tcp_socket(conn->tcp_socket_incoming); conn = connections.erase(conn); - PRINT_DEBUG("USER TIMEOUT\n"); + PRINT_DEBUG("USER TIMEOUT"); } else { ++conn; } @@ -1166,7 +1158,7 @@ void Networking::addListenId(CSteamID id) return; } - PRINT_DEBUG("Networking::addListenId ADDED ID %llu\n", (uint64)id.ConvertToUint64()); + PRINT_DEBUG("ADDED ID %llu", (uint64)id.ConvertToUint64()); ids.push_back(id); send_announce_broadcasts(); return; @@ -1181,7 +1173,7 @@ bool Networking::sendToIPPort(Common_Message *msg, uint32 ip, uint16 port, bool { bool is_local_ip = ((ip >> 24) == 0x7F); 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 for (auto &conn: connections) { 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; CSteamID dest_id((uint64)msg->dest_id()); 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) { - PRINT_DEBUG("Networking local send\n"); + PRINT_DEBUG("local send"); local_send.push_back(*msg); ret = true; } @@ -1363,7 +1355,7 @@ void Networking::startQuery(IP_PORT ip_port) { if (ip_port.port == MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE) { - PRINT_DEBUG("Source Query in Shared Mode\n"); + PRINT_DEBUG("Source Query in Shared Mode"); return; } @@ -1409,7 +1401,7 @@ void Networking::startQuery(IP_PORT ip_port) char 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; } diff --git a/dll/source_query.cpp b/dll/source_query.cpp index bfea1c0d..a2448272 100644 --- a/dll/source_query.cpp +++ b/dll/source_query.cpp @@ -157,7 +157,7 @@ std::vector Source_Query::handle_source_query(const void* buffer, size_ switch (query.header) { 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)) { std::vector> const& players = *get_steam_client()->steam_gameserver->get_players(); @@ -213,7 +213,7 @@ std::vector Source_Query::handle_source_query(const void* buffer, size_ break; 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 (query.challenge == 0xFFFFFFFFul) @@ -241,7 +241,7 @@ std::vector Source_Query::handle_source_query(const void* buffer, size_ break; 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 (query.challenge == 0xFFFFFFFFul) @@ -266,7 +266,7 @@ std::vector Source_Query::handle_source_query(const void* buffer, size_ break; default: - PRINT_DEBUG("Source_Query::handle_source_query got unknown request\n"); + PRINT_DEBUG("got unknown request"); break; } return output_buffer; diff --git a/dll/steam_applist.cpp b/dll/steam_applist.cpp index 5ba9a39b..22e0fca4 100644 --- a/dll/steam_applist.cpp +++ b/dll/steam_applist.cpp @@ -19,33 +19,33 @@ uint32 Steam_Applist::GetNumInstalledApps() { - PRINT_DEBUG("TODO Steam_Applist::GetNumInstalledApps\n"); + PRINT_DEBUG_TODO(); return 0; } uint32 Steam_Applist::GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs ) { - PRINT_DEBUG("TODO Steam_Applist::GetInstalledApps\n"); + PRINT_DEBUG_TODO(); return 0; } // returns -1 if no name was found 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; } // returns -1 if no dir was found int Steam_Applist::GetAppInstallDir( AppId_t nAppID, char *pchDirectory, int cchNameMax ) { - PRINT_DEBUG("TODO Steam_Applist::GetAppInstallDir\n"); + PRINT_DEBUG_TODO(); return -1; } // 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 ) { - PRINT_DEBUG("TODO Steam_Applist::GetAppBuildId\n"); + PRINT_DEBUG_TODO(); return 10; } diff --git a/dll/steam_gameserver.cpp b/dll/steam_gameserver.cpp index e03219dc..ef7c1b8c 100644 --- a/dll/steam_gameserver.cpp +++ b/dll/steam_gameserver.cpp @@ -47,7 +47,7 @@ std::vector>* Steam_GameServer::ge /// 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 ) { - PRINT_DEBUG("Steam_GameServer::InitGameServer\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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); 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 { auto ver = std::stoul(version); server_data.set_version(ver); - PRINT_DEBUG("Steam_GameServer::InitGameServer set version to %lu\n", ver); + PRINT_DEBUG("set version to %lu", ver); } catch (...) { - PRINT_DEBUG("Steam_GameServer::InitGameServer: not a number: %s\n", pchVersionString); + PRINT_DEBUG("not a number: %s", pchVersionString); 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. void Steam_GameServer::SetProduct( const char *pszProduct ) { - PRINT_DEBUG("Steam_GameServer::SetProduct\n"); + PRINT_DEBUG("%s", pszProduct); std::lock_guard lock(global_mutex); // pszGameDescription should be used instead of pszProduct for accurate information // 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. void Steam_GameServer::SetGameDescription( const char *pszGameDescription ) { - PRINT_DEBUG("Steam_GameServer::SetGameDescription\n"); + PRINT_DEBUG("%s", pszGameDescription); std::lock_guard lock(global_mutex); server_data.set_game_description(pszGameDescription); //server_data.set_product(pszGameDescription); @@ -115,7 +115,7 @@ void Steam_GameServer::SetGameDescription( const char *pszGameDescription ) /// @see k_cbMaxGameServerGameDir void Steam_GameServer::SetModDir( const char *pszModDir ) { - PRINT_DEBUG("Steam_GameServer::SetModDir\n"); + PRINT_DEBUG("%s", pszModDir); std::lock_guard lock(global_mutex); 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. void Steam_GameServer::SetDedicatedServer( bool bDedicated ) { - PRINT_DEBUG("Steam_GameServer::SetDedicatedServer\n"); + PRINT_DEBUG("%i", bDedicated); std::lock_guard lock(global_mutex); server_data.set_dedicated_server(bDedicated); } @@ -142,7 +142,7 @@ void Steam_GameServer::SetDedicatedServer( bool bDedicated ) /// @see SteamServersDisconnected_t void Steam_GameServer::LogOn( const char *pszToken ) { - PRINT_DEBUG("Steam_GameServer::LogOn %s\n", pszToken); + PRINT_DEBUG("%s", pszToken); std::lock_guard lock(global_mutex); call_servers_connected = true; logged_in = true; @@ -153,7 +153,7 @@ void Steam_GameServer::LogOn( const char *pszPassword ) { - PRINT_DEBUG("Steam_GameServer::LogOn %s %s\n", pszAccountName, pszPassword); + PRINT_DEBUG("%s %s", pszAccountName, pszPassword); LogOn(pszAccountName); } @@ -163,7 +163,7 @@ void Steam_GameServer::LogOn( /// but this is no longer the case. void Steam_GameServer::LogOnAnonymous() { - PRINT_DEBUG("Steam_GameServer::LogOnAnonymous\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); call_servers_connected = true; logged_in = true; @@ -171,14 +171,14 @@ void Steam_GameServer::LogOnAnonymous() void Steam_GameServer::LogOn() { - PRINT_DEBUG("Steam_GameServer::LogOn\n"); + PRINT_DEBUG_ENTRY(); LogOnAnonymous(); } /// Begin process of logging game server out of steam void Steam_GameServer::LogOff() { - PRINT_DEBUG("Steam_GameServer::LogOff\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (logged_in) { call_servers_disconnected = true; @@ -191,14 +191,14 @@ void Steam_GameServer::LogOff() // status functions bool Steam_GameServer::BLoggedOn() { - PRINT_DEBUG("Steam_GameServer::BLoggedOn\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return logged_in; } bool Steam_GameServer::BSecure() { - PRINT_DEBUG("Steam_GameServer::BSecure\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (!policy_response_called) { server_data.set_secure(0); @@ -211,7 +211,7 @@ bool Steam_GameServer::BSecure() CSteamID Steam_GameServer::GetSteamID() { - PRINT_DEBUG("Steam_GameServer::GetSteamID\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (!logged_in) return k_steamIDNil; return settings->get_local_steam_id(); @@ -222,7 +222,7 @@ CSteamID Steam_GameServer::GetSteamID() /// Only returns true once per request. bool Steam_GameServer::WasRestartRequested() { - PRINT_DEBUG("Steam_GameServer::WasRestartRequested\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; } @@ -235,7 +235,7 @@ bool Steam_GameServer::WasRestartRequested() /// Max player count that will be reported to server browser and client queries void Steam_GameServer::SetMaxPlayerCount( int cPlayersMax ) { - PRINT_DEBUG("Steam_GameServer::SetMaxPlayerCount\n"); + PRINT_DEBUG("%i", cPlayersMax); std::lock_guard lock(global_mutex); server_data.set_max_player_count(cPlayersMax); } @@ -244,7 +244,7 @@ void Steam_GameServer::SetMaxPlayerCount( int cPlayersMax ) /// Number of bots. Default value is zero void Steam_GameServer::SetBotPlayerCount( int cBotplayers ) { - PRINT_DEBUG("Steam_GameServer::SetBotPlayerCount\n"); + PRINT_DEBUG("%i", cBotplayers); std::lock_guard lock(global_mutex); server_data.set_bot_player_count(cBotplayers); } @@ -255,7 +255,7 @@ void Steam_GameServer::SetBotPlayerCount( int cBotplayers ) /// @see k_cbMaxGameServerName void Steam_GameServer::SetServerName( const char *pszServerName ) { - PRINT_DEBUG("Steam_GameServer::SetServerName\n"); + PRINT_DEBUG("%s", pszServerName); std::lock_guard lock(global_mutex); server_data.set_server_name(pszServerName); } @@ -266,7 +266,7 @@ void Steam_GameServer::SetServerName( const char *pszServerName ) /// @see k_cbMaxGameServerName void Steam_GameServer::SetMapName( const char *pszMapName ) { - PRINT_DEBUG("Steam_GameServer::SetMapName\n"); + PRINT_DEBUG("%s", pszMapName); std::lock_guard lock(global_mutex); 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 void Steam_GameServer::SetPasswordProtected( bool bPasswordProtected ) { - PRINT_DEBUG("Steam_GameServer::SetPasswordProtected\n"); + PRINT_DEBUG("%i", bPasswordProtected); std::lock_guard lock(global_mutex); server_data.set_password_protected(bPasswordProtected); } @@ -285,7 +285,7 @@ void Steam_GameServer::SetPasswordProtected( bool bPasswordProtected ) /// is not used. void Steam_GameServer::SetSpectatorPort( uint16 unSpectatorPort ) { - PRINT_DEBUG("Steam_GameServer::SetSpectatorPort\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); server_data.set_spectator_port(unSpectatorPort); } @@ -296,7 +296,7 @@ void Steam_GameServer::SetSpectatorPort( uint16 unSpectatorPort ) /// @see k_cbMaxGameServerMapName void Steam_GameServer::SetSpectatorServerName( const char *pszSpectatorServerName ) { - PRINT_DEBUG("Steam_GameServer::SetSpectatorServerName\n"); + PRINT_DEBUG("%s", pszSpectatorServerName); std::lock_guard lock(global_mutex); 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. void Steam_GameServer::ClearAllKeyValues() { - PRINT_DEBUG("Steam_GameServer::ClearAllKeyValues\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); server_data.clear_values(); } @@ -314,7 +314,7 @@ void Steam_GameServer::ClearAllKeyValues() /// Call this to add/update a key/value pair. 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 lock(global_mutex); (*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 void Steam_GameServer::SetGameTags( const char *pchGameTags ) { - PRINT_DEBUG("Steam_GameServer::SetGameTags\n"); + PRINT_DEBUG("%s", pchGameTags); std::lock_guard lock(global_mutex); server_data.set_tags(pchGameTags); } @@ -340,7 +340,7 @@ void Steam_GameServer::SetGameTags( const char *pchGameTags ) /// @see k_cbMaxGameServerGameData void Steam_GameServer::SetGameData( const char *pchGameData ) { - PRINT_DEBUG("Steam_GameServer::SetGameData\n"); + PRINT_DEBUG("%s", pchGameData); std::lock_guard lock(global_mutex); 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 void Steam_GameServer::SetRegion( const char *pszRegion ) { - PRINT_DEBUG("Steam_GameServer::SetRegion\n"); + PRINT_DEBUG("%s", pszRegion); std::lock_guard lock(global_mutex); 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) 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 lock(global_mutex); 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 ) { + PRINT_DEBUG_ENTRY(); 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. CSteamID Steam_GameServer::CreateUnauthenticatedUserConnection() { - PRINT_DEBUG("Steam_GameServer::CreateUnauthenticatedUserConnection\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. void Steam_GameServer::SendUserDisconnect( CSteamID steamIDUser ) { - PRINT_DEBUG("Steam_GameServer::SendUserDisconnect\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); auto player_it = std::find_if(players.begin(), players.end(), [&steamIDUser](std::pair& 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) 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 lock(global_mutex); auto player_it = std::find_if(players.begin(), players.end(), [&steamIDUser](std::pair& player) @@ -480,7 +481,7 @@ bool Steam_GameServer::BUpdateUserData( CSteamID steamIDUser, const char *pchPla bool Steam_GameServer::BSetServerType( uint32 unServerFlags, uint32 unGameIP, uint16 unGamePort, uint16 unSpectatorPort, uint16 usQueryPort, const char *pchGameDir, const char *pchVersion, bool bLANMode ) { - PRINT_DEBUG("Steam_GameServer::BSetServerType\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); server_data.set_ip(unGameIP); 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 *pchMapName ) { - PRINT_DEBUG("Steam_GameServer::UpdateServerStatus\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); server_data.set_num_players(cPlayers); 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). void Steam_GameServer::UpdateSpectatorPort( uint16 unSpectatorPort ) { - PRINT_DEBUG("Steam_GameServer::UpdateSpectatorPort\n"); + PRINT_DEBUG_ENTRY(); 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 void Steam_GameServer::SetGameType( const char *pchGameType ) { - PRINT_DEBUG("Steam_GameServer::SetGameType\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); } // Ask if a user has a specific achievement for this game, will get a callback on reply bool Steam_GameServer::BGetUserAchievementStatus( CSteamID steamID, const char *pchAchievementName ) { - PRINT_DEBUG("Steam_GameServer::BGetUserAchievementStatus\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return false; } @@ -548,6 +549,7 @@ bool Steam_GameServer::BGetUserAchievementStatus( CSteamID steamID, const char * // pcbTicket retrieves the length of the actual ticket. HAuthTicket Steam_GameServer::GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) { + PRINT_DEBUG_ENTRY(); 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 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 lock(global_mutex); 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 ) 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 lock(global_mutex); std::pair 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 void Steam_GameServer::EndAuthSession( CSteamID steamID ) { - PRINT_DEBUG("Steam_GameServer::EndAuthSession %llu\n", steamID.ConvertToUint64()); + PRINT_DEBUG("%llu", steamID.ConvertToUint64()); std::lock_guard lock(global_mutex); auto player_it = std::find_if(players.begin(), players.end(), [&steamID](std::pair& 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 void Steam_GameServer::CancelAuthTicket( HAuthTicket hAuthTicket ) { - PRINT_DEBUG("Steam_GameServer::CancelAuthTicket\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. EUserHasLicenseForAppResult Steam_GameServer::UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) { - PRINT_DEBUG("Steam_GameServer::UserHasLicenseForApp\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 bool Steam_GameServer::RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) { - PRINT_DEBUG("Steam_GameServer::RequestUserGroupStatus\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 void Steam_GameServer::GetGameplayStats( ) { - PRINT_DEBUG("Steam_GameServer::GetGameplayStats\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); } STEAM_CALL_RESULT( GSReputation_t ) SteamAPICall_t Steam_GameServer::GetServerReputation() { - PRINT_DEBUG("Steam_GameServer::GetServerReputation\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return 0; } @@ -655,16 +657,16 @@ SteamAPICall_t Steam_GameServer::GetServerReputation() // connect to uint32 Steam_GameServer::GetPublicIP_old() { - PRINT_DEBUG("Steam_GameServer::GetPublicIP_old\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); uint32 ip = network->getOwnIP(); - PRINT_DEBUG(" %X\n", ip); + PRINT_DEBUG(" %X", ip); return ip; } SteamIPAddress_t Steam_GameServer::GetPublicIP() { - PRINT_DEBUG("Steam_GameServer::GetPublicIP\n"); + PRINT_DEBUG_ENTRY(); SteamIPAddress_t ip = SteamIPAddress_t::IPv4Any(); ip.m_unIPv4 = GetPublicIP_old(); return ip; @@ -672,7 +674,7 @@ SteamIPAddress_t Steam_GameServer::GetPublicIP() void Steam_GameServer::GetPublicIP_fix(SteamIPAddress_t *out) { - PRINT_DEBUG("Steam_GameServer::GetPublicIP_fix\n"); + PRINT_DEBUG_ENTRY(); if (out) *out = GetPublicIP(); } @@ -693,7 +695,7 @@ void Steam_GameServer::GetPublicIP_fix(SteamIPAddress_t *out) // it's for us. 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 lock(global_mutex); 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. int Steam_GameServer::GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) { - PRINT_DEBUG("Steam_GameServer::GetNextOutgoingPacket\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (settings->disable_source_query) 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). 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 @@ -752,7 +754,7 @@ void Steam_GameServer::EnableHeartbeats( bool bActive ) /// the old name was just confusing.) void Steam_GameServer::SetAdvertiseServerActive( bool bActive ) { - PRINT_DEBUG("Steam_GameServer::SetAdvertiseServerActive\n"); + PRINT_DEBUG("%i", bActive); EnableHeartbeats(bActive); } @@ -761,24 +763,24 @@ void Steam_GameServer::SetAdvertiseServerActive( bool bActive ) // Some mods change this. void Steam_GameServer::SetHeartbeatInterval( int iHeartbeatInterval ) { - PRINT_DEBUG("Steam_GameServer::SetHeartbeatInterval\n"); + PRINT_DEBUG_TODO(); } 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 void Steam_GameServer::ForceHeartbeat() { - PRINT_DEBUG("Steam_GameServer::ForceHeartbeat\n"); + PRINT_DEBUG_TODO(); } 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 ) SteamAPICall_t Steam_GameServer::AssociateWithClan( CSteamID steamIDClan ) { - PRINT_DEBUG("Steam_GameServer::AssociateWithClan\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return 0; } @@ -796,7 +798,7 @@ SteamAPICall_t Steam_GameServer::AssociateWithClan( CSteamID steamIDClan ) STEAM_CALL_RESULT( ComputeNewPlayerCompatibilityResult_t ) SteamAPICall_t Steam_GameServer::ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer ) { - PRINT_DEBUG("Steam_GameServer::ComputeNewPlayerCompatibility\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return 0; } @@ -808,13 +810,13 @@ void Steam_GameServer::RunCallbacks() call_servers_disconnected = call_servers_connected = false; if (temp_call_servers_connected) { - PRINT_DEBUG("Steam_GameServer::SteamServersConnected_t\n"); + PRINT_DEBUG("SteamServersConnected_t"); SteamServersConnected_t data; callbacks->addCBResult(data.k_iCallback, &data, sizeof(data), 0.1); } if (logged_in && !policy_response_called) { - PRINT_DEBUG("Steam_GameServer::GSPolicyResponse_t\n"); + PRINT_DEBUG("GSPolicyResponse_t"); GSPolicyResponse_t data; data.m_bSecure = !!(flags & k_unServerFlagSecure); 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)) { - PRINT_DEBUG("Steam_GameServer Sending Gameserver\n"); + PRINT_DEBUG("Sending Gameserver"); Common_Message msg; msg.set_source_id(settings->get_local_steam_id().ConvertToUint64()); server_data.set_appid(settings->get_local_game_id().AppID()); diff --git a/dll/steam_gameserverstats.cpp b/dll/steam_gameserverstats.cpp index 3eda64d6..b94783c9 100644 --- a/dll/steam_gameserverstats.cpp +++ b/dll/steam_gameserverstats.cpp @@ -23,7 +23,7 @@ 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; 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) { - // PRINT_DEBUG("Steam_GameServerStats::steam_gameserverstats_network_callback\n"); + //PRINT_DEBUG_ENTRY(); auto inst = (Steam_GameServerStats *)object; 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) { - // PRINT_DEBUG("Steam_GameServerStats::steam_gameserverstats_run_every_runcb\n"); + //PRINT_DEBUG_ENTRY(); auto inst = (Steam_GameServerStats *)object; inst->steam_run_callback(); @@ -115,7 +115,7 @@ Steam_GameServerStats::~Steam_GameServerStats() STEAM_CALL_RESULT( GSStatsReceived_t ) 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 lock(global_mutex); if (settings->disable_sharing_stats_with_gameserver) { 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() bool Steam_GameServerStats::GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData ) { - PRINT_DEBUG("Steam_GameServerStats::GetUserStat %llu '%s' %p\n", (uint64)steamIDUser.ConvertToUint64(), pchName, pData); + PRINT_DEBUG(" %llu '%s' %p", (uint64)steamIDUser.ConvertToUint64(), pchName, pData); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_GameServerStats::GetUserStat %llu '%s' %p\n", (uint64)steamIDUser.ConvertToUint64(), pchName, pData); + PRINT_DEBUG(" %llu '%s' %p", (uint64)steamIDUser.ConvertToUint64(), pchName, pData); std::lock_guard lock(global_mutex); 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 ) { - 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 lock(global_mutex); 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 bool Steam_GameServerStats::SetUserStat( CSteamID steamIDUser, const char *pchName, int32 nData ) { - PRINT_DEBUG("Steam_GameServerStats::SetUserStat %llu '%s'=%i\n", (uint64)steamIDUser.ConvertToUint64(), pchName, nData); + PRINT_DEBUG(" %llu '%s'=%i", (uint64)steamIDUser.ConvertToUint64(), pchName, nData); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_GameServerStats::SetUserStat %llu '%s'=%f\n", (uint64)steamIDUser.ConvertToUint64(), pchName, fData); + PRINT_DEBUG(" %llu '%s'=%f", (uint64)steamIDUser.ConvertToUint64(), pchName, fData); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_GameServerStats::UpdateUserAvgRateStat %llu '%s'\n", (uint64)steamIDUser.ConvertToUint64(), pchName); + PRINT_DEBUG("%llu '%s'", (uint64)steamIDUser.ConvertToUint64(), pchName); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_GameServerStats::SetUserAchievement %llu '%s'\n", (uint64)steamIDUser.ConvertToUint64(), pchName); + PRINT_DEBUG("%llu '%s'", (uint64)steamIDUser.ConvertToUint64(), pchName); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_GameServerStats::ClearUserAchievement %llu '%s'\n", (uint64)steamIDUser.ConvertToUint64(), pchName); + PRINT_DEBUG("%llu '%s'", (uint64)steamIDUser.ConvertToUint64(), pchName); std::lock_guard lock(global_mutex); 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 ) { // 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 lock(global_mutex); if (settings->disable_sharing_stats_with_gameserver) { GSStatsStored_t data_bad{}; @@ -367,10 +367,7 @@ void Steam_GameServerStats::remove_timedout_userstats_requests() data.m_steamIDUser = pendReq.steamIDUser; callback_results->addCallResult(pendReq.steamAPICall, data.k_iCallback, &data, sizeof(data)); - PRINT_DEBUG( - "Steam_GameServerStats::steam_run_callback RequestUserStats timeout, %llu\n", - pendReq.steamIDUser.ConvertToUint64() - ); + PRINT_DEBUG("RequestUserStats timeout, %llu", pendReq.steamIDUser.ConvertToUint64()); } } @@ -441,8 +438,7 @@ void Steam_GameServerStats::collect_and_send_updated_user_stats() msg.set_dest_id(user_steamid); network->sendTo(&msg, true); - PRINT_DEBUG( - "Steam_GameServerStats::collect_and_send_updated_user_stats server sent updated stats %llu: %zu stats, %zu achievements\n", + PRINT_DEBUG("server sent updated stats %llu: %zu stats, %zu achievements", 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 +// user sent all their stats void Steam_GameServerStats::network_callback_initial_stats(Common_Message *msg) { 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() || !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; } @@ -481,7 +478,7 @@ void Steam_GameServerStats::network_callback_initial_stats(Common_Message *msg) } ); 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; } @@ -507,21 +504,21 @@ void Steam_GameServerStats::network_callback_initial_stats(Common_Message *msg) data.m_steamIDUser = user_steamid; callback_results->addCallResult(it->steamAPICall, data.k_iCallback, &data, sizeof(data)); - PRINT_DEBUG( - "Steam_GameServerStats::network_callback_initial_stats server got all player stats %llu: %zu stats, %zu achievements\n", + PRINT_DEBUG("server got all player stats %llu: %zu stats, %zu achievements", 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) { 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()) { - PRINT_DEBUG("Steam_GameServerStats::network_callback_updated_stats error empty msg\n"); + PRINT_DEBUG("error empty msg"); return; } @@ -542,8 +539,7 @@ void Steam_GameServerStats::network_callback_updated_stats(Common_Message *msg) current_ach.ach = new_ach.second; } - PRINT_DEBUG( - "Steam_GameServerStats::network_callback got updated user stats %llu: %zu stats, %zu achievements\n", + PRINT_DEBUG("got updated user stats %llu: %zu stats, %zu achievements", 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; 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; } } @@ -598,19 +594,16 @@ void Steam_GameServerStats::network_callback_low_level(Common_Message *msg) data.m_steamIDUser = it_rm->steamIDUser; callback_results->addCallResult(it_rm->steamAPICall, data.k_iCallback, &data, sizeof(data)); - PRINT_DEBUG( - "Steam_GameServerStats::network_callback_low_level RequestUserStats timeout, %llu\n", - it_rm->steamIDUser.ConvertToUint64() - ); + PRINT_DEBUG("RequestUserStats timeout, %llu", it_rm->steamIDUser.ConvertToUint64()); 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; 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; } } diff --git a/dll/steam_http.cpp b/dll/steam_http.cpp index efd361aa..d0a90575 100644 --- a/dll/steam_http.cpp +++ b/dll/steam_http.cpp @@ -38,7 +38,7 @@ Steam_Http_Request *Steam_HTTP::get_request(HTTPRequestHandle hRequest) // or such. 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 lock(global_mutex); 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. bool Steam_HTTP::SetHTTPRequestContextValue( HTTPRequestHandle hRequest, uint64 ulContextValue ) { - PRINT_DEBUG("Steam_HTTP::SetHTTPRequestContextValue\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); Steam_Http_Request *request = get_request(hRequest); @@ -101,7 +101,7 @@ bool Steam_HTTP::SetHTTPRequestContextValue( HTTPRequestHandle hRequest, uint64 // has already been sent. bool Steam_HTTP::SetHTTPRequestNetworkActivityTimeout( HTTPRequestHandle hRequest, uint32 unTimeoutSeconds ) { - PRINT_DEBUG("Steam_HTTP::SetHTTPRequestNetworkActivityTimeout\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. 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 lock(global_mutex); 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. 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 lock(global_mutex); 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) { - 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()); const auto send_callresult = [&]() -> void { @@ -194,19 +194,19 @@ void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t directory_path = "."; 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("")); FILE *hfile = std::fopen(request->target_filepath.c_str(), "wb"); 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(); return; } CURL *chttp = curl_easy_init(); if (!chttp) { fclose(hfile); - PRINT_DEBUG("Steam_HTTP::online_http_request curl_easy_init() failed\n"); + PRINT_DEBUG("curl_easy_init() failed"); send_callresult(); return; } @@ -215,7 +215,7 @@ void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t std::vector headers{}; for (const auto &hdr : request->headers) { 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); } @@ -229,39 +229,39 @@ void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t switch (request->request_method) { 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); break; 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); break; 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); break; 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." break; 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, "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 break; 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"); break; 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, "Accept: application/json,application/x-www-form-urlencoded,text/html,application/xhtml+xml,application/xml"); 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 (request->request_method == EHTTPMethod::k_EHTTPMethodGET) { 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 { - 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()); } } 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()); } @@ -311,7 +311,7 @@ void Steam_HTTP::online_http_request(Steam_Http_Request *request, SteamAPICall_t fclose(hfile); 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); 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. 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 lock(global_mutex); 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. bool Steam_HTTP::SendHTTPRequestAndStreamResponse( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle ) { - PRINT_DEBUG("Steam_HTTP::SendHTTPRequestAndStreamResponse\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. bool Steam_HTTP::DeferHTTPRequest( HTTPRequestHandle hRequest ) { - PRINT_DEBUG("Steam_HTTP::DeferHTTPRequest\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. bool Steam_HTTP::PrioritizeHTTPRequest( HTTPRequestHandle hRequest ) { - PRINT_DEBUG("Steam_HTTP::PrioritizeHTTPRequest\n"); + PRINT_DEBUG("Steam_HTTP::PrioritizeHTTPRequest"); std::lock_guard lock(global_mutex); Steam_Http_Request *request = get_request(hRequest); @@ -411,7 +411,7 @@ bool Steam_HTTP::PrioritizeHTTPRequest( HTTPRequestHandle hRequest ) // GetHTTPResponseHeaderValue. 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 lock(global_mutex); 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. 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 lock(global_mutex); if (!pchHeaderName) return false; @@ -457,7 +457,7 @@ bool Steam_HTTP::GetHTTPResponseHeaderValue( HTTPRequestHandle hRequest, const c // handle is invalid. bool Steam_HTTP::GetHTTPResponseBodySize( HTTPRequestHandle hRequest, uint32 *unBodySize ) { - PRINT_DEBUG("Steam_HTTP::GetHTTPResponseBodySize\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. 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 lock(global_mutex); Steam_Http_Request *request = get_request(hRequest); if (!request) { 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 (pBodyDataBuffer) { 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. bool Steam_HTTP::GetHTTPStreamingResponseBodyData( HTTPRequestHandle hRequest, uint32 cOffset, uint8 *pBodyDataBuffer, uint32 unBufferSize ) { - PRINT_DEBUG("Steam_HTTP::GetHTTPStreamingResponseBodyData\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); Steam_Http_Request *request = get_request(hRequest); @@ -518,7 +518,7 @@ bool Steam_HTTP::GetHTTPStreamingResponseBodyData( HTTPRequestHandle hRequest, u // callback and finishing using the response. bool Steam_HTTP::ReleaseHTTPRequest( HTTPRequestHandle hRequest ) { - PRINT_DEBUG("Steam_HTTP::ReleaseHTTPRequest\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. bool Steam_HTTP::GetHTTPDownloadProgressPct( HTTPRequestHandle hRequest, float *pflPercentOut ) { - PRINT_DEBUG("Steam_HTTP::GetHTTPDownloadProgressPct\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. 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 lock(global_mutex); Steam_Http_Request *request = get_request(hRequest); @@ -584,7 +584,7 @@ bool Steam_HTTP::SetHTTPRequestRawPostBody( HTTPRequestHandle hRequest, const ch // repeat executions of your process. HTTPCookieContainerHandle Steam_HTTP::CreateCookieContainer( bool bAllowResponsesToModify ) { - PRINT_DEBUG("TODO Steam_HTTP::CreateCookieContainer\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 bool Steam_HTTP::ReleaseCookieContainer( HTTPCookieContainerHandle hCookieContainer ) { - PRINT_DEBUG("TODO Steam_HTTP::ReleaseCookieContainer\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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. 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 lock(global_mutex); return false; @@ -618,7 +618,7 @@ bool Steam_HTTP::SetCookie( HTTPCookieContainerHandle hCookieContainer, const ch // Set the cookie container to use for a HTTP request bool Steam_HTTP::SetHTTPRequestCookieContainer( HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer ) { - PRINT_DEBUG("TODO Steam_HTTP::SetHTTPRequestCookieContainer\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 bool Steam_HTTP::SetHTTPRequestUserAgentInfo( HTTPRequestHandle hRequest, const char *pchUserAgentInfo ) { - PRINT_DEBUG("Steam_HTTP::SetHTTPRequestUserAgentInfo\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 bool Steam_HTTP::SetHTTPRequestRequiresVerifiedCertificate( HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate ) { - PRINT_DEBUG("Steam_HTTP::SetHTTPRequestRequiresVerifiedCertificate\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 bool Steam_HTTP::SetHTTPRequestAbsoluteTimeoutMS( HTTPRequestHandle hRequest, uint32 unMilliseconds ) { - PRINT_DEBUG("Steam_HTTP::SetHTTPRequestAbsoluteTimeoutMS\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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) bool Steam_HTTP::GetHTTPRequestWasTimedOut( HTTPRequestHandle hRequest, bool *pbWasTimedOut ) { - PRINT_DEBUG("Steam_HTTP::GetHTTPRequestWasTimedOut\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); Steam_Http_Request *request = get_request(hRequest); diff --git a/dll/steam_matchmaking_servers.cpp b/dll/steam_matchmaking_servers.cpp index 878cbaad..a4fabb50 100644 --- a/dll/steam_matchmaking_servers.cpp +++ b/dll/steam_matchmaking_servers.cpp @@ -20,7 +20,7 @@ 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; 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) { - 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 lock(global_mutex); ++server_list_request; HServerListRequest id = (char *)0 + server_list_request; // (char *)0 silences the compiler warning 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; } @@ -61,7 +61,7 @@ HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, IS request.type = type; request.id = id; requests.push_back(request); - PRINT_DEBUG("Steam_Matchmaking_Servers::request id: %p\n", id); + PRINT_DEBUG("id: %p", id); if (type == eLANServer) return id; @@ -79,7 +79,7 @@ HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, IS g2.server = server; g2.type = type; gameservers.push_back(g2); - PRINT_DEBUG(" eFriendsServer SERVER ADDED\n"); + PRINT_DEBUG(" eFriendsServer SERVER ADDED"); } } return id; @@ -98,7 +98,7 @@ HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, IS 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; if (file_size) { list.resize(file_size); @@ -141,7 +141,7 @@ HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, IS g.server = server; g.type = type; gameservers.push_back(g); - PRINT_DEBUG(" SERVER ADDED\n"); + PRINT_DEBUG(" SERVER ADDED"); list_ip = ""; } @@ -154,37 +154,37 @@ HServerListRequest Steam_Matchmaking_Servers::RequestServerList(AppId_t iApp, IS // 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 ) { - PRINT_DEBUG("Steam_Matchmaking_Servers::RequestInternetServerList\n"); + PRINT_DEBUG_ENTRY(); return RequestServerList(iApp, pRequestServersResponse, eInternetServer); } 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); } 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); } 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); } 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); } 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); } @@ -192,7 +192,7 @@ HServerListRequest Steam_Matchmaking_Servers::RequestSpectatorServerList( AppId_ 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 lock(global_mutex); auto g = std::begin(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 ) { - PRINT_DEBUG("Steam_Matchmaking_Servers::%s old\n", __FUNCTION__); + PRINT_DEBUG("old"); //TODO RequestOldServerList(iApp, pRequestServersResponse, eInternetServer); } void Steam_Matchmaking_Servers::RequestLANServerList( AppId_t iApp, ISteamMatchmakingServerListResponse001 *pRequestServersResponse ) { - PRINT_DEBUG("Steam_Matchmaking_Servers::%s old\n", __FUNCTION__); + PRINT_DEBUG("old"); //TODO RequestOldServerList(iApp, pRequestServersResponse, eLANServer); } 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 RequestOldServerList(iApp, pRequestServersResponse, eFriendsServer); } 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 RequestOldServerList(iApp, pRequestServersResponse, eFavoritesServer); } 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 RequestOldServerList(iApp, pRequestServersResponse, eHistoryServer); } 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 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. 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); while (g != std::end(requests)) { 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) { - PRINT_DEBUG("Steam_Matchmaking_Servers::server_details\n"); + PRINT_DEBUG_ENTRY(); constexpr const static int MIN_LATENCY = 2; int latency = MIN_LATENCY; @@ -364,10 +364,10 @@ void Steam_Matchmaking_Servers::server_details(Gameserver *g, gameserveritem_t * ip[3] = (g->ip() >> 24) & 0xFF; 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()); 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); 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 (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); g->set_game_description(ssq_a2s_info->game); 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); g->set_offline(false); } 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); } 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); @@ -453,7 +453,7 @@ void Steam_Matchmaking_Servers::server_details(Gameserver *g, gameserveritem_t * memset(server->m_szGameTags, 0, sizeof(server->m_szGameTags)); 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) @@ -467,43 +467,43 @@ void Steam_Matchmaking_Servers::server_details_players(Gameserver *g, Steam_Matc ip[3] = (g->ip() >> 24) & 0xFF; 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()); 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); uint8_t ssq_a2s_player_count = 0; A2S_PLAYER *ssq_a2s_player = ssq_player(ssq, &ssq_a2s_player_count); 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++) { r->players_response->AddPlayerToList(ssq_a2s_player[i].name, ssq_a2s_player[i].score, ssq_a2s_player[i].duration); } } 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); } 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); } else if (!settings->matchmaking_server_details_via_source_query) { // original behavior 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(); auto player = players->cbegin(); for (int i = 0; i < number_players && player != players->end(); ++i, ++player) { float playtime = static_cast(std::chrono::duration_cast(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); } } - 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) @@ -517,7 +517,7 @@ void Steam_Matchmaking_Servers::server_details_rules(Gameserver *g, Steam_Matchm ip[3] = (g->ip() >> 24) & 0xFF; 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()); if (ssq != NULL && ssq_server_eok(ssq)) { 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); 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++) { r->rules_response->RulesResponded(ssq_a2s_rules[i].name, ssq_a2s_rules[i].value); } } 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); } 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); } else if (!settings->matchmaking_server_details_via_source_query) { // original behavior 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(); 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()); ++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 @@ -559,16 +559,16 @@ void Steam_Matchmaking_Servers::server_details_rules(Gameserver *g, Steam_Matchm // ISteamMatchmakingServerListResponse::ServerResponded() callbacks 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 lock(global_mutex); std::vector gameservers_filtered; auto g = std::begin(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) { gameservers_filtered = g->gameservers_filtered; - PRINT_DEBUG(" found %zu\n", gameservers_filtered.size()); + PRINT_DEBUG(" found %zu", gameservers_filtered.size()); break; } @@ -582,7 +582,7 @@ gameserveritem_t *Steam_Matchmaking_Servers::GetServerDetails( HServerListReques Gameserver *gs = &gameservers_filtered[iServer].server; gameserveritem_t *server = new gameserveritem_t(); //TODO: is the new here ok? server_details(gs, server); - PRINT_DEBUG(" Returned server details\n"); + PRINT_DEBUG(" Returned server details"); return server; } @@ -595,7 +595,7 @@ gameserveritem_t *Steam_Matchmaking_Servers::GetServerDetails( HServerListReques // The request handle must be released using ReleaseRequest( 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); while (g != std::end(requests)) { if (g->id == hRequest) { @@ -614,14 +614,14 @@ void Steam_Matchmaking_Servers::CancelQuery( HServerListRequest hRequest ) // is released with ReleaseRequest( 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 bool Steam_Matchmaking_Servers::IsRefreshing( HServerListRequest hRequest ) { - PRINT_DEBUG("Steam_Matchmaking_Servers::IsRefreshing %p\n", hRequest); + PRINT_DEBUG("%p", hRequest); 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 int Steam_Matchmaking_Servers::GetServerCount( HServerListRequest hRequest ) { - PRINT_DEBUG("Steam_Matchmaking_Servers::GetServerCount %p\n", hRequest); + PRINT_DEBUG("%p", hRequest); std::lock_guard lock(global_mutex); int size = 0; 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 ) void Steam_Matchmaking_Servers::RefreshServer( HServerListRequest hRequest, int iServer ) { - PRINT_DEBUG("Steam_Matchmaking_Servers::RefreshServer %p\n", hRequest); + PRINT_DEBUG("%p", hRequest); //TODO } @@ -669,7 +669,7 @@ static HServerQuery new_server_query() // Request updated ping time and other details from a single server 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 lock(global_mutex); Steam_Matchmaking_Servers_Direct_IP_Request r; 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 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 lock(global_mutex); Steam_Matchmaking_Servers_Direct_IP_Request r; 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) 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 lock(global_mutex); Steam_Matchmaking_Servers_Direct_IP_Request r; 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. void Steam_Matchmaking_Servers::CancelServerQuery( HServerQuery hServerQuery ) { - PRINT_DEBUG("Steam_Matchmaking_Servers::CancelServerQuery\n"); + PRINT_DEBUG("Steam_Matchmaking_Servers::CancelServerQuery"); std::lock_guard 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; }); if (direct_ip_requests.end() == r) return; @@ -727,37 +727,37 @@ void Steam_Matchmaking_Servers::CancelServerQuery( HServerQuery hServerQuery ) void Steam_Matchmaking_Servers::RunCallbacks() { - // PRINT_DEBUG("Steam_Matchmaking_Servers::RunCallbacks\n"); + // PRINT_DEBUG_ENTRY(); { auto g = std::begin(gameservers); while (g != std::end(gameservers)) { if (check_timedout(g->last_recv, SERVER_TIMEOUT)) { g = gameservers.erase(g); - PRINT_DEBUG("Steam_Matchmaking_Servers::SERVER TIMEOUT\n"); + PRINT_DEBUG("TIMEOUT"); } else { ++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) { if (r.cancelled || r.completed) continue; r.gameservers_filtered.clear(); 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)) { - PRINT_DEBUG("Steam_Matchmaking_Servers::REQUESTS server found\n"); + PRINT_DEBUG("server found"); r.gameservers_filtered.push_back(g); } } } std::vector 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) { r.completed = true; } @@ -768,7 +768,7 @@ void Steam_Matchmaking_Servers::RunCallbacks() if (r.callbacks) { 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); ++i; } @@ -782,7 +782,7 @@ void Steam_Matchmaking_Servers::RunCallbacks() if (r.old_callbacks) { 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); ++i; } @@ -807,9 +807,9 @@ void Steam_Matchmaking_Servers::RunCallbacks() } 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) { - 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(); if (query_port == 0xFFFF) { query_port = g.server.port(); @@ -846,7 +846,7 @@ void Steam_Matchmaking_Servers::RunCallbacks() void Steam_Matchmaking_Servers::Callback(Common_Message *msg) { 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()) { for (auto &g : gameservers) { 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.type = eLANServer; gameservers.push_back(g); - PRINT_DEBUG("Steam_Matchmaking_Servers::SERVER ADDED\n"); + PRINT_DEBUG("ADDED"); } } } 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; for (auto &g : gameservers_friends) { if (g.source_id == msg->source_id()) { diff --git a/dll/steam_music.cpp b/dll/steam_music.cpp index bc3e126f..5119b472 100644 --- a/dll/steam_music.cpp +++ b/dll/steam_music.cpp @@ -36,20 +36,20 @@ void Steam_Music::change_playstate(int new_playing) bool Steam_Music::BIsEnabled() { - PRINT_DEBUG("TODO Steam_Music::BIsEnabled\n"); + PRINT_DEBUG_TODO(); return true; } bool Steam_Music::BIsPlaying() { - PRINT_DEBUG("TODO Steam_Music::BIsPlaying\n"); + PRINT_DEBUG_TODO(); return playing > 0; } AudioPlayback_Status Steam_Music::GetPlaybackStatus() { - PRINT_DEBUG("TODO Steam_Music::GetPlaybackStatus\n"); + PRINT_DEBUG_TODO(); if (playing == 0) { return AudioPlayback_Idle; } @@ -67,25 +67,25 @@ AudioPlayback_Status Steam_Music::GetPlaybackStatus() void Steam_Music::Play() { - PRINT_DEBUG("TODO Steam_Music::Play\n"); + PRINT_DEBUG_TODO(); change_playstate(2); } void Steam_Music::Pause() { - PRINT_DEBUG("TODO Steam_Music::Pause\n"); + PRINT_DEBUG_TODO(); change_playstate(1); } void Steam_Music::PlayPrevious() { - PRINT_DEBUG("TODO Steam_Music::PlayPrevious\n"); + PRINT_DEBUG_TODO(); change_playstate(2); } void Steam_Music::PlayNext() { - PRINT_DEBUG("TODO Steam_Music::PlayNext\n"); + PRINT_DEBUG_TODO(); change_playstate(2); } @@ -93,7 +93,7 @@ void Steam_Music::PlayNext() // volume is between 0.0 and 1.0 void Steam_Music::SetVolume( float flVolume ) { - PRINT_DEBUG("TODO Steam_Music::SetVolume\n"); + PRINT_DEBUG_TODO(); if (flVolume > 1.0) flVolume = 1.0; @@ -111,6 +111,6 @@ void Steam_Music::SetVolume( float flVolume ) float Steam_Music::GetVolume() { - PRINT_DEBUG("TODO Steam_Music::GetVolume\n"); + PRINT_DEBUG_TODO(); return volume; } diff --git a/dll/steam_musicremote.cpp b/dll/steam_musicremote.cpp index 81e69187..adaaa9b0 100644 --- a/dll/steam_musicremote.cpp +++ b/dll/steam_musicremote.cpp @@ -20,38 +20,38 @@ // Service Definition bool Steam_MusicRemote::RegisterSteamMusicRemote( const char *pchName ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::DeregisterSteamMusicRemote() { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::BIsCurrentMusicRemote() { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::BActivationSuccess( bool bValue ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::SetDisplayName( const char *pchDisplayName ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::SetPNGIcon_64x64( void *pvBuffer, uint32 cbBufferLength ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } @@ -59,37 +59,37 @@ bool Steam_MusicRemote::SetPNGIcon_64x64( void *pvBuffer, uint32 cbBufferLength // Abilities for the user interface bool Steam_MusicRemote::EnablePlayPrevious(bool bValue) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::EnablePlayNext( bool bValue ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::EnableShuffled( bool bValue ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::EnableLooped( bool bValue ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::EnableQueue( bool bValue ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::EnablePlaylists( bool bValue ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } @@ -97,25 +97,25 @@ bool Steam_MusicRemote::EnablePlaylists( bool bValue ) // Status bool Steam_MusicRemote::UpdatePlaybackStatus( AudioPlayback_Status nStatus ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::UpdateShuffled( bool bValue ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::UpdateLooped( bool bValue ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::UpdateVolume( float flValue ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } // volume is between 0.0 and 1.0 @@ -123,37 +123,37 @@ bool Steam_MusicRemote::UpdateVolume( float flValue ) // Current Entry bool Steam_MusicRemote::CurrentEntryWillChange() { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::CurrentEntryIsAvailable( bool bAvailable ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::UpdateCurrentEntryText( const char *pchText ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::UpdateCurrentEntryElapsedSeconds( int nValue ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::UpdateCurrentEntryCoverArt( void *pvBuffer, uint32 cbBufferLength ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::CurrentEntryDidChange() { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } @@ -161,31 +161,31 @@ bool Steam_MusicRemote::CurrentEntryDidChange() // Queue bool Steam_MusicRemote::QueueWillChange() { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::ResetQueueEntries() { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::SetQueueEntry( int nID, int nPosition, const char *pchEntryText ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::SetCurrentQueueEntry( int nID ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::QueueDidChange() { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } @@ -193,30 +193,30 @@ bool Steam_MusicRemote::QueueDidChange() // Playlist bool Steam_MusicRemote::PlaylistWillChange() { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::ResetPlaylistEntries() { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::SetPlaylistEntry( int nID, int nPosition, const char *pchEntryText ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::SetCurrentPlaylistEntry( int nID ) { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } bool Steam_MusicRemote::PlaylistDidChange() { - PRINT_DEBUG("TODO Steam_MusicRemote::%s\n", __FUNCTION__); + PRINT_DEBUG_TODO(); return false; } diff --git a/dll/steam_parental.cpp b/dll/steam_parental.cpp index 6fc4205e..92795508 100644 --- a/dll/steam_parental.cpp +++ b/dll/steam_parental.cpp @@ -19,38 +19,38 @@ bool Steam_Parental::BIsParentalLockEnabled() { - PRINT_DEBUG("TODO Steam_Parental::BIsParentalLockEnabled\n"); + PRINT_DEBUG_TODO(); return false; } bool Steam_Parental::BIsParentalLockLocked() { - PRINT_DEBUG("TODO Steam_Parental::BIsParentalLockLocked\n"); + PRINT_DEBUG_TODO(); return false; } bool Steam_Parental::BIsAppBlocked( AppId_t nAppID ) { - PRINT_DEBUG("TODO Steam_Parental::BIsAppBlocked\n"); + PRINT_DEBUG_TODO(); return false; } bool Steam_Parental::BIsAppInBlockList( AppId_t nAppID ) { - PRINT_DEBUG("TODO Steam_Parental::BIsAppInBlockList\n"); + PRINT_DEBUG_TODO(); return false; } bool Steam_Parental::BIsFeatureBlocked( EParentalFeature eFeature ) { - PRINT_DEBUG("TODO Steam_Parental::BIsFeatureBlocked\n"); + PRINT_DEBUG_TODO(); return false; } bool Steam_Parental::BIsFeatureInBlockList( EParentalFeature eFeature ) { - PRINT_DEBUG("TODO Steam_Parental::BIsFeatureInBlockList\n"); + PRINT_DEBUG_TODO(); return false; } diff --git a/dll/steam_screenshots.cpp b/dll/steam_screenshots.cpp index 3c2131b8..88e33eac 100644 --- a/dll/steam_screenshots.cpp +++ b/dll/steam_screenshots.cpp @@ -25,15 +25,20 @@ Steam_Screenshots::Steam_Screenshots(class Local_Storage* local_storage, class S ScreenshotHandle Steam_Screenshots::create_screenshot_handle() { + std::lock_guard lock(global_mutex); 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. // 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 ) { - PRINT_DEBUG("Steam_Screenshots::WriteScreenshot\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); char buff[128]; 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. 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 lock(global_mutex); if (pchFilename == nullptr) 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. void Steam_Screenshots::TriggerScreenshot() { - PRINT_DEBUG("Steam_Screenshots::TriggerScreenshot\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); - if (hooked) - { + if (hooked) { ScreenshotRequested_t data; callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); - } - else - { + } else { PRINT_DEBUG(" TODO: Make the overlay take a screenshot"); } } @@ -110,7 +114,8 @@ void Steam_Screenshots::TriggerScreenshot() // in response. void Steam_Screenshots::HookScreenshots( bool bHook ) { - PRINT_DEBUG("Steam_Screenshots::HookScreenshots\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); 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) bool Steam_Screenshots::SetLocation( ScreenshotHandle hScreenshot, const char *pchLocation ) { - PRINT_DEBUG("Steam_Screenshots::SetLocation\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); auto it = _screenshots.find(hScreenshot); - if (it == _screenshots.end()) - return false; + if (it == _screenshots.end()) return false; it->second.metadatas["locations"].push_back(pchLocation); 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 bool Steam_Screenshots::TagUser( ScreenshotHandle hScreenshot, CSteamID steamID ) { - PRINT_DEBUG("Steam_Screenshots::TagUser\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); auto it = _screenshots.find(hScreenshot); - if (it == _screenshots.end()) - return false; + if (it == _screenshots.end()) return false; 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); @@ -150,11 +155,11 @@ bool Steam_Screenshots::TagUser( ScreenshotHandle hScreenshot, CSteamID steamID // Tags a published file as being visible in the screenshot bool Steam_Screenshots::TagPublishedFile( ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID ) { - PRINT_DEBUG("Steam_Screenshots::TagPublishedFile\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); auto it = _screenshots.find(hScreenshot); - if (it == _screenshots.end()) - return false; + if (it == _screenshots.end()) return false; 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); @@ -166,7 +171,9 @@ bool Steam_Screenshots::TagPublishedFile( ScreenshotHandle hScreenshot, Publishe // Returns true if the app has hooked the screenshot bool Steam_Screenshots::IsScreenshotsHooked() { - PRINT_DEBUG("Steam_Screenshots::IsScreenshotsHooked\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); + return hooked; } @@ -178,7 +185,9 @@ bool Steam_Screenshots::IsScreenshotsHooked() // JPEG, TGA, and PNG formats are supported. ScreenshotHandle Steam_Screenshots::AddVRScreenshotToLibrary( EVRScreenshotType eType, const char *pchFilename, const char *pchVRFilename ) { - PRINT_DEBUG("Steam_Screenshots::AddVRScreenshotToLibrary\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); + return INVALID_SCREENSHOT_HANDLE; } diff --git a/dll/steam_user_stats.cpp b/dll/steam_user_stats.cpp index f62ff48d..899af9e9 100644 --- a/dll/steam_user_stats.cpp +++ b/dll/steam_user_stats.cpp @@ -175,14 +175,13 @@ std::vector Steam_User_Stats::load_leaderboard_entries( ++i; // move past this score detail } - PRINT_DEBUG( - "Steam_User_Stats::load_leaderboard_entries '%s': user %llu, score %i, details count = %zu\n", + PRINT_DEBUG("'%s': user %llu, score %i, details count = %zu", name.c_str(), new_entry.steam_id.ConvertToUint64(), new_entry.score, new_entry.score_details.size() ); 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; } @@ -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()); 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 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 leaderboard.sort_entries(); 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; @@ -248,7 +247,7 @@ unsigned int Steam_User_Stats::cache_leaderboard_ifneeded(const std::string &nam { unsigned int board_handle = find_cached_leaderboard(name); 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 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); board_handle = cached_leaderboards.size(); - PRINT_DEBUG( - "Steam_User_Stats::cache_leaderboard_ifneeded cached a new leaderboard '%s' %i %i\n", + PRINT_DEBUG("cached a new leaderboard '%s' %i %i", new_board.name.c_str(), (int)eLeaderboardSortMethod, (int)eLeaderboardDisplayType ); 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 bool Steam_User_Stats::clear_stats_internal() { - PRINT_DEBUG("Steam_User_Stats::clear_stats_internal\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); bool notify_server = false; @@ -395,7 +393,7 @@ bool Steam_User_Stats::clear_stats_internal() } 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 Steam_User_Stats::set_stat_internal( const char *pchName, int32 nData ) { - PRINT_DEBUG("Steam_User_Stats::set_stat_internal '%s' = %i\n", pchName, nData); + PRINT_DEBUG(" '%s' = %i", pchName, nData); std::lock_guard lock(global_mutex); Steam_User_Stats::InternalSetResult result{}; @@ -448,7 +446,7 @@ Steam_User_Stats::InternalSetResult Steam_User_Stats::set_stat_internal( Steam_User_Stats::InternalSetResult> Steam_User_Stats::set_stat_internal( const char *pchName, float fData ) { - PRINT_DEBUG("Steam_User_Stats::set_stat_internal '%s' = %f\n", pchName, fData); + PRINT_DEBUG(" '%s' = %f", pchName, fData); std::lock_guard lock(global_mutex); Steam_User_Stats::InternalSetResult> result{}; @@ -493,7 +491,7 @@ Steam_User_Stats::InternalSetResult> 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 lock(global_mutex); Steam_User_Stats::InternalSetResult> result{}; @@ -539,7 +537,7 @@ Steam_User_Stats::InternalSetResult 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 lock(global_mutex); Steam_User_Stats::InternalSetResult result{}; @@ -585,7 +583,7 @@ Steam_User_Stats::InternalSetResult Steam_User_Stats::set_achievement_inte Steam_User_Stats::InternalSetResult 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 lock(global_mutex); Steam_User_Stats::InternalSetResult result{}; @@ -628,7 +626,7 @@ Steam_User_Stats::InternalSetResult Steam_User_Stats::clear_achievement_in 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; 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) { - // PRINT_DEBUG("Steam_User_Stats::steam_user_stats_network_stats\n"); + // PRINT_DEBUG_ENTRY(); auto inst = (Steam_User_Stats *)object; 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) { - // PRINT_DEBUG("Steam_User_Stats::steam_user_stats_network_leaderboards\n"); + // PRINT_DEBUG_ENTRY(); auto inst = (Steam_User_Stats *)object; 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) { - // PRINT_DEBUG("Steam_User_Stats::steam_user_stats_run_every_runcb\n"); + // PRINT_DEBUG_ENTRY(); auto inst = (Steam_User_Stats *)object; inst->steam_run_callback(); @@ -741,7 +739,7 @@ Steam_User_Stats::~Steam_User_Stats() STEAM_CALL_BACK( UserStatsReceived_t ) bool Steam_User_Stats::RequestCurrentStats() { - PRINT_DEBUG("Steam_User_Stats::RequestCurrentStats\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); UserStatsReceived_t data{}; @@ -756,7 +754,7 @@ bool Steam_User_Stats::RequestCurrentStats() // Data accessors bool Steam_User_Stats::GetStat( const char *pchName, int32 *pData ) { - PRINT_DEBUG("Steam_User_Stats::GetStat '%s' %p\n", pchName, pData); + PRINT_DEBUG(" '%s' %p", pchName, pData); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_User_Stats::GetStat '%s' %p\n", pchName, pData); + PRINT_DEBUG(" '%s' %p", pchName, pData); std::lock_guard lock(global_mutex); if (!pchName) return false; @@ -822,7 +820,7 @@ bool Steam_User_Stats::GetStat( const char *pchName, float *pData ) // Set / update data bool Steam_User_Stats::SetStat( const char *pchName, int32 nData ) { - PRINT_DEBUG("Steam_User_Stats::SetStat '%s' = %i\n", pchName, nData); + PRINT_DEBUG(" '%s' = %i", pchName, nData); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_User_Stats::SetStat '%s' = %f\n", pchName, fData); + PRINT_DEBUG(" '%s' = %f", pchName, fData); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_User_Stats::UpdateAvgRateStat '%s'\n", pchName); + PRINT_DEBUG("'%s'", pchName); std::lock_guard lock(global_mutex); 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 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 lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_User_Stats::SetAchievement '%s'\n", pchName); + PRINT_DEBUG("'%s'", pchName); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_User_Stats::ClearAchievement '%s'\n", pchName); + PRINT_DEBUG("'%s'", pchName); std::lock_guard lock(global_mutex); 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. 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 lock(global_mutex); if (!pchName) return false; @@ -977,7 +975,7 @@ bool Steam_User_Stats::GetAchievementAndUnlockTime( const char *pchName, bool *p 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) - PRINT_DEBUG("Steam_User_Stats::StoreStats\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); UserStatsStored_t data{}; @@ -997,7 +995,7 @@ bool Steam_User_Stats::StoreStats() // specified achievement. int Steam_User_Stats::GetAchievementIcon( const char *pchName ) { - PRINT_DEBUG("TODO Steam_User_Stats::GetAchievementIcon\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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) 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 lock(global_mutex); 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. 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 lock(global_mutex); if (!pchName) return false; @@ -1121,7 +1119,7 @@ bool Steam_User_Stats::IndicateAchievementProgress( const char *pchName, uint32 // list of existing achievements compiled into them uint32 Steam_User_Stats::GetNumAchievements() { - PRINT_DEBUG("Steam_User_Stats::GetNumAchievements\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return (uint32)defined_achievements.size(); } @@ -1129,7 +1127,7 @@ uint32 Steam_User_Stats::GetNumAchievements() // Get achievement name iAchievement in [0,GetNumAchievements) const char * Steam_User_Stats::GetAchievementName( uint32 iAchievement ) { - PRINT_DEBUG("Steam_User_Stats::GetAchievementName\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); if (iAchievement >= sorted_achievement_names.size()) { return ""; @@ -1148,7 +1146,7 @@ const char * Steam_User_Stats::GetAchievementName( uint32 iAchievement ) STEAM_CALL_RESULT( UserStatsReceived_t ) 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 lock(global_mutex); // 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() 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 lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_User_Stats::GetUserStat %s %llu\n", pchName, steamIDUser.ConvertToUint64()); + PRINT_DEBUG("%s %llu", pchName, steamIDUser.ConvertToUint64()); std::lock_guard lock(global_mutex); 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 ) { - PRINT_DEBUG("Steam_User_Stats::GetUserAchievement %s\n", pchName); + PRINT_DEBUG("%s", pchName); std::lock_guard lock(global_mutex); if (!pchName) return false; @@ -1215,7 +1213,7 @@ bool Steam_User_Stats::GetUserAchievement( CSteamID steamIDUser, const char *pch // See notes for GetAchievementAndUnlockTime above 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 lock(global_mutex); if (!pchName) return false; @@ -1230,7 +1228,7 @@ bool Steam_User_Stats::GetUserAchievementAndUnlockTime( CSteamID steamIDUser, co // Reset stats bool Steam_User_Stats::ResetAllStats( bool bAchievementsToo ) { - PRINT_DEBUG("Steam_User_Stats::ResetAllStats\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); clear_stats_internal(); @@ -1252,7 +1250,7 @@ bool Steam_User_Stats::ResetAllStats( bool bAchievementsToo ) new_stat.set_value_float(stat.second.default_value_float); 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) 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 lock(global_mutex); if (!pchLeaderboardName) { LeaderboardFindResult_t data{}; @@ -1313,7 +1311,7 @@ SteamAPICall_t Steam_User_Stats::FindOrCreateLeaderboard( const char *pchLeaderb STEAM_CALL_RESULT( LeaderboardFindResult_t ) 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 lock(global_mutex); if (!pchLeaderboardName) { LeaderboardFindResult_t data{}; @@ -1345,7 +1343,7 @@ SteamAPICall_t Steam_User_Stats::FindLeaderboard( const char *pchLeaderboardName // returns the name of a leaderboard 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 lock(global_mutex); 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 int Steam_User_Stats::GetLeaderboardEntryCount( SteamLeaderboard_t hSteamLeaderboard ) { - PRINT_DEBUG("Steam_User_Stats::GetLeaderboardEntryCount %llu\n", hSteamLeaderboard); + PRINT_DEBUG("%llu", hSteamLeaderboard); std::lock_guard lock(global_mutex); 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 ELeaderboardSortMethod Steam_User_Stats::GetLeaderboardSortMethod( SteamLeaderboard_t hSteamLeaderboard ) { - PRINT_DEBUG("Steam_User_Stats::GetLeaderboardSortMethod %llu\n", hSteamLeaderboard); + PRINT_DEBUG("%llu", hSteamLeaderboard); std::lock_guard lock(global_mutex); 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 ELeaderboardDisplayType Steam_User_Stats::GetLeaderboardDisplayType( SteamLeaderboard_t hSteamLeaderboard ) { - PRINT_DEBUG("Steam_User_Stats::GetLeaderboardDisplayType %llu\n", hSteamLeaderboard); + PRINT_DEBUG("%llu", hSteamLeaderboard); std::lock_guard lock(global_mutex); 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 ) 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 lock(global_mutex); 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, 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 lock(global_mutex); 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]; if (!user_steamid.IsValid()) { ok = false; - PRINT_DEBUG("Steam_User_Stats::DownloadLeaderboardEntriesForUsers bad userid %llu\n", user_steamid.ConvertToUint64()); + PRINT_DEBUG("bad userid %llu", user_steamid.ConvertToUint64()); break; } 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 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 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 lock(global_mutex); 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 ) 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 lock(global_mutex); 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 ) { - PRINT_DEBUG("UploadLeaderboardScore old\n"); + PRINT_DEBUG("old"); 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 ) 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 lock(global_mutex); LeaderboardUGCSet_t data{}; 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 ) SteamAPICall_t Steam_User_Stats::GetNumberOfCurrentPlayers() { - PRINT_DEBUG("Steam_User_Stats::GetNumberOfCurrentPlayers\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); std::random_device rd{}; @@ -1625,7 +1623,7 @@ SteamAPICall_t Steam_User_Stats::GetNumberOfCurrentPlayers() STEAM_CALL_RESULT( GlobalAchievementPercentagesReady_t ) SteamAPICall_t Steam_User_Stats::RequestGlobalAchievementPercentages() { - PRINT_DEBUG("Steam_User_Stats::RequestGlobalAchievementPercentages\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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). 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 lock(global_mutex); if (!pchName) return -1; @@ -1668,7 +1666,7 @@ int Steam_User_Stats::GetMostAchievedAchievementInfo( char *pchName, uint32 unNa // achievement has been iterated. 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 lock(global_mutex); 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. 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 lock(global_mutex); auto it = defined_achievements_find(pchName); @@ -1721,7 +1719,7 @@ bool Steam_User_Stats::GetAchievementAchievedPercent( const char *pchName, float STEAM_CALL_RESULT( GlobalStatsReceived_t ) SteamAPICall_t Steam_User_Stats::RequestGlobalStats( int nHistoryDays ) { - PRINT_DEBUG("Steam_User_Stats::RequestGlobalStats %i\n", nHistoryDays); + PRINT_DEBUG("%i", nHistoryDays); std::lock_guard lock(global_mutex); GlobalStatsReceived_t data{}; 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 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 lock(global_mutex); return false; } 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 lock(global_mutex); return false; } @@ -1750,13 +1750,15 @@ bool Steam_User_Stats::GetGlobalStat( const char *pchStatName, double *pData ) // elements actually set. 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 lock(global_mutex); return 0; } 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 lock(global_mutex); 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. 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 lock(global_mutex); return false; } 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 lock(global_mutex); 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 network->sendToAllGameservers(&msg, true); - PRINT_DEBUG( - "Steam_User_Stats::send_updated_stats sent updated stats: %zu stats, %zu achievements\n", + PRINT_DEBUG("sent updated stats: %zu stats, %zu achievements", 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) { 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; } @@ -1851,7 +1854,7 @@ void Steam_User_Stats::network_stats_initial(Common_Message *msg) break; 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; } } @@ -1883,8 +1886,7 @@ void Steam_User_Stats::network_stats_initial(Common_Message *msg) new_msg.set_dest_id(server_steamid); network->sendTo(&new_msg, true); - PRINT_DEBUG( - "Steam_User_Stats::network_stats_initial server requested all stats, sent %zu stats, %zu achievements\n", + PRINT_DEBUG("server requested all stats, sent %zu stats, %zu achievements", 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) { 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; } @@ -1921,7 +1923,7 @@ void Steam_User_Stats::network_stats_updated(Common_Message *msg) break; 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; } } @@ -1935,8 +1937,7 @@ void Steam_User_Stats::network_stats_updated(Common_Message *msg) } } - PRINT_DEBUG( - "Steam_User_Stats::network_stats_updated server sent updated user stats, %zu stats, %zu achievements\n", + PRINT_DEBUG("server sent updated user stats, %zu stats, %zu achievements", 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; 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; } } @@ -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) { CSteamID sender_steamid((uint64)msg->source_id()); - PRINT_DEBUG( - "Steam_User_Stats::network_leaderboard_update_score got score for user %llu on leaderboard '%s' (send our score back=%i)\n", + PRINT_DEBUG("got score for user %llu on leaderboard '%s' (send our score back=%i)", (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) { CSteamID sender_steamid((uint64)msg->source_id()); - PRINT_DEBUG( - "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() - ); + PRINT_DEBUG("user %llu requested our score for leaderboard '%s'", (uint64)msg->source_id(), board.name.c_str()); 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 (!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; } 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( board_info_msg.board_name(), (ELeaderboardSortMethod)board_info_msg.sort_method(), @@ -2048,7 +2045,7 @@ void Steam_User_Stats::network_callback_leaderboards(Common_Message *msg) break; 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; } @@ -2073,12 +2070,12 @@ void Steam_User_Stats::network_callback_low_level(Common_Message *msg) 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; 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; } } diff --git a/dll/steam_utils.cpp b/dll/steam_utils.cpp index d8b23acb..262ada84 100644 --- a/dll/steam_utils.cpp +++ b/dll/steam_utils.cpp @@ -30,14 +30,14 @@ overlay(overlay) // return the number of seconds since the user uint32 Steam_Utils::GetSecondsSinceAppActive() { - PRINT_DEBUG("Steam_Utils::GetSecondsSinceAppActive\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return std::chrono::duration_cast(std::chrono::system_clock::now() - startup_time).count(); } uint32 Steam_Utils::GetSecondsSinceComputerActive() { - PRINT_DEBUG("Steam_Utils::GetSecondsSinceComputerActive\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return GetSecondsSinceAppActive() + 2000; } @@ -46,7 +46,7 @@ uint32 Steam_Utils::GetSecondsSinceComputerActive() // the universe this client is connecting to EUniverse Steam_Utils::GetConnectedUniverse() { - PRINT_DEBUG("Steam_Utils::GetConnectedUniverse\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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) uint32 Steam_Utils::GetServerRealTime() { - PRINT_DEBUG("Steam_Utils::GetServerRealTime\n"); + PRINT_DEBUG_ENTRY(); + std::lock_guard lock(global_mutex); uint32 server_time = std::chrono::duration_cast>(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; } @@ -66,7 +67,7 @@ uint32 Steam_Utils::GetServerRealTime() // e.g "US" or "UK". const char* Steam_Utils::GetIPCountry() { - PRINT_DEBUG("Steam_Utils::GetIPCountry\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 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 lock(global_mutex); 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) 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 lock(global_mutex); 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 bool Steam_Utils::GetCSERIPPort( uint32 *unIP, uint16 *usPort ) { - PRINT_DEBUG("Steam_Utils::GetCSERIPPort\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 uint8 Steam_Utils::GetCurrentBatteryPower() { - PRINT_DEBUG("Steam_Utils::GetCurrentBatteryPower\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return 255; } @@ -127,7 +128,7 @@ uint8 Steam_Utils::GetCurrentBatteryPower() // returns the appID of the current process uint32 Steam_Utils::GetAppID() { - PRINT_DEBUG("Steam_Utils::GetAppID\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. void Steam_Utils::SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition ) { - PRINT_DEBUG("Steam_Utils::SetOverlayNotificationPosition\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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) bool Steam_Utils::IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFailed ) { - PRINT_DEBUG("Steam_Utils::IsAPICallCompleted %llu\n", hSteamAPICall); + PRINT_DEBUG("%llu", hSteamAPICall); std::lock_guard lock(global_mutex); if (pbFailed) *pbFailed = false; @@ -162,18 +163,18 @@ bool Steam_Utils::IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFail ESteamAPICallFailure Steam_Utils::GetAPICallFailureReason( SteamAPICall_t hSteamAPICall ) { - PRINT_DEBUG("Steam_Utils::GetAPICallFailureReason\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return k_ESteamAPICallFailureNone; } 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 lock(global_mutex); if (callback_results->callback_result(hSteamAPICall, pCallback, cubCallback)) { if (pbFailed) *pbFailed = false; - PRINT_DEBUG("Steam_Utils::GetAPICallResult Succeeded\n"); + PRINT_DEBUG(" Succeeded"); return true; } else { return false; @@ -184,7 +185,7 @@ bool Steam_Utils::GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallbac STEAM_PRIVATE_API( void Steam_Utils::RunFrame() { - PRINT_DEBUG("Steam_Utils::RunFrame\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); // Steam_Client *client = get_steam_client(); // client ->RunCallbacks(true, false, false); @@ -197,7 +198,7 @@ void Steam_Utils::RunFrame() // control how often you do them. uint32 Steam_Utils::GetIPCCallCount() { - PRINT_DEBUG("TODO Steam_Utils::GetIPCCallCount\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); static int i = 0; 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 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. bool Steam_Utils::IsOverlayEnabled() { - PRINT_DEBUG("Steam_Utils::IsOverlayEnabled\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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. bool Steam_Utils::BOverlayNeedsPresent() { - PRINT_DEBUG("Steam_Utils::BOverlayNeedsPresent\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return overlay->NeedPresent(); } @@ -253,7 +254,7 @@ bool Steam_Utils::BOverlayNeedsPresent() STEAM_CALL_RESULT( CheckFileSignature_t ) SteamAPICall_t Steam_Utils::CheckFileSignature( const char *szFileName ) { - PRINT_DEBUG("Steam_Utils::CheckFileSignature '%s'\n", szFileName); + PRINT_DEBUG("'%s'", szFileName); std::lock_guard lock(global_mutex); CheckFileSignature_t data; 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 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 lock(global_mutex); return false; } bool Steam_Utils::ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax ) { - PRINT_DEBUG("ShowGamepadTextInput old\n"); + PRINT_DEBUG("old"); std::lock_guard lock(global_mutex); return ShowGamepadTextInput(eInputMode, eLineInputMode, pchDescription, unCharMax, NULL); } @@ -279,14 +280,14 @@ bool Steam_Utils::ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamep // Returns previously entered text & length uint32 Steam_Utils::GetEnteredGamepadTextLength() { - PRINT_DEBUG("Steam_Utils::GetEnteredGamepadTextLength\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return 0; } bool Steam_Utils::GetEnteredGamepadTextInput( char *pchText, uint32 cchText ) { - PRINT_DEBUG("Steam_Utils::GetEnteredGamepadTextInput\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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 const char* Steam_Utils::GetSteamUILanguage() { - PRINT_DEBUG("Steam_Utils::GetSteamUILanguage\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); return settings->get_language(); } @@ -304,7 +305,7 @@ const char* Steam_Utils::GetSteamUILanguage() // returns true if Steam itself is running in VR mode bool Steam_Utils::IsSteamRunningInVR() { - PRINT_DEBUG("Steam_Utils::IsSteamRunningInVR\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; } @@ -313,7 +314,7 @@ bool Steam_Utils::IsSteamRunningInVR() // Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition. void Steam_Utils::SetOverlayNotificationInset( int nHorizontalInset, int nVerticalInset ) { - PRINT_DEBUG("Steam_Utils::SetOverlayNotificationInset\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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 bool Steam_Utils::IsSteamInBigPictureMode() { - PRINT_DEBUG("Steam_Utils::IsSteamInBigPictureMode\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; } @@ -333,7 +334,7 @@ bool Steam_Utils::IsSteamInBigPictureMode() // ask SteamUI to create and render its OpenVR dashboard void Steam_Utils::StartVRDashboard() { - PRINT_DEBUG("Steam_Utils::StartVRDashboard\n"); + PRINT_DEBUG_TODO(); std::lock_guard 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 bool Steam_Utils::IsVRHeadsetStreamingEnabled() { - PRINT_DEBUG("Steam_Utils::IsVRHeadsetStreamingEnabled\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; } @@ -354,14 +355,14 @@ bool Steam_Utils::IsVRHeadsetStreamingEnabled() // (this is useful for games that have asymmetric multiplayer gameplay) void Steam_Utils::SetVRHeadsetStreamingEnabled( bool bEnabled ) { - PRINT_DEBUG("Steam_Utils::SetVRHeadsetStreamingEnabled\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); } // Returns whether this steam client is a Steam China specific client, vs the global client. bool Steam_Utils::IsSteamChinaLauncher() { - PRINT_DEBUG("Steam_Utils::IsSteamChinaLauncher\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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. bool Steam_Utils::InitFilterText() { - PRINT_DEBUG("Steam_Utils::InitFilterText old\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); 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. bool Steam_Utils::InitFilterText( uint32 unFilterOptions ) { - PRINT_DEBUG("Steam_Utils::InitFilterText\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return false; } @@ -393,7 +394,7 @@ bool Steam_Utils::InitFilterText( uint32 unFilterOptions ) // Returns the number of characters (not bytes) filtered. 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 lock(global_mutex); 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 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 lock(global_mutex); if (!nByteSizeOutFilteredText) return 0; 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. ESteamIPv6ConnectivityState Steam_Utils::GetIPv6ConnectivityState( ESteamIPv6ConnectivityProtocol eProtocol ) { - PRINT_DEBUG("Steam_Utils::GetIPv6ConnectivityState\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return k_ESteamIPv6ConnectivityState_Unknown; } @@ -434,7 +435,7 @@ ESteamIPv6ConnectivityState Steam_Utils::GetIPv6ConnectivityState( ESteamIPv6Con // returns true if currently running on the Steam Deck device 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 lock(global_mutex); 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 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 lock(global_mutex); 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 void Steam_Utils::SetGameLauncherMode( bool bLauncherMode ) { - PRINT_DEBUG("Steam_Utils::SetGameLauncherMode\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); } bool Steam_Utils::DismissFloatingGamepadTextInput() { - PRINT_DEBUG("Steam_Utils::DismissFloatingGamepadTextInput\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return true; } bool Steam_Utils::DismissGamepadTextInput() { - PRINT_DEBUG("Steam_Utils::DismissGamepadTextInput\n"); + PRINT_DEBUG_TODO(); std::lock_guard lock(global_mutex); return true; } diff --git a/dll/steam_video.cpp b/dll/steam_video.cpp index 32303f46..8418fda5 100644 --- a/dll/steam_video.cpp +++ b/dll/steam_video.cpp @@ -20,14 +20,16 @@ // Get a URL suitable for streaming the given Video app ID's video void Steam_Video::GetVideoURL( AppId_t unVideoAppID ) { - PRINT_DEBUG("TODO Steam_Video::GetVideoURL\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } // returns true if user is uploading a live broadcast bool Steam_Video::IsBroadcasting( int *pnNumViewers ) { - PRINT_DEBUG("TODO Steam_Video::IsBroadcasting\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } @@ -36,11 +38,13 @@ bool Steam_Video::IsBroadcasting( int *pnNumViewers ) STEAM_CALL_BACK( GetOPFSettingsResult_t ) void Steam_Video::GetOPFSettings( AppId_t unVideoAppID ) { - PRINT_DEBUG("TODO Steam_Video::GetOPFSettings\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); } bool Steam_Video::GetOPFStringForApp( AppId_t unVideoAppID, char *pchBuffer, int32 *pnBufferSize ) { - PRINT_DEBUG("TODO Steam_Video::GetOPFStringForApp\n"); + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); return false; } diff --git a/overlay_experimental/steam_overlay.cpp b/overlay_experimental/steam_overlay.cpp index 112be5cc..3157af6f 100644 --- a/overlay_experimental/steam_overlay.cpp +++ b/overlay_experimental/steam_overlay.cpp @@ -89,7 +89,7 @@ static inline bool ImGuiHelper_BeginListBox(const char* label, int items_count) 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(object); _this->steam_run_callback(); } @@ -150,14 +150,14 @@ Steam_Overlay::~Steam_Overlay() void Steam_Overlay::request_renderer_detector() { - PRINT_DEBUG("Steam_Overlay::request_renderer_detector\n"); + PRINT_DEBUG_ENTRY(); // request renderer detection future_renderer = InGameOverlay::DetectRenderer(); } 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...) int timeout_ctr = settings->overlay_hook_delay_sec /*seconds*/ * 1000 /*milli per second*/ / renderer_detector_polling_ms; 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 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; } @@ -178,7 +178,7 @@ void Steam_Overlay::renderer_detector_delay_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; while (timeout_ctr > 0 && setup_overlay_called && future_renderer.wait_for(std::chrono::milliseconds(renderer_detector_polling_ms)) != std::future_status::ready) { --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(); // 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) { - PRINT_DEBUG( - "Steam_Overlay::renderer_hook_init_thread failed to detect renderer, ctr=%i, overlay was set up=%i, hook intance state=%i\n", + PRINT_DEBUG("failed to detect renderer, ctr=%i, overlay was set up=%i, hook intance state=%i", timeout_ctr, (int)setup_overlay_called, (int)final_chance ); return; @@ -201,7 +200,7 @@ void Steam_Overlay::renderer_hook_init_thread() // do a one time initialization // std::lock_guard lock(overlay_mutex); _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 load_achievements_data(); @@ -215,12 +214,12 @@ void Steam_Overlay::renderer_hook_init_thread() auto overlay_toggle_callback = [this]() { open_overlay_hook(true); }; _renderer->OverlayProc = [this]() { overlay_render_proc(); }; _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); }; 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 @@ -307,7 +306,7 @@ void Steam_Overlay::create_fonts() font_notif = font_default = font; 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(); } @@ -359,7 +358,7 @@ void Steam_Overlay::load_audio() void Steam_Overlay::load_achievements_data() { - PRINT_DEBUG("Steam_Overlay::load_achievements_data\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(global_mutex); 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; } - 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; } - PRINT_DEBUG("Steam_Overlay::initial_load_achievements_icons\n"); + PRINT_DEBUG_ENTRY(); for (auto &ach : achievements) { { std::lock_guard lock(overlay_mutex); if (!is_ready || !setup_overlay_called) { - PRINT_DEBUG("Steam_Overlay::initial_load_achievements_icons early exit\n"); + PRINT_DEBUG("early exit"); return; } } @@ -417,7 +416,7 @@ void Steam_Overlay::initial_load_achievements_icons() { std::lock_guard lock(overlay_mutex); if (!is_ready || !setup_overlay_called) { - PRINT_DEBUG("Steam_Overlay::initial_load_achievements_icons early exit\n"); + PRINT_DEBUG("early exit"); return; } } @@ -432,7 +431,7 @@ void Steam_Overlay::initial_load_achievements_icons() // called initially and when window size is updated 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 // 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 bool not_yet = false; 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(); // 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 // allow internal frmae processing _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 { if (renderer_frame_processing_requests > 0) { 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 _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 _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 { if (obscure_cursor_requests > 0) { @@ -525,7 +524,7 @@ void Steam_Overlay::obscure_game_input(bool state) { // restore the old cursor _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 const& notifications) bool Steam_Overlay::submit_notification(notification_type type, const std::string &msg, std::pair *frd, const std::weak_ptr &icon) { - PRINT_DEBUG("Steam_Overlay::submit_notification %i\n", (int)type); + PRINT_DEBUG("%i", (int)type); std::lock_guard lock(overlay_mutex); if (!Ready()) return false; int id = find_free_notification_id(notifications); 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; } @@ -650,7 +649,7 @@ bool Steam_Overlay::submit_notification(notification_type type, const std::strin break; default: - PRINT_DEBUG("Steam_Overlay::submit_notification error unhandled type %i\n", (int)type); + PRINT_DEBUG("error unhandled type %i", (int)type); 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) { - PRINT_DEBUG("Steam_Overlay::add_chat_message_notification '%s'\n", message.c_str()); + PRINT_DEBUG("'%s'", message.c_str()); std::lock_guard lock(overlay_mutex); 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 &f) { - PRINT_DEBUG("Steam_Overlay::is_friend_joinable " "%" PRIu64 "\n", f.first.id()); + PRINT_DEBUG("%" PRIu64 "", f.first.id()); std::lock_guard lock(global_mutex); Steam_Friends* steamFriends = get_steam_client()->steam_friends; 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; } FriendGameInfo_t 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)) { - 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; } - PRINT_DEBUG("Steam_Overlay::is_friend_joinable " "%" PRIu64 " false\n", f.first.id()); + PRINT_DEBUG("%" PRIu64 " false", f.first.id()); return false; } @@ -960,7 +959,7 @@ void Steam_Overlay::build_notifications(int width, int height) break; 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; } @@ -1007,7 +1006,7 @@ void Steam_Overlay::build_notifications(int width, int height) break; 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; } @@ -1021,7 +1020,7 @@ void Steam_Overlay::build_notifications(int width, int height) // erase all notifications whose visible time exceeded the max notifications.erase(std::remove_if(notifications.begin(), notifications.end(), [this, &now](Notification &item) { 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); // uncomment this block to restore app input focus switch (item.type) { @@ -1038,7 +1037,7 @@ void Steam_Overlay::build_notifications(int width, int height) break; 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; } @@ -1058,7 +1057,7 @@ void Steam_Overlay::build_notifications(int width, int height) void Steam_Overlay::add_auto_accept_invite_notification() { - PRINT_DEBUG("Steam_Overlay::add_auto_accept_invite_notification\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(overlay_mutex); if (!Ready()) return; @@ -1071,7 +1070,7 @@ void Steam_Overlay::add_auto_accept_invite_notification() void Steam_Overlay::add_invite_notification(std::pair& wnd_state) { - PRINT_DEBUG("Steam_Overlay::add_invite_notification\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(overlay_mutex); if (settings->disable_overlay_friend_notification) 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"); if (connect_str.length() > 0) { 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()) { 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(), settings->overlay_appearance.icon_size, settings->overlay_appearance.icon_size); 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(), 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; - 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 bool yes_clicked = true; 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(); for (auto &fr : friends) { 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() { - PRINT_DEBUG("Steam_Overlay::SetupOverlay\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(overlay_mutex); if (settings->disable_overlay) return; @@ -1666,7 +1665,7 @@ void Steam_Overlay::SetupOverlay() void Steam_Overlay::UnSetupOverlay() { - PRINT_DEBUG("Steam_Overlay::UnSetupOverlay\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(overlay_mutex); bool already_called = true; @@ -1693,7 +1692,7 @@ void Steam_Overlay::UnSetupOverlay() ); if (_renderer) { - PRINT_DEBUG("Steam_Overlay::UnSetupOverlay will free any images resources\n"); + PRINT_DEBUG("will free any images resources"); for (auto &ach : achievements) { if (!ach.icon.expired()) { _renderer->ReleaseImageResource(ach.icon); @@ -1718,13 +1717,13 @@ bool Steam_Overlay::Ready() const bool Steam_Overlay::NeedPresent() const { - PRINT_DEBUG("Steam_Overlay::NeedPresent\n"); + PRINT_DEBUG_ENTRY(); return !settings->disable_overlay; } 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 lock(overlay_mutex); if (settings->disable_overlay) return; @@ -1733,7 +1732,7 @@ void Steam_Overlay::SetNotificationPosition(ENotificationPosition eNotificationP 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 lock(overlay_mutex); if (settings->disable_overlay) return; @@ -1743,7 +1742,7 @@ void Steam_Overlay::SetNotificationInset(int nHorizontalInset, int nVerticalInse 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 lock(overlay_mutex); if (!Ready()) return; @@ -1752,13 +1751,13 @@ void Steam_Overlay::OpenOverlayInvite(CSteamID lobbyId) void Steam_Overlay::OpenOverlay(const char* pchDialog) { - PRINT_DEBUG("TODO Steam_Overlay::OpenOverlay '%s'\n", pchDialog); + PRINT_DEBUG("TODO '%s'", pchDialog); std::lock_guard lock(overlay_mutex); if (!Ready()) return; // TODO: Show pages depending on pchDialog 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(); } else { ShowOverlay(true); @@ -1767,7 +1766,7 @@ void Steam_Overlay::OpenOverlay(const char* pchDialog) void Steam_Overlay::OpenOverlayWebpage(const char* pchURL) { - PRINT_DEBUG("TODO Steam_Overlay::OpenOverlayWebpage '%s'\n", pchURL); + PRINT_DEBUG("TODO '%s'", pchURL); std::lock_guard lock(overlay_mutex); if (!Ready()) return; @@ -1788,7 +1787,7 @@ void Steam_Overlay::ShowOverlay(bool state) show_overlay = state; 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::obscure_game_input(state); @@ -1797,7 +1796,7 @@ void Steam_Overlay::ShowOverlay(bool state) 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 lock(overlay_mutex); 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) { - PRINT_DEBUG("Steam_Overlay::SetRichInvite " "%" PRIu64 " '%s'\n", friendId.id(), connect_str); + PRINT_DEBUG("%" PRIu64 " '%s'", friendId.id(), connect_str); std::lock_guard lock(overlay_mutex); if (!Ready()) return; @@ -1835,7 +1834,7 @@ void Steam_Overlay::SetRichInvite(Friend friendId, const char* connect_str) void Steam_Overlay::FriendConnect(Friend _friend) { - PRINT_DEBUG("Steam_Overlay::FriendConnect " "%" PRIu64 "\n", _friend.id()); + PRINT_DEBUG("%" PRIu64 "", _friend.id()); std::lock_guard lock(overlay_mutex); if (settings->disable_overlay) return; @@ -1852,13 +1851,13 @@ void Steam_Overlay::FriendConnect(Friend _friend) memset(item.chat_input, 0, max_chat_len); item.joinable = false; } 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) { - PRINT_DEBUG("Steam_Overlay::FriendDisconnect " "%" PRIu64 "\n", _friend.id()); + PRINT_DEBUG("%" PRIu64 "", _friend.id()); std::lock_guard lock(overlay_mutex); if (settings->disable_overlay) return; @@ -1874,7 +1873,7 @@ void Steam_Overlay::FriendDisconnect(Friend _friend) // show a notification when the user unlocks an achievement void Steam_Overlay::AddAchievementNotification(nlohmann::json const& ach) { - PRINT_DEBUG("Steam_Overlay::AddAchievementNotification\n"); + PRINT_DEBUG_ENTRY(); std::lock_guard lock(overlay_mutex); if (!Ready()) return; diff --git a/steamclient/steamclient.cpp b/steamclient/steamclient.cpp index 6e933ba8..33b32c08 100644 --- a/steamclient/steamclient.cpp +++ b/steamclient/steamclient.cpp @@ -9,7 +9,7 @@ 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); void *(__stdcall* create_interface)(const char*) = (void * (__stdcall *)(const char*))GetProcAddress(steam_api, "SteamInternal_CreateInterface");