Merge branch 'fix-gme-disabled' into 'master'

Fix gme support being effectively disabled

See merge request STJr/SRB2!1586
This commit is contained in:
SteelT 2021-09-11 15:05:34 +00:00
commit a822de5ffc
2 changed files with 24 additions and 24 deletions

View file

@ -60,7 +60,7 @@ if(${SRB2_CONFIG_HAVE_GME})
endif()
if(${GME_FOUND})
set(SRB2_HAVE_GME ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_LIBGME)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
else()
message(WARNING "You have specified that GME is available but it was not found.")
endif()

View file

@ -9,7 +9,7 @@
/// \file
/// \brief SDL Mixer interface for sound
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
#ifdef HAVE_ZLIB
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
@ -27,7 +27,7 @@
#include <zlib.h>
#endif // HAVE_ZLIB
#endif // HAVE_LIBGME
#endif // HAVE_GME
#include "../doomdef.h"
#include "../doomstat.h" // menuactive
@ -73,11 +73,11 @@
#define MUS_MODPLUG MUS_MODPLUG_UNUSED
#endif
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
#include "gme/gme.h"
#define GME_TREBLE 5.0f
#define GME_BASS 1.0f
#endif // HAVE_LIBGME
#endif // HAVE_GME
static UINT16 BUFFERSIZE = 2048;
static UINT16 SAMPLERATE = 44100;
@ -110,7 +110,7 @@ static INT32 fading_id;
static void (*fading_callback)(void);
static boolean fading_nocleanup;
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
static Music_Emu *gme;
static UINT16 current_track;
#endif
@ -220,7 +220,7 @@ static void var_cleanup(void)
internal_volume = 100;
}
#if defined (HAVE_LIBGME) && defined (HAVE_ZLIB)
#if defined (HAVE_GME) && defined (HAVE_ZLIB)
static const char* get_zlib_error(int zErr)
{
switch (zErr)
@ -318,7 +318,7 @@ void I_ShutdownSound(void)
SDL_QuitSubSystem(SDL_INIT_AUDIO);
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
gme_delete(gme);
#endif
@ -453,7 +453,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
void *lump;
Mix_Chunk *chunk;
SDL_RWops *rw;
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
Music_Emu *emu;
gme_info_t *info;
#endif
@ -473,7 +473,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
}
// Not a doom sound? Try something else.
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
// VGZ format
if (((UINT8 *)lump)[0] == 0x1F
&& ((UINT8 *)lump)[1] == 0x8B)
@ -729,7 +729,7 @@ static UINT32 music_fade(UINT32 interval, void *param)
}
}
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
static void mix_gme(void *udata, Uint8 *stream, int len)
{
int i;
@ -797,7 +797,7 @@ void I_ShutdownMusic(void)
musictype_t I_SongType(void)
{
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
return MU_GME;
else
@ -828,7 +828,7 @@ musictype_t I_SongType(void)
boolean I_SongPlaying(void)
{
return (
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
(I_SongType() == MU_GME && gme) ||
#endif
#ifdef HAVE_OPENMPT
@ -851,7 +851,7 @@ boolean I_SetSongSpeed(float speed)
{
if (speed > 250.0f)
speed = 250.0f; //limit speed up to 250x
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
SDL_LockAudio();
@ -893,7 +893,7 @@ UINT32 I_GetSongLength(void)
{
INT32 length;
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
gme_info_t *info;
@ -963,7 +963,7 @@ boolean I_SetSongLoopPoint(UINT32 looppoint)
UINT32 I_GetSongLoopPoint(void)
{
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
INT32 looppoint;
@ -992,7 +992,7 @@ UINT32 I_GetSongLoopPoint(void)
boolean I_SetSongPosition(UINT32 position)
{
UINT32 length;
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
// this is unstable, so fail silently
@ -1055,7 +1055,7 @@ boolean I_SetSongPosition(UINT32 position)
UINT32 I_GetSongPosition(void)
{
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
INT32 position = gme_tell(gme);
@ -1124,7 +1124,7 @@ boolean I_LoadSong(char *data, size_t len)
SDL_RWops *rw;
if (music
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
|| gme
#endif
#ifdef HAVE_OPENMPT
@ -1136,7 +1136,7 @@ boolean I_LoadSong(char *data, size_t len)
// always do this whether or not a music already exists
var_cleanup();
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if ((UINT8)data[0] == 0x1F
&& (UINT8)data[1] == 0x8B)
{
@ -1271,7 +1271,7 @@ void I_UnloadSong(void)
{
I_StopSong();
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
gme_delete(gme);
@ -1294,7 +1294,7 @@ void I_UnloadSong(void)
boolean I_PlaySong(boolean looping)
{
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
@ -1360,7 +1360,7 @@ void I_StopSong(void)
if (!fading_nocleanup)
I_StopFadingSong();
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
Mix_HookMusic(NULL, NULL);
@ -1433,7 +1433,7 @@ void I_SetMusicVolume(UINT8 volume)
boolean I_SetSongTrack(int track)
{
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
// If the specified track is within the number of tracks playing, then change it
if (gme)
{