Fix libgme not compiling
Still no music playback but it compiles gme now...
This commit is contained in:
parent
fd9fc0d12a
commit
fa63db9b06
4 changed files with 19 additions and 2 deletions
|
|
@ -74,6 +74,7 @@ cmake_dependent_option(
|
|||
option(SRB2_CONFIG_ENABLE_DISCORDRPC "Enable Discord RPC features" ON)
|
||||
option(SRB2_CONFIG_STATIC_STDLIB "Link static version of standard library. All dependencies must also be static" ON)
|
||||
option(SRB2_CONFIG_HWRENDER "Enable hardware render (OpenGL) support" ON)
|
||||
option(SRB2_CONFIG_USE_GME "Enable GME playback support" ON)
|
||||
option(SRB2_CONFIG_STATIC_OPENGL "Enable static linking GL (do not do this)" OFF)
|
||||
option(SRB2_CONFIG_ERRORMODE "Compile C code with warnings treated as errors." OFF)
|
||||
option(SRB2_CONFIG_DEBUGMODE "Compile with PARANOIA, ZDEBUG, RANGECHECK and PACKETDROP defined." OFF)
|
||||
|
|
@ -140,7 +141,9 @@ if("${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
|||
find_package(SDL2_mixer REQUIRED)
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(OPENMPT REQUIRED)
|
||||
find_package(GME REQUIRED)
|
||||
if("${SRB2_CONFIG_USE_GME}")
|
||||
find_package(libgme QUIET)
|
||||
endif()
|
||||
find_package(DiscordRPC REQUIRED)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -111,6 +111,15 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
|||
target_compile_definitions(SRB2SDL2 PRIVATE -DMACOSX)
|
||||
endif()
|
||||
|
||||
if("${SRB2_CONFIG_USE_GME}")
|
||||
target_link_libraries(SRB2SDL2 PRIVATE gme)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
|
||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
||||
# this sucks but gme doesn't use modern cmake to delineate public headers
|
||||
target_include_directories(SRB2SDL2 PRIVATE "${libgme_SOURCE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(SRB2SDL2 PRIVATE openmpt)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_OPENMPT)
|
||||
|
||||
|
|
|
|||
|
|
@ -613,6 +613,7 @@ static ALuint LoadDataIntoBuffer(void *input, size_t size)
|
|||
gme_set_equalizer(emu, &eq);
|
||||
gme_track_info(emu, &gme_info, 0);
|
||||
|
||||
len = (gme_info->play_length * 441 / 10) << 2;
|
||||
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||
gme_play(emu, len >> 1, mem);
|
||||
gme_free_info(gme_info);
|
||||
|
|
@ -1104,6 +1105,7 @@ static boolean InitializeMusicStreaming(void *input, size_t size)
|
|||
gme_set_equalizer(gme, &eq);
|
||||
gme_track_info(gme, &gme_info, 0);
|
||||
|
||||
len = (gme_info->play_length * 441 / 10) << 2;
|
||||
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||
gme_play(gme, len >> 1, mem);
|
||||
gme_free_info(gme_info);
|
||||
|
|
@ -1114,8 +1116,10 @@ static boolean InitializeMusicStreaming(void *input, size_t size)
|
|||
(void)inflateEnd(&stream);
|
||||
}
|
||||
else // Hold up, zlib's got a problem
|
||||
{
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", GetZLibError(zErr), stream.msg);
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
}
|
||||
#else
|
||||
return INVALID_HANDLE; // No zlib support
|
||||
#endif
|
||||
|
|
|
|||
1
thirdparty/cpm-libgme.cmake
vendored
1
thirdparty/cpm-libgme.cmake
vendored
|
|
@ -11,4 +11,5 @@ CPMAddPackage(
|
|||
|
||||
if(libgme_ADDED)
|
||||
target_compile_features(gme PRIVATE cxx_std_11)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Reference in a new issue