mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
🐛Correct CD ECC calcuations, fixes #170.
This commit is contained in:
@@ -197,13 +197,13 @@ namespace DiscImageChef.Checksums
|
||||
byte[] eccQ = new byte[104];
|
||||
|
||||
Array.Copy(channel, 0x0C, address, 0, 4);
|
||||
Array.Copy(channel, 0x0C, data, 0, 2060);
|
||||
Array.Copy(channel, 0x0C, data2, 0, 2232);
|
||||
Array.Copy(channel, 0x10, data, 0, 2060);
|
||||
Array.Copy(channel, 0x10, data2, 0, 2232);
|
||||
Array.Copy(channel, 0x81C, eccP, 0, 172);
|
||||
Array.Copy(channel, 0x8C8, eccQ, 0, 104);
|
||||
|
||||
bool failedEccP = CheckEcc(address, data, 86, 24, 2, 86, eccP);
|
||||
bool failedEccQ = CheckEcc(address, data2, 52, 43, 86, 88, eccQ);
|
||||
bool failedEccP = !CheckEcc(address, data, 86, 24, 2, 86, eccP);
|
||||
bool failedEccQ = !CheckEcc(address, data2, 52, 43, 86, 88, eccQ);
|
||||
|
||||
if(failedEccP)
|
||||
DicConsole.DebugWriteLine("CD checksums",
|
||||
@@ -276,13 +276,13 @@ namespace DiscImageChef.Checksums
|
||||
address[1] = 0;
|
||||
address[2] = 0;
|
||||
address[3] = 0;
|
||||
Array.Copy(channel, 0x0C, data, 0, 2060);
|
||||
Array.Copy(channel, 0x0C, data2, 0, 2232);
|
||||
Array.Copy(channel, 0x10, data, 0, 2060);
|
||||
Array.Copy(channel, 0x10, data2, 0, 2232);
|
||||
Array.Copy(channel, 0x80C, eccP, 0, 172);
|
||||
Array.Copy(channel, 0x8B8, eccQ, 0, 104);
|
||||
|
||||
bool failedEccP = CheckEcc(address, data, 86, 24, 2, 86, eccP);
|
||||
bool failedEccQ = CheckEcc(address, data2, 52, 43, 86, 88, eccQ);
|
||||
bool failedEccP = !CheckEcc(address, data, 86, 24, 2, 86, eccP);
|
||||
bool failedEccQ = !CheckEcc(address, data2, 52, 43, 86, 88, eccQ);
|
||||
|
||||
if(failedEccP)
|
||||
DicConsole.DebugWriteLine("CD checksums",
|
||||
@@ -340,6 +340,7 @@ namespace DiscImageChef.Checksums
|
||||
cdTextPack3[j] = 0;
|
||||
cdTextPack4[j] = 0;
|
||||
}
|
||||
|
||||
for(int j = 0; j < 24; j++)
|
||||
{
|
||||
cdSubRwPack1[j] = 0;
|
||||
@@ -370,6 +371,7 @@ namespace DiscImageChef.Checksums
|
||||
if(j < 18) cdTextPack1[j] = (byte)(cdTextPack1[j] | ((subchannel[i++] & 0x03) << 6));
|
||||
if(j < 18) cdTextPack1[j] = (byte)(cdTextPack1[j] | (subchannel[i++] & 0x3F));
|
||||
}
|
||||
|
||||
for(int j = 0; j < 18; j++)
|
||||
{
|
||||
if(j < 18) cdTextPack2[j] = (byte)(cdTextPack2[j] | ((subchannel[i++] & 0x3F) << 2));
|
||||
@@ -379,6 +381,7 @@ namespace DiscImageChef.Checksums
|
||||
if(j < 18) cdTextPack2[j] = (byte)(cdTextPack2[j] | ((subchannel[i++] & 0x03) << 6));
|
||||
if(j < 18) cdTextPack2[j] = (byte)(cdTextPack2[j] | (subchannel[i++] & 0x3F));
|
||||
}
|
||||
|
||||
for(int j = 0; j < 18; j++)
|
||||
{
|
||||
if(j < 18) cdTextPack3[j] = (byte)(cdTextPack3[j] | ((subchannel[i++] & 0x3F) << 2));
|
||||
@@ -388,6 +391,7 @@ namespace DiscImageChef.Checksums
|
||||
if(j < 18) cdTextPack3[j] = (byte)(cdTextPack3[j] | ((subchannel[i++] & 0x03) << 6));
|
||||
if(j < 18) cdTextPack3[j] = (byte)(cdTextPack3[j] | (subchannel[i++] & 0x3F));
|
||||
}
|
||||
|
||||
for(int j = 0; j < 18; j++)
|
||||
{
|
||||
if(j < 18) cdTextPack4[j] = (byte)(cdTextPack4[j] | ((subchannel[i++] & 0x3F) << 2));
|
||||
|
||||
Reference in New Issue
Block a user