[ALL] Add device non-merged option

This is a special merging mode that counts on newer versions of MAME not respecting the romof tags, leaving parents with files that are not actually required by the children. This new merging mode ignores those romof and cloneof tags, using devices only to add more required roms.
This commit is contained in:
Matt Nadareski
2017-08-26 23:57:33 -07:00
parent 3aef68c941
commit 29c503b9ec
6 changed files with 40 additions and 0 deletions

View File

@@ -279,6 +279,7 @@
Merged, Merged,
FullNonMerged, FullNonMerged,
Split, Split,
DeviceNonMerged
} }
#endregion #endregion

View File

@@ -381,6 +381,28 @@ namespace SabreTools.Library.Dats
#region Merging/Splitting Methods #region Merging/Splitting Methods
/// <summary>
/// Use cdevice_ref tags to get full non-merged sets and remove parenting tags
/// </summary>
/// <param name="mergeroms">True if roms should be deduped, false otherwise</param>
public void CreateDeviceNonMergedSets(bool mergeroms)
{
Globals.Logger.User("Creating device non-merged sets from the DAT");
// For sake of ease, the first thing we want to do is sort by game
BucketBy(SortedBy.Game, mergeroms, norename: true);
_sortedBy = SortedBy.Default;
// Now we want to loop through all of the games and set the correct information
AddRomsFromDevices();
// Then, remove the romof and cloneof tags so it's not picked up by the manager
RemoveTagsFromChild();
// Finally, remove all sets that are labeled as bios or device
//RemoveBiosAndDeviceSets(logger);
}
/// <summary> /// <summary>
/// Use cloneof tags to create non-merged sets and remove the tags plus using the device_ref tags to get full sets /// Use cloneof tags to create non-merged sets and remove the tags plus using the device_ref tags to get full sets
/// </summary> /// </summary>

View File

@@ -180,6 +180,9 @@ namespace SabreTools.Library.Dats
// Now we pre-process the DAT with the splitting/merging mode // Now we pre-process the DAT with the splitting/merging mode
switch (splitType) switch (splitType)
{ {
case SplitType.DeviceNonMerged:
CreateDeviceNonMergedSets(false);
break;
case SplitType.FullNonMerged: case SplitType.FullNonMerged:
CreateFullyNonMergedSets(false); CreateFullyNonMergedSets(false);
break; break;

View File

@@ -597,6 +597,11 @@ Options:
parent set based on the cloneof tag. This is incompatible with the parent set based on the cloneof tag. This is incompatible with the
other --dat-X flags. other --dat-X flags.
-dnd, --dat-devnonmerged Force creating device non-merged sets
Preprocess the DAT to have child sets contain all items from the
device references. This is incompatible with the other --dat-X
flags.
-df, --dat-fullnonmerged Force creating fully non-merged sets -df, --dat-fullnonmerged Force creating fully non-merged sets
Preprocess the DAT to have child sets contain all items from the Preprocess the DAT to have child sets contain all items from the
parent sets based on the cloneof and romof tags as well as device parent sets based on the cloneof and romof tags as well as device

View File

@@ -1100,6 +1100,11 @@ namespace SabreTools
"Create non-merged sets", "Create non-merged sets",
FeatureType.Flag, FeatureType.Flag,
null)); null));
update.AddFeature("dat-devnonmerged", new Feature(
new List<string>() { "-dnd", "--dat-devnonmerged" },
"Create device non-merged sets",
FeatureType.Flag,
null));
update.AddFeature("dat-fullnonmerged", new Feature( update.AddFeature("dat-fullnonmerged", new Feature(
new List<string>() { "-df", "--dat-fullnonmerged" }, new List<string>() { "-df", "--dat-fullnonmerged" },
"Create fully non-merged sets", "Create fully non-merged sets",

View File

@@ -356,6 +356,10 @@ namespace SabreTools
case "--dat-merged": case "--dat-merged":
splitType = SplitType.Merged; splitType = SplitType.Merged;
break; break;
case "-dnd":
case "--dat-devnonmerged":
splitType = SplitType.DeviceNonMerged;
break;
case "-dnm": case "-dnm":
case "--dat-nonmerged": case "--dat-nonmerged":
splitType = SplitType.NonMerged; splitType = SplitType.NonMerged;