Skip to content

Commit

Permalink
updated SDL_endian.h and SDL_platform.h from latest SDL2
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Apr 23, 2024
1 parent bb2f7ff commit c140618
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
6 changes: 3 additions & 3 deletions include/SDL/SDL_endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ real SDL-1.2 available to you. */

#if HAS_BUILTIN_BSWAP16
#define SDL_Swap16(x) __builtin_bswap16(x)
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_ushort)
#define SDL_Swap16(x) _byteswap_ushort(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
Expand Down Expand Up @@ -147,7 +147,7 @@ SDL_Swap16(Uint16 x)

#if HAS_BUILTIN_BSWAP32
#define SDL_Swap32(x) __builtin_bswap32(x)
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_ulong)
#define SDL_Swap32(x) _byteswap_ulong(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
Expand Down Expand Up @@ -199,7 +199,7 @@ SDL_Swap32(Uint32 x)

#if HAS_BUILTIN_BSWAP64
#define SDL_Swap64(x) __builtin_bswap64(x)
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_uint64)
#define SDL_Swap64(x) _byteswap_uint64(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
Expand Down
37 changes: 35 additions & 2 deletions include/SDL/SDL_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ requirement is dropped too. Send patches. :) */
#undef __LINUX__ /* do we need to do this? */
#define __ANDROID__ 1
#endif
#if defined(__NGAGE__)
#undef __NGAGE__
#define __NGAGE__ 1
#endif

#if defined(__APPLE__)
/* lets us know what version of Mac OS X we're compiling on */
Expand Down Expand Up @@ -139,7 +143,7 @@ requirement is dropped too. Send patches. :) */
#endif

#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT or non-WinRT */
/* Try to find out if we're compiling for WinRT, GDK or non-WinRT/GDK */
#if defined(_MSC_VER) && defined(__has_include)
#if __has_include(<winapifamily.h>)
#define HAVE_WINAPIFAMILY_H 1
Expand All @@ -161,9 +165,24 @@ requirement is dropped too. Send patches. :) */
#define WINAPI_FAMILY_WINRT 0
#endif /* HAVE_WINAPIFAMILY_H */

#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP)
#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
#else
#define SDL_WINAPI_FAMILY_PHONE 0
#endif

#if WINAPI_FAMILY_WINRT
#undef __WINRT__
#define __WINRT__ 1
#elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */
#undef __WINGDK__
#define __WINGDK__ 1
#elif defined(_GAMING_XBOX_XBOXONE)
#undef __XBOXONE__
#define __XBOXONE__ 1
#elif defined(_GAMING_XBOX_SCARLETT)
#undef __XBOXSERIES__
#define __XBOXSERIES__ 1
#else
#undef __WINDOWS__
#define __WINDOWS__ 1
Expand All @@ -174,10 +193,20 @@ requirement is dropped too. Send patches. :) */
#undef __WIN32__
#define __WIN32__ 1
#endif
#if defined(__PSP__)
/* This is to support generic "any GDK" separate from a platform-specific GDK */
#if defined(__WINGDK__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
#undef __GDK__
#define __GDK__ 1
#endif
#if defined(__PSP__) || defined(__psp__)
#ifdef __PSP__
#undef __PSP__
#endif
#define __PSP__ 1
#endif
#if defined(PS2)
#define __PS2__ 1
#endif

/* The NACL compiler defines __native_client__ and __pnacl__
* Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi
Expand All @@ -199,5 +228,9 @@ requirement is dropped too. Send patches. :) */
#define __VITA__ 1
#endif

#if defined(__3DS__)
#undef __3DS__
#define __3DS__ 1
#endif

#endif

0 comments on commit c140618

Please sign in to comment.