Fixed GME/VGMPlay metadata retrieval during playback, which fixes song lengths.

CQTexperiment
Chris Moeller 2016-02-09 22:20:00 -08:00
parent cf1857fa94
commit 8533dde6dd
1 changed files with 4 additions and 3 deletions

View File

@ -149,11 +149,11 @@ static int check_gd3_header( byte const h [], int remain )
static void get_vgm_length( Vgm_Emu::header_t const& h, track_info_t* out ) static void get_vgm_length( Vgm_Emu::header_t const& h, track_info_t* out )
{ {
int length = get_le32( &h.lngTotalSamples ) * 10 / 441; // 1000 / 44100 int length = h.lngTotalSamples * 10 / 441; // 1000 / 44100
if ( length > 0 ) if ( length > 0 )
{ {
int loop = get_le32( &h.lngLoopSamples ); int loop = h.lngLoopSamples;
if ( loop > 0 && get_le32( &h.lngLoopOffset ) ) if ( loop > 0 && h.lngLoopOffset )
{ {
out->loop_length = loop * 10 / 441; out->loop_length = loop * 10 / 441;
out->intro_length = length - out->loop_length; out->intro_length = length - out->loop_length;
@ -171,6 +171,7 @@ static void get_vgm_length( Vgm_Emu::header_t const& h, track_info_t* out )
blargg_err_t Vgm_Emu::track_info_( track_info_t* out, int ) const blargg_err_t Vgm_Emu::track_info_( track_info_t* out, int ) const
{ {
*out = metadata;
return blargg_ok; return blargg_ok;
} }