added message to assert when gdi track fails to open

This commit is contained in:
Anthony Pesch 2017-11-25 12:36:16 -05:00
parent a8501a2f62
commit cdfbb58a6b
1 changed files with 4 additions and 3 deletions

View File

@ -15,13 +15,14 @@ static void gdi_read_sector(struct disc *disc, struct track *track, int fad,
void *dst) {
struct gdi *gdi = (struct gdi *)disc;
/* open the file backing the track */
int n = (int)(track - gdi->tracks);
FILE *fp = gdi->files[n];
/* lazily open the file backing the track */
if (!fp) {
fp = gdi->files[n] = fopen(track->filename, "rb");
CHECK_NOTNULL(fp);
fp = fopen(track->filename, "rb");
CHECK_NOTNULL(fp, "gdi_read_sector failed to open %s", track->filename);
gdi->files[n] = fp;
}
/* seek the to the starting fad */