mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SabreTools, Flags, DatFile] Add new base replacement flags
Update game type (bios, device, mechanical) and update parenting information (romof, cloneof, sampleof)
This commit is contained in:
@@ -1903,8 +1903,10 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
// If we are matching based on names of any sort
|
||||
if ((replaceMode & ReplaceMode.Description) != 0
|
||||
|| (replaceMode & ReplaceMode.MachineType) != 0
|
||||
|| (replaceMode & ReplaceMode.Year) != 0
|
||||
|| (replaceMode & ReplaceMode.Manufacturer) != 0)
|
||||
|| (replaceMode & ReplaceMode.Manufacturer) != 0
|
||||
|| (replaceMode & ReplaceMode.Parents) != 0)
|
||||
{
|
||||
// For comparison's sake, we want to use Machine Name as the base ordering
|
||||
BucketBy(SortedBy.Game, DedupeType.Full);
|
||||
@@ -1928,6 +1930,10 @@ namespace SabreTools.Library.DatFiles
|
||||
newDatItem.MachineDescription = this[key][0].MachineDescription;
|
||||
}
|
||||
}
|
||||
if ((replaceMode & ReplaceMode.MachineType) != 0)
|
||||
{
|
||||
newDatItem.MachineType = this[key][0].MachineType;
|
||||
}
|
||||
if ((replaceMode & ReplaceMode.Year) != 0)
|
||||
{
|
||||
newDatItem.Year = this[key][0].Year;
|
||||
@@ -1936,6 +1942,12 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
newDatItem.Manufacturer = this[key][0].Manufacturer;
|
||||
}
|
||||
if ((replaceMode & ReplaceMode.Parents) != 0)
|
||||
{
|
||||
newDatItem.CloneOf = this[key][0].CloneOf;
|
||||
newDatItem.RomOf = this[key][0].RomOf;
|
||||
newDatItem.SampleOf = this[key][0].SampleOf;
|
||||
}
|
||||
}
|
||||
|
||||
newDatItems.Add(newDatItem);
|
||||
|
||||
@@ -260,8 +260,10 @@ namespace SabreTools.Library.Data
|
||||
|
||||
// Sorted by machine name
|
||||
Description = Hash << 1,
|
||||
Year = Description << 1,
|
||||
MachineType = Description << 1,
|
||||
Year = MachineType << 1,
|
||||
Manufacturer = Year << 1,
|
||||
Parents = Manufacturer << 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1024,6 +1024,14 @@ Options:
|
||||
will only be overwritten if they are the same as the machine
|
||||
names.
|
||||
|
||||
-ugt, --update-game-type Update machine type from base DATs
|
||||
This flag enables updating of machine type from base DATs.
|
||||
[Both base-replace and reverse-base-replace]
|
||||
|
||||
-up, --update-parents Update machine parents from base DATs
|
||||
This flag enables updating of machine parents (romof, cloneof,
|
||||
sampleof) from base DATs. [Both base-replace and reverse-base-replace]
|
||||
|
||||
-uy, --update-year Update machine years from base DATs
|
||||
This flag enables updating of machine years from base DATs.
|
||||
[Both base-replace and reverse-base-replace]
|
||||
|
||||
@@ -1341,6 +1341,18 @@ namespace SabreTools
|
||||
longDescription: "This flag enables updating of machine descriptions from base DATs.");
|
||||
}
|
||||
}
|
||||
private static Feature _updateGameTypeFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
"update-game-type",
|
||||
new List<string>() { "-ugt", "--update-game-type" },
|
||||
"Update machine type from base DATs",
|
||||
FeatureType.Flag,
|
||||
longDescription: "This flag enables updating of machine type from base DATs.");
|
||||
}
|
||||
}
|
||||
private static Feature _updateHashesFlag
|
||||
{
|
||||
get
|
||||
@@ -1377,6 +1389,18 @@ namespace SabreTools
|
||||
longDescription: "This flag enables updating of item names from base DATs.");
|
||||
}
|
||||
}
|
||||
private static Feature _updateParentsFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
"update-parents",
|
||||
new List<string>() { "-up", "--update-parents" },
|
||||
"Update machine parents from base DATs",
|
||||
FeatureType.Flag,
|
||||
longDescription: "This flag enables updating of machine parents (romof, cloneof, sampleof) from base DATs.");
|
||||
}
|
||||
}
|
||||
private static Feature _updateYearFlag
|
||||
{
|
||||
get
|
||||
@@ -2647,16 +2671,20 @@ The stats that are outputted are as follows:
|
||||
update[_baseReplaceFlag].AddFeature(_updateHashesFlag);
|
||||
update[_baseReplaceFlag].AddFeature(_updateDescriptionFlag);
|
||||
update[_baseReplaceFlag][_updateDescriptionFlag].AddFeature(_onlySameFlag);
|
||||
update[_baseReplaceFlag].AddFeature(_updateGameTypeFlag);
|
||||
update[_baseReplaceFlag].AddFeature(_updateYearFlag);
|
||||
update[_baseReplaceFlag].AddFeature(_updateManufacturerFlag);
|
||||
update[_baseReplaceFlag].AddFeature(_updateParentsFlag);
|
||||
update.AddFeature(_reverseBaseReplaceFlag);
|
||||
update[_reverseBaseReplaceFlag].AddFeature(_baseDatListInput);
|
||||
update[_reverseBaseReplaceFlag].AddFeature(_updateNamesFlag);
|
||||
update[_reverseBaseReplaceFlag].AddFeature(_updateHashesFlag);
|
||||
update[_reverseBaseReplaceFlag].AddFeature(_updateDescriptionFlag);
|
||||
update[_reverseBaseReplaceFlag][_updateDescriptionFlag].AddFeature(_onlySameFlag);
|
||||
update[_reverseBaseReplaceFlag].AddFeature(_updateGameTypeFlag);
|
||||
update[_reverseBaseReplaceFlag].AddFeature(_updateYearFlag);
|
||||
update[_reverseBaseReplaceFlag].AddFeature(_updateManufacturerFlag);
|
||||
update[_reverseBaseReplaceFlag].AddFeature(_updateParentsFlag);
|
||||
update.AddFeature(_diffCascadeFlag);
|
||||
update[_diffCascadeFlag].AddFeature(_skipFirstOutputFlag);
|
||||
update.AddFeature(_diffReverseCascadeFlag);
|
||||
|
||||
@@ -570,6 +570,9 @@ namespace SabreTools
|
||||
case "update-description":
|
||||
replaceMode |= ReplaceMode.Description;
|
||||
break;
|
||||
case "update-game-type":
|
||||
replaceMode |= ReplaceMode.MachineType;
|
||||
break;
|
||||
case "update-hashes":
|
||||
replaceMode |= ReplaceMode.Hash;
|
||||
break;
|
||||
@@ -579,6 +582,9 @@ namespace SabreTools
|
||||
case "update-names":
|
||||
replaceMode |= ReplaceMode.ItemName;
|
||||
break;
|
||||
case "update-parents":
|
||||
replaceMode |= ReplaceMode.Parents;
|
||||
break;
|
||||
case "update-year":
|
||||
replaceMode |= ReplaceMode.Year;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user