Define SDL_PLATFORM_* macros instead of underscored ones (#8875)

This commit is contained in:
Anonymous Maarten
2024-01-24 02:40:51 +01:00
committed by GitHub
parent ceccf24519
commit 31d133db40
208 changed files with 1293 additions and 1138 deletions

View File

@@ -25,7 +25,7 @@
/* #define DEBUG_TIMERS */
#if !defined(__EMSCRIPTEN__) || !defined(SDL_THREADS_DISABLED)
#if !defined(SDL_PLATFORM_EMSCRIPTEN) || !defined(SDL_THREADS_DISABLED)
typedef struct SDL_Timer
{
@@ -461,7 +461,7 @@ SDL_bool SDL_RemoveTimer(SDL_TimerID id)
return SDL_FALSE;
}
#endif /* !defined(__EMSCRIPTEN__) || !SDL_THREADS_DISABLED */
#endif /* !defined(SDL_PLATFORM_EMSCRIPTEN) || !SDL_THREADS_DISABLED */
static Uint64 tick_start;
static Uint32 tick_numerator_ns;
@@ -470,7 +470,7 @@ static Uint32 tick_numerator_ms;
static Uint32 tick_denominator_ms;
#if defined(SDL_TIMER_WINDOWS) && \
!defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
!defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
#include <mmsystem.h>
#define HAVE_TIME_BEGIN_PERIOD
#endif

View File

@@ -29,7 +29,7 @@
#include "../SDL_timer_c.h"
#ifdef __EMSCRIPTEN__
#ifdef SDL_PLATFORM_EMSCRIPTEN
#include <emscripten.h>
#endif
@@ -47,7 +47,7 @@
#if defined(HAVE_NANOSLEEP) || defined(HAVE_CLOCK_GETTIME)
#include <time.h>
#endif
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
#include <mach/mach_time.h>
#endif
@@ -61,7 +61,7 @@
#endif
/* The first ticks value of the application */
#if !defined(HAVE_CLOCK_GETTIME) && defined(__APPLE__)
#if !defined(HAVE_CLOCK_GETTIME) && defined(SDL_PLATFORM_APPLE)
mach_timebase_info_data_t mach_base_info;
#endif
static SDL_bool checked_monotonic_time = SDL_FALSE;
@@ -74,7 +74,7 @@ static void CheckMonotonicTime(void)
if (clock_gettime(SDL_MONOTONIC_CLOCK, &value) == 0) {
has_monotonic_time = SDL_TRUE;
} else
#elif defined(__APPLE__)
#elif defined(SDL_PLATFORM_APPLE)
if (mach_timebase_info(&mach_base_info) == 0) {
has_monotonic_time = SDL_TRUE;
}
@@ -98,7 +98,7 @@ Uint64 SDL_GetPerformanceCounter(void)
ticks = now.tv_sec;
ticks *= SDL_NS_PER_SECOND;
ticks += now.tv_nsec;
#elif defined(__APPLE__)
#elif defined(SDL_PLATFORM_APPLE)
ticks = mach_absolute_time();
#else
SDL_assert(SDL_FALSE);
@@ -124,7 +124,7 @@ Uint64 SDL_GetPerformanceFrequency(void)
if (has_monotonic_time) {
#ifdef HAVE_CLOCK_GETTIME
return SDL_NS_PER_SECOND;
#elif defined(__APPLE__)
#elif defined(SDL_PLATFORM_APPLE)
Uint64 freq = mach_base_info.denom;
freq *= SDL_NS_PER_SECOND;
freq /= mach_base_info.numer;
@@ -146,7 +146,7 @@ void SDL_DelayNS(Uint64 ns)
Uint64 then, now, elapsed;
#endif
#ifdef __EMSCRIPTEN__
#ifdef SDL_PLATFORM_EMSCRIPTEN
if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) {
/* pseudo-synchronous pause, used directly or through e.g. SDL_WaitEvent */
emscripten_sleep(ns / SDL_NS_PER_MS);

View File

@@ -100,7 +100,7 @@ void SDL_DelayNS(Uint64 ns)
ns = max_delay;
}
#if defined(__WINRT__) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER <= 180030723)
#if defined(SDL_PLATFORM_WINRT) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER <= 180030723)
static HANDLE mutex = 0;
if (!mutex) {
mutex = CreateEventEx(0, 0, 0, EVENT_ALL_ACCESS);