Compare commits

...
33 Commits
Author SHA1 Message Date
Gustaf Alhäll 89cecb88f5 Update license info 2025-12-06 19:45:35 +01:00
Gustaf Alhäll baf5c8d66b Fix music looping on digital 2025-12-06 19:45:32 +01:00
Gustaf Alhäll 72000c4546 Fix memory leak in AATree string trees 2025-12-06 19:45:29 +01:00
Gustaf Alhäll 82b774b2c3 Fix use-after-free when mobj is removed while still playing sounds 2025-12-06 19:45:27 +01:00
Gustaf Alhäll 3818b9ad1a Limit audio channels to 2 2025-12-05 00:22:09 +01:00
Alug ca8e811bd9 sdl_sound: attempt to fix sounds cutting off
i suck at explaining so just trust. :chonkbuncle:
Game sound handling has no idea which sound it is playing/checking, so a sound that ended frees its slot and it might get occupied again without the game knowing
so just encode the channel number into the sound so we can actually check
2025-12-04 17:52:38 +01:00
Alug 97ca034037 sdl_sound: handle explicit float conversions 2025-12-04 17:52:35 +01:00
Alug ac46f7ed00 add missing Fluidsynth ifdefs 2025-12-04 17:52:32 +01:00
Gustaf Alhäll 0afed59329 Fix MIDI music looping 2025-12-04 17:52:30 +01:00
Gustaf Alhäll ec3a1fee70 Tweak audio settings 2025-12-04 17:52:25 +01:00
Alug 5e8c0c3806 Add chorus and reverb settings to MIDI 2025-12-04 17:52:22 +01:00
Gustaf Alhäll 05ea898345 Fix Haiku build 2025-12-04 17:52:11 +01:00
Gustaf Alhäll 0c1fdc0be8 Fine-tune volume settings 2025-12-04 17:52:08 +01:00
Gustaf Alhäll 0e4c72e6f6 Implement MIDI seeking 2025-12-04 17:52:05 +01:00
Alug 29b83903ef delet the bird music resynching stuff
idk who even wants this, its pain, and even more pain to adapt
2025-12-04 17:52:03 +01:00
Alug 1cae09fa11 sdl_audio: use float M_PI for S_CURVE
meant for floats, prevents implicit double conversions
2025-12-04 17:51:59 +01:00
Alug 4a56819bc3 makefile: move openmpt stuff to before sdl stuff
seems to fix linking openmpt without mixer for some reason oh well
2025-12-01 16:49:11 +01:00
Alug 567a48aac3 sdl_sound: fix -Wmaybe-uninitialized warning 2025-12-01 16:49:08 +01:00
Alug d100401c5f this shouldnt be in sourcefile oops 2025-12-01 16:49:05 +01:00
Alug 6dee9fa561 add back "nearest" resampling from mixer
sdls own resampler uses linear interpolation, which sounds super muffled to me
some may like this, but i dont want to change how the game "sounds"
2025-12-01 16:49:01 +01:00
Alug 5bd7a09d9f force 44100khz sample rate
sounds better to me honestly
2025-12-01 16:48:56 +01:00
Alug 47477c2d03 make gme and tracker music slightly louder
prob needs some adjustment, but both were always quite quiet
2025-12-01 16:48:53 +01:00
Alug cd128a1084 lock audio stream in I_PlaySong
seems to fix weird crashes with gme
2025-12-01 16:48:49 +01:00
Alug 34f2afa3d9 add "audiobuffersize" handling
uses the SDL_AUDIO_DEVICE_SAMPLE_FRAMES hint
2025-12-01 16:48:46 +01:00
Alug 22f285edec disable sound precache for sdl sound 2025-12-01 16:48:43 +01:00
Alug 592abdef96 pitch is a float 2025-12-01 16:48:40 +01:00
Alug a27eee8e2f add few missing audiostream unlocks 2025-12-01 16:48:37 +01:00
Alug 904019d24b fix startup playing a super loud bit of music 2025-12-01 16:48:32 +01:00
Alug c6ca5a6f0f i_video: few type fixes for sdl3 2025-12-01 16:48:29 +01:00
Alug 2392f0484c remove hwr_shutdown call
honestly this didnt help with the issue i had, game should already release all the memory on quit anyways.
this just makes it take longer to quit
2025-12-01 16:48:26 +01:00
Alug 986a131a36 fix a few warnings 2025-12-01 16:48:23 +01:00
Alug e9685ef3e8 port srb2classics sdl audio system
still needs a little work reimplementing everything we got

from: https://codeberg.org/srb2classic/srb2classic/pulls/177
2025-12-01 16:48:18 +01:00
Alug 59f194cb9d fuckit SDL3 2025-12-01 16:48:15 +01:00
26 changed files with 2439 additions and 405 deletions

No files matched your search

