mirror of
https://github.com/aaru-dps/Aaru.git
synced 2026-02-04 00:44:39 +00:00
Correct processing of headerless CD-Text coming from images, in image info command. Fixes #662
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Aaru" type="DotNetProject" factoryName=".NET Project">
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Release/net10.0/linux-x64/aaru" />
|
||||
<option name="PROGRAM_PARAMETERS" value="i create-sidecar "OpenSolaris Disc 1 (708-0235-11).aif"" />
|
||||
<option name="WORKING_DIRECTORY" value="/mnt/datos/Dumps (bugs)/PC/Operating Systems/OpenSolaris Starter Kit (819-7180-10) (July 2006)/" />
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/net10.0/osx-arm64/aaru" />
|
||||
<option name="PROGRAM_PARAMETERS" value="i info "Tanxugueiras - Contra (CLVR012).aif"" />
|
||||
<option name="WORKING_DIRECTORY" value="/Volumes/iPhone/issue662/" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
<option name="ENV_FILE_PATHS" value="" />
|
||||
<option name="REDIRECT_INPUT_PATH" value="" />
|
||||
|
||||
@@ -49,6 +49,7 @@ using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Aaru.Localization;
|
||||
using Aaru.Logging;
|
||||
using Humanizer;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
|
||||
|
||||
@@ -509,16 +509,14 @@ public static class ImageInfo
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
{
|
||||
uint dataLen = Swapping.Swap(BitConverter.ToUInt32(cdtext, 0));
|
||||
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(cdtext, 0));
|
||||
|
||||
if(dataLen + 4 != cdtext.Length)
|
||||
if(dataLen + 2 != cdtext.Length)
|
||||
{
|
||||
var tmp = new byte[cdtext.Length + 4];
|
||||
Array.Copy(cdtext, 0, tmp, 4, cdtext.Length);
|
||||
tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24);
|
||||
tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16);
|
||||
tmp[2] = (byte)((cdtext.Length & 0xFF00) >> 8);
|
||||
tmp[3] = (byte)(cdtext.Length & 0xFF);
|
||||
tmp[0] = (byte)((cdtext.Length + 2 & 0xFF00) >> 8);
|
||||
tmp[1] = (byte)(cdtext.Length + 2 & 0xFF);
|
||||
cdtext = tmp;
|
||||
}
|
||||
|
||||
@@ -868,7 +866,9 @@ public static class ImageInfo
|
||||
}
|
||||
}
|
||||
|
||||
if(imageFormat is IFluxImage fluxImage && fluxImage.GetAllFluxCaptures(out List<FluxCapture> captures) == ErrorNumber.NoError && captures is { Count: > 0 })
|
||||
if(imageFormat is IFluxImage fluxImage &&
|
||||
fluxImage.GetAllFluxCaptures(out List<FluxCapture> captures) == ErrorNumber.NoError &&
|
||||
captures is { Count: > 0 })
|
||||
AaruLogging.WriteLine(Localization.Core.Image_flux_captures);
|
||||
|
||||
if(imageFormat is not IOpticalMediaImage opticalImage) return;
|
||||
|
||||
@@ -274,8 +274,9 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags is { Count: > 0 })
|
||||
foreach(MediaTagType tag in imageFormat.Info.ReadableMediaTags.Order())
|
||||
MediaTagsList.Add(tag.Humanize());
|
||||
{
|
||||
foreach(MediaTagType tag in imageFormat.Info.ReadableMediaTags.Order()) MediaTagsList.Add(tag.Humanize());
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableSectorTags is { Count: > 0 })
|
||||
{
|
||||
@@ -456,16 +457,14 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
{
|
||||
uint dataLen = Swapping.Swap(BitConverter.ToUInt32(cdtext, 0));
|
||||
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(cdtext, 0));
|
||||
|
||||
if(dataLen + 4 != cdtext.Length)
|
||||
if(dataLen + 2 != cdtext.Length)
|
||||
{
|
||||
var tmp = new byte[cdtext.Length + 4];
|
||||
Array.Copy(cdtext, 0, tmp, 4, cdtext.Length);
|
||||
tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24);
|
||||
tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16);
|
||||
tmp[2] = (byte)((cdtext.Length & 0xFF00) >> 8);
|
||||
tmp[3] = (byte)(cdtext.Length & 0xFF);
|
||||
tmp[0] = (byte)((cdtext.Length + 2 & 0xFF00) >> 8);
|
||||
tmp[1] = (byte)(cdtext.Length + 2 & 0xFF);
|
||||
cdtext = tmp;
|
||||
}
|
||||
|
||||
@@ -794,9 +793,8 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
try
|
||||
{
|
||||
if(opticalMediaImage.Sessions is { Count: > 0 })
|
||||
{
|
||||
foreach(Session session in opticalMediaImage.Sessions) Sessions.Add(session);
|
||||
}
|
||||
foreach(Session session in opticalMediaImage.Sessions)
|
||||
Sessions.Add(session);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
@@ -806,9 +804,8 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
try
|
||||
{
|
||||
if(opticalMediaImage.Tracks is { Count: > 0 })
|
||||
{
|
||||
foreach(Track track in opticalMediaImage.Tracks) Tracks.Add(track);
|
||||
}
|
||||
foreach(Track track in opticalMediaImage.Tracks)
|
||||
Tracks.Add(track);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
@@ -189,14 +189,12 @@ public sealed partial class DecodeMediaTagsViewModel : ViewModelBase
|
||||
case MediaTagType.CD_TEXT:
|
||||
dataLen = Swapping.Swap(BitConverter.ToUInt32(value.Data, 0));
|
||||
|
||||
if(dataLen + 4 != value.Data.Length)
|
||||
if(dataLen + 2 != value.Data.Length)
|
||||
{
|
||||
var tmp = new byte[value.Data.Length + 4];
|
||||
Array.Copy(value.Data, 0, tmp, 4, value.Data.Length);
|
||||
tmp[0] = (byte)((value.Data.Length & 0xFF000000) >> 24);
|
||||
tmp[1] = (byte)((value.Data.Length & 0xFF0000) >> 16);
|
||||
tmp[2] = (byte)((value.Data.Length & 0xFF00) >> 8);
|
||||
tmp[3] = (byte)(value.Data.Length & 0xFF);
|
||||
tmp[0] = (byte)((value.Data.Length + 2 & 0xFF00) >> 8);
|
||||
tmp[1] = (byte)(value.Data.Length + 2 & 0xFF);
|
||||
value.Data = tmp;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user