Make it build and work on old PPC Macs again (#568)

also added the changelog entry for in_namePressed
This commit is contained in:
Daniel Gibson 2024-03-27 00:57:31 +01:00
parent 9ccce9b4b6
commit d6c0bb2003
7 changed files with 41 additions and 6 deletions

View file

@ -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)

View file

@ -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..

View file

@ -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();

View file

@ -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;

View file

@ -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

View file

@ -40,6 +40,12 @@ If you have questions concerning this license or the applicable additional terms
#include <AL/alc.h>
#include <AL/alext.h>
// 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"

View file

@ -15,6 +15,8 @@
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>
#include <Availability.h>
/* 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<NSApplicationDelegate>)sdlMain];
#endif
/* Start the main event loop */
[NSApp run];