+10 -6
View File
@@ -972,6 +972,14 @@ Public License instead of this License. But first, please read
Copyright (C) 1995-2018 Free Software Foundation, Inc.
https://www.gnu.org/software/gettext/
- FluidSynth
Copyright (C) 2000-2025 Peter Hanappe and others.
https://www.fluidsynth.org/
- libsndfile
Copyright (C) 1999-2016 Erik de Castro Lopo
https://libsndfile.github.io/libsndfile/
- mpg123
Copyright (c) 1995-2013 by Michael Hipp and others,
free software under the terms of the LGPL v2.1
@@ -1699,12 +1707,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
zlib License
applies to:
- Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
https://www.libsdl.org/hg.php
- SDL_mixer: An audio mixer library based on the SDL library
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
https://www.libsdl.org/projects/SDL_mixer/
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
https://libsdl.org/
- zlib
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
+41
View File
@@ -0,0 +1,41 @@
# Find FluidSynth
# Once done, this will define
#
# FLUIDSYNTH_FOUND - system has FluidSynth
# FLUIDSYNTH_INCLUDE_DIRS - FluidSynth include directories
# FLUIDSYNTH_LIBRARIES - link libraries
include(LibFindMacros)
libfind_pkg_check_modules(FLUIDSYNTH_PKGCONF FLUIDSYNTH)
# includes
find_path(FLUIDSYNTH_INCLUDE_DIR
NAMES fluidsynth.h
PATHS
${FLUIDSYNTH_PKGCONF_INCLUDE_DIRS}
)
# library
find_library(FLUIDSYNTH_LIBRARY
NAMES fluidsynth
PATHS
${FLUIDSYNTH_PKGCONF_LIBRARY_DIRS}
"/usr/lib"
"/usr/local/lib"
)
# set include dir variables
set(FLUIDSYNTH_PROCESS_INCLUDES FLUIDSYNTH_INCLUDE_DIR)
set(FLUIDSYNTH_PROCESS_LIBS FLUIDSYNTH_LIBRARY)
libfind_process(FLUIDSYNTH)
if(FLUIDSYNTH_FOUND AND NOT TARGET FluidSynth::libfluidsynth)
add_library(FluidSynth::libfluidsynth UNKNOWN IMPORTED)
set_target_properties(
FluidSynth::libfluidsynth
PROPERTIES
IMPORTED_LOCATION "${FLUIDSYNTH_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FLUIDSYNTH_INCLUDE_DIR}"
)
endif()
+1 -1
View File
@@ -8,6 +8,7 @@ passthru_opts+=\
HAVE_MINIUPNPC\
HAVE_DISCORDRPC DEVELOP\
NOHOLEPUNCH\
NOOPENMPT\
# build with debugging information
ifdef DEBUGMODE
@@ -91,7 +92,6 @@ endif
default_packages:=\
LIBGME/libgme/LIBGME\
OPENMPT/libopenmpt/LIBOPENMPT\
ZLIB/zlib\
$(foreach p,$(default_packages),\
+13 -9
View File
@@ -29,8 +29,19 @@ ifndef NOHW
sources+=sdl/ogl_sdl.c
endif
ifndef NOOPENMPT
LIBOPENMPT_PKGCONFIG?=libopenmpt
$(eval $(call Use_pkg_config,LIBOPENMPT))
opts+=-DHAVE_OPENMPT
endif
NOMIXER=1
ifdef NOMIXER
sources+=sdl/dummy_sound.c
#sources+=sdl/dummy_sound.c
sources+=sdl/sdl_sound.c
SNDFILE_PKGCONFIG?=sndfile
$(eval $(call Use_pkg_config,SNDFILE))
else
opts+=-DHAVE_MIXER
sources+=sdl/mixer_sound.c
@@ -45,15 +56,8 @@ opts+=-DHAVE_THREADS
sources+=sdl/i_threads.c
endif
ifdef SDL_PKGCONFIG
SDL_PKGCONFIG?=sdl3
$(eval $(call Use_pkg_config,SDL))
else
SDL_CONFIG?=$(call Prefix,sdl2-config)
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) \
$(if $(STATIC),--static-libs,--libs))
$(eval $(call Propogate_flags,SDL))
endif
ifdef MINGW
ifndef NOSDLMAIN
+3 -3
View File
@@ -79,14 +79,14 @@ $(eval $(call _set,LIBOPENMPT))
lib:=../libs/SDL2_mixer/$(mingw)
ifdef SDL
mixer_opts:=-I$(lib)/include/SDL2
mixer_opts:=-I$(lib)/include/SDL3
mixer_libs:=-L$(lib)/lib
lib:=../libs/SDL2/$(mingw)
SDL_opts:=-I$(lib)/include/SDL2\
SDL_opts:=-I$(lib)/include/SDL3\
$(mixer_opts) -Dmain=SDL_main
SDL_libs:=-L$(lib)/lib $(mixer_libs)\
-lmingw32 -lSDL2main -lSDL2 -mwindows
-lmingw32 -lSDL3main -lSDL3 -mwindows
$(eval $(call _set,SDL))
endif
+1 -1
View File
@@ -1264,7 +1264,7 @@ static void IdentifyVersion(void)
if (AddIWAD("extra3.kart", srb2waddir))
found_extra3_kart = true;
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
#if defined (HAVE_SDL)
#define MUSICTEST(str) \
musicpath = va(pandf, srb2waddir, str);\
handle = W_OpenWadFile(&musicpath, false); \
+2 -1
View File
@@ -20,6 +20,7 @@
// but I can't stand that gibberish. D:
#define SOUND_DUMMY 0
#define SOUND_MIXER 1
#define SOUND_SDL 2
#ifndef SOUND
#ifdef HAVE_SDL
@@ -27,7 +28,7 @@
#ifdef HAVE_MIXER
#define SOUND SOUND_MIXER
#else
#define SOUND SOUND_DUMMY
#define SOUND SOUND_SDL
#endif
#else
#define SOUND SOUND_DUMMY
+1 -1
View File
@@ -27,7 +27,7 @@ extern "C" {
#ifdef HAVE_SDL
#define _MATH_DEFINES_DEFINED
#include "SDL_opengl.h" //Alam_GBC: Simple, yes?
#include <SDL3/SDL_opengl.h> //Alam_GBC: Simple, yes?
#else
#include <GL/gl.h>
-2
View File
@@ -158,8 +158,6 @@ UINT32 I_GetSongLoopPoint(void);
boolean I_SetSongPosition(UINT32 position);
UINT32 I_GetSongPosition(void);
void I_UpdateSongLagThreshold (void);
/// ------------------------
// MUSIC PLAYBACK
/// ------------------------
+6 -4
View File
@@ -49,17 +49,19 @@ aatree_t *M_AATreeAlloc(UINT32 flags)
return aatree;
}
static void M_AATreeFree_Node(aatree_node_t *node)
static void M_AATreeFree_Node(aatree_node_t *node, bool is_string)
{
if (node->left) M_AATreeFree_Node(node->left);
if (node->right) M_AATreeFree_Node(node->right);
if (node->left) M_AATreeFree_Node(node->left, is_string);
if (node->right) M_AATreeFree_Node(node->right, is_string);
if (is_string)
Z_Free(node->value);
Z_Free(node);
}
void M_AATreeFree(aatree_t *aatree)
{
if (aatree->root)
M_AATreeFree_Node(aatree->root);
M_AATreeFree_Node(aatree->root, (aatree->flags & AATREE_STRING) == AATREE_STRING);
Z_Free(aatree);
}
+2 -3
View File
@@ -88,8 +88,8 @@
#include "z_zone.h"
#include "mserv.h"
#if defined(HAVE_SDL)
#include "SDL.h"
#if defined (HAVE_SDL)
#include <SDL3/SDL.h>
#if SDL_VERSION_ATLEAST(2,0,0)
#include "sdl/sdlmain.h" // JOYSTICK_HOTPLUG
#endif
@@ -504,7 +504,6 @@ static INT32 M_ShiftChar(INT32 ch)
// Pretty and consistent ^u^
// See also G_GetGametypeColor.
//
static INT32 highlightflags, recommendedflags, warningflags;
inline static void M_GetGametypeColor(void)
+12 -7
View File
@@ -1153,6 +1153,13 @@ static menuitem_t OP_SoundAdvancedMenu[] =
{IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 35},
#endif
#ifdef HAVE_FLUIDSYNTH
{IT_HEADER, NULL, "MIDI Settings", NULL, NULL, OPENMPT_MENUOFFSET},
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Sound Font File", NULL, &cv_midisoundfontpath, OPENMPT_MENUOFFSET+12},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chorus", NULL, &cv_midichorus, OPENMPT_MENUOFFSET+40},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Reverb", NULL, &cv_midireverb, OPENMPT_MENUOFFSET+50},
#endif
{IT_HEADER, NULL, "Misc", NULL, 45},
{IT_STRING | IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 55},
@@ -1180,6 +1187,11 @@ static const char* OP_SoundAdvancedTooltips[] =
"Which Amiga should be used for .mod playback?",
#endif
"How far should the four channels in .mod be panned?",
#endif
#ifdef HAVE_FLUIDSYNTH
"Which MIDI soundfont to use",
"Controls the chorus of MIDI playback\n setting this too high might cause some instruments to be overexposed",
"Controls the reverb of MIDI playback\n setting this too high might cause notes to be drawn out",
#endif
NULL,
"How many times is the same sound allowed to play at once?\nIf 0 theres no limit.",
@@ -2180,9 +2192,6 @@ static menuitem_t OP_AdvancedBirdMenu[] =
{IT_STRING | IT_CVAR, NULL, "Fade Back from Grow", &cv_growmusicfade, 20},
{IT_STRING | IT_CVAR, NULL, "Fade Out Before Respawning", &cv_respawnfademusicout, 30},
{IT_STRING | IT_CVAR, NULL, "Fade Back In While Respawning", &cv_respawnfademusicback, 40},
{IT_STRING | IT_CVAR, NULL, "Resync Threshold", &cv_music_resync_threshold, 60},
{IT_STRING | IT_CVAR, NULL, "Resync Special Music Only", &cv_music_resync_powerups_only, 70},
};
static const char* OP_AdvancedBirdTooltips[] =
@@ -2192,8 +2201,6 @@ static const char* OP_AdvancedBirdTooltips[] =
"Fade in music after Grow.",
"Fade out music before respawning.",
"Fade in music while respawning.",
"Threshold for syncing music.",
"Only sync special music.",
};
enum
@@ -2203,8 +2210,6 @@ enum
fadegrow,
respawnfadeout,
respawnfadein,
syncthreshold,
syncspecialonly,
};
menuitem_t OP_CustomCvarMenu[MAXMENUCCVARS];
+2
View File
@@ -812,6 +812,8 @@ static void P_LoadSectors(UINT8 *data)
ss->tag = SHORT(ms->tag);
ss->flags |= SF_FLIPSPECIAL_FLOOR;
ss->soundorg.thinker.function = (actionf_p1)P_MobjThinker;
}
// set the sky flat num
+6 -1
View File
@@ -3986,7 +3986,12 @@ DoneSection2:
player->tossdelay = 3;
}
#if 0
// Event - Final Lap
// Still works for GME, but disabled for consistency
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f);
#endif
if (player->laps >= (unsigned)cv_numlaps.value)
{
if (P_IsLocalPlayer(player))
+19 -17
View File
@@ -58,7 +58,7 @@ static void AmigaType_OnChange(void);
#endif
static CV_PossibleValue_t audbuffersize_cons_t[] = {{128, "128"}, {256, "256"}, {512, "512"}, {1024, "1024"}, {2048, "2048"}, {4096, "4096"}, {0, NULL}};
consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE|CV_CALL, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE|CV_CALL|CV_NOINIT, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL};
// stereo reverse
consvar_t stereoreverse = {"stereoreverse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -94,14 +94,6 @@ consvar_t cv_playsoundifunfocused = {"playsoundsifunfocused", "No", CV_SAVE, CV_
consvar_t cv_pausemusic = {"playmusicifpaused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
//bird music stuff
static CV_PossibleValue_t music_resync_threshold_cons_t[] = {
{0, "MIN"},
{1000, "MAX"},
{0}
};
consvar_t cv_music_resync_threshold = {"music_resync_threshold", "0", CV_SAVE|CV_CALL, music_resync_threshold_cons_t, I_UpdateSongLagThreshold, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_music_resync_powerups_only = {"music_resync_powerups_only", "No", CV_SAVE|CV_CALL, CV_YesNo, I_UpdateSongLagThreshold, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -281,6 +273,12 @@ void S_RegisterSoundStuff(void)
CV_RegisterVar(&cv_gamesounds);
CV_RegisterVar(&cv_gamedigimusic);
#ifdef HAVE_FLUIDSYNTH
CV_RegisterVar(&cv_midisoundfontpath);
CV_RegisterVar(&cv_midichorus);
CV_RegisterVar(&cv_midireverb);
#endif
CV_RegisterVar(&cv_samesoundlimit);
// bird music stuff
@@ -288,9 +286,6 @@ void S_RegisterSoundStuff(void)
CV_RegisterVar(&cv_playsoundifunfocused);
CV_RegisterVar(&cv_pausemusic);
CV_RegisterVar(&cv_music_resync_threshold);
CV_RegisterVar(&cv_music_resync_powerups_only);
CV_RegisterVar(&cv_invincmusicfade);
CV_RegisterVar(&cv_growmusicfade);
@@ -362,6 +357,7 @@ boolean S_SoundDisabled(void)
int S_CacheSound(void)
{
#if SOUND == SOUND_MIXER
if (sound_disabled)
return SOUNDCACHE_OFF;
@@ -369,6 +365,9 @@ int S_CacheSound(void)
return SOUNDCACHE_PRECACHE;
return cv_cachesound.value;
#else
return SOUNDCACHE_OFF;
#endif
}
// Stop all sounds, load level info, THEN start sounds.
@@ -772,9 +771,14 @@ void S_UpdateSounds(void)
volume = c->volume; // 8 bits internal volume precision
sep = NORM_SEP;
if (P_MobjWasRemoved(c->origin))
{
// origin was removed, stop the music
S_StopChannel(cnum);
}
// check non-local sounds for distance clipping
// or modify their params
if (c->origin)
else
{
boolean itsUs = false;
@@ -1642,7 +1646,7 @@ UINT32 S_GetMusicPosition(void)
static lumpnum_t S_GetMusicLumpNum(const char *mname)
{
if (S_MusicExists(mname, false, true)) // check non midis first
return W_GetNumForName(va("o_%s", mname));
return W_GetNumForName(va("O_%s", mname));
if (S_MusicExists(mname, true, false))
{
@@ -1650,7 +1654,7 @@ static lumpnum_t S_GetMusicLumpNum(const char *mname)
CONS_Alert(CONS_ERROR, "A MIDI music lump %.6s was found,\nbut SRB2Kart does not support MIDI output.\nWe apologise for the inconvenience.\n", mname);
return LUMPERROR;
#else
return W_GetNumForName(va("d_%s", mname));
return W_GetNumForName(va("D_%s", mname));
#endif
}
@@ -1709,8 +1713,6 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms)
if (S_MusicDisabled())
return false;
I_UpdateSongLagThreshold();
if ((!fadeinms && !I_PlaySong(looping)) ||
(fadeinms && !I_FadeInPlaySong(fadeinms, looping)))
{
+6 -3
View File
@@ -54,10 +54,13 @@ extern consvar_t cv_amigatype;
#endif
#endif
//bird music stuff
extern consvar_t cv_music_resync_threshold;
extern consvar_t cv_music_resync_powerups_only;
#ifdef HAVE_FLUIDSYNTH
extern consvar_t cv_midisoundfontpath;
extern consvar_t cv_midichorus;
extern consvar_t cv_midireverb;
#endif
//bird music stuff
extern consvar_t cv_invincmusicfade;
extern consvar_t cv_growmusicfade;
+25 -24
View File
@@ -46,8 +46,8 @@
#include "SDL_image.h"
#else
// SDLCALL terms removed from original SDL_image declarations
int IMG_isXPM(SDL_RWops *src);
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src);
int IMG_isXPM(SDL_IOStream *src);
SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src);
SDL_Surface *IMG_ReadXPMFromArray(const char **xpm);
#define IMG_SetError SDL_SetError
#define IMG_GetError SDL_GetError
@@ -56,7 +56,7 @@ SDL_Surface *IMG_ReadXPMFromArray(const char **xpm);
#ifdef LOAD_XPM
/* See if an image is contained in a data source */
int IMG_isXPM(SDL_RWops *src)
int IMG_isXPM(SDL_IOStream *src)
{
Sint64 start;
int is_XPM;
@@ -64,14 +64,14 @@ int IMG_isXPM(SDL_RWops *src)
if ( !src )
return 0;
start = SDL_RWtell(src);
start = SDL_TellIO(src);
is_XPM = 0;
if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
if ( SDL_ReadIO(src, magic, sizeof(magic)) ) {
if ( SDL_memcmp(magic, "/* XPM */", sizeof(magic)) == 0 ) {
is_XPM = 1;
}
}
SDL_RWseek(src, start, RW_SEEK_SET);
SDL_SeekIO(src, start, SDL_IO_SEEK_SET);
return(is_XPM);
}
@@ -933,7 +933,7 @@ static const char *error;
* If len > 0, it's assumed to be at least len chars (for efficiency).
* Return NULL and set error upon EOF or parse error.
*/
static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
static const char *get_next_line(const char ***lines, SDL_IOStream *src, int len)
{
char *linebufnew;
@@ -943,7 +943,7 @@ static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
char c;
int n;
do {
if (SDL_RWread(src, &c, 1, 1) <= 0) {
if (SDL_ReadIO(src, &c, 1) <= 0) {
error = "Premature end of data";
return NULL;
}
@@ -960,7 +960,7 @@ static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
}
linebuf = linebufnew;
}
if (SDL_RWread(src, linebuf, len - 1, 1) <= 0) {
if (SDL_ReadIO(src, linebuf, len - 1) <= 0) {
error = "Premature end of data";
return NULL;
}
@@ -980,7 +980,7 @@ static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
}
linebuf = linebufnew;
}
if (SDL_RWread(src, linebuf + n, 1, 1) <= 0) {
if (SDL_ReadIO(src, linebuf + n, 1) <= 0) {
error = "Premature end of data";
return NULL;
}
@@ -1005,7 +1005,7 @@ do { \
} while (0)
/* read XPM from either array or RWops */
static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
static SDL_Surface *load_xpm(const char **xpm, SDL_IOStream *src)
{
Sint64 start = 0;
SDL_Surface *image = NULL;
@@ -1027,7 +1027,7 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
buflen = 0;
if (src)
start = SDL_RWtell(src);
start = SDL_TellIO(src);
if (xpm)
xpmlines = &xpm;
@@ -1065,14 +1065,15 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
/* Create the new surface */
if (ncolors <= 256) {
indexed = 1;
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8,
0, 0, 0, 0);
im_colors = image->format->palette->colors;
image->format->palette->ncolors = ncolors;
image = SDL_CreateSurface(w, h,
SDL_PIXELFORMAT_INDEX8);
SDL_Palette *palette = SDL_CreateSurfacePalette(image);
im_colors = palette->colors;
palette->ncolors = ncolors;
} else {
indexed = 0;
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
0xff0000, 0x00ff00, 0x0000ff, 0);
image = SDL_CreateSurface(w, h,
SDL_GetPixelFormatForMasks(32, 0xff0000, 0x00ff00, 0x0000ff, 0));
}
if (!image) {
/* Hmm, some SDL error (out of memory?) */
@@ -1128,7 +1129,7 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
add_colorhash(colors, nextkey, cpp, pixel);
nextkey += cpp;
if (rgb == 0xffffffff)
SDL_SetColorKey(image, SDL_TRUE, pixel);
SDL_SetSurfaceColorKey(image, true, pixel);
break;
}
}
@@ -1164,9 +1165,9 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
done:
if (error) {
if ( src )
SDL_RWseek(src, start, RW_SEEK_SET);
SDL_SeekIO(src, start, SDL_IO_SEEK_SET);
if ( image ) {
SDL_FreeSurface(image);
SDL_DestroySurface(image);
image = NULL;
}
IMG_SetError("%s", error);
@@ -1180,7 +1181,7 @@ done:
}
/* Load a XPM type image from an RWops datasource */
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src)
{
if ( !src ) {
/* The error message has been set in SDL_RWFromFile */
@@ -1203,14 +1204,14 @@ SDL_Surface *IMG_ReadXPMFromArray(const char **xpm)
#else /* not LOAD_XPM */
/* See if an image is contained in a data source */
int IMG_isXPM(SDL_RWops *src)
int IMG_isXPM(SDL_IOStream *src)
{
return(0);
}
/* Load a XPM type image from an SDL datasource */
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src)
{
return(NULL);
}
+2 -2
View File
@@ -27,10 +27,10 @@
#ifdef HAVE_SDL
#include "SDL.h"
#include <SDL3/SDL.h>
#ifndef NOLOADSO
#include "SDL_loadso.h"
#include <SDL3/SDL_loadso.h>
#endif
#define _CREATE_DLL_ // necessary for Unix AND Windows
+1 -1
View File
@@ -36,7 +36,7 @@
#ifdef HAVE_SDL
#ifdef HAVE_TTF
#include "SDL.h"
#include <SDL3/SDL.h>
#include "i_ttf.h"
#endif
+52 -50
View File
@@ -67,13 +67,15 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#ifdef HAVE_SDL
#define _MATH_DEFINES_DEFINED
#include "SDL.h"
#include <SDL3/SDL.h>
#include <SDL3/SDL_joystick.h>
#include <SDL3/SDL_gamepad.h>
#ifdef HAVE_TTF
#include "i_ttf.h"
#endif
#include "SDL_cpuinfo.h"
#include <SDL3/SDL_cpuinfo.h>
#define HAVE_SDLCPUINFO
#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
@@ -213,13 +215,13 @@ static char returnWadPath[256];
#include "../byteptr.h"
#endif
SDL_bool consolevent = SDL_FALSE;
SDL_bool framebuffer = SDL_FALSE;
bool consolevent = false;
bool framebuffer = false;
UINT8 keyboard_started = false;
#ifdef HAVE_TERMIOS
// TERMIOS console code from Quake3: thank you!
SDL_bool stdin_active = SDL_TRUE;
bool stdin_active = true;
typedef struct
{
@@ -282,7 +284,7 @@ static void I_ShutdownConsole(void)
if (consolevent)
{
I_OutputMsg("Shutdown tty console\n");
consolevent = SDL_FALSE;
consolevent = false;
tcsetattr(STDIN_FILENO, TCSADRAIN, &tty_tc);
}
}
@@ -297,11 +299,11 @@ static void I_StartupConsole(void)
signal(SIGTTIN, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
consolevent = static_cast<SDL_bool>(!M_CheckParm("-noconsole"));
framebuffer = static_cast<SDL_bool>( M_CheckParm("-framebuffer"));
consolevent = static_cast<bool>(!M_CheckParm("-noconsole"));
framebuffer = static_cast<bool>( M_CheckParm("-framebuffer"));
if (framebuffer)
consolevent = SDL_FALSE;
consolevent = false;
if (!consolevent)
return;
@@ -309,7 +311,7 @@ static void I_StartupConsole(void)
if (isatty(STDIN_FILENO)!=1)
{
I_OutputMsg("stdin is not a tty, tty console mode failed\n");
consolevent = SDL_FALSE;
consolevent = false;
return;
}
@@ -511,7 +513,7 @@ static void I_StartupConsole(void)
if (gotConsole)
{
SetConsoleTitleA("SRB2Kart Console");
consolevent = SDL_TRUE;
consolevent = true;
}
//Let get the real console HANDLE, because Mingw's Bash is bad!
@@ -544,7 +546,7 @@ static inline void I_StartupConsole(void)
framebuffer = M_CheckParm("-framebuffer");
if (framebuffer)
consolevent = SDL_FALSE;
consolevent = false;
}
static inline void I_ShutdownConsole(void){}
#endif
@@ -693,7 +695,7 @@ void I_OutputMsg(const char *fmt, ...)
//
// I_GetKey
//
INT32 I_GetKey (void)
INT32 I_GetKey(void)
{
// Warning: I_GetKey empties the event queue till next keypress
event_t *ev;
@@ -723,7 +725,7 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
{
if (JoySet->dev)
{
SDL_GameControllerClose(JoySet->dev);
SDL_CloseGamepad(JoySet->dev);
}
JoySet->dev = NULL;
@@ -765,15 +767,15 @@ void I_JoyScale4(void)
}
// Cheat to get the device index for a joystick handle
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev)
INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev)
{
SDL_Joystick *joystick = NULL;
joystick = SDL_GameControllerGetJoystick(dev);
joystick = SDL_GetGamepadJoystick(dev);
if (joystick)
{
return SDL_JoystickInstanceID(joystick);
return SDL_GetJoystickID(joystick);
}
return -1;
@@ -883,7 +885,7 @@ void I_ShutdownJoystick(UINT8 index)
*/
static int joy_open(int playerIndex, int joyIndex)
{
SDL_GameController *newdev = NULL;
SDL_Gamepad *newdev = NULL;
int num_joy = 0;
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
@@ -892,7 +894,7 @@ static int joy_open(int playerIndex, int joyIndex)
return -1;
}
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0)
if (SDL_WasInit(SDL_INIT_GAMEPAD) == 0)
{
CONS_Printf(M_GetText("Game Controller subsystem not started\n"));
return -1;
@@ -901,7 +903,7 @@ static int joy_open(int playerIndex, int joyIndex)
if (joyIndex <= 0)
return -1;
num_joy = SDL_NumJoysticks();
SDL_GetJoysticks(&num_joy);
if (num_joy == 0)
{
@@ -909,7 +911,7 @@ static int joy_open(int playerIndex, int joyIndex)
return -1;
}
newdev = SDL_GameControllerOpen(joyIndex-1);
newdev = SDL_OpenGamepad(joyIndex-1);
// Handle the edge case where the device <-> joystick index assignment can change due to hotplugging
// This indexing is SDL's responsibility and there's not much we can do about it.
@@ -924,8 +926,8 @@ static int joy_open(int playerIndex, int joyIndex)
if (JoyInfo[playerIndex].dev)
{
if (JoyInfo[playerIndex].dev == newdev // same device, nothing to do
|| (newdev == NULL && SDL_GameControllerGetAttached(JoyInfo[playerIndex].dev))) // we failed, but already have a working device
return SDL_CONTROLLER_AXIS_MAX;
|| (newdev == NULL && SDL_GamepadConnected(JoyInfo[playerIndex].dev))) // we failed, but already have a working device
return SDL_GAMEPAD_AXIS_COUNT;
// Else, we're changing devices, so send neutral joy events
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device is changing; resetting events...\n");
@@ -942,13 +944,13 @@ static int joy_open(int playerIndex, int joyIndex)
}
else
{
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GameControllerName(JoyInfo[playerIndex].dev));
JoyInfo[playerIndex].axises = SDL_CONTROLLER_AXIS_MAX;
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GetGamepadName(JoyInfo[playerIndex].dev));
JoyInfo[playerIndex].axises = SDL_GAMEPAD_AXIS_COUNT;
if (JoyInfo[playerIndex].axises > JOYAXISSET*2)
JoyInfo[playerIndex].axises = JOYAXISSET*2;
JoyInfo[playerIndex].buttons = SDL_CONTROLLER_BUTTON_MAX ; // dpad is 4 buttons
JoyInfo[playerIndex].buttons = SDL_GAMEPAD_BUTTON_COUNT; // dpad is 4 buttons
if (JoyInfo[playerIndex].buttons > JOYBUTTONS)
JoyInfo[playerIndex].buttons = JOYBUTTONS;
@@ -968,7 +970,7 @@ static int joy_open(int playerIndex, int joyIndex)
void I_InitJoystick(UINT8 index)
{
UINT8 i;
SDL_GameController *newcontroller = NULL;
SDL_Gamepad *newcontroller = NULL;
// not sure if this is the best place to put this
SDL_SetHint(SDL_HINT_AUTO_UPDATE_SENSORS, "0");
@@ -986,15 +988,16 @@ void I_InitJoystick(UINT8 index)
{
CONS_Printf("I_InitJoystick()...\n");
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK))
{
CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
return;
}
}
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0)
if (SDL_WasInit(SDL_INIT_GAMEPAD) == 0)
{
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1)
if (!SDL_InitSubSystem(SDL_INIT_GAMEPAD))
{
CONS_Printf(M_GetText("Couldn't initialize gamepads: %s\n"), SDL_GetError());
return;
@@ -1007,7 +1010,7 @@ void I_InitJoystick(UINT8 index)
JoyInfo[index].axises = JoyInfo[index].buttons = JoyInfo[index].hats = JoyInfo[index].balls = 0;
if (cv_usejoystick[index].value)
newcontroller = SDL_GameControllerOpen(cv_usejoystick[index].value-1);
newcontroller = SDL_OpenGamepad(cv_usejoystick[index].value-1);
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
@@ -1047,7 +1050,7 @@ void I_InitJoystick(UINT8 index)
if (i == MAXSPLITSCREENPLAYERS)
{
// Joystick didn't end up being used
SDL_GameControllerClose(newcontroller);
SDL_CloseGamepad(newcontroller);
}
}
@@ -1082,10 +1085,10 @@ static void I_ShutdownInput(void)
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
I_ShutdownJoystick(i);
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == SDL_INIT_GAMECONTROLLER)
if (SDL_WasInit(SDL_INIT_GAMEPAD) == SDL_INIT_GAMEPAD)
{
CONS_Printf("Shutting down gamecontroller system\n");
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
SDL_QuitSubSystem(SDL_INIT_GAMEPAD);
I_OutputMsg("I_Joystick: SDL's Game Controller system has been shutdown\n");
}
@@ -1102,7 +1105,9 @@ INT32 I_NumJoys(void)
INT32 numjoy = 0;
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
numjoy = SDL_NumJoysticks();
{
SDL_GetJoysticks(&numjoy);
}
return numjoy;
}
@@ -1117,7 +1122,7 @@ const char *I_GetJoyName(INT32 joyindex)
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
{
tempname = SDL_JoystickNameForIndex(joyindex);
tempname = SDL_GetJoystickNameForID(joyindex);
if (tempname)
{
@@ -1137,14 +1142,14 @@ void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength,
(void)high_strength;
(void)duration;
#else
SDL_GameController *controller = JoyInfo[playernum].dev;
SDL_Gamepad *controller = JoyInfo[playernum].dev;
if (controller == NULL)
{
return;
}
SDL_GameControllerRumble(controller, low_strength, high_strength, duration);
SDL_RumbleGamepad(controller, low_strength, high_strength, duration);
#endif
}
@@ -1156,14 +1161,14 @@ void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 b
(void)green;
(void)blue;
#else
SDL_GameController *controller = JoyInfo[playernum].dev;
SDL_Gamepad *controller = JoyInfo[playernum].dev;
if (controller == NULL)
{
return;
}
SDL_GameControllerSetLED(controller, red, green, blue);
SDL_SetGamepadLED(controller, red, green, blue);
#endif
}
@@ -1816,10 +1821,7 @@ static void I_Fork(void)
INT32 I_StartupSystem(void)
{
SDL_version SDLcompiled;
SDL_version SDLlinked;
SDL_VERSION(&SDLcompiled)
SDL_GetVersion(&SDLlinked);
int SDLlinked = SDL_GetVersion();
I_StartupConsole();
#ifdef NEWSIGNALHANDLER
// This is useful when debugging. It lets GDB attach to
@@ -1835,15 +1837,15 @@ INT32 I_StartupSystem(void)
#endif
I_RegisterSignals();
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION);
I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
SDLlinked.major, SDLlinked.minor, SDLlinked.patch);
SDL_VERSIONNUM_MAJOR(SDLlinked), SDL_VERSIONNUM_MINOR(SDLlinked), SDL_VERSIONNUM_MICRO(SDLlinked));
#if (SDL_VERSION_ATLEAST(2, 0, 18))
SDL_SetHint(SDL_HINT_APP_NAME, "SRB2Kart Saturn");
#endif
if (SDL_Init(0) < 0)
if (!SDL_Init(0))
I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no....
#ifndef NOMUMBLE
I_SetupMumble();
@@ -1856,12 +1858,12 @@ INT32 I_StartupSystem(void)
//
FUNCNORETURN void ATTRNORETURN I_Quit(void)
{
static SDL_bool quiting = SDL_FALSE;
static bool quiting = false;
/* prevent recursive I_Quit() */
if (quiting) goto death;
SDL_ShowCursor(SDL_TRUE);
quiting = SDL_FALSE;
SDL_ShowCursor();
quiting = false;
I_ShutdownConsole();
M_SaveConfig(NULL); //save game config, cvars..
D_SaveBan(); // save the ban list
+25 -30
View File
@@ -12,7 +12,7 @@
#include "../doomdef.h"
#include "../i_threads.h"
#include <SDL.h>
#include <SDL3/SDL.h>
typedef void * (*Create_fn)(void);
@@ -45,7 +45,7 @@ static I_mutex i_thread_pool_mutex;
static I_mutex i_mutex_pool_mutex;
static I_mutex i_cond_pool_mutex;
static SDL_atomic_t i_threads_running = {1};
static SDL_AtomicInt i_threads_running = {1};
static Link
Insert_link (
@@ -103,13 +103,13 @@ Identity (
){
void * id;
id = SDL_AtomicGetPtr(anchor);
id = SDL_GetAtomicPointer(anchor);
if (! id)
{
I_lock_mutex(&pool_mutex);
{
id = SDL_AtomicGetPtr(anchor);
id = SDL_GetAtomicPointer(anchor);
if (! id)
{
@@ -120,7 +120,7 @@ Identity (
Insert_link(pool_anchor, New_link(id));
SDL_AtomicSetPtr(anchor, id);
SDL_SetAtomicPointer(anchor, id);
}
}
I_unlock_mutex(pool_mutex);
@@ -139,11 +139,11 @@ Worker (
(*th->entry)(th->userdata);
if (SDL_AtomicGet(&i_threads_running))
if (SDL_GetAtomicInt(&i_threads_running))
{
I_lock_mutex(&i_thread_pool_mutex);
{
if (SDL_AtomicGet(&i_threads_running))
if (SDL_GetAtomicInt(&i_threads_running))
{
SDL_DetachThread(th->thread);
Free_link(&i_thread_pool, link);
@@ -176,7 +176,7 @@ I_spawn_thread (
{
link = Insert_link(&i_thread_pool, New_link(th));
if (SDL_AtomicGet(&i_threads_running))
if (SDL_GetAtomicInt(&i_threads_running))
{
th->thread = SDL_CreateThread(
(SDL_ThreadFunction)Worker,
@@ -194,7 +194,7 @@ I_spawn_thread (
int
I_thread_is_stopped (void)
{
return ( ! SDL_AtomicGet(&i_threads_running) );
return ( ! SDL_GetAtomicInt(&i_threads_running) );
}
void
@@ -220,13 +220,13 @@ I_stop_threads (void)
Link next;
Thread th;
SDL_mutex * mutex;
SDL_cond * cond;
SDL_Mutex * mutex;
SDL_Condition * cond;
if (i_threads_running.value)
{
/* rely on the good will of thread-san */
SDL_AtomicSet(&i_threads_running, 0);
SDL_SetAtomicInt(&i_threads_running, 0);
I_lock_mutex(&i_thread_pool_mutex);
{
@@ -267,7 +267,7 @@ I_stop_threads (void)
next = link->next;
cond = link->data;
SDL_DestroyCond(cond);
SDL_DestroyCondition(cond);
free(link);
}
@@ -282,7 +282,7 @@ void
I_lock_mutex (
I_mutex * anchor
){
SDL_mutex * mutex;
SDL_Mutex * mutex;
mutex = Identity(
&i_mutex_pool,
@@ -291,16 +291,14 @@ I_lock_mutex (
(Create_fn)SDL_CreateMutex
);
if (SDL_LockMutex(mutex) == -1)
abort();
SDL_LockMutex(mutex);
}
void
I_unlock_mutex (
I_mutex id
){
if (SDL_UnlockMutex(id) == -1)
abort();
SDL_UnlockMutex(id);
}
void
@@ -308,49 +306,46 @@ I_hold_cond (
I_cond * cond_anchor,
I_mutex mutex_id
){
SDL_cond * cond;
SDL_Condition * cond;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
cond_anchor,
(Create_fn)SDL_CreateCond
(Create_fn)SDL_CreateCondition
);
if (SDL_CondWait(cond, mutex_id) == -1)
abort();
SDL_WaitCondition(cond, mutex_id);
}
void
I_wake_one_cond (
I_cond * anchor
){
SDL_cond * cond;
SDL_Condition * cond;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
anchor,
(Create_fn)SDL_CreateCond
(Create_fn)SDL_CreateCondition
);
if (SDL_CondSignal(cond) == -1)
abort();
SDL_SignalCondition(cond);
}
void
I_wake_all_cond (
I_cond * anchor
){
SDL_cond * cond;
SDL_Condition * cond;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
anchor,
(Create_fn)SDL_CreateCond
(Create_fn)SDL_CreateCondition
);
if (SDL_CondBroadcast(cond) == -1)
abort();
SDL_BroadcastCondition(cond);
}
+3 -3
View File
@@ -16,7 +16,7 @@
/// \file
/// \brief SDL_ttf interface code. Necessary for platforms with no framebuffer console systems.
#if defined(HAVE_SDL) && defined(HAVE_TTF)
#if defined (HAVE_SDL) && defined (HAVE_TTF)
#include "SDL.h"
#include "SDL_ttf.h"
#include "../doomdef.h"
@@ -236,14 +236,14 @@ void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags)
// what's the point of trying to display an error?
// SDL_ttf is not started, can't display anything to screen (presumably)...
if (SDL_InitSubSystem(initflags) < 0)
if (!SDL_InitSubSystem(initflags))
I_Error("Couldn't initialize SDL: %s\n", SDL_GetError());
TTFSurface = SDL_SetVideoMode(res.width, res.height, bitsperpixel, vidmodeflags);
if (!TTFSurface)
I_Error("Couldn't set SDL Video resolution: %s\n", SDL_GetError());
if (TTF_Init() < 0)
if (!TTF_Init())
I_Error("Couldn't start SDL_ttf: %s\n", TTF_GetError());
// look for default font in many directories
+235 -229
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -20,7 +20,7 @@
#ifdef HAVE_SDL
#define _MATH_DEFINES_DEFINED
#include "SDL.h"
#include <SDL3/SDL.h>
#include "sdlmain.h"
@@ -96,7 +96,7 @@ boolean VID_LoadOGLAPI(void)
if (M_CheckParm("-OGLlib") && M_IsNextParm())
OGLLibname = M_GetNextParm();
if (SDL_GL_LoadLibrary(OGLLibname) != 0)
if (!SDL_GL_LoadLibrary(OGLLibname))
{
CONS_Alert(CONS_ERROR, "Could not load OpenGL Library: %s\n", SDL_GetError());
if (!M_CheckParm("-OGLlib"))
+1962
View File
File diff suppressed because it is too large. Load diff
+7 -5
View File
@@ -23,14 +23,16 @@
extern "C" {
#endif
extern SDL_bool consolevent;
extern SDL_bool framebuffer;
extern bool consolevent;
extern bool framebuffer;
#include "../m_fixed.h"
// SDL2 stub macro
#define SDL2STUB() CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__)
#include <SDL3/SDL_gamepad.h>
// So m_menu knows whether to store cv_usejoystick value or string
#define JOYSTICK_HOTPLUG
@@ -41,9 +43,9 @@ extern SDL_bool framebuffer;
typedef struct SDLJoyInfo_s
{
/// Controller handle
SDL_GameController *dev;
SDL_Gamepad *dev;
/// Controller index
INT32 id;
SDL_JoystickID id;
/// number of old joystick
int oldjoy;
/// number of axies
@@ -71,7 +73,7 @@ extern SDLJoyInfo_t JoyInfo[4]; //MAXSPLITSCREENPLAYERS
void I_ShutdownJoystick(UINT8 index);
// Cheat to get the device index for a game controller handle
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev);
INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev);
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
void I_UpdateJoystickDeviceIndex(UINT8 player);