From: DeaDDooMER Date: Sun, 1 Dec 2019 21:04:59 +0000 (+0300) Subject: fix SDL2 for osx-ppc X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=1aabd118ca7663db8646c6ee9ac07b35fc3fb51b;p=d2df-sdl.git fix SDL2 for osx-ppc --- diff --git a/README b/README index c5a6590..58c544c 100644 --- a/README +++ b/README @@ -14,7 +14,7 @@ Requirements: Create the "tmp" and "bin" directories and then run: cd src/game - fpc -O3 -FE../../bin -FU../../tmp Doom2DF.lpr + fpc -g -gl -O3 -FE../../bin -FU../../tmp Doom2DF.lpr Additionally you can add following options: System driver: @@ -40,13 +40,14 @@ Additionally you can add following options: * -dUSE_MPG123 Build with libmpg123 * -dUSE_OPUS Build with libopus Other: + * -dSDL2_NODPI Build for old libSDL2 * -dUSE_MINIUPNPC Build with libminiupnpc for automatic server port forwarding via UPNP * -dENABLE_HOLMES Build with ingame map debugger * -dHEADLESS Build a headless executable for dedicated servers -Replace -O3 with -g -gl to enable debugging features. Run the game with --gdb -when using a debugger to prevent it from eating exceptions. +Run the game with --gdb when using a debugger to prevent it from eating +exceptions. Windows binaries will require the appropriate DLLs (SDL2.dll, SDL2_mixer.dll or FMODEx.dll, ENet.dll, miniupnpc.dll), unless you choose to static link them. diff --git a/src/game/sdl2/g_system.pas b/src/game/sdl2/g_system.pas index bfb76fb..694042c 100644 --- a/src/game/sdl2/g_system.pas +++ b/src/game/sdl2/g_system.pas @@ -531,11 +531,15 @@ implementation flags := SDL_INIT_TIMER or $00004000; {$ENDIF} {$ELSE} - flags := SDL_INIT_JOYSTICK or SDL_INIT_TIMER or SDL_INIT_VIDEO; + flags := SDL_INIT_TIMER or SDL_INIT_VIDEO; {$ENDIF} SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, '0'); if SDL_Init(flags) <> 0 then raise Exception.Create('SDL: Init failed: ' + SDL_GetError); + {$IFNDEF HEADLESS} + if SDL_InitSubSystem(SDL_INIT_JOYSTICK) <> 0 then + e_LogWritefln('SDL: Init subsystem failed: %s', [SDL_GetError()]); + {$ENDIF} SDL_ShowCursor(SDL_DISABLE); end; diff --git a/src/game/sdl2/g_touch.pas b/src/game/sdl2/g_touch.pas index 6971879..23cfbc1 100644 --- a/src/game/sdl2/g_touch.pas +++ b/src/game/sdl2/g_touch.pas @@ -58,8 +58,12 @@ implementation begin founded := false; - if SDL_GetDisplayDPI(0, @dpi, nil, nil) <> 0 then + {$IFNDEF SDL2_NODPI} + if SDL_GetDisplayDPI(0, @dpi, nil, nil) <> 0 then + dpi := 96; + {$ELSE} dpi := 96; + {$ENDIF} sz := Trunc(g_touch_size * dpi); sw := gScreenWidth; sh := gScreenHeight; x := 0; y := Round(sh * g_touch_offset / 100); diff --git a/src/lib/sdl2/sdl2.pas b/src/lib/sdl2/sdl2.pas index 6e77ca2..ab47a82 100644 --- a/src/lib/sdl2/sdl2.pas +++ b/src/lib/sdl2/sdl2.pas @@ -138,7 +138,7 @@ interface {$ENDIF} {$IF DEFINED(UNIX)} - {$IF NOT DEFINED(HAIKU) AND NOT DEFINED(ANDROID)} + {$IF NOT DEFINED(HAIKU) AND NOT DEFINED(ANDROID) AND NOT DEFINED(DARWIN)} uses X, XLib; diff --git a/src/lib/sdl2/sdlsyswm.inc b/src/lib/sdl2/sdlsyswm.inc index e3ac0a8..5dc90fc 100644 --- a/src/lib/sdl2/sdlsyswm.inc +++ b/src/lib/sdl2/sdlsyswm.inc @@ -5,7 +5,7 @@ {$ENDIF} {$IF DEFINED (LINUX) OR DEFINED(UNIX)} - {$IF NOT DEFINED(HAIKU) AND NOT DEFINED(ANDROID)} + {$IF NOT DEFINED(HAIKU) AND NOT DEFINED(ANDROID) AND NOT DEFINED(DARWIN)} {$DEFINE SDL_VIDEO_DRIVER_X11} {$ENDIF} {$IFEND}