[ZZZRawImage] Add support for Wii U disc format and key sidecar detection

This commit is contained in:
2026-03-17 18:41:26 +00:00
parent 636b71e8d1
commit 07c61dd792
3 changed files with 32 additions and 0 deletions

View File

@@ -36,6 +36,11 @@ namespace Aaru.Images;
public sealed partial class ZZZRawImage
{
const long WIIU_DISC_SIZE = 25_025_314_816L;
const uint WIIU_TOC_SIGNATURE = 0xCCA6E67BU;
const uint WIIU_PHYSICAL_SECTOR_SIZE = 0x8000;
const uint WIIU_ENCRYPTED_OFFSET = 0x18000U;
static readonly byte[] _ps3Id = "PlayStation3\0\0\0\0"u8.ToArray();
readonly byte[] _cdSync = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
readonly (MediaTagType tag, string name)[] _readWriteSidecars =

View File

@@ -69,6 +69,8 @@ public sealed partial class ZZZRawImage
return imageFilter.DataForkLength % 128 == 0;
case ".256":
return imageFilter.DataForkLength % 256 == 0;
case ".wud" when imageFilter.DataForkLength == WIIU_DISC_SIZE:
return true;
case ".toast" when imageFilter.DataForkLength % 2048 == 0:
return true;
case ".toast" when imageFilter.DataForkLength % 2056 == 0:

View File

@@ -148,6 +148,10 @@ public sealed partial class ZZZRawImage
case ".d81" when imageFilter.DataForkLength == 819200:
_imageInfo.SectorSize = 256;
break;
case ".wud" when imageFilter.DataForkLength == WIIU_DISC_SIZE:
_imageInfo.SectorSize = 2048;
break;
case ".raw" when imageFilter.DataForkLength % 2064 == 0:
_imageInfo.SectorSize = 2048;
@@ -430,6 +434,23 @@ public sealed partial class ZZZRawImage
}
}
// Check for Wii U disc key sidecar (.key file, 16 bytes)
if(_imageInfo.MediaType == MediaType.WUOD)
{
string keyPath = basename + ".key";
if(File.Exists(keyPath))
{
byte[] keyData = File.ReadAllBytes(keyPath);
if(keyData.Length == 16)
{
_mediaTags[MediaTagType.WiiUDiscKey] = keyData;
AaruLogging.Debug(MODULE_NAME, "Found Wii U disc key sidecar");
}
}
}
// If there are INQUIRY and IDENTIFY tags, it's ATAPI
if(_mediaTags.ContainsKey(MediaTagType.SCSI_INQUIRY))
{
@@ -580,6 +601,9 @@ public sealed partial class ZZZRawImage
if(sector1.SequenceEqual(_ps3Id)) _imageInfo.MediaType = MediaType.PS3BD;
}
// Check for Wii U disc: .wud extension and exact disc size
if(_extension == ".wud" && imageFilter.DataForkLength == WIIU_DISC_SIZE) _imageInfo.MediaType = MediaType.WUOD;
switch(_imageInfo.MediaType)
{
case MediaType.ACORN_35_DS_DD:
@@ -1171,6 +1195,7 @@ public sealed partial class ZZZRawImage
case MediaType.XGD3:
case MediaType.PD650:
case MediaType.PD650_WORM:
case MediaType.WUOD:
_imageInfo.MetadataMediaType = MetadataMediaType.OpticalDisc;
break;