mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Fix reading multisession CDRWin images.
This commit is contained in:
2
.idea/.idea.Aaru/.idea/contentModel.xml
generated
2
.idea/.idea.Aaru/.idea/contentModel.xml
generated
@@ -5,6 +5,8 @@
|
|||||||
<e p="$USER_HOME$/.cache/JetBrains/Rider2020.1/resharper-host/local/Transient/ReSharperHost/v201/SolutionCaches/_Aaru.232757112.00" t="ExcludeRecursive" />
|
<e p="$USER_HOME$/.cache/JetBrains/Rider2020.1/resharper-host/local/Transient/ReSharperHost/v201/SolutionCaches/_Aaru.232757112.00" t="ExcludeRecursive" />
|
||||||
<e p="$APPLICATION_CONFIG_DIR$/consoles/db" t="IncludeRecursive" />
|
<e p="$APPLICATION_CONFIG_DIR$/consoles/db" t="IncludeRecursive" />
|
||||||
<e p="$APPLICATION_CONFIG_DIR$/extensions" t="IncludeRecursive" />
|
<e p="$APPLICATION_CONFIG_DIR$/extensions" t="IncludeRecursive" />
|
||||||
|
<e p="$APPLICATION_CONFIG_DIR$/scratches" t="IncludeRecursive" />
|
||||||
|
<e p="$USER_HOME$/.config/git/ignore" t="IncludeRecursive" />
|
||||||
<e p="$APPLICATION_PLUGINS_DIR$/puppet/lib/stubs" t="IncludeRecursive" />
|
<e p="$APPLICATION_PLUGINS_DIR$/puppet/lib/stubs" t="IncludeRecursive" />
|
||||||
<e p="$PROJECT_DIR$" t="IncludeFlat">
|
<e p="$PROJECT_DIR$" t="IncludeFlat">
|
||||||
<e p=".git/info/exclude" t="IncludeRecursive" />
|
<e p=".git/info/exclude" t="IncludeRecursive" />
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ namespace Aaru.DiscImages
|
|||||||
var filtersList = new FiltersList();
|
var filtersList = new FiltersList();
|
||||||
bool inTruripDiscHash = false;
|
bool inTruripDiscHash = false;
|
||||||
bool inTruripTrackHash = false;
|
bool inTruripTrackHash = false;
|
||||||
|
bool firstTrackInSession = false;
|
||||||
|
|
||||||
ulong gdRomSession2Offset = 45000;
|
ulong gdRomSession2Offset = 45000;
|
||||||
densitySeparationSectors = 0;
|
densitySeparationSectors = 0;
|
||||||
@@ -350,6 +351,7 @@ namespace Aaru.DiscImages
|
|||||||
{
|
{
|
||||||
AaruConsole.DebugWriteLine("CDRWin plugin", "Found REM SESSION at line {0}", lineNumber);
|
AaruConsole.DebugWriteLine("CDRWin plugin", "Found REM SESSION at line {0}", lineNumber);
|
||||||
currentSession = byte.Parse(matchSession.Groups[1].Value);
|
currentSession = byte.Parse(matchSession.Groups[1].Value);
|
||||||
|
firstTrackInSession = true;
|
||||||
}
|
}
|
||||||
else if(matchRedumpSdArea.Success)
|
else if(matchRedumpSdArea.Success)
|
||||||
{
|
{
|
||||||
@@ -669,7 +671,21 @@ namespace Aaru.DiscImages
|
|||||||
currentFile.Offset = (ulong)(offset * currentTrack.Bps);
|
currentFile.Offset = (ulong)(offset * currentTrack.Bps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(currentTrack.Indexes.Count == 0)
|
||||||
|
{
|
||||||
|
if(firstTrackInSession &&
|
||||||
|
index != 0 &&
|
||||||
|
offset > 150)
|
||||||
|
{
|
||||||
|
currentTrack.Indexes[0] = offset - 150;
|
||||||
|
firstTrackInSession = false;
|
||||||
|
currentFileOffsetSector = offset - 150;
|
||||||
|
currentFile.Offset -= (ulong)(150 * currentTrack.Bps);
|
||||||
|
}
|
||||||
|
else
|
||||||
currentFileOffsetSector = offset;
|
currentFileOffsetSector = offset;
|
||||||
|
}
|
||||||
|
|
||||||
currentTrack.Indexes.Add(index, offset);
|
currentTrack.Indexes.Add(index, offset);
|
||||||
}
|
}
|
||||||
else if(matchIsrc.Success)
|
else if(matchIsrc.Success)
|
||||||
@@ -1122,8 +1138,6 @@ namespace Aaru.DiscImages
|
|||||||
|
|
||||||
Partitions = new List<Partition>();
|
Partitions = new List<Partition>();
|
||||||
|
|
||||||
ulong byteOffset = 0;
|
|
||||||
ulong sectorOffset = 0;
|
|
||||||
ulong partitionSequence = 0;
|
ulong partitionSequence = 0;
|
||||||
|
|
||||||
_offsetMap = new Dictionary<uint, ulong>();
|
_offsetMap = new Dictionary<uint, ulong>();
|
||||||
@@ -1139,41 +1153,25 @@ namespace Aaru.DiscImages
|
|||||||
if(!_discImage.Tracks[i].Indexes.TryGetValue(1, out _))
|
if(!_discImage.Tracks[i].Indexes.TryGetValue(1, out _))
|
||||||
throw new ImageNotSupportedException($"Track {_discImage.Tracks[i].Sequence} lacks index 01");
|
throw new ImageNotSupportedException($"Track {_discImage.Tracks[i].Sequence} lacks index 01");
|
||||||
|
|
||||||
if(_discImage.IsRedumpGigadisc &&
|
|
||||||
_discImage.Tracks[i].Session != 1 &&
|
|
||||||
sectorOffset < gdRomSession2Offset)
|
|
||||||
{
|
|
||||||
_offsetMap.Add(0, sectorOffset);
|
|
||||||
densitySeparationSectors = gdRomSession2Offset - sectorOffset;
|
|
||||||
sectorOffset = gdRomSession2Offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Index 01
|
// Index 01
|
||||||
partition.Description = $"Track {_discImage.Tracks[i].Sequence}.";
|
partition.Description = $"Track {_discImage.Tracks[i].Sequence}.";
|
||||||
partition.Name = _discImage.Tracks[i].Title;
|
partition.Name = _discImage.Tracks[i].Title;
|
||||||
partition.Start = sectorOffset;
|
partition.Start = (ulong)_discImage.Tracks[i].Indexes[1];
|
||||||
partition.Size = _discImage.Tracks[i].Sectors * _discImage.Tracks[i].Bps;
|
partition.Size = _discImage.Tracks[i].Sectors * _discImage.Tracks[i].Bps;
|
||||||
partition.Length = _discImage.Tracks[i].Sectors;
|
partition.Length = _discImage.Tracks[i].Sectors;
|
||||||
partition.Sequence = partitionSequence;
|
partition.Sequence = partitionSequence;
|
||||||
partition.Offset = byteOffset;
|
partition.Offset = partition.Start * 2352;
|
||||||
partition.Type = _discImage.Tracks[i].TrackType;
|
partition.Type = _discImage.Tracks[i].TrackType;
|
||||||
|
|
||||||
sectorOffset += partition.Length;
|
|
||||||
byteOffset += partition.Size;
|
|
||||||
partitionSequence++;
|
partitionSequence++;
|
||||||
|
|
||||||
if(!_offsetMap.ContainsKey(_discImage.Tracks[i].Sequence))
|
if(_discImage.Tracks[i].Indexes.TryGetValue(0, out int idx0))
|
||||||
_offsetMap.Add(_discImage.Tracks[i].Sequence, partition.Start);
|
_offsetMap.Add(_discImage.Tracks[i].Sequence, (ulong)idx0);
|
||||||
|
else if(_discImage.Tracks[i].Sequence > 1)
|
||||||
|
_offsetMap.Add(_discImage.Tracks[i].Sequence,
|
||||||
|
(ulong)(_discImage.Tracks[i].Indexes[1] - _discImage.Tracks[i].Pregap));
|
||||||
else
|
else
|
||||||
{
|
_offsetMap.Add(_discImage.Tracks[i].Sequence, (ulong)_discImage.Tracks[i].Indexes[1]);
|
||||||
_offsetMap.TryGetValue(_discImage.Tracks[i].Sequence, out ulong oldStart);
|
|
||||||
|
|
||||||
if(partition.Start < oldStart)
|
|
||||||
{
|
|
||||||
_offsetMap.Remove(_discImage.Tracks[i].Sequence);
|
|
||||||
_offsetMap.Add(_discImage.Tracks[i].Sequence, partition.Start);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Partitions.Add(partition);
|
Partitions.Add(partition);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user