From ce6055e88de3895f5e0d5b1b5220e477e0844cea Mon Sep 17 00:00:00 2001 From: waker Date: Thu, 1 Mar 2012 19:30:57 +0100 Subject: gme: fixed file extension detection for headerless files --- plugins/gme/cgme.c | 10 +++++----- plugins/gme/game-music-emu-svn/gme/gme.cpp | 4 ++-- plugins/gme/game-music-emu-svn/gme/gme.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/gme/cgme.c b/plugins/gme/cgme.c index 0955698a..daf0b981 100644 --- a/plugins/gme/cgme.c +++ b/plugins/gme/cgme.c @@ -120,7 +120,7 @@ cgme_init (DB_fileinfo_t *_info, DB_playItem_t *it) { char *buffer; int sz; if (!read_gzfile (deadbeef->pl_find_meta (it, ":URI"), &buffer, &sz)) { - res = gme_open_data (buffer, sz, &info->emu, samplerate); + res = gme_open_data (deadbeef->pl_find_meta (it, ":URI"), buffer, sz, &info->emu, samplerate); free (buffer); } if (res) { @@ -142,7 +142,7 @@ cgme_init (DB_fileinfo_t *_info, DB_playItem_t *it) { return -1; } - res = gme_open_data (buf, sz, &info->emu, samplerate); + res = gme_open_data (deadbeef->pl_find_meta (it, ":URI"), buf, sz, &info->emu, samplerate); free (buf); } @@ -271,7 +271,7 @@ cgme_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { char *buffer; int sz; if (!read_gzfile (fname, &buffer, &sz)) { - res = gme_open_data (buffer, sz, &emu, gme_info_only); + res = gme_open_data (fname, buffer, sz, &emu, gme_info_only); free (buffer); } if (res) { @@ -296,7 +296,7 @@ cgme_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { return NULL; } - res = gme_open_data (buf, sz, &emu, gme_info_only); + res = gme_open_data (fname, buf, sz, &emu, gme_info_only); free (buf); } @@ -393,7 +393,7 @@ cgme_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { } } else { - trace ("gme_open_file/data failed\n"); + trace ("gme_open_file/data failed with error %s\n", res); } return after; } diff --git a/plugins/gme/game-music-emu-svn/gme/gme.cpp b/plugins/gme/game-music-emu-svn/gme/gme.cpp index 35266ded..255dbf4b 100644 --- a/plugins/gme/game-music-emu-svn/gme/gme.cpp +++ b/plugins/gme/game-music-emu-svn/gme/gme.cpp @@ -126,14 +126,14 @@ BLARGG_EXPORT gme_err_t gme_identify_file( const char* path, gme_type_t* type_ou return 0; } -BLARGG_EXPORT gme_err_t gme_open_data( void const* data, long size, Music_Emu** out, int sample_rate ) +BLARGG_EXPORT gme_err_t gme_open_data( const char *path, void const* data, long size, Music_Emu** out, int sample_rate ) { require( (data || !size) && out ); *out = 0; gme_type_t file_type = 0; if ( size >= 4 ) - file_type = gme_identify_extension( gme_identify_header( data ) ); + file_type = gme_identify_extension( path ); if ( !file_type ) return gme_wrong_file_type; diff --git a/plugins/gme/game-music-emu-svn/gme/gme.h b/plugins/gme/game-music-emu-svn/gme/gme.h index 2fc442eb..d86c8761 100644 --- a/plugins/gme/game-music-emu-svn/gme/gme.h +++ b/plugins/gme/game-music-emu-svn/gme/gme.h @@ -185,7 +185,7 @@ int gme_type_multitrack( gme_type_t ); extern const char* const gme_wrong_file_type; /* Same as gme_open_file(), but uses file data already in memory. Makes copy of data. */ -gme_err_t gme_open_data( void const* data, long size, Music_Emu** out, int sample_rate ); +gme_err_t gme_open_data( const char *path, void const* data, long size, Music_Emu** out, int sample_rate ); /* Determine likely game music type based on first four bytes of file. Returns string containing proper file suffix (i.e. "NSF", "SPC", etc.) or "" if -- cgit v1.2.3