From dfed1a38149a68a94d905b087ae61fcf7ff557ce Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Tue, 10 Mar 2015 21:22:04 -0700 Subject: [PATCH] Fixed Sap_File song length reporting, even though it doesn't affect Cog --- Frameworks/GME/gme/Sap_Emu.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Frameworks/GME/gme/Sap_Emu.cpp b/Frameworks/GME/gme/Sap_Emu.cpp index c8471890b..69141ddce 100644 --- a/Frameworks/GME/gme/Sap_Emu.cpp +++ b/Frameworks/GME/gme/Sap_Emu.cpp @@ -294,9 +294,28 @@ struct Sap_File : Gme_Info_ return blargg_ok; } - blargg_err_t track_info_( track_info_t* out, int ) const + blargg_err_t track_info_( track_info_t* out, int track ) const { copy_sap_fields( info, out ); + + if (track < Sap_Emu::max_tracks) + { + int time = info.track_times[track]; + if (time) + { + if (time > 0) + { + out->loop_length = 0; + } + else + { + time = -time; + out->loop_length = time; + } + out->length = time; + } + } + return blargg_ok; }