mcd, fix no chd music in some cases
authorkub <derkub@gmail.com>
Thu, 29 Jun 2023 19:54:07 +0000 (19:54 +0000)
committerkub <derkub@gmail.com>
Thu, 29 Jun 2023 19:54:07 +0000 (19:54 +0000)
pico/cd/cd_parse.c

index 53c15d2..0a802ed 100644 (file)
@@ -172,7 +172,8 @@ cd_data_t *chd_parse(const char *fname)
                }
                memset(&data->tracks[count], 0, sizeof(data->tracks[0]));
 
-               data->tracks[count].fname = strdup(fname);
+               if (count == 1)
+                       data->tracks[count].fname = strdup(fname);
                if (!strcmp(type, "MODE1_RAW") || !strcmp(type, "MODE2_RAW")) {
                        data->tracks[count].type = CT_BIN;
                } else if (!strcmp(type, "MODE1") || !strcmp(type, "MODE2_FORM1")) {