diff --git a/SabreTools.DatFiles/ItemDictionaryDB.cs b/SabreTools.DatFiles/ItemDictionaryDB.cs
index e996ba7c..67491535 100644
--- a/SabreTools.DatFiles/ItemDictionaryDB.cs
+++ b/SabreTools.DatFiles/ItemDictionaryDB.cs
@@ -1206,6 +1206,53 @@ namespace SabreTools.DatFiles
#region Splitting
+ ///
+ /// Use romof tags to add roms to the children
+ ///
+ public void AddRomsFromBios()
+ {
+ List games = [.. SortedKeys];
+ foreach (string game in games)
+ {
+ var items = GetDatItemsForBucket(game);
+
+ // If the game has no items in it, we want to continue
+ if (items == null || items.Length == 0)
+ continue;
+
+ // Get the machine for the first item
+ var machine = GetMachineForItem(items[0].Item1);
+ if (machine.Item2 == null)
+ continue;
+
+ // Determine if the game has a parent or not
+ (long, string?) parent = (-1, null);
+ if (!string.IsNullOrEmpty(machine.Item2.GetStringFieldValue(Models.Metadata.Machine.RomOfKey)))
+ {
+ string? romOf = machine.Item2.GetStringFieldValue(Models.Metadata.Machine.RomOfKey);
+ var romOfMachine = GetMachine(romOf);
+ parent = (romOfMachine.Item1, romOf);
+ }
+
+ // If the parent doesnt exist, we want to continue
+ if (string.IsNullOrEmpty(parent.Item2))
+ continue;
+
+ // If the parent doesn't have any items, we want to continue
+ var parentItems = GetDatItemsForBucket(parent.Item2!);
+ if (parentItems == null || parentItems.Length == 0)
+ continue;
+
+ // If the parent exists and has items, we copy the items from the parent to the current game
+ foreach ((long, DatItem) item in parentItems)
+ {
+ DatItem datItem = (item.Item2.Clone() as DatItem)!;
+ if (!items.Where(i => i.Item2.GetName() == datItem.GetName()).Any() && !items.Any(i => i.Item2 == datItem))
+ AddItem(datItem, machine.Item1);
+ }
+ }
+ }
+
///
/// Use device_ref and optionally slotoption tags to add roms to the children
///
diff --git a/SabreTools.Filtering/Splitter.cs b/SabreTools.Filtering/Splitter.cs
index fac4efed..ce9bba74 100644
--- a/SabreTools.Filtering/Splitter.cs
+++ b/SabreTools.Filtering/Splitter.cs
@@ -131,6 +131,7 @@ namespace SabreTools.Filtering
// Now we want to loop through all of the games and set the correct information
AddRomsFromChildren(datFile, skipDedup: false);
+ datFile.ItemsDB.AddRomsFromChildren(true, false);
// Now that we have looped through the cloneof tags, we loop through the romof tags
RemoveBiosRomsFromChild(datFile, false);
@@ -164,6 +165,7 @@ namespace SabreTools.Filtering
// Now that we have looped through the cloneof tags, we loop through the romof tags
AddRomsFromBios(datFile);
+ datFile.ItemsDB.AddRomsFromBios();
// Then, remove the romof and cloneof tags so it's not picked up by the manager
RemoveTagsFromChild(datFile);
@@ -183,6 +185,7 @@ namespace SabreTools.Filtering
// Now we want to loop through all of the games and set the correct information
AddRomsFromChildren(datFile, skipDedup: true);
+ datFile.ItemsDB.AddRomsFromChildren(true, true);
// Now that we have looped through the cloneof tags, we loop through the romof tags
RemoveBiosRomsFromChild(datFile, false);
@@ -293,8 +296,6 @@ namespace SabreTools.Filtering
}
}
- // TODO: Add AddRomsFromBiosDB
-
///
/// Use device_ref and optionally slotoption tags to add roms to the children
///