diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs index 75352192..53b21a48 100644 --- a/SabreTools.Library/DatFiles/DatFile.cs +++ b/SabreTools.Library/DatFiles/DatFile.cs @@ -2683,14 +2683,12 @@ namespace SabreTools.Library.DatFiles // For sake of ease, the first thing we want to do is sort by game BucketBy(SortedBy.Game, mergeroms, norename: true); - // First, we need to get parent bios sets into their children - AddRomsFromParentBios(); - // Now we want to loop through all of the games and set the correct information RemoveRomsFromChild(); // Now that we have looped through the cloneof tags, we loop through the romof tags - RemoveBiosRomsFromChild(); + RemoveBiosRomsFromChild(false); + RemoveBiosRomsFromChild(true); // Finally, remove the romof and cloneof tags so it's not picked up by the manager RemoveTagsFromChild(); @@ -2744,60 +2742,6 @@ namespace SabreTools.Library.DatFiles } } - /// - /// Use romof tags and isbios properties to add roms to children bios - /// - private void AddRomsFromParentBios() - { - List games = Keys; - foreach (string game in games) - { - // If the game has no items in it, we want to continue - if (this[game].Count == 0) - { - continue; - } - - // If the current game is not a bios set, we want to continue - if (this[game][0].MachineType != MachineType.Bios) - { - continue; - } - - // Determine if the game has a parent or not - string parent = null; - if (!String.IsNullOrWhiteSpace(this[game][0].RomOf)) - { - parent = this[game][0].RomOf; - } - - // If the parent doesnt exist, we want to continue - if (String.IsNullOrWhiteSpace(parent)) - { - continue; - } - - // If the parent doesn't have any items, we want to continue - if (this[parent].Count == 0) - { - continue; - } - - // If the parent exists and has items, we copy the items from the parent to the current game - DatItem copyFrom = this[game][0]; - List parentItems = this[parent]; - foreach (DatItem item in parentItems) - { - DatItem datItem = (DatItem)item.Clone(); - datItem.CopyMachineInformation(copyFrom); - if (this[game].Where(i => i.Name == datItem.Name).Count() == 0 && !this[game].Contains(datItem)) - { - Add(game, datItem); - } - } - } - } - /// /// Use device_ref tags to add roms to the children /// @@ -2972,7 +2916,8 @@ namespace SabreTools.Library.DatFiles /// /// Use romof tags to remove bios roms from children /// - private void RemoveBiosRomsFromChild() + /// True if only child Bios sets are touched, false for non-bios sets (default) + private void RemoveBiosRomsFromChild(bool bios = false) { // Loop through the romof tags List games = Keys; @@ -2984,6 +2929,12 @@ namespace SabreTools.Library.DatFiles continue; } + // If the game (is/is not) a bios, we want to continue + if (bios ^ this[game][0].MachineType == MachineType.Bios) + { + continue; + } + // Determine if the game has a parent or not string parent = null; if (!String.IsNullOrWhiteSpace(this[game][0].RomOf))