mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Do not set INDEX 1 to a value higher than what the TOC already said.
This commit is contained in:
@@ -72,7 +72,8 @@ public static class CompactDisc
|
||||
bool fixSubchannelPosition, IWritableOpticalImage outputPlugin,
|
||||
bool fixSubchannel, bool fixSubchannelCrc, DumpLog dumpLog,
|
||||
UpdateStatusHandler updateStatus,
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack, bool dumping, out List<ulong> newPregapSectors)
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack, bool dumping,
|
||||
out List<ulong> newPregapSectors)
|
||||
{
|
||||
// We need to work in PW raw subchannels
|
||||
if(supportedSubchannel == MmcSubchannel.Q16)
|
||||
@@ -88,7 +89,8 @@ public static class CompactDisc
|
||||
byte[] deSub = Subchannel.Deinterleave(sub);
|
||||
|
||||
bool indexesChanged = CheckIndexesFromSubchannel(deSub, isrcs, currentTrack, ref mcn, tracks, dumpLog,
|
||||
updateStatus, smallestPregapLbaPerTrack, dumping, out newPregapSectors);
|
||||
updateStatus, smallestPregapLbaPerTrack, dumping,
|
||||
out newPregapSectors);
|
||||
|
||||
if(!fixSubchannelPosition ||
|
||||
desiredSubchannel == MmcSubchannel.None)
|
||||
@@ -312,7 +314,8 @@ public static class CompactDisc
|
||||
static bool CheckIndexesFromSubchannel(byte[] deSub, Dictionary<byte, string> isrcs, byte currentTrack,
|
||||
ref string mcn, Track[] tracks, DumpLog dumpLog,
|
||||
UpdateStatusHandler updateStatus,
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack, bool dumping, out List<ulong> newPregapSectors)
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack, bool dumping,
|
||||
out List<ulong> newPregapSectors)
|
||||
{
|
||||
var status = false;
|
||||
newPregapSectors = new List<ulong>();
|
||||
@@ -433,8 +436,8 @@ public static class CompactDisc
|
||||
updateStatus?.Invoke($"Pregap for track {trackNo} set to {tracks[i].Pregap} sectors.");
|
||||
|
||||
for(var p = 0; p < dif; p++)
|
||||
newPregapSectors.Add(tracks[i].StartSector+(ulong)p);
|
||||
|
||||
newPregapSectors.Add(tracks[i].StartSector + (ulong)p);
|
||||
|
||||
status = true;
|
||||
}
|
||||
|
||||
@@ -455,8 +458,8 @@ public static class CompactDisc
|
||||
updateStatus?.Invoke($"Pregap for track {trackNo} set to {tracks[i].Pregap} sectors.");
|
||||
|
||||
for(var p = 0; p < (int)(tracks[i].Pregap - oldPregap); p++)
|
||||
newPregapSectors.Add(tracks[i].StartSector +(ulong)p);
|
||||
|
||||
newPregapSectors.Add(tracks[i].StartSector + (ulong)p);
|
||||
|
||||
status = true;
|
||||
|
||||
continue;
|
||||
@@ -470,6 +473,11 @@ public static class CompactDisc
|
||||
var aframe = (byte)(q[9] / 16 * 10 + (q[9] & 0x0F));
|
||||
int aPos = amin * 60 * 75 + asec * 75 + aframe - 150;
|
||||
|
||||
// Do not set INDEX 1 to a value higher than what the TOC already said.
|
||||
if(q[2] == 1 &&
|
||||
aPos > (int)tracks[i].StartSector)
|
||||
continue;
|
||||
|
||||
if(tracks[i].Indexes.ContainsKey(q[2]) &&
|
||||
aPos >= tracks[i].Indexes[q[2]])
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user