From 34ac5f9ba0d4aef97ae69731661895f3d6322d09 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sun, 2 Aug 2020 21:22:24 -0700 Subject: [PATCH] Fix audio disc error count (fixes #215) --- DICUI.Library/DiscImageCreator/Parameters.cs | 26 +++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/DICUI.Library/DiscImageCreator/Parameters.cs b/DICUI.Library/DiscImageCreator/Parameters.cs index eb53520e..017bc105 100644 --- a/DICUI.Library/DiscImageCreator/Parameters.cs +++ b/DICUI.Library/DiscImageCreator/Parameters.cs @@ -1580,6 +1580,11 @@ namespace DICUI.DiscImageCreator { string outputDirectory = Path.GetDirectoryName(basePath); + // Some disc types are audio-only + bool audioOnly = (system == KnownSystem.AtariJaguarCD) + || (system == KnownSystem.AudioCD) + || (system == KnownSystem.SuperAudioCD); + // Fill in the hash data info.TracksAndWriteOffsets.ClrMameProData = GetDatfile(basePath + ".dat"); @@ -1590,13 +1595,22 @@ namespace DICUI.DiscImageCreator case MediaType.GDROM: // TODO: Verify GD-ROM outputs this info.Extras.PVD = GetPVD(basePath + "_mainInfo.txt") ?? "Disc has no PVD"; ; - long errorCount = -1; - if (File.Exists(basePath + ".img_EdcEcc.txt")) - errorCount = GetErrorCount(basePath + ".img_EdcEcc.txt"); - else if (File.Exists(basePath + ".img_EccEdc.txt")) - errorCount = GetErrorCount(basePath + ".img_EccEdc.txt"); + // Audio-only discs will fail if there are any C2 errors, so they would never get here + if (audioOnly) + { + info.CommonDiscInfo.ErrorsCount = "0"; + } + else + { + long errorCount = -1; + if (File.Exists(basePath + ".img_EdcEcc.txt")) + errorCount = GetErrorCount(basePath + ".img_EdcEcc.txt"); + else if (File.Exists(basePath + ".img_EccEdc.txt")) + errorCount = GetErrorCount(basePath + ".img_EccEdc.txt"); + + info.CommonDiscInfo.ErrorsCount = (errorCount == -1 ? "Error retrieving error count" : errorCount.ToString()); + } - info.CommonDiscInfo.ErrorsCount = (errorCount == -1 ? "Error retrieving error count" : errorCount.ToString()); info.TracksAndWriteOffsets.Cuesheet = GetFullFile(basePath + ".cue") ?? ""; string cdWriteOffset = GetWriteOffset(basePath + "_disc.txt") ?? "";