Mac and Linux SDL2 binary snapshots
Edward Rudd
2019-04-09 9cd2e9ec8fc0127393dfce9c0359d500c8c238be
source/src/SDL.c
@@ -1,6 +1,6 @@
/*
  Simple DirectMedia Layer
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
  Copyright (C) 1997-2018 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,7 +18,7 @@
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"
#include "./SDL_internal.h"
#if defined(__WIN32__)
#include "core/windows/SDL_windows.h"
@@ -33,12 +33,11 @@
#include "events/SDL_events_c.h"
#include "haptic/SDL_haptic_c.h"
#include "joystick/SDL_joystick_c.h"
#include "sensor/SDL_sensor_c.h"
/* Initialization/Cleanup routines */
#if !SDL_TIMERS_DISABLED
extern int SDL_TimerInit(void);
extern void SDL_TimerQuit(void);
extern void SDL_InitTicks(void);
# include "timer/SDL_timer_c.h"
#endif
#if SDL_VIDEO_DRIVER_WINDOWS
extern int SDL_HelperWindowCreate(void);
@@ -80,7 +79,7 @@
{
    int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
    SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255);
    return (SDL_SubsystemRefCount[subsystem_index] == 0);
    return (SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE;
}
/* Private helper to check if a system needs to be quit. */
@@ -94,7 +93,7 @@
    /* If we're in SDL_Quit, we shut down every subsystem, even if refcount
     * isn't zero.
     */
    return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit;
    return (SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE;
}
void
@@ -114,16 +113,6 @@
    /* Clear the error message */
    SDL_ClearError();
#if SDL_VIDEO_DRIVER_WINDOWS
    if (SDL_HelperWindowCreate() < 0) {
        return -1;
    }
#endif
#if !SDL_TIMERS_DISABLED
    SDL_InitTicks();
#endif
    if ((flags & SDL_INIT_GAMECONTROLLER)) {
        /* game controller implies joystick */
        flags |= SDL_INIT_JOYSTICK;
@@ -133,6 +122,18 @@
        /* video or joystick implies events */
        flags |= SDL_INIT_EVENTS;
    }
#if SDL_VIDEO_DRIVER_WINDOWS
    if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
        if (SDL_HelperWindowCreate() < 0) {
            return -1;
        }
    }
#endif
#if !SDL_TIMERS_DISABLED
    SDL_TicksInit();
#endif
    /* Initialize the event subsystem */
    if ((flags & SDL_INIT_EVENTS)) {
@@ -232,6 +233,20 @@
#endif
    }
    /* Initialize the sensor subsystem */
    if ((flags & SDL_INIT_SENSOR)){
#if !SDL_SENSOR_DISABLED
        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_SENSOR)) {
            if (SDL_SensorInit() < 0) {
                return (-1);
            }
        }
        SDL_PrivateSubsystemRefCountIncr(SDL_INIT_SENSOR);
#else
        return SDL_SetError("SDL not built with sensor support");
#endif
    }
    return (0);
}
@@ -245,6 +260,15 @@
SDL_QuitSubSystem(Uint32 flags)
{
    /* Shut down requested initialized subsystems */
#if !SDL_SENSOR_DISABLED
    if ((flags & SDL_INIT_SENSOR)) {
        if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) {
            SDL_SensorQuit();
        }
        SDL_PrivateSubsystemRefCountDecr(SDL_INIT_SENSOR);
    }
#endif
#if !SDL_JOYSTICK_DISABLED
    if ((flags & SDL_INIT_GAMECONTROLLER)) {
        /* game controller implies joystick */
@@ -353,6 +377,10 @@
#endif
    SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
#if !SDL_TIMERS_DISABLED
    SDL_TicksQuit();
#endif
    SDL_ClearHints();
    SDL_AssertionsQuit();
    SDL_LogResetPriorities();
@@ -394,12 +422,12 @@
    return "AIX";
#elif __ANDROID__
    return "Android";
#elif __BEOS__
    return "BeOS";
#elif __BSDI__
    return "BSDI";
#elif __DREAMCAST__
    return "Dreamcast";
#elif __EMSCRIPTEN__
    return "Emscripten";
#elif __FREEBSD__
    return "FreeBSD";
#elif __HAIKU__
@@ -416,6 +444,8 @@
    return "MacOS Classic";
#elif __MACOSX__
    return "Mac OS X";
#elif __NACL__
    return "NaCl";
#elif __NETBSD__
    return "NetBSD";
#elif __OPENBSD__
@@ -432,6 +462,10 @@
    return "Solaris";
#elif __WIN32__
    return "Windows";
#elif __WINRT__
    return "WinRT";
#elif __TVOS__
    return "tvOS";
#elif __IPHONEOS__
    return "iOS";
#elif __PSP__
@@ -441,9 +475,23 @@
#endif
}
SDL_bool
SDL_IsTablet()
{
#if __ANDROID__
    extern SDL_bool SDL_IsAndroidTablet(void);
    return SDL_IsAndroidTablet();
#elif __IPHONEOS__
    extern SDL_bool SDL_IsIPad(void);
    return SDL_IsIPad();
#else
    return SDL_FALSE;
#endif
}
#if defined(__WIN32__)
#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL))
#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB)
/* Need to include DllMain() on Watcom C for some reason.. */
BOOL APIENTRY
@@ -459,7 +507,7 @@
    }
    return TRUE;
}
#endif /* building DLL with Watcom C */
#endif /* Building DLL */
#endif /* __WIN32__ */