Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/steam/steamnetworkingtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,7 @@ typedef SteamNetworkingMessage_t ISteamNetworkingMessage;
typedef SteamNetworkingErrMsg SteamDatagramErrMsg;

inline void SteamNetworkingIPAddr::Clear() { memset( this, 0, sizeof(*this) ); }
inline bool SteamNetworkingIPAddr::IsIPv6AllZeros() const { const uint64 *q = (const uint64 *)m_ipv6; return q[0] == 0 && q[1] == 0; }
inline bool SteamNetworkingIPAddr::IsIPv6AllZeros() const { uint64 q[2] = {}; memcpy(q, m_ipv6, sizeof(m_ipv6)); return q[0] == 0 && q[1] == 0; }
inline void SteamNetworkingIPAddr::SetIPv6( const uint8 *ipv6, uint16 nPort ) { memcpy( m_ipv6, ipv6, 16 ); m_port = nPort; }
inline void SteamNetworkingIPAddr::SetIPv4( uint32 nIP, uint16 nPort ) { m_ipv4.m_8zeros = 0; m_ipv4.m_0000 = 0; m_ipv4.m_ffff = 0xffff; m_ipv4.m_ip[0] = uint8(nIP>>24); m_ipv4.m_ip[1] = uint8(nIP>>16); m_ipv4.m_ip[2] = uint8(nIP>>8); m_ipv4.m_ip[3] = uint8(nIP); m_port = nPort; }
inline bool SteamNetworkingIPAddr::IsIPv4() const { return m_ipv4.m_8zeros == 0 && m_ipv4.m_0000 == 0 && m_ipv4.m_ffff == 0xffff; }
Expand Down
8 changes: 7 additions & 1 deletion src/public/tier0/valve_tracelogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@
#include <windows.h>
//#include <ShlObj.h>
//#include <winsock2.h>
#include <winmeta.h>

// TraceLoggingProvider-related header files are not available in MinGW builds, so disable it.
#if defined(_WIN32) && (defined(__MINGW32__) || defined(__MINGW64__))
#define VALVE_DISABLE_TRACELOGGING
#else
#include <winmeta.h>
#endif

#ifdef VALVE_DISABLE_TRACELOGGING
#define IsTraceLoggingEnabled() false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,20 @@ TRACELOGGING_DEFINE_PROVIDER(
constexpr int k_cbETWEventUDPPacketDataSize = 16;
#endif

#if defined(_WIN32) && (defined(__MINGW32__) || defined(__MINGW64__))
// This one contains `_WSACMSGHDR` and friends in MinGW case (as opposed to `ws2def.h` for ordinary windows builds)
#include <mswsock.h>
#define cmsghdr WSACMSGHDR
#define CMSGHDR WSACMSGHDR
#define CMSG_FIRSTHDR WSA_CMSG_FIRSTHDR
#define CMSG_NXTHDR WSA_CMSG_NXTHDR
#endif

namespace SteamNetworkingSocketsLib {

inline void ETW_LongOp( const char *opName, SteamNetworkingMicroseconds usec, const char *pszInfo )
{
#if IsTraceLoggingEnabled()
if ( !pszInfo )
pszInfo = "";
TraceLoggingWrite(
Expand All @@ -87,6 +97,11 @@ inline void ETW_LongOp( const char *opName, SteamNetworkingMicroseconds usec, co
TraceLoggingUInt64( usec, "Microseconds" ),
TraceLoggingString( pszInfo, "ExtraInfo" )
);
#else
(void)opName;
(void)usec;
(void)pszInfo;
#endif
}

constexpr int k_msMaxPollWait = 1000;
Expand Down Expand Up @@ -4513,6 +4528,7 @@ STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingSockets_DefaultPreFormatDeb
// Gah, some, but not all, of our code has newlines on the end
V_StripTrailingWhitespaceASCII( buf );

#if IsTraceLoggingEnabled()
// Emit an ETW event. Unfortunately, TraceLoggingLevel requires a constant argument
if ( IsTraceLoggingProviderEnabled( HTraceLogging_SteamNetworkingSockets ) )
{
Expand Down Expand Up @@ -4553,6 +4569,7 @@ STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingSockets_DefaultPreFormatDeb
);
}
}
#endif // IsTraceLoggingEnabled()

// Spew to log file?
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SYSTEMSPEW
Expand Down