diff --git a/SabreTools.Library/Data/Enums.cs b/SabreTools.Library/Data/Enums.cs index f037237d..36393ac7 100644 --- a/SabreTools.Library/Data/Enums.cs +++ b/SabreTools.Library/Data/Enums.cs @@ -279,6 +279,7 @@ Merged, FullNonMerged, Split, + DeviceNonMerged } #endregion diff --git a/SabreTools.Library/Dats/Partials/DatFile.Manipulate.cs b/SabreTools.Library/Dats/Partials/DatFile.Manipulate.cs index 9683e97c..e81eed64 100644 --- a/SabreTools.Library/Dats/Partials/DatFile.Manipulate.cs +++ b/SabreTools.Library/Dats/Partials/DatFile.Manipulate.cs @@ -381,6 +381,28 @@ namespace SabreTools.Library.Dats #region Merging/Splitting Methods + /// + /// Use cdevice_ref tags to get full non-merged sets and remove parenting tags + /// + /// True if roms should be deduped, false otherwise + 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); + } + /// /// Use cloneof tags to create non-merged sets and remove the tags plus using the device_ref tags to get full sets /// diff --git a/SabreTools.Library/Dats/Partials/DatFile.Parsers.cs b/SabreTools.Library/Dats/Partials/DatFile.Parsers.cs index 6bec1ff9..af8edf40 100644 --- a/SabreTools.Library/Dats/Partials/DatFile.Parsers.cs +++ b/SabreTools.Library/Dats/Partials/DatFile.Parsers.cs @@ -180,6 +180,9 @@ namespace SabreTools.Library.Dats // Now we pre-process the DAT with the splitting/merging mode switch (splitType) { + case SplitType.DeviceNonMerged: + CreateDeviceNonMergedSets(false); + break; case SplitType.FullNonMerged: CreateFullyNonMergedSets(false); break; diff --git a/SabreTools.Library/README.1ST b/SabreTools.Library/README.1ST index 4150d64c..5a894267 100644 --- a/SabreTools.Library/README.1ST +++ b/SabreTools.Library/README.1ST @@ -597,6 +597,11 @@ Options: parent set based on the cloneof tag. This is incompatible with the 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 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 diff --git a/SabreTools/Partials/SabreTools.Help.cs b/SabreTools/Partials/SabreTools.Help.cs index df16a9fe..a9525ba8 100644 --- a/SabreTools/Partials/SabreTools.Help.cs +++ b/SabreTools/Partials/SabreTools.Help.cs @@ -1100,6 +1100,11 @@ namespace SabreTools "Create non-merged sets", FeatureType.Flag, null)); + update.AddFeature("dat-devnonmerged", new Feature( + new List() { "-dnd", "--dat-devnonmerged" }, + "Create device non-merged sets", + FeatureType.Flag, + null)); update.AddFeature("dat-fullnonmerged", new Feature( new List() { "-df", "--dat-fullnonmerged" }, "Create fully non-merged sets", diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs index 1d48cada..e70a9693 100644 --- a/SabreTools/SabreTools.cs +++ b/SabreTools/SabreTools.cs @@ -356,6 +356,10 @@ namespace SabreTools case "--dat-merged": splitType = SplitType.Merged; break; + case "-dnd": + case "--dat-devnonmerged": + splitType = SplitType.DeviceNonMerged; + break; case "-dnm": case "--dat-nonmerged": splitType = SplitType.NonMerged;