Skip to content

Commit 2cecbe6

Browse files
committed
Support the /ps command for DIC
1 parent 5574106 commit 2cecbe6

File tree

5 files changed

+49
-0
lines changed

5 files changed

+49
-0
lines changed

CHANGELIST.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Fixed default media type when detection fails
1919
- Add option to allow users to select dumping program
2020
- Updated to DIC version 20201101
21+
- Add support for `/ps` DIC flag
2122

2223
### 1.17.1 (2020-09-14)
2324
- Shuffled some shared, internal UI variables

DICUI.Library/DiscImageCreator/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static class FlagStrings
5454
public const string NoFixSubRtoW = "/nr";
5555
public const string NoFixSubQSecuROM = "/ns";
5656
public const string NoSkipSS = "/nss";
57+
public const string PadSector = "/ps";
5758
public const string Raw = "/raw";
5859
public const string Resume = "/re";
5960
public const string Reverse = "/r";

DICUI.Library/DiscImageCreator/Converters.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ public static string LongName(Flag flag)
232232
return FlagStrings.NoFixSubQSecuROM;
233233
case Flag.NoSkipSS:
234234
return FlagStrings.NoSkipSS;
235+
case Flag.PadSector:
236+
return FlagStrings.PadSector;
235237
case Flag.Raw:
236238
return FlagStrings.Raw;
237239
case Flag.Resume:

DICUI.Library/DiscImageCreator/Enumerations.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public enum Flag : int
5656
NoFixSubRtoW,
5757
NoFixSubQSecuROM,
5858
NoSkipSS,
59+
PadSector,
5960
Raw,
6061
Resume,
6162
Reverse,

DICUI.Library/DiscImageCreator/Parameters.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ public bool? this[Flag key]
113113
/// </summary>
114114
public int? NoSkipSecuritySectorValue { get; set; }
115115

116+
/// <summary>
117+
/// Set the pad sector flag value (default 0)
118+
/// </summary>
119+
public int? PadSectorValue { get; set; }
120+
116121
/// <summary>
117122
/// Set the reverse End LBA value (required for DVD)
118123
/// </summary>
@@ -469,6 +474,17 @@ public override string GenerateParameters()
469474
}
470475
}
471476

477+
// Pad sectors
478+
if (GetSupportedCommands(Flag.PadSector).Contains(BaseCommand))
479+
{
480+
if (this[Flag.PadSector] == true)
481+
{
482+
parameters.Add(Converters.LongName(Flag.PadSector));
483+
if (PadSectorValue != null)
484+
parameters.Add(PadSectorValue.ToString());
485+
}
486+
}
487+
472488
// Raw read (2064 byte/sector)
473489
if (GetSupportedCommands(Flag.Raw).Contains(BaseCommand))
474490
{
@@ -1448,6 +1464,31 @@ protected override bool ValidateAndSetParameters(string parameters)
14481464
i++;
14491465
break;
14501466

1467+
case FlagStrings.PadSector:
1468+
if (!GetSupportedCommands(Flag.PadSector).Contains(BaseCommand))
1469+
{
1470+
return false;
1471+
}
1472+
else if (!DoesExist(parts, i + 1))
1473+
{
1474+
this[Flag.PadSector] = true;
1475+
break;
1476+
}
1477+
else if (IsFlag(parts[i + 1]))
1478+
{
1479+
this[Flag.PadSector] = true;
1480+
break;
1481+
}
1482+
else if (!IsValidInt32(parts[i + 1], lowerBound: 0, upperBound: 1))
1483+
{
1484+
return false;
1485+
}
1486+
1487+
this[Flag.PadSector] = true;
1488+
PadSectorValue = Int32.Parse(parts[i + 1]);
1489+
i++;
1490+
break;
1491+
14511492
case FlagStrings.Raw:
14521493
if (!GetSupportedCommands(Flag.Raw).Contains(BaseCommand))
14531494
return false;
@@ -2259,6 +2300,9 @@ private static List<Command> GetSupportedCommands(Flag flag)
22592300
commands.Add(Command.XGD2Swap);
22602301
commands.Add(Command.XGD3Swap);
22612302
break;
2303+
case Flag.PadSector:
2304+
commands.Add(Command.DigitalVideoDisc);
2305+
break;
22622306
case Flag.Raw:
22632307
commands.Add(Command.DigitalVideoDisc);
22642308
break;

0 commit comments

Comments
 (0)