diff --git a/Changelog.md b/Changelog.md index 22eecc03..94f00ce0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -27,6 +27,8 @@ Note: Numbers starting with a "#" like #330 refer to the bugreport with that num * Added build instructions for Linux (and similar systems) to README.md * Updated stb_image and stb_vorbis * Updated minizip (from zlib/contrib) to latest upstream code +* Added `in_namePressed` CVar to print currently pressed key/button (useful for binding keys + in the console or configs). Thanks *Biel Bestué de Luna*! 1.5.2 (2022-06-13) diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index 0557cce4..69f28b15 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -307,7 +307,10 @@ if(D3_COMPILER_IS_GCC_OR_CLANG) add_compile_options(-fno-strict-aliasing) # dear idiot compilers, don't fuck up math code with useless FMA "optimizations" # (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100839) - add_compile_options(-ffp-contract=off) + CHECK_CXX_COMPILER_FLAG("-ffp-contract=off" cxx_has_fp-contract) + if(cxx_has_fp-contract) + add_compile_options(-ffp-contract=off) + endif() if(ASAN) # if this doesn't work, ASan might not be available on your platform, don't set ASAN then.. diff --git a/neo/framework/Common.cpp b/neo/framework/Common.cpp index 0e504481..ad88825a 100644 --- a/neo/framework/Common.cpp +++ b/neo/framework/Common.cpp @@ -2920,12 +2920,18 @@ void idCommonLocal::Init( int argc, char **argv ) { #endif #if SDL_VERSION_ATLEAST(2, 0, 0) - if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER)) // init joystick to work around SDL 2.0.9 bug #4391 -#else - if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO)) // no gamecontroller support in SDL1 -#endif + if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER) != 0) { - Sys_Error("Error while initializing SDL: %s", SDL_GetError()); + if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO) == 0) { // retry without joystick/gamecontroller if it failed + Sys_Printf( "WARNING: Couldn't get SDL gamecontroller support! Gamepads won't work!\n" ); + } else +#else + if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO) != 0) // no gamecontroller support in SDL1 + { +#endif + { + Sys_Error("Error while initializing SDL: %s", SDL_GetError()); + } } Sys_InitThreads(); diff --git a/neo/framework/minizip/ioapi.c b/neo/framework/minizip/ioapi.c index d8e1e5f7..db6689c5 100644 --- a/neo/framework/minizip/ioapi.c +++ b/neo/framework/minizip/ioapi.c @@ -187,7 +187,13 @@ static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T o } ret = 0; + // DG: compat with older zlib versions +#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1243 // orig. code: if(FSEEKO_FUNC((FILE *)stream, (z_off64_t)offset, fseek_origin) != 0) +#else // zlib before 1.2.4.3 didn't have z_off64_t + // DG: just remove the z_off64_t cast + if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0) +#endif ret = -1; return ret; diff --git a/neo/renderer/Image_files.cpp b/neo/renderer/Image_files.cpp index 8ea1dbaa..289f3b07 100644 --- a/neo/renderer/Image_files.cpp +++ b/neo/renderer/Image_files.cpp @@ -28,6 +28,10 @@ If you have questions concerning this license or the applicable additional terms // DG: replace libjpeg with stb_image.h because it causes fewer headaches // include this first, otherwise build breaks because of use_idStr_* #defines in Str.h +#if defined(__APPLE__) && !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 5 + // Extra-Hack for ancient GCC 4.2-based Apple compilers that don't support __thread + #define STBI_NO_THREAD_LOCALS +#endif #define STB_IMAGE_IMPLEMENTATION #define STBI_NO_HDR #define STBI_NO_LINEAR diff --git a/neo/sound/snd_local.h b/neo/sound/snd_local.h index 6c5790eb..c2f5baf8 100644 --- a/neo/sound/snd_local.h +++ b/neo/sound/snd_local.h @@ -40,6 +40,12 @@ If you have questions concerning this license or the applicable additional terms #include #include +// DG: make this code build with older OpenAL headers that don't know about ALC_SOFT_HRTF +// which provides LPALCRESETDEVICESOFT for idSoundSystemLocal::alcResetDeviceSOFT() +#ifndef ALC_SOFT_HRTF + typedef ALCboolean (ALC_APIENTRY*LPALCRESETDEVICESOFT)(ALCdevice *device, const ALCint *attribs); +#endif + #include "framework/UsercmdGen.h" #include "sound/efxlib.h" #include "sound/sound.h" diff --git a/neo/sys/osx/SDLMain.m b/neo/sys/osx/SDLMain.m index 5599789e..ce6a7bd1 100644 --- a/neo/sys/osx/SDLMain.m +++ b/neo/sys/osx/SDLMain.m @@ -15,6 +15,8 @@ #include /* for MAXPATHLEN */ #include +#include + /* For some reason, Apple removed setAppleMenu from the headers in 10.4, but the method still is there and works. To avoid warnings, we declare it ourselves here. */ @@ -226,7 +228,13 @@ static void CustomApplicationMain (int argc, char **argv) /* Create SDLMain and make it the app delegate */ sdlMain = [[SDLMain alloc] init]; + +#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 /* before 10.6 */ + [NSApp setDelegate:sdlMain]; +#else /* 10.6 introduced NSApplicationDelegate, according to + https://developer.apple.com/documentation/appkit/nsapplicationdelegate?language=objc */ [NSApp setDelegate:(id)sdlMain]; +#endif /* Start the main event loop */ [NSApp run];