From eaa2def3cded6e4855f0a640f1834877e345d0dc Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 24 Jun 2018 10:57:58 +0100 Subject: [PATCH] Correct detection of MODE 2 Forms when dumping, fixes #184. --- Changelog.md | 1 + .../Devices/Dumping/CompactDisc.cs | 22 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 877e16aa..ff0fce47 100644 --- a/Changelog.md +++ b/Changelog.md @@ -184,6 +184,7 @@ ### - Dumping - Correctly detect CD-i, CD+ and CD-ROM XA. +- Correctly detect Mode 2 Form 1 and Form 2. - Do not retry when retry passes are zero. - Do not try to read multisession lead-out/lead-in as they result in errors that are not really there. - Get correct track flags. diff --git a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs index b7dc3d93..dcc5af7a 100644 --- a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs +++ b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs @@ -647,9 +647,25 @@ namespace DiscImageChef.Core.Devices.Dumping tracks[t].TrackType = TrackType.CdMode1; break; case 2: - DicConsole.WriteLine("Track {0} is MODE2", tracks[t].TrackSequence); - dumpLog.WriteLine("Track {0} is MODE2", tracks[t].TrackSequence); - tracks[t].TrackType = TrackType.CdMode2Formless; + if(dskType == MediaType.CDI) + { + DicConsole.WriteLine("Track {0} is MODE2", tracks[t].TrackSequence); + dumpLog.WriteLine("Track {0} is MODE2", tracks[t].TrackSequence); + tracks[t].TrackType = TrackType.CdMode2Formless; + break; + } + + if((readBuffer[0x012] & 0x20) == 0x20) // mode 2 form 2 + { + DicConsole.WriteLine("Track {0} is MODE2 FORM 2", tracks[t].TrackSequence); + dumpLog.WriteLine("Track {0} is MODE2 FORM 2", tracks[t].TrackSequence); + tracks[t].TrackType = TrackType.CdMode2Form2; + break; + } + + DicConsole.WriteLine("Track {0} is MODE2 FORM 1", tracks[t].TrackSequence); + dumpLog.WriteLine("Track {0} is MODE2 FORM 1", tracks[t].TrackSequence); + tracks[t].TrackType = TrackType.CdMode2Form1; break; default: DicConsole.WriteLine("Track {0} is unknown mode {1}", tracks[t].TrackSequence, readBuffer[15]);