From 26c889088d45fb46741db9bde544578443671af1 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 25 Sep 2023 04:17:47 +0600 Subject: [PATCH] Fix compressed format support on GME when using miniz --- thirdparty/CMakeLists.txt | 2 +- thirdparty/game-music-emu/gme/CMakeLists.txt | 20 +++++++++++-------- thirdparty/game-music-emu/gme/Data_Reader.cpp | 3 ++- thirdparty/game-music-emu/gme/Data_Reader.h | 3 ++- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 8a7ac65..6c7b6fd 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -1,3 +1,4 @@ +add_subdirectory(miniz) # GME is not currently released in a way that's conducive to using as a system # library. Nevertheless at least one person tried, and so the ability to use a # system copy exists soley to placate people following distro guidelines to the @@ -19,7 +20,6 @@ add_subdirectory(game-music-emu) #endif() -add_subdirectory(miniz) add_subdirectory(dumb) add_subdirectory(adlmidi) add_subdirectory(opnmidi) diff --git a/thirdparty/game-music-emu/gme/CMakeLists.txt b/thirdparty/game-music-emu/gme/CMakeLists.txt index 0576268..6449be0 100644 --- a/thirdparty/game-music-emu/gme/CMakeLists.txt +++ b/thirdparty/game-music-emu/gme/CMakeLists.txt @@ -21,7 +21,8 @@ if(NOT BUILD_SHARED_LIBS) set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") endif() -find_package(ZLIB QUIET) +# [ZMusic] We use miniz now. +# find_package(ZLIB QUIET) # Ay_Apu is very popular around here if (USE_GME_AY OR USE_GME_KSS) @@ -165,17 +166,20 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) # Add library to be compiled. add_library(gme OBJECT ${libgme_SRCS}) -if(ZLIB_FOUND) - message(" ** ZLib library located, compressed file formats will be supported") +# Commented our since we use miniz +#if(ZLIB_FOUND) +# message(" ** ZLib library located, compressed file formats will be supported") target_compile_definitions(gme PRIVATE -DHAVE_ZLIB_H) + target_link_libraries(gme PRIVATE miniz) + # [ZMusic] Switch to modern target for better transitive handling. - target_link_libraries(gme PRIVATE ZLIB::ZLIB) + # target_link_libraries(gme PRIVATE ZLIB::ZLIB) # Is not to be installed though - set(PKG_CONFIG_ZLIB -lz) # evaluated in libgme.pc.in -else() - message("ZLib library not found, disabling support for compressed formats such as VGZ") -endif() +# set(PKG_CONFIG_ZLIB -lz) # evaluated in libgme.pc.in +#else() +# message("ZLib library not found, disabling support for compressed formats such as VGZ") +#endif() # [ZMusic] Interface include directories target_include_directories(gme INTERFACE ..) diff --git a/thirdparty/game-music-emu/gme/Data_Reader.cpp b/thirdparty/game-music-emu/gme/Data_Reader.cpp index 1556c32..bbd9820 100644 --- a/thirdparty/game-music-emu/gme/Data_Reader.cpp +++ b/thirdparty/game-music-emu/gme/Data_Reader.cpp @@ -21,7 +21,8 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "blargg_source.h" #ifdef HAVE_ZLIB_H -#include +// [ZMusic] Use miniz. +#include #include #include static const unsigned char gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ diff --git a/thirdparty/game-music-emu/gme/Data_Reader.h b/thirdparty/game-music-emu/gme/Data_Reader.h index 5935776..8ff82f3 100644 --- a/thirdparty/game-music-emu/gme/Data_Reader.h +++ b/thirdparty/game-music-emu/gme/Data_Reader.h @@ -7,7 +7,8 @@ #include "blargg_common.h" #ifdef HAVE_ZLIB_H -#include +// [ZMusic] Use miniz. +#include #endif // Supports reading and finding out how many bytes are remaining