mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Fix PhotoCD detection.
This commit is contained in:
10
.idea/.idea.Aaru/.idea/contentModel.xml
generated
10
.idea/.idea.Aaru/.idea/contentModel.xml
generated
@@ -16,6 +16,16 @@
|
|||||||
<e p="$USER_HOME$/.nuget/packages/nunit3testadapter/3.15.1/build/netcoreapp2.0/nunit.engine.api.dll" t="Include" />
|
<e p="$USER_HOME$/.nuget/packages/nunit3testadapter/3.15.1/build/netcoreapp2.0/nunit.engine.api.dll" t="Include" />
|
||||||
<e p="$USER_HOME$/.nuget/packages/nunit3testadapter/3.15.1/build/netcoreapp2.0/nunit.engine.dll" t="Include" />
|
<e p="$USER_HOME$/.nuget/packages/nunit3testadapter/3.15.1/build/netcoreapp2.0/nunit.engine.dll" t="Include" />
|
||||||
<e p="$PROJECT_DIR$" t="IncludeFlat">
|
<e p="$PROJECT_DIR$" t="IncludeFlat">
|
||||||
|
<e p=".git/info/exclude" t="IncludeRecursive" />
|
||||||
|
<e p=".git/modules/Aaru.Checksums/info/exclude" t="IncludeRecursive" />
|
||||||
|
<e p=".git/modules/Aaru.CommonTypes/info/exclude" t="IncludeRecursive" />
|
||||||
|
<e p=".git/modules/Aaru.Console/info/exclude" t="IncludeRecursive" />
|
||||||
|
<e p=".git/modules/Aaru.Decoders/info/exclude" t="IncludeRecursive" />
|
||||||
|
<e p=".git/modules/Aaru.Dto/info/exclude" t="IncludeRecursive" />
|
||||||
|
<e p=".git/modules/Aaru.Helpers/info/exclude" t="IncludeRecursive" />
|
||||||
|
<e p=".git/modules/CICMMetadata/info/exclude" t="IncludeRecursive" />
|
||||||
|
<e p=".git/modules/cuetools.net/info/exclude" t="IncludeRecursive" />
|
||||||
|
<e p=".git/modules/cuetoolsnet/info/exclude" t="IncludeRecursive" />
|
||||||
<e p=".github/CODE_OF_CONDUCT.md" t="Include" />
|
<e p=".github/CODE_OF_CONDUCT.md" t="Include" />
|
||||||
<e p=".github/ISSUE_TEMPLATE.md" t="Include" />
|
<e p=".github/ISSUE_TEMPLATE.md" t="Include" />
|
||||||
<e p=".github/PULL_REQUEST_TEMPLATE.md" t="Include" />
|
<e p=".github/PULL_REQUEST_TEMPLATE.md" t="Include" />
|
||||||
|
|||||||
@@ -1101,53 +1101,56 @@ namespace Aaru.Core.Media.Detection
|
|||||||
if(isoSector.Length < 2048)
|
if(isoSector.Length < 2048)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int pcdPos = 0;
|
for(int pi = 0; pi < pcdLength; pi++)
|
||||||
uint infoPos = 0;
|
|
||||||
|
|
||||||
while(isoSector[pcdPos] > 0 &&
|
|
||||||
pcdPos < isoSector.Length &&
|
|
||||||
pcdPos + isoSector[pcdPos] <= isoSector.Length)
|
|
||||||
{
|
{
|
||||||
int nameLen = isoSector[pcdPos + 32];
|
int pcdPos = pi * 2048;
|
||||||
byte[] tmpName = new byte[nameLen];
|
uint infoPos = 0;
|
||||||
Array.Copy(isoSector, pcdPos + 33, tmpName, 0, nameLen);
|
|
||||||
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
|
|
||||||
|
|
||||||
if(name.EndsWith(";1", StringComparison.InvariantCulture))
|
while(isoSector[pcdPos] > 0 &&
|
||||||
name = name.Substring(0, name.Length - 2);
|
pcdPos < isoSector.Length &&
|
||||||
|
pcdPos + isoSector[pcdPos] <= isoSector.Length)
|
||||||
if(name == "INFO.PCD")
|
|
||||||
{
|
{
|
||||||
infoPos = BitConverter.ToUInt32(isoSector, pcdPos + 2);
|
int nameLen = isoSector[pcdPos + 32];
|
||||||
|
byte[] tmpName = new byte[nameLen];
|
||||||
|
Array.Copy(isoSector, pcdPos + 33, tmpName, 0, nameLen);
|
||||||
|
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
|
||||||
|
|
||||||
break;
|
if(name.EndsWith(";1", StringComparison.InvariantCulture))
|
||||||
|
name = name.Substring(0, name.Length - 2);
|
||||||
|
|
||||||
|
if(name == "INFO.PCD")
|
||||||
|
{
|
||||||
|
infoPos = BitConverter.ToUInt32(isoSector, pcdPos + 2);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pcdPos += isoSector[pcdPos];
|
||||||
}
|
}
|
||||||
|
|
||||||
pcdPos += isoSector[pcdPos];
|
if(infoPos > 0)
|
||||||
}
|
|
||||||
|
|
||||||
if(infoPos > 0)
|
|
||||||
{
|
|
||||||
sense = dev.Read12(out isoSector, out _, 0, false, true, false, false, infoPos, 2048, 0, 1,
|
|
||||||
false, dev.Timeout, out _);
|
|
||||||
|
|
||||||
if(sense)
|
|
||||||
break;
|
|
||||||
|
|
||||||
byte[] systemId = new byte[8];
|
|
||||||
Array.Copy(isoSector, 0, systemId, 0, 8);
|
|
||||||
|
|
||||||
string id = StringHandlers.CToString(systemId).TrimEnd();
|
|
||||||
|
|
||||||
switch(id)
|
|
||||||
{
|
{
|
||||||
case "PHOTO_CD":
|
sense = dev.Read12(out isoSector, out _, 0, false, true, false, false, infoPos, 2048, 0,
|
||||||
mediaType = MediaType.PCD;
|
1, false, dev.Timeout, out _);
|
||||||
|
|
||||||
AaruConsole.DebugWriteLine("Media detection",
|
if(sense)
|
||||||
"Found Photo CD description file, setting disc type to Photo CD.");
|
break;
|
||||||
|
|
||||||
return;
|
byte[] systemId = new byte[8];
|
||||||
|
Array.Copy(isoSector, 0, systemId, 0, 8);
|
||||||
|
|
||||||
|
string id = StringHandlers.CToString(systemId).TrimEnd();
|
||||||
|
|
||||||
|
switch(id)
|
||||||
|
{
|
||||||
|
case "PHOTO_CD":
|
||||||
|
mediaType = MediaType.PCD;
|
||||||
|
|
||||||
|
AaruConsole.DebugWriteLine("Media detection",
|
||||||
|
"Found Photo CD description file, setting disc type to Photo CD.");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1878,7 +1881,7 @@ namespace Aaru.Core.Media.Detection
|
|||||||
|
|
||||||
uint infoPos = 0;
|
uint infoPos = 0;
|
||||||
|
|
||||||
for(int pi = 0; pi < vcdLength; pi++)
|
for(int pi = 0; pi < pcdLength; pi++)
|
||||||
{
|
{
|
||||||
int pcdPos = pi * 2048;
|
int pcdPos = pi * 2048;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user