mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Finally CD-Text on lead-in is getting decoded correctly...
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using DiscImageChef.Console;
|
using DiscImageChef.Console;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace DiscImageChef.Decoders.CD
|
namespace DiscImageChef.Decoders.CD
|
||||||
{
|
{
|
||||||
@@ -215,12 +216,12 @@ namespace DiscImageChef.Decoders.CD
|
|||||||
decoded.DataPacks[i].HeaderID1 = CDTextResponse[0 + i * 18 + 4];
|
decoded.DataPacks[i].HeaderID1 = CDTextResponse[0 + i * 18 + 4];
|
||||||
decoded.DataPacks[i].HeaderID2 = CDTextResponse[1 + i * 18 + 4];
|
decoded.DataPacks[i].HeaderID2 = CDTextResponse[1 + i * 18 + 4];
|
||||||
decoded.DataPacks[i].HeaderID3 = CDTextResponse[2 + i * 18 + 4];
|
decoded.DataPacks[i].HeaderID3 = CDTextResponse[2 + i * 18 + 4];
|
||||||
decoded.DataPacks[i].DBCC = Convert.ToBoolean(CDTextResponse[3 + i * 8 + 4] & 0x80);
|
decoded.DataPacks[i].DBCC = Convert.ToBoolean(CDTextResponse[3 + i * 18 + 4] & 0x80);
|
||||||
decoded.DataPacks[i].BlockNumber = (byte)((CDTextResponse[3 + i * 8 + 4] & 0x70) >> 4);
|
decoded.DataPacks[i].BlockNumber = (byte)((CDTextResponse[3 + i * 18 + 4] & 0x70) >> 4);
|
||||||
decoded.DataPacks[i].CharacterPosition = (byte)(CDTextResponse[3 + i * 8 + 4] & 0x0F);
|
decoded.DataPacks[i].CharacterPosition = (byte)(CDTextResponse[3 + i * 18 + 4] & 0x0F);
|
||||||
decoded.DataPacks[i].TextDataField = new byte[12];
|
decoded.DataPacks[i].TextDataField = new byte[12];
|
||||||
Array.Copy(CDTextResponse, 4, decoded.DataPacks[i].TextDataField, 0, 12);
|
Array.Copy(CDTextResponse, 4 + i * 18 + 4, decoded.DataPacks[i].TextDataField, 0, 12);
|
||||||
decoded.DataPacks[i].CRC = BigEndianBitConverter.ToUInt16(CDTextResponse, 16 + i * 8 + 4);
|
decoded.DataPacks[i].CRC = BigEndianBitConverter.ToUInt16(CDTextResponse, 16 + i * 18 + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return decoded;
|
return decoded;
|
||||||
@@ -232,7 +233,6 @@ namespace DiscImageChef.Decoders.CD
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
CDText response = CDTextResponse.Value;
|
CDText response = CDTextResponse.Value;
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
@@ -241,10 +241,15 @@ namespace DiscImageChef.Decoders.CD
|
|||||||
if(response.Reserved2 != 0)
|
if(response.Reserved2 != 0)
|
||||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
foreach (CDTextPack descriptor in response.DataPacks)
|
foreach (CDTextPack descriptor in response.DataPacks)
|
||||||
{
|
{
|
||||||
if ((descriptor.HeaderID1 & 0x80) != 0x80)
|
if ((descriptor.HeaderID1 & 0x80) != 0x80)
|
||||||
|
{
|
||||||
|
// Ignore NOPs
|
||||||
|
if((descriptor.HeaderID1 & 0x80) != 0)
|
||||||
sb.AppendFormat("Incorrect CD-Text pack type {0}, not decoding", descriptor.HeaderID1).AppendLine();
|
sb.AppendFormat("Incorrect CD-Text pack type {0}, not decoding", descriptor.HeaderID1).AppendLine();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (descriptor.HeaderID1)
|
switch (descriptor.HeaderID1)
|
||||||
@@ -278,7 +283,6 @@ namespace DiscImageChef.Decoders.CD
|
|||||||
}
|
}
|
||||||
case 0x83:
|
case 0x83:
|
||||||
{
|
{
|
||||||
sb.Append("CD-Text pack contains composer for ");
|
|
||||||
if (descriptor.HeaderID2 == 0x00)
|
if (descriptor.HeaderID2 == 0x00)
|
||||||
sb.AppendLine("album");
|
sb.AppendLine("album");
|
||||||
else
|
else
|
||||||
@@ -340,7 +344,7 @@ namespace DiscImageChef.Decoders.CD
|
|||||||
if (descriptor.HeaderID2 == 0x00)
|
if (descriptor.HeaderID2 == 0x00)
|
||||||
sb.AppendLine("CD-Text pack contains UPC");
|
sb.AppendLine("CD-Text pack contains UPC");
|
||||||
else
|
else
|
||||||
sb.AppendFormat("CD-Text pack contains ISRC for track {0}", descriptor.HeaderID2).AppendLine();
|
sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x8F:
|
case 0x8F:
|
||||||
@@ -366,7 +370,7 @@ namespace DiscImageChef.Decoders.CD
|
|||||||
sb.AppendLine("Double Byte Character Code is used");
|
sb.AppendLine("Double Byte Character Code is used");
|
||||||
sb.AppendFormat("Block number {0}", descriptor.BlockNumber).AppendLine();
|
sb.AppendFormat("Block number {0}", descriptor.BlockNumber).AppendLine();
|
||||||
sb.AppendFormat("Character position {0}", descriptor.CharacterPosition).AppendLine();
|
sb.AppendFormat("Character position {0}", descriptor.CharacterPosition).AppendLine();
|
||||||
sb.AppendFormat("Text field: \"{0}\"", StringHandlers.CToString(descriptor.TextDataField)).AppendLine();
|
sb.AppendFormat("Text field: \"{0}\"", StringHandlers.CToString(descriptor.TextDataField, Encoding.GetEncoding("iso-8859-1"))).AppendLine();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
|
* CD/CDTextOnLeadIn.cs:
|
||||||
|
Finally CD-Text on lead-in is getting decoded correctly...
|
||||||
|
|
||||||
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* CD/FullTOC.cs:
|
* CD/FullTOC.cs:
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
|
* Device/ScsiCommands.cs:
|
||||||
|
Finally CD-Text on lead-in is getting decoded correctly...
|
||||||
|
|
||||||
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* Device/ScsiCommands.cs:
|
* Device/ScsiCommands.cs:
|
||||||
|
|||||||
@@ -846,9 +846,14 @@ namespace DiscImageChef.Devices
|
|||||||
{
|
{
|
||||||
senseBuffer = new byte[32];
|
senseBuffer = new byte[32];
|
||||||
byte[] cdb = new byte[10];
|
byte[] cdb = new byte[10];
|
||||||
byte[] tmpBuffer = new byte[1024];
|
byte[] tmpBuffer;
|
||||||
bool sense;
|
bool sense;
|
||||||
|
|
||||||
|
if(format == 5)
|
||||||
|
tmpBuffer = new byte[32768];
|
||||||
|
else
|
||||||
|
tmpBuffer = new byte[1024];
|
||||||
|
|
||||||
cdb[0] = (byte)ScsiCommands.ReadTocPmaAtip;
|
cdb[0] = (byte)ScsiCommands.ReadTocPmaAtip;
|
||||||
if (MSF)
|
if (MSF)
|
||||||
cdb[1] = 0x02;
|
cdb[1] = 0x02;
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
|
* StringHandlers.cs:
|
||||||
|
Finally CD-Text on lead-in is getting decoded correctly...
|
||||||
|
|
||||||
2015-10-19 Natalia Portillo <claunia@claunia.com>
|
2015-10-19 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* DiscImageChef.Helpers.csproj:
|
* DiscImageChef.Helpers.csproj:
|
||||||
|
|||||||
@@ -49,6 +49,17 @@ namespace DiscImageChef
|
|||||||
/// <returns>The corresponding C# string</returns>
|
/// <returns>The corresponding C# string</returns>
|
||||||
/// <param name="CString">A null-terminated (aka C string) ASCII byte array</param>
|
/// <param name="CString">A null-terminated (aka C string) ASCII byte array</param>
|
||||||
public static string CToString(byte[] CString)
|
public static string CToString(byte[] CString)
|
||||||
|
{
|
||||||
|
return CToString(CString, Encoding.ASCII);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts a null-terminated (aka C string) byte array with the specified encoding to a C# string
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The corresponding C# string</returns>
|
||||||
|
/// <param name="CString">A null-terminated (aka C string) byte array in the specified encoding</param>
|
||||||
|
/// <param name="encoding">Encoding.</param>
|
||||||
|
public static string CToString(byte[] CString, Encoding encoding)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
@@ -57,7 +68,7 @@ namespace DiscImageChef
|
|||||||
if (CString[i] == 0)
|
if (CString[i] == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
sb.Append(Encoding.ASCII.GetString(CString, i, 1));
|
sb.Append(encoding.GetString(CString, i, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
|
* Commands/MediaInfo.cs:
|
||||||
|
Finally CD-Text on lead-in is getting decoded correctly...
|
||||||
|
|
||||||
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* Commands/MediaInfo.cs:
|
* Commands/MediaInfo.cs:
|
||||||
|
|||||||
@@ -807,8 +807,8 @@ namespace DiscImageChef.Commands
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
doWriteFile(outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf);
|
doWriteFile(outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf);
|
||||||
//if(Decoders.CD.CDTextOnLeadIn.Decode(cmdBuf).HasValue)
|
if(Decoders.CD.CDTextOnLeadIn.Decode(cmdBuf).HasValue)
|
||||||
// DicConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", Decoders.CD.CDTextOnLeadIn.Prettify(cmdBuf));
|
DicConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", Decoders.CD.CDTextOnLeadIn.Prettify(cmdBuf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user