From bd50a0d2ef5662e8f4164d4f6d1bd763c08ff769 Mon Sep 17 00:00:00 2001 From: John Regan Date: Tue, 26 Sep 2017 08:42:53 -0500 Subject: [PATCH] GME Plugin: fix track numbering GME starts all track indexes at zero, but subtune prefixes start at one. This fixes an off-by-one error during track enumeration. --- src/decoder/plugins/GmeDecoderPlugin.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/decoder/plugins/GmeDecoderPlugin.cxx b/src/decoder/plugins/GmeDecoderPlugin.cxx index c8f7ae2d4..d623f6ad6 100644 --- a/src/decoder/plugins/GmeDecoderPlugin.cxx +++ b/src/decoder/plugins/GmeDecoderPlugin.cxx @@ -319,13 +319,13 @@ gme_container_scan(Path path_fs) TagBuilder tag_builder; auto tail = list.before_begin(); - for (unsigned i = 1; i <= num_songs; ++i) { + for (unsigned i = 0; i < num_songs; ++i) { ScanMusicEmu(emu, i, add_tag_handler, &tag_builder); char track_name[64]; snprintf(track_name, sizeof(track_name), - SUBTUNE_PREFIX "%03u.%s", i, subtune_suffix); + SUBTUNE_PREFIX "%03u.%s", i+1, subtune_suffix); tail = list.emplace_after(tail, track_name, tag_builder.Commit()); }