Update to new DIC version (#167)

* Remove `.` handling code since it should be in DIC now

* Add support for 3 new flags

* Fix dot tests

* Fix PS4 autodetect (Fixes #164)

* Fix PS4 version finding

* Update DIC archive path

* Add support for disk command (unused by default)
This commit is contained in:
Matt Nadareski
2019-10-01 11:53:44 -07:00
committed by GitHub
parent 700ff50eef
commit 8b41f03472
7 changed files with 83 additions and 12 deletions

View File

@@ -11,6 +11,7 @@
public const string CompactDisc = "cd";
public const string Data = "data";
public const string DigitalVideoDisc = "dvd";
public const string Disk = "disk";
public const string DriveSpeed = "ls";
public const string Eject = "eject";
public const string Floppy = "fd";
@@ -36,6 +37,7 @@
{
public const string AddOffset = "/a";
public const string AMSF = "/p";
public const string AtariJaguar = "/aj";
public const string BEOpcode = "/be";
public const string C2Opcode = "/c2";
public const string CopyrightManagementInformation = "/c";
@@ -59,6 +61,7 @@
public const string SkipSector = "/sk";
public const string SubchannelReadLevel = "/s";
public const string VideoNow = "/vn";
public const string VideoNowColor = "/vnc";
}
/// <summary>

View File

@@ -30,6 +30,7 @@
CompactDisc,
Data,
DigitalVideoDisc,
Disk,
DriveSpeed,
Eject,
Floppy,
@@ -56,6 +57,7 @@
NONE = 0,
AddOffset,
AMSF,
AtariJaguar,
BEOpcode,
C2Opcode,
CopyrightManagementInformation,
@@ -79,6 +81,7 @@
SkipSector,
SubchannelReadLevel,
VideoNow,
VideoNowColor,
}
/// <summary>

View File

@@ -24,6 +24,7 @@ namespace DICUI.Utilities
case DICCommand.CompactDisc:
case DICCommand.Data:
case DICCommand.DigitalVideoDisc:
case DICCommand.Disk:
case DICCommand.Floppy:
return KnownSystem.IBMPCCompatible;
case DICCommand.GDROM:
@@ -239,6 +240,8 @@ namespace DICUI.Utilities
// Non-optical
case DICCommand.Floppy:
return MediaType.FloppyDisk;
case DICCommand.Disk:
return MediaType.HardDisk;
default:
return null;
}
@@ -532,6 +535,8 @@ namespace DICUI.Utilities
return DICCommandStrings.Data;
case DICCommand.DigitalVideoDisc:
return DICCommandStrings.DigitalVideoDisc;
case DICCommand.Disk:
return DICCommandStrings.Disk;
case DICCommand.DriveSpeed:
return DICCommandStrings.DriveSpeed;
case DICCommand.Eject:
@@ -584,6 +589,8 @@ namespace DICUI.Utilities
return DICFlagStrings.AddOffset;
case DICFlag.AMSF:
return DICFlagStrings.AMSF;
case DICFlag.AtariJaguar:
return DICFlagStrings.AtariJaguar;
case DICFlag.BEOpcode:
return DICFlagStrings.BEOpcode;
case DICFlag.C2Opcode:
@@ -630,6 +637,8 @@ namespace DICUI.Utilities
return DICFlagStrings.SubchannelReadLevel;
case DICFlag.VideoNow:
return DICFlagStrings.VideoNow;
case DICFlag.VideoNowColor:
return DICFlagStrings.VideoNowColor;
case DICFlag.NONE:
default:

View File

@@ -257,10 +257,9 @@ namespace DICUI.Utilities
OutputFilename = Path.GetFileName(combinedPath);
// Take care of extra path characters
OutputDirectory = new StringBuilder(OutputDirectory.Replace('.', '_').Replace('&', '_'))
OutputDirectory = new StringBuilder(OutputDirectory.Replace('&', '_'))
.Replace(':', '_', 0, OutputDirectory.LastIndexOf(':') == -1 ? 0 : OutputDirectory.LastIndexOf(':')).ToString();
OutputFilename = new StringBuilder(OutputFilename.Replace('&', '_'))
.Replace('.', '_', 0, OutputFilename.LastIndexOf('.') == -1 ? 0 : OutputFilename.LastIndexOf('.')).ToString();
OutputFilename = new StringBuilder(OutputFilename.Replace('&', '_')).ToString();
// Sanitize everything else
foreach (char c in Path.GetInvalidPathChars())

View File

@@ -252,6 +252,7 @@ namespace DICUI.Utilities
|| Command == DICCommand.CompactDisc
|| Command == DICCommand.Data
|| Command == DICCommand.DigitalVideoDisc
|| Command == DICCommand.Disk
|| Command == DICCommand.DriveSpeed
|| Command == DICCommand.Eject
|| Command == DICCommand.Floppy
@@ -278,6 +279,7 @@ namespace DICUI.Utilities
|| Command == DICCommand.CompactDisc
|| Command == DICCommand.Data
|| Command == DICCommand.DigitalVideoDisc
|| Command == DICCommand.Disk
|| Command == DICCommand.Floppy
|| Command == DICCommand.GDROM
|| Command == DICCommand.MDS
@@ -360,6 +362,13 @@ namespace DICUI.Utilities
parameters.Add(DICFlag.AMSF.LongName());
}
// Atari Jaguar CD
if (Command == DICCommand.CompactDisc)
{
if (this[DICFlag.AtariJaguar])
parameters.Add(DICFlag.AtariJaguar.LongName());
}
// BE Opcode
if (Command == DICCommand.Audio
|| Command == DICCommand.CompactDisc
@@ -556,7 +565,8 @@ namespace DICUI.Utilities
// Reverse read
if (Command == DICCommand.CompactDisc
|| Command == DICCommand.Data)
|| Command == DICCommand.Data
|| Command == DICCommand.DigitalVideoDisc)
{
if (this[DICFlag.Reverse])
parameters.Add(DICFlag.Reverse.LongName());
@@ -663,6 +673,13 @@ namespace DICUI.Utilities
}
}
// VideoNow Color
if (Command == DICCommand.CompactDisc)
{
if (this[DICFlag.VideoNowColor])
parameters.Add(DICFlag.VideoNowColor.LongName());
}
return string.Join(" ", parameters);
}
@@ -830,6 +847,23 @@ namespace DICUI.Utilities
index = 4;
break;
case DICCommandStrings.Disk:
if (!DoesExist(parts, 1) || !IsValidDriveLetter(parts[1]))
return false;
else
DriveLetter = parts[1];
if (!DoesExist(parts, 2) || IsFlag(parts[2]))
return false;
else
Filename = parts[2];
if (parts.Count > 3)
return false;
Command = DICCommand.Disk;
break;
case DICCommandStrings.DriveSpeed:
if (!DoesExist(parts, 1) || !IsValidDriveLetter(parts[1]))
return false;
@@ -1087,6 +1121,13 @@ namespace DICUI.Utilities
this[DICFlag.AMSF] = true;
break;
case DICFlagStrings.AtariJaguar:
if (parts[0] != DICCommandStrings.CompactDisc)
return false;
this[DICFlag.AtariJaguar] = true;
break;
case DICFlagStrings.BEOpcode:
if (parts[0] != DICCommandStrings.Audio
&& parts[0] != DICCommandStrings.CompactDisc
@@ -1287,7 +1328,8 @@ namespace DICUI.Utilities
case DICFlagStrings.Reverse:
if (parts[0] != DICCommandStrings.CompactDisc
&& parts[0] != DICCommandStrings.Data)
&& parts[0] != DICCommandStrings.Data
&& parts[0] != DICCommandStrings.DigitalVideoDisc)
return false;
this[DICFlag.Reverse] = true;
@@ -1399,6 +1441,13 @@ namespace DICUI.Utilities
i++;
break;
case DICFlagStrings.VideoNowColor:
if (parts[0] != DICCommandStrings.CompactDisc)
return false;
this[DICFlag.VideoNowColor] = true;
break;
default:
return false;
}
@@ -1516,6 +1565,9 @@ namespace DICUI.Utilities
case MediaType.FloppyDisk:
Command = DICCommand.Floppy;
return;
case MediaType.HardDisk:
Command = DICCommand.Disk;
return;
default:
Command = DICCommand.NONE;
@@ -1571,12 +1623,17 @@ namespace DICUI.Utilities
SubchannelReadLevelValue = 2;
}
break;
case KnownSystem.AtariJaguarCD:
this[DICFlag.AtariJaguar] = true;
break;
case KnownSystem.HasbroVideoNow:
case KnownSystem.HasbroVideoNowColor:
case KnownSystem.HasbroVideoNowJr:
this[DICFlag.VideoNow] = true;
this.VideoNowValue = 18032;
break;
case KnownSystem.HasbroVideoNowColor:
this[DICFlag.VideoNowColor] = true;
break;
case KnownSystem.HasbroVideoNowXP:
this[DICFlag.VideoNow] = true;
this.VideoNowValue = 20832;

View File

@@ -31,8 +31,8 @@ namespace DICUI.Test
[InlineData(" ", "", " ", "")]
[InlineData("super", "blah.bin", "super", "blah.bin")]
[InlineData("super\\hero", "blah.bin", "super\\hero", "blah.bin")]
[InlineData("super.hero", "blah.bin", "super_hero", "blah.bin")]
[InlineData("superhero", "blah.rev.bin", "superhero", "blah_rev.bin")]
[InlineData("super.hero", "blah.bin", "super.hero", "blah.bin")]
[InlineData("superhero", "blah.rev.bin", "superhero", "blah.rev.bin")]
[InlineData("super&hero", "blah.bin", "super_hero", "blah.bin")]
[InlineData("superhero", "blah&foo.bin", "superhero", "blah_foo.bin")]
public void FixOutputPathsTest(string outputDirectory, string outputFilename, string expectedOutputDirectory, string expectedOutputFilename)

View File

@@ -32,11 +32,11 @@ build:
# post-build step
after_build:
- ps: appveyor DownloadFile https://github.com/saramibreak/DiscImageCreator/files/3341769/DiscImageCreator_20190627.zip
- ps: appveyor DownloadFile https://github.com/saramibreak/DiscImageCreator/files/3674664/DiscImageCreator_20191001.zip
- ps: appveyor DownloadFile https://archive.org/download/subdump_fua_0x28/subdump_fua_0x28.zip
- 7z e DiscImageCreator_20190627.zip -oDICUI\bin\Debug\net462\Programs Release_ANSI\*
- 7z e DiscImageCreator_20190627.zip -oDICUI\bin\Debug\net472\Programs Release_ANSI\*
- 7z e DiscImageCreator_20190627.zip -oDICUI\bin\Debug\netcoreapp3.0\Programs Release_ANSI\*
- 7z e DiscImageCreator_20191001.zip -oDICUI\bin\Debug\net462\Programs Release_ANSI\*
- 7z e DiscImageCreator_20191001.zip -oDICUI\bin\Debug\net472\Programs Release_ANSI\*
- 7z e DiscImageCreator_20191001.zip -oDICUI\bin\Debug\netcoreapp3.0\Programs Release_ANSI\*
- 7z e subdump_fua_0x28.zip -oDICUI\bin\Debug\net462 *
- mv DICUI\bin\Debug\net462\subdump_fua_0x28.exe DICUI\bin\Debug\net462\subdump.exe
- 7z e subdump_fua_0x28.zip -oDICUI\bin\Debug\net472 *