Skip to content

upgrade vendored libgme to latest 0.6.4 release (SDL2 version) #682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
[submodule "external/libgme"]
path = external/libgme
url = https://github.com/libsdl-org/game-music-emu.git
branch = v0.6.3-SDL
branch = v0.6.4-SDL
18 changes: 13 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -591,16 +591,24 @@ endif()
if(SDL2MIXER_GME)
target_compile_definitions(SDL2_mixer PRIVATE MUSIC_GME)
if(SDL2MIXER_VENDORED)
set(BUILD_SHARED_LIBS "${SDL2MIXER_GME_SHARED}")
set(ENABLE_UBSAN OFF)
set(BUILD_FRAMEWORK OFF)
set(GME_BUILD_SHARED "${SDL2MIXER_GME_SHARED}")
if(SDL2MIXER_GME_SHARED)
set(GME_BUILD_STATIC OFF)
set(tgt_gme gme_shared)
else()
set(GME_BUILD_STATIC ON)
set(tgt_gme gme_static)
endif()
set(GME_BUILD_FRAMEWORK OFF)
set(GME_BUILD_TESTING OFF)
set(GME_BUILD_EXAMPLES OFF)
set(GME_ENABLE_UBSAN OFF)
option(GME_ZLIB "Enable GME to support compressed sound formats" OFF)
message(STATUS "Using vendored libgme")
sdl_check_project_in_subfolder(external/libgme libgme SDL2MIXER_VENDORED)
add_subdirectory(external/libgme EXCLUDE_FROM_ALL)
add_library(gme::gme ALIAS gme)
if(SDL2MIXER_GME_SHARED)
list(APPEND INSTALL_EXTRA_TARGETS gme)
list(APPEND INSTALL_EXTRA_TARGETS ${tgt_gme})
endif()
if(NOT SDL2MIXER_GME_SHARED)
list(APPEND PC_LIBS -l$<TARGET_FILE_BASE_NAME:gme>)
Expand Down
50 changes: 37 additions & 13 deletions VisualC/external/include/gme/gme.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* Game music emulator library C interface (also usable from C++) */

/* Game_Music_Emu 0.6.3 */
/* Game_Music_Emu 0.6.4 */
#ifndef GME_H
#define GME_H

#ifdef __cplusplus
extern "C" {
#endif

#define GME_VERSION 0x000603 /* 1 byte major, 1 byte minor, 1 byte patch-level */
#define GME_VERSION 0x000604 /* 1 byte major, 1 byte minor, 1 byte patch-level */

/* Error string returned by library functions, or NULL if no error (success) */
typedef const char* gme_err_t;
Expand Down Expand Up @@ -57,6 +57,11 @@ BLARGG_EXPORT void gme_delete( Music_Emu* );
Fade time can be changed while track is playing. */
BLARGG_EXPORT void gme_set_fade( Music_Emu*, int start_msec );

/** See gme_set_fade.
* @since 0.6.4
*/
BLARGG_EXPORT void gme_set_fade_msecs( Music_Emu*, int start_msec, int length_msecs );

/**
* If do_autoload_limit is nonzero, then automatically load track length
* metadata (if present) and terminate playback once the track length has been
Expand All @@ -67,12 +72,13 @@ BLARGG_EXPORT void gme_set_fade( Music_Emu*, int start_msec );
*
* By default, playback limits are loaded and applied.
*
* @since 0.6.2
* @since 0.6.3
*/
BLARGG_EXPORT void gme_set_autoload_playback_limit( Music_Emu *, int do_autoload_limit );

/** See gme_set_autoload_playback_limit.
* @since 0.6.2
* (This was actually added in 0.6.3, but wasn't exported because of a typo.)
* @since 0.6.4
*/
BLARGG_EXPORT int gme_autoload_playback_limit( Music_Emu const* );

Expand Down Expand Up @@ -123,13 +129,16 @@ struct gme_info_t
int length; /* total length, if file specifies it */
int intro_length; /* length of song up to looping section */
int loop_length; /* length of looping section */

/* Length if available, otherwise intro_length+loop_length*2 if available,
otherwise a default of 150000 (2.5 minutes). */
int play_length;

int i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15; /* reserved */


/* fade length in milliseconds; -1 if unknown */
int fade_length;

int i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15; /* reserved */

/* empty string ("") if not available */
const char* system;
const char* game;
Expand All @@ -138,7 +147,7 @@ struct gme_info_t
const char* copyright;
const char* comment;
const char* dumper;

const char *s7,*s8,*s9,*s10,*s11,*s12,*s13,*s14,*s15; /* reserved */
};

Expand Down Expand Up @@ -170,13 +179,17 @@ BLARGG_EXPORT void gme_mute_voice( Music_Emu*, int index, int mute );
voices, 0 unmutes them all, 0x01 mutes just the first voice, etc. */
BLARGG_EXPORT void gme_mute_voices( Music_Emu*, int muting_mask );

/* Disable/Enable echo effect for SPC files */
/* Available since 0.6.4 */
BLARGG_EXPORT void gme_disable_echo( Music_Emu*, int disable );

/* Frequency equalizer parameters (see gme.txt) */
/* Implementers: If modified, also adjust Music_Emu::make_equalizer as needed */
typedef struct gme_equalizer_t
{
double treble; /* -50.0 = muffled, 0 = flat, +5.0 = extra-crisp */
double bass; /* 1 = full bass, 90 = average, 16000 = almost no bass */

double d2,d3,d4,d5,d6,d7,d8,d9; /* reserved */
} gme_equalizer_t;

Expand Down Expand Up @@ -224,7 +237,7 @@ BLARGG_EXPORT int gme_type_multitrack( gme_type_t );

/* whether the pcm output retrieved by gme_play() will have all 8 voices rendered to their
* individual stereo channel or (if false) these voices get mixed into one single stereo channel
* @since 0.6.2 */
* @since 0.6.3 */
BLARGG_EXPORT int gme_multi_channel( Music_Emu const* );

/******** Advanced file loading ********/
Expand All @@ -248,7 +261,7 @@ BLARGG_EXPORT gme_type_t gme_identify_extension( const char path_or_extension []
* Get typical file extension for a given music type. This is not a replacement
* for a file content identification library (but see gme_identify_header).
*
* @since 0.6.2
* @since 0.6.3
*/
BLARGG_EXPORT const char* gme_type_extension( gme_type_t music_type );

Expand All @@ -263,7 +276,7 @@ BLARGG_EXPORT Music_Emu* gme_new_emu( gme_type_t, int sample_rate );
/* Create new multichannel emulator and set sample rate. Returns NULL if out of memory.
* If you only need track information, pass gme_info_only for sample_rate.
* (see gme_multi_channel for more information on multichannel support)
* @since 0.6.2
* @since 0.6.3
*/
BLARGG_EXPORT Music_Emu* gme_new_emu_multi_channel( gme_type_t, int sample_rate );

Expand All @@ -273,6 +286,17 @@ BLARGG_EXPORT gme_err_t gme_load_file( Music_Emu*, const char path [] );
/* Load music file from memory into emulator. Makes a copy of data passed. */
BLARGG_EXPORT gme_err_t gme_load_data( Music_Emu*, void const* data, long size );

/* Load multiple single-track music files from memory into emulator.
* @since 0.6.4
*/
BLARGG_EXPORT gme_err_t gme_load_tracks( Music_Emu* me,
void const* data, long* sizes, int count );

/* Return the fixed track count of an emu file type
* @since 0.6.4
*/
BLARGG_EXPORT int gme_fixed_track_count( gme_type_t );

/* Load music file using custom data reader function that will be called to
read file data. Most emulators load the entire file in one read call. */
typedef gme_err_t (*gme_reader_t)( void* your_data, void* out, int count );
Expand Down
Binary file modified VisualC/external/optional/x64/libgme.dll
Binary file not shown.
Binary file modified VisualC/external/optional/x86/libgme.dll
Binary file not shown.
16 changes: 16 additions & 0 deletions Xcode/gme/gme.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
F307A2DC2B54329C0012534B /* Spc_Dsp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F307A2AD2B54329C0012534B /* Spc_Dsp.cpp */; };
F307A2DD2B54329C0012534B /* gme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F307A2AE2B54329C0012534B /* gme.cpp */; };
F307A2DF2B5434FF0012534B /* Vgm_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F307A2DE2B5434FF0012534B /* Vgm_Emu.cpp */; };
6314974C2D8D4A3600EEC879 /* Nes_Fds_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6314974B2D8D4A3600EEC879 /* Nes_Fds_Apu.cpp */; };
6314974E2D8D4A9200EEC879 /* Nes_Vrc7_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6314974D2D8D4A9200EEC879 /* Nes_Vrc7_Apu.cpp */; };
631497502D8D4AEA00EEC879 /* emu2413.c in Sources */ = {isa = PBXBuildFile; fileRef = 6314974F2D8D4AEA00EEC879 /* emu2413.c */; };
631497522D8D4B0500EEC879 /* panning.c in Sources */ = {isa = PBXBuildFile; fileRef = 631497512D8D4B0500EEC879 /* panning.c */; };
F307A2E12B54358D0012534B /* gme.h in Headers */ = {isa = PBXBuildFile; fileRef = F307A2E02B54358D0012534B /* gme.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -127,6 +131,10 @@
F307A2AD2B54329C0012534B /* Spc_Dsp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Spc_Dsp.cpp; path = ../../external/libgme/gme/Spc_Dsp.cpp; sourceTree = "<group>"; };
F307A2AE2B54329C0012534B /* gme.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = gme.cpp; path = ../../external/libgme/gme/gme.cpp; sourceTree = "<group>"; };
F307A2DE2B5434FF0012534B /* Vgm_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Vgm_Emu.cpp; path = ../../external/libgme/gme/Vgm_Emu.cpp; sourceTree = "<group>"; };
6314974B2D8D4A3600EEC879 /* Nes_Fds_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Nes_Fds_Apu.cpp; path = ../../external/libgme/gme/Nes_Fds_Apu.cpp; sourceTree = "<group>"; };
6314974D2D8D4A9200EEC879 /* Nes_Vrc7_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Nes_Vrc7_Apu.cpp; path = ../../external/libgme/gme/Nes_Vrc7_Apu.cpp; sourceTree = "<group>"; };
6314974F2D8D4AEA00EEC879 /* emu2413.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = emu2413.c; path = ../../external/libgme/gme/ext/emu2413.c; sourceTree = "<group>"; };
631497512D8D4B0500EEC879 /* panning.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = panning.c; path = ../../external/libgme/gme/ext/panning.c; sourceTree = "<group>"; };
F307A2E02B54358D0012534B /* gme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gme.h; path = ../../external/libgme/gme/gme.h; sourceTree = "<group>"; };
F3F70EDA281F61B4005AA27D /* gme.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = gme.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -178,6 +186,8 @@
F307A2932B54329C0012534B /* Gbs_Emu.cpp */,
F307A2982B54329C0012534B /* Gme_File.cpp */,
F307A2AE2B54329C0012534B /* gme.cpp */,
6314974F2D8D4AEA00EEC879 /* emu2413.c */,
631497512D8D4B0500EEC879 /* panning.c */,
F307A2A82B54329C0012534B /* Gym_Emu.cpp */,
F307A2A02B54329C0012534B /* Hes_Apu.cpp */,
F307A29C2B54329C0012534B /* Hes_Cpu.cpp */,
Expand All @@ -194,6 +204,8 @@
F307A2852B54329C0012534B /* Nes_Namco_Apu.cpp */,
F307A29E2B54329C0012534B /* Nes_Oscs.cpp */,
F307A2812B54329C0012534B /* Nes_Vrc6_Apu.cpp */,
6314974B2D8D4A3600EEC879 /* Nes_Fds_Apu.cpp */,
6314974D2D8D4A9200EEC879 /* Nes_Vrc7_Apu.cpp */,
F307A29F2B54329C0012534B /* Nsf_Emu.cpp */,
F307A2992B54329C0012534B /* Nsfe_Emu.cpp */,
F307A2902B54329C0012534B /* Sap_Apu.cpp */,
Expand Down Expand Up @@ -388,6 +400,10 @@
F307A2BF2B54329C0012534B /* Sap_Apu.cpp in Sources */,
F307A2DC2B54329C0012534B /* Spc_Dsp.cpp in Sources */,
F307A2C82B54329C0012534B /* Nsfe_Emu.cpp in Sources */,
6314974C2D8D4A3600EEC879 /* Nes_Fds_Apu.cpp in Sources */,
6314974E2D8D4A9200EEC879 /* Nes_Vrc7_Apu.cpp in Sources */,
631497502D8D4AEA00EEC879 /* emu2413.c in Sources */,
631497522D8D4B0500EEC879 /* panning.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion external/libgme
Submodule libgme updated 140 files