Before, unconfigured music files were played in the order they were
stored in the file system (that is, in unpredictable order). This
change adds sorting them by filename.
return NULL;
}
+static int compareMusicInfo(const void *object1, const void *object2)
+{
+ const MusicInfo *mi1 = *((MusicInfo **)object1);
+ const MusicInfo *mi2 = *((MusicInfo **)object2);
+
+ return strcmp(mi1->source_filename, mi2->source_filename);
+}
+
static void LoadCustomMusic_NoConf(void)
{
static boolean draw_init_text = TRUE; // only draw at startup
closeDirectory(dir);
+ // sort music files by filename
+ qsort(Music_NoConf, num_music_noconf, sizeof(MusicInfo *), compareMusicInfo);
+
draw_init_text = FALSE;
}