mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Updates SDL to version 2.0.4, which makes it compatible with VS2015.
This commit is contained in:
parent
7b52fed504
commit
b63ef177f4
924 changed files with 79241 additions and 39934 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -18,6 +18,9 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifdef SDL_TIMERS_PSP
|
||||
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_timer.h"
|
||||
|
|
@ -82,5 +85,7 @@ void SDL_Delay(Uint32 ms)
|
|||
sceKernelDelayThreadCB(ms * 1000);
|
||||
}
|
||||
|
||||
#endif /* SDL_TIMERS_PSP */
|
||||
|
||||
/* vim: ts=4 sw=4
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_assert.h"
|
||||
|
||||
/* The clock_gettime provides monotonous time, so we should use it if
|
||||
it's available. The clock_gettime function is behind ifdef
|
||||
|
|
@ -47,6 +48,15 @@
|
|||
#include <mach/mach_time.h>
|
||||
#endif
|
||||
|
||||
/* Use CLOCK_MONOTONIC_RAW, if available, which is not subject to adjustment by NTP */
|
||||
#if HAVE_CLOCK_GETTIME
|
||||
#ifdef CLOCK_MONOTONIC_RAW
|
||||
#define SDL_MONOTONIC_CLOCK CLOCK_MONOTONIC_RAW
|
||||
#else
|
||||
#define SDL_MONOTONIC_CLOCK CLOCK_MONOTONIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* The first ticks value of the application */
|
||||
#if HAVE_CLOCK_GETTIME
|
||||
static struct timespec start_ts;
|
||||
|
|
@ -68,7 +78,7 @@ SDL_TicksInit(void)
|
|||
|
||||
/* Set first ticks value */
|
||||
#if HAVE_CLOCK_GETTIME
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &start_ts) == 0) {
|
||||
if (clock_gettime(SDL_MONOTONIC_CLOCK, &start_ts) == 0) {
|
||||
has_monotonic_time = SDL_TRUE;
|
||||
} else
|
||||
#elif defined(__APPLE__)
|
||||
|
|
@ -100,20 +110,21 @@ SDL_GetTicks(void)
|
|||
if (has_monotonic_time) {
|
||||
#if HAVE_CLOCK_GETTIME
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
clock_gettime(SDL_MONOTONIC_CLOCK, &now);
|
||||
ticks = (now.tv_sec - start_ts.tv_sec) * 1000 + (now.tv_nsec -
|
||||
start_ts.tv_nsec) / 1000000;
|
||||
#elif defined(__APPLE__)
|
||||
uint64_t now = mach_absolute_time();
|
||||
ticks = (((now - start_mach) * mach_base_info.numer) / mach_base_info.denom) / 1000000;
|
||||
ticks = (Uint32)((((now - start_mach) * mach_base_info.numer) / mach_base_info.denom) / 1000000);
|
||||
#else
|
||||
SDL_assert(SDL_FALSE);
|
||||
ticks = 0;
|
||||
#endif
|
||||
} else {
|
||||
struct timeval now;
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
ticks =
|
||||
(now.tv_sec - start_tv.tv_sec) * 1000 + (now.tv_usec -
|
||||
start_tv.tv_usec) / 1000;
|
||||
ticks = (Uint32)((now.tv_sec - start_tv.tv_sec) * 1000 + (now.tv_usec - start_tv.tv_usec) / 1000);
|
||||
}
|
||||
return (ticks);
|
||||
}
|
||||
|
|
@ -130,12 +141,15 @@ SDL_GetPerformanceCounter(void)
|
|||
#if HAVE_CLOCK_GETTIME
|
||||
struct timespec now;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
clock_gettime(SDL_MONOTONIC_CLOCK, &now);
|
||||
ticks = now.tv_sec;
|
||||
ticks *= 1000000000;
|
||||
ticks += now.tv_nsec;
|
||||
#elif defined(__APPLE__)
|
||||
ticks = mach_absolute_time();
|
||||
#else
|
||||
SDL_assert(SDL_FALSE);
|
||||
ticks = 0;
|
||||
#endif
|
||||
} else {
|
||||
struct timeval now;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -30,10 +30,9 @@
|
|||
|
||||
|
||||
/* The first (low-resolution) ticks value of the application */
|
||||
static DWORD start;
|
||||
static DWORD start = 0;
|
||||
static BOOL ticks_started = FALSE;
|
||||
|
||||
#ifndef USE_GETTICKCOUNT
|
||||
/* Store if a high-resolution performance counter exists on the system */
|
||||
static BOOL hires_timer_available;
|
||||
/* The first high-resolution ticks value of the application */
|
||||
|
|
@ -41,10 +40,10 @@ static LARGE_INTEGER hires_start_ticks;
|
|||
/* The number of ticks per second of the high-resolution performance counter */
|
||||
static LARGE_INTEGER hires_ticks_per_second;
|
||||
|
||||
#ifndef __WINRT__
|
||||
static void
|
||||
timeSetPeriod(UINT uPeriod)
|
||||
SDL_SetSystemTimerResolution(const UINT uPeriod)
|
||||
{
|
||||
#ifndef __WINRT__
|
||||
static UINT timer_period = 0;
|
||||
|
||||
if (uPeriod != timer_period) {
|
||||
|
|
@ -58,6 +57,7 @@ timeSetPeriod(UINT uPeriod)
|
|||
timeBeginPeriod(timer_period);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -72,12 +72,9 @@ SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValu
|
|||
uPeriod = 1;
|
||||
}
|
||||
if (uPeriod || oldValue != hint) {
|
||||
timeSetPeriod(uPeriod);
|
||||
SDL_SetSystemTimerResolution(uPeriod);
|
||||
}
|
||||
}
|
||||
#endif /* ifndef __WINRT__ */
|
||||
|
||||
#endif /* !USE_GETTICKCOUNT */
|
||||
|
||||
void
|
||||
SDL_TicksInit(void)
|
||||
|
|
@ -87,10 +84,12 @@ SDL_TicksInit(void)
|
|||
}
|
||||
ticks_started = SDL_TRUE;
|
||||
|
||||
/* if we didn't set a precision, set it high. This affects lots of things
|
||||
on Windows besides the SDL timers, like audio callbacks, etc. */
|
||||
SDL_AddHintCallback(SDL_HINT_TIMER_RESOLUTION,
|
||||
SDL_TimerResolutionChanged, NULL);
|
||||
|
||||
/* Set first ticks value */
|
||||
#ifdef USE_GETTICKCOUNT
|
||||
start = GetTickCount();
|
||||
#else
|
||||
/* QueryPerformanceCounter has had problems in the past, but lots of games
|
||||
use it, so we'll rely on it here.
|
||||
*/
|
||||
|
|
@ -99,51 +98,36 @@ SDL_TicksInit(void)
|
|||
QueryPerformanceCounter(&hires_start_ticks);
|
||||
} else {
|
||||
hires_timer_available = FALSE;
|
||||
#ifdef __WINRT__
|
||||
start = 0; /* the timer failed to start! */
|
||||
#else
|
||||
timeSetPeriod(1); /* use 1 ms timer precision */
|
||||
#ifndef __WINRT__
|
||||
start = timeGetTime();
|
||||
|
||||
SDL_AddHintCallback(SDL_HINT_TIMER_RESOLUTION,
|
||||
SDL_TimerResolutionChanged, NULL);
|
||||
#endif /* __WINRT__ */
|
||||
}
|
||||
#endif /* USE_GETTICKCOUNT */
|
||||
}
|
||||
|
||||
void
|
||||
SDL_TicksQuit(void)
|
||||
{
|
||||
#ifndef USE_GETTICKCOUNT
|
||||
if (!hires_timer_available) {
|
||||
#ifndef __WINRT__
|
||||
SDL_DelHintCallback(SDL_HINT_TIMER_RESOLUTION,
|
||||
SDL_TimerResolutionChanged, NULL);
|
||||
|
||||
timeSetPeriod(0);
|
||||
#endif /* __WINRT__ */
|
||||
}
|
||||
#endif /* USE_GETTICKCOUNT */
|
||||
|
||||
SDL_SetSystemTimerResolution(0); /* always release our timer resolution request. */
|
||||
|
||||
start = 0;
|
||||
ticks_started = SDL_FALSE;
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_GetTicks(void)
|
||||
{
|
||||
DWORD now;
|
||||
#ifndef USE_GETTICKCOUNT
|
||||
DWORD now = 0;
|
||||
LARGE_INTEGER hires_now;
|
||||
#endif
|
||||
|
||||
if (!ticks_started) {
|
||||
SDL_TicksInit();
|
||||
}
|
||||
|
||||
#ifdef USE_GETTICKCOUNT
|
||||
now = GetTickCount();
|
||||
#else
|
||||
if (hires_timer_available) {
|
||||
QueryPerformanceCounter(&hires_now);
|
||||
|
||||
|
|
@ -153,13 +137,10 @@ SDL_GetTicks(void)
|
|||
|
||||
return (DWORD) hires_now.QuadPart;
|
||||
} else {
|
||||
#ifdef __WINRT__
|
||||
now = 0;
|
||||
#else
|
||||
#ifndef __WINRT__
|
||||
now = timeGetTime();
|
||||
#endif /* __WINRT__ */
|
||||
}
|
||||
#endif
|
||||
|
||||
return (now - start);
|
||||
}
|
||||
|
|
@ -186,23 +167,30 @@ SDL_GetPerformanceFrequency(void)
|
|||
return frequency.QuadPart;
|
||||
}
|
||||
|
||||
#ifdef __WINRT__
|
||||
static void
|
||||
Sleep(DWORD timeout)
|
||||
{
|
||||
static HANDLE mutex = 0;
|
||||
if ( ! mutex )
|
||||
{
|
||||
mutex = CreateEventEx(0, 0, 0, EVENT_ALL_ACCESS);
|
||||
}
|
||||
WaitForSingleObjectEx(mutex, timeout, FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
SDL_Delay(Uint32 ms)
|
||||
{
|
||||
/* Sleep() is not publicly available to apps in early versions of WinRT.
|
||||
*
|
||||
* Visual C++ 2013 Update 4 re-introduced Sleep() for Windows 8.1 and
|
||||
* Windows Phone 8.1.
|
||||
*
|
||||
* Use the compiler version to determine availability.
|
||||
*
|
||||
* NOTE #1: _MSC_FULL_VER == 180030723 for Visual C++ 2013 Update 3.
|
||||
* NOTE #2: Visual C++ 2013, when compiling for Windows 8.0 and
|
||||
* Windows Phone 8.0, uses the Visual C++ 2012 compiler to build
|
||||
* apps and libraries.
|
||||
*/
|
||||
#if defined(__WINRT__) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER <= 180030723)
|
||||
static HANDLE mutex = 0;
|
||||
if (!mutex) {
|
||||
mutex = CreateEventEx(0, 0, 0, EVENT_ALL_ACCESS);
|
||||
}
|
||||
WaitForSingleObjectEx(mutex, ms, FALSE);
|
||||
#else
|
||||
Sleep(ms);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* SDL_TIMER_WINDOWS */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue