forked from JACoders/OpenJK
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
87 changed files
with
4,511 additions
and
530 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2016 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2017 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -26,8 +26,8 @@ | |
*/ | ||
|
||
|
||
#ifndef _SDL_H | ||
#define _SDL_H | ||
#ifndef SDL_h_ | ||
#define SDL_h_ | ||
|
||
#include "SDL_main.h" | ||
#include "SDL_stdinc.h" | ||
|
@@ -40,17 +40,18 @@ | |
#include "SDL_error.h" | ||
#include "SDL_events.h" | ||
#include "SDL_filesystem.h" | ||
#include "SDL_joystick.h" | ||
#include "SDL_gamecontroller.h" | ||
#include "SDL_haptic.h" | ||
#include "SDL_hints.h" | ||
#include "SDL_joystick.h" | ||
#include "SDL_loadso.h" | ||
#include "SDL_log.h" | ||
#include "SDL_messagebox.h" | ||
#include "SDL_mutex.h" | ||
#include "SDL_power.h" | ||
#include "SDL_render.h" | ||
#include "SDL_rwops.h" | ||
#include "SDL_shape.h" | ||
#include "SDL_system.h" | ||
#include "SDL_thread.h" | ||
#include "SDL_timer.h" | ||
|
@@ -72,14 +73,14 @@ extern "C" { | |
* specify the subsystems which you will be using in your application. | ||
*/ | ||
/* @{ */ | ||
#define SDL_INIT_TIMER 0x00000001 | ||
#define SDL_INIT_AUDIO 0x00000010 | ||
#define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ | ||
#define SDL_INIT_JOYSTICK 0x00000200 /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ | ||
#define SDL_INIT_HAPTIC 0x00001000 | ||
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ | ||
#define SDL_INIT_EVENTS 0x00004000 | ||
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< compatibility; this flag is ignored. */ | ||
#define SDL_INIT_TIMER 0x00000001u | ||
#define SDL_INIT_AUDIO 0x00000010u | ||
#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ | ||
#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ | ||
#define SDL_INIT_HAPTIC 0x00001000u | ||
#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ | ||
#define SDL_INIT_EVENTS 0x00004000u | ||
#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */ | ||
#define SDL_INIT_EVERYTHING ( \ | ||
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ | ||
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ | ||
|
@@ -95,8 +96,8 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); | |
* This function initializes specific SDL subsystems | ||
* | ||
* Subsystem initialization is ref-counted, you must call | ||
* SDL_QuitSubSystem for each SDL_InitSubSystem to correctly | ||
* shutdown a subsystem manually (or call SDL_Quit to force shutdown). | ||
* SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly | ||
* shutdown a subsystem manually (or call SDL_Quit() to force shutdown). | ||
* If a subsystem is already loaded then this call will | ||
* increase the ref-count and return. | ||
*/ | ||
|
@@ -127,6 +128,6 @@ extern DECLSPEC void SDLCALL SDL_Quit(void); | |
#endif | ||
#include "close_code.h" | ||
|
||
#endif /* _SDL_H */ | ||
#endif /* SDL_h_ */ | ||
|
||
/* vi: set ts=4 sw=4 expandtab: */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2016 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2017 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -19,8 +19,8 @@ | |
3. This notice may not be removed or altered from any source distribution. | ||
*/ | ||
|
||
#ifndef _SDL_assert_h | ||
#define _SDL_assert_h | ||
#ifndef SDL_assert_h_ | ||
#define SDL_assert_h_ | ||
|
||
#include "SDL_config.h" | ||
|
||
|
@@ -51,9 +51,11 @@ assert can have unique static variables associated with it. | |
/* Don't include intrin.h here because it contains C++ code */ | ||
extern void __cdecl __debugbreak(void); | ||
#define SDL_TriggerBreakpoint() __debugbreak() | ||
#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) | ||
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) | ||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) | ||
#elif defined(HAVE_SIGNAL_H) | ||
#elif defined(__386__) && defined(__WATCOMC__) | ||
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } } | ||
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__) | ||
#include <signal.h> | ||
#define SDL_TriggerBreakpoint() raise(SIGTRAP) | ||
#else | ||
|
@@ -63,7 +65,7 @@ assert can have unique static variables associated with it. | |
|
||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ | ||
# define SDL_FUNCTION __func__ | ||
#elif ((__GNUC__ >= 2) || defined(_MSC_VER)) | ||
#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__)) | ||
# define SDL_FUNCTION __FUNCTION__ | ||
#else | ||
# define SDL_FUNCTION "???" | ||
|
@@ -201,7 +203,7 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( | |
* | ||
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()! | ||
* | ||
* \return SDL_AssertState value of how to handle the assertion failure. | ||
* Return SDL_AssertState value of how to handle the assertion failure. | ||
* | ||
* \param handler Callback function, called when an assertion fails. | ||
* \param userdata A pointer passed to the callback as-is. | ||
|
@@ -250,7 +252,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse | |
* <code> | ||
* const SDL_AssertData *item = SDL_GetAssertionReport(); | ||
* while (item) { | ||
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", | ||
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n", | ||
* item->condition, item->function, item->filename, | ||
* item->linenum, item->trigger_count, | ||
* item->always_ignore ? "yes" : "no"); | ||
|
@@ -284,6 +286,6 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); | |
#endif | ||
#include "close_code.h" | ||
|
||
#endif /* _SDL_assert_h */ | ||
#endif /* SDL_assert_h_ */ | ||
|
||
/* vi: set ts=4 sw=4 expandtab: */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2016 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2017 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -56,8 +56,8 @@ | |
* All of the atomic operations that modify memory are full memory barriers. | ||
*/ | ||
|
||
#ifndef _SDL_atomic_h_ | ||
#define _SDL_atomic_h_ | ||
#ifndef SDL_atomic_h_ | ||
#define SDL_atomic_h_ | ||
|
||
#include "SDL_stdinc.h" | ||
#include "SDL_platform.h" | ||
|
@@ -118,13 +118,16 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); | |
* The compiler barrier prevents the compiler from reordering | ||
* reads and writes to globally visible variables across the call. | ||
*/ | ||
#if defined(_MSC_VER) && (_MSC_VER > 1200) | ||
#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__) | ||
void _ReadWriteBarrier(void); | ||
#pragma intrinsic(_ReadWriteBarrier) | ||
#define SDL_CompilerBarrier() _ReadWriteBarrier() | ||
#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) | ||
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */ | ||
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") | ||
#elif defined(__WATCOMC__) | ||
extern _inline void SDL_CompilerBarrier (void); | ||
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact []; | ||
#else | ||
#define SDL_CompilerBarrier() \ | ||
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); } | ||
|
@@ -149,18 +152,21 @@ void _ReadWriteBarrier(void); | |
* For more information on these semantics, take a look at the blog post: | ||
* http://preshing.com/20120913/acquire-and-release-semantics | ||
*/ | ||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); | ||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); | ||
|
||
#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) | ||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") | ||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") | ||
#elif defined(__GNUC__) && defined(__arm__) | ||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) | ||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") | ||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") | ||
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) | ||
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__) | ||
#ifdef __thumb__ | ||
/* The mcr instruction isn't available in thumb mode, use real functions */ | ||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease(); | ||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(); | ||
#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction() | ||
#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction() | ||
#else | ||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") | ||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") | ||
|
@@ -263,6 +269,6 @@ extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a); | |
|
||
#include "close_code.h" | ||
|
||
#endif /* _SDL_atomic_h_ */ | ||
#endif /* SDL_atomic_h_ */ | ||
|
||
/* vi: set ts=4 sw=4 expandtab: */ |
Oops, something went wrong.