Skip to content

Commit 7012a24

Browse files
committed
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
1 parent 63dadf6 commit 7012a24

File tree

4 files changed

+39
-31
lines changed

4 files changed

+39
-31
lines changed

include/steam/steamnetworkingtypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK )
3232
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C"
3333
#elif defined( STEAMNETWORKINGSOCKETS_FOREXPORT )
34-
#ifdef _WIN32
34+
#if defined( _WIN32 ) || defined( __ORBIS__ ) || defined( __PROSPERO__ )
3535
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __declspec( dllexport )
3636
#else
3737
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __attribute__((visibility("default")))

src/public/minbase/minbase_identify.h

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,12 @@
118118
#define IsDebug() false
119119
#endif
120120

121-
#if defined( _XBOX_ONE )
121+
#if defined( _XBOX_ONE ) || defined( _GAMING_XBOX_XBOXONE )
122122
#define IsXboxOne() true
123123
#define IsConsole() true
124+
#elif defined( _GAMING_XBOX_SCARLETT )
125+
#define IsXboxScarlett() true
126+
#define IsConsole() true
124127
#elif defined( NN_NINTENDO_SDK )
125128
#ifndef _WIN32
126129
#define IsPosix() true
@@ -147,7 +150,12 @@
147150
#define SUPPORTS_IOPOLLINGHELPER
148151
#define IsOSX() true
149152
#define IsPosix() true
150-
//#elif defined( TARGET_OS_IPHONE )
153+
#elif defined( TARGET_OS_IPHONE )
154+
#define IsIOS() true
155+
#define IsPosix() true
156+
#elif defined( TARGET_OS_TV )
157+
#define IsTVOS() true
158+
#define IsPosix() true
151159
#else
152160
#error "Unsupported platform"
153161
#endif
@@ -179,13 +187,32 @@
179187
#ifndef IsXboxOne
180188
#define IsXboxOne() false
181189
#endif
190+
#ifndef IsXboxScarlett
191+
#define IsXboxScarlett() false
192+
#endif
193+
#define IsXbox() ( IsXboxOne() || IsXboxScarlett() )
194+
#if defined( _GAMING_XBOX ) && !IsXbox()
195+
#error "_GAMING_XBOX_XBOXONE or _GAMING_XBOX_SCARLETT should be defined"
196+
#endif
182197
#ifndef IsPS4
183198
#define IsPS4() false
184199
#endif
185200
#ifndef IsPS5
186201
#define IsPS5() false
187202
#endif
188203
#define IsPlaystation() ( IsPS4() || IsPS5() )
204+
#ifndef IsIOS
205+
#define IsIOS() false
206+
#if defined(IOS) || defined(__IOS__)
207+
#error "TVOS detection not working"
208+
#endif
209+
#endif
210+
#ifndef IsTVOS
211+
#define IsTVOS() false
212+
#if defined(TVOS) || defined(__TVOS__)
213+
#error "TVOS detection not working"
214+
#endif
215+
#endif
189216
#ifndef IsLinux
190217
#define IsLinux() false
191218
#endif

src/steamnetworkingsockets/clientlib/csteamnetworkingsockets.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,9 +2386,8 @@ const char *CSteamNetworkingUtils::GetPlatformString()
23862386
{
23872387
#if IsNintendoSwitch()
23882388
return "nswitch";
2389-
#elif defined( _GAMECORE )
2390-
// Is this right? This might actually require a system call.
2391-
return "xboxx";
2389+
#elif IsXboxScarlett()
2390+
return "scarlett";
23922391
#elif defined( _STADIA )
23932392
// Not sure if this works.
23942393
return "stadia";
@@ -2398,16 +2397,10 @@ const char *CSteamNetworkingUtils::GetPlatformString()
23982397
return "ps4";
23992398
#elif IsPS5()
24002399
return "ps5";
2401-
#elif defined( TVOS ) || defined( __TVOS__ )
2400+
#elif IsTVOS()
24022401
return "tvos";
2403-
#elif defined( __APPLE__ )
2404-
#if TARGET_OS_TV
2405-
return "tvos";
2406-
#elif TARGET_OS_IPHONE
2407-
return "ios";
2408-
#else
2409-
return "osx";
2410-
#endif
2402+
#elif IsIOS()
2403+
return "ios";
24112404
#elif IsOSX()
24122405
return "osx";
24132406
#elif IsAndroid()

src/steamnetworkingsockets/clientlib/steamnetworkingsockets_lowlevel.cpp

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
//====== Copyright Valve Corporation, All rights reserved. ====================
2-
3-
#if defined( _MSC_VER ) && ( _MSC_VER <= 1800 )
4-
#pragma warning( disable: 4244 )
5-
// 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)
6-
#endif
7-
8-
#ifdef __GNUC__
9-
// 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]
10-
// 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
11-
#pragma GCC diagnostic ignored "-Wstrict-overflow"
12-
#endif
13-
142
#include <thread>
153
#include <mutex>
164
#include <atomic>
@@ -1009,7 +997,7 @@ class CRawUDPSocketImpl final : public IRawUDPSocket
1009997
nullptr // lpCompletionRoutine
1010998
);
1011999
bool bResult = ( r == 0 );
1012-
#ifndef _XBOX_ONE
1000+
#if !IsXbox()
10131001
if ( !bResult )
10141002
{
10151003
const char *lpMsgBuf = nullptr;
@@ -3255,12 +3243,12 @@ bool BSteamNetworkingSocketsLowLevelAddRef( SteamNetworkingErrMsg &errMsg )
32553243
return false;
32563244
}
32573245

3258-
#ifndef _XBOX_ONE
3246+
#if !IsXbox()
32593247
#pragma comment( lib, "winmm.lib" )
32603248
if ( ::timeBeginPeriod( 1 ) != 0 )
32613249
{
32623250
::WSACleanup();
3263-
#ifdef _XBOX_ONE
3251+
#ifdef _XBOX_ONE // Yes I realize this is always false here, but this is shutdown that needs to happen at every return
32643252
::CoUninitialize();
32653253
#endif
32663254
V_strcpy_safe( errMsg, "timeBeginPeriod failed" );
@@ -3475,7 +3463,7 @@ void SteamNetworkingSocketsLowLevelDecRef()
34753463

34763464
// Nuke sockets and COM
34773465
#ifdef _WIN32
3478-
#ifndef _XBOX_ONE
3466+
#if !IsXbox()
34793467
::timeEndPeriod( 1 );
34803468
#endif
34813469
::WSACleanup();

0 commit comments

Comments
 (0)