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