Fix compatibility with Mac OSX 10.4 and 10.5

- Fix build with SDL <=2.0.3
  SDL_GetGlobalMouseState was introduced in 2.0.4
  (which doesn't support OSX 10.5 or older)
- Don't include execinfo.h on Mac OS X 10.4
  This file isn't included in the 10.4 SDK
- Use custom typedef for PFNGLSTENCILOPSEPARATEPROC on OSX 10.4/10.5
  because the system OpenGL headers for those versions don't have it
This commit is contained in:
SiliconExarch 2021-08-27 09:49:25 +01:00 committed by Daniel Gibson
parent 443802b683
commit 4f0c54f63f
4 changed files with 19 additions and 1 deletions

View file

@ -96,6 +96,10 @@ extern void ( APIENTRY *qglColorTableEXT)( int, int, int, int, int, const void *
extern PFNGLACTIVESTENCILFACEEXTPROC qglActiveStencilFaceEXT;
// DG: couldn't find any extension for this, it's supported in GL2.0 and newer, incl OpenGL ES2.0
// SE: work around missing function definition on legacy Mac OS X versions
#if defined(OSX_TIGER) || defined(OSX_LEOPARD)
typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
#endif
extern PFNGLSTENCILOPSEPARATEPROC qglStencilOpSeparate;
// ARB_texture_compression

View file

@ -246,6 +246,7 @@ bool GLimp_Init(glimpParms_t parms) {
#if SDL_VERSION_ATLEAST(2, 0, 0)
int displayIndex = 0;
#if SDL_VERSION_ATLEAST(2, 0, 4)
// try to put the window on the display the mousecursor currently is on
{
int x, y;
@ -264,6 +265,7 @@ bool GLimp_Init(glimpParms_t parms) {
}
}
}
#endif
window = SDL_CreateWindow(ENGINE_VERSION,
SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayIndex),

View file

@ -200,6 +200,18 @@ If you have questions concerning this license or the applicable additional terms
#undef FindText // stupid namespace poluting Microsoft monkeys
#endif
// Apple legacy
#ifdef __APPLE__
#include <Availability.h>
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1040
#define OSX_TIGER
#elif __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
#define OSX_LEOPARD
#endif
#endif
#endif
#define ID_TIME_T time_t
typedef unsigned char byte; // 8 bits

View file

@ -401,7 +401,7 @@ int Sys_GetDriveFreeSpace( const char *path ) {
static const int crashSigs[] = { SIGILL, SIGABRT, SIGFPE, SIGSEGV };
static const char* crashSigNames[] = { "SIGILL", "SIGABRT", "SIGFPE", "SIGSEGV" };
#if ( defined(__linux__) && defined(__GLIBC__) ) || defined(__FreeBSD__) || defined(__APPLE__)
#if ( defined(__linux__) && defined(__GLIBC__) ) || defined(__FreeBSD__) || (defined(__APPLE__) && !defined(OSX_TIGER))
#define D3_HAVE_BACKTRACE
#include <execinfo.h>
#endif