A few more platform fixes

- minbase_identify will now check for _GAMING_XBOX_XBOXONE and
  _GAMING_XBOX_SCARLETT.  (And also _GAMING_XBOX)
- Added IsXboxScarlett() and IsXbox()
- A few places in the low level code need to be tweaked based on IsXbox()
  instead of _XBOX_ONE
- Added IsIOS() and IsTVOS()

Deleted some code that was disabling warnings, I don't think it's needed
anymore.

Tweak defines in CSteamNetworkingUtils::GetPlatformString

PS4/PS5 need Microsoft-style __declspec(dllexport)

P4:7324318
This commit is contained in:
Fletcher Dunn
2022-06-15 13:09:27 -07:00
parent 63dadf6492
commit 7012a24e0d
4 changed files with 39 additions and 31 deletions
+1 -1
View File
@@ -31,7 +31,7 @@
#if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK )
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C"
#elif defined( STEAMNETWORKINGSOCKETS_FOREXPORT )
#ifdef _WIN32
#if defined( _WIN32 ) || defined( __ORBIS__ ) || defined( __PROSPERO__ )
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __declspec( dllexport )
#else
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __attribute__((visibility("default")))
+29 -2
View File
@@ -118,9 +118,12 @@
#define IsDebug() false
#endif
#if defined( _XBOX_ONE )
#if defined( _XBOX_ONE ) || defined( _GAMING_XBOX_XBOXONE )
#define IsXboxOne() true
#define IsConsole() true
#elif defined( _GAMING_XBOX_SCARLETT )
#define IsXboxScarlett() true
#define IsConsole() true
#elif defined( NN_NINTENDO_SDK )
#ifndef _WIN32
#define IsPosix() true
@@ -147,7 +150,12 @@
#define SUPPORTS_IOPOLLINGHELPER
#define IsOSX() true
#define IsPosix() true
//#elif defined( TARGET_OS_IPHONE )
#elif defined( TARGET_OS_IPHONE )
#define IsIOS() true
#define IsPosix() true
#elif defined( TARGET_OS_TV )
#define IsTVOS() true
#define IsPosix() true
#else
#error "Unsupported platform"
#endif
@@ -179,6 +187,13 @@
#ifndef IsXboxOne
#define IsXboxOne() false
#endif
#ifndef IsXboxScarlett
#define IsXboxScarlett() false
#endif
#define IsXbox() ( IsXboxOne() || IsXboxScarlett() )
#if defined( _GAMING_XBOX ) && !IsXbox()
#error "_GAMING_XBOX_XBOXONE or _GAMING_XBOX_SCARLETT should be defined"
#endif
#ifndef IsPS4
#define IsPS4() false
#endif
@@ -186,6 +201,18 @@
#define IsPS5() false
#endif
#define IsPlaystation() ( IsPS4() || IsPS5() )
#ifndef IsIOS
#define IsIOS() false
#if defined(IOS) || defined(__IOS__)
#error "TVOS detection not working"
#endif
#endif
#ifndef IsTVOS
#define IsTVOS() false
#if defined(TVOS) || defined(__TVOS__)
#error "TVOS detection not working"
#endif
#endif
#ifndef IsLinux
#define IsLinux() false
#endif
@@ -2386,9 +2386,8 @@ const char *CSteamNetworkingUtils::GetPlatformString()
{
#if IsNintendoSwitch()
return "nswitch";
#elif defined( _GAMECORE )
// Is this right? This might actually require a system call.
return "xboxx";
#elif IsXboxScarlett()
return "scarlett";
#elif defined( _STADIA )
// Not sure if this works.
return "stadia";
@@ -2398,16 +2397,10 @@ const char *CSteamNetworkingUtils::GetPlatformString()
return "ps4";
#elif IsPS5()
return "ps5";
#elif defined( TVOS ) || defined( __TVOS__ )
#elif IsTVOS()
return "tvos";
#elif defined( __APPLE__ )
#if TARGET_OS_TV
return "tvos";
#elif TARGET_OS_IPHONE
return "ios";
#else
return "osx";
#endif
#elif IsIOS()
return "ios";
#elif IsOSX()
return "osx";
#elif IsAndroid()
@@ -1,16 +1,4 @@
//====== Copyright Valve Corporation, All rights reserved. ====================
#if defined( _MSC_VER ) && ( _MSC_VER <= 1800 )
#pragma warning( disable: 4244 )
// 1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\chrono(749): warning C4244: '=' : conversion from '__int64' to 'time_t', possible loss of data (steamnetworkingsockets_lowlevel.cpp)
#endif
#ifdef __GNUC__
// src/public/tier0/basetypes.h:104:30: error: assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Werror=strict-overflow]
// current steamrt:scout gcc "g++ (SteamRT 4.8.4-1ubuntu15~12.04+steamrt1.2+srt1) 4.8.4" requires this at the top due to optimizations
#pragma GCC diagnostic ignored "-Wstrict-overflow"
#endif
#include <thread>
#include <mutex>
#include <atomic>
@@ -1009,7 +997,7 @@ public:
nullptr // lpCompletionRoutine
);
bool bResult = ( r == 0 );
#ifndef _XBOX_ONE
#if !IsXbox()
if ( !bResult )
{
const char *lpMsgBuf = nullptr;
@@ -3255,12 +3243,12 @@ bool BSteamNetworkingSocketsLowLevelAddRef( SteamNetworkingErrMsg &errMsg )
return false;
}
#ifndef _XBOX_ONE
#if !IsXbox()
#pragma comment( lib, "winmm.lib" )
if ( ::timeBeginPeriod( 1 ) != 0 )
{
::WSACleanup();
#ifdef _XBOX_ONE
#ifdef _XBOX_ONE // Yes I realize this is always false here, but this is shutdown that needs to happen at every return
::CoUninitialize();
#endif
V_strcpy_safe( errMsg, "timeBeginPeriod failed" );
@@ -3475,7 +3463,7 @@ void SteamNetworkingSocketsLowLevelDecRef()
// Nuke sockets and COM
#ifdef _WIN32
#ifndef _XBOX_ONE
#if !IsXbox()
::timeEndPeriod( 1 );
#endif
::WSACleanup();