diff --git a/SabreTools.Core/README.1ST b/SabreTools.Core/README.1ST index 24106ead..8fc942c4 100644 --- a/SabreTools.Core/README.1ST +++ b/SabreTools.Core/README.1ST @@ -608,6 +608,13 @@ Features and Options: children based on the cloneof tag. This is incompatible with the other --dat-X flags. + --frp, --force-rom-parenting Force ROMs to be added to parent + By default, a merged DAT will take the first instance of a given + ROM in the parent as the file existing. To be more strict to the + source, this flag allows overriding that where if the file is in + the child, it will be added to the resulting combined parent in + call cases that are not controlled by a merge tag. + -ds, --dat-split Force creating split sets Preprocess the DAT to remove redundant files between parents and children based on the romof and cloneof tags. This is incompatible @@ -1003,6 +1010,13 @@ Features and Options: children based on the cloneof tag. This is incompatible with the other --dat-X flags. + --frp, --force-rom-parenting Force ROMs to be added to parent + By default, a merged DAT will take the first instance of a given + ROM in the parent as the file existing. To be more strict to the + source, this flag allows overriding that where if the file is in + the child, it will be added to the resulting combined parent in + call cases that are not controlled by a merge tag. + -ds, --dat-split Force creating split sets Preprocess the DAT to remove redundant files between parents and children based on the romof and cloneof tags. This is incompatible @@ -1250,6 +1264,13 @@ Features and Options: children based on the cloneof tag. This is incompatible with the other --dat-X flags. + --frp, --force-rom-parenting Force ROMs to be added to parent + By default, a merged DAT will take the first instance of a given + ROM in the parent as the file existing. To be more strict to the + source, this flag allows overriding that where if the file is in + the child, it will be added to the resulting combined parent in + call cases that are not controlled by a merge tag. + -ds, --dat-split Force creating split sets Preprocess the DAT to remove redundant files between parents and children based on the romof and cloneof tags. This is incompatible diff --git a/SabreTools/Features/BaseFeature.cs b/SabreTools/Features/BaseFeature.cs index 8b6742f3..a92f5a42 100644 --- a/SabreTools/Features/BaseFeature.cs +++ b/SabreTools/Features/BaseFeature.cs @@ -430,6 +430,21 @@ namespace SabreTools.Features } } + internal const string ForceRomParentingValue = "force-rom-parenting"; + internal static Feature ForceRomParentingFlag + { + get + { + return new Feature( + ForceRomParentingValue, + new List() { "-frp", "--force-rom-parenting" }, + "Force ROMs to be added to parent", + ParameterType.Flag, + "By default, a merged DAT will take the first instance of a given ROM in the parent as the file existing. To be more strict to the source, this flag allows overriding that where if the file is in the child, it will be added to the resulting combined parent in call cases that are not controlled by a merge tag." + ); + } + } + internal const string GameDedupValue = "game-dedup"; internal static Feature GameDedupFlag { @@ -1864,6 +1879,7 @@ Some special strings that can be used: protected void AddInternalSplitFeatures() { AddFeature(DatMergedFlag); + this[DatMergedFlag].AddFeature(ForceRomParentingFlag); AddFeature(DatSplitFlag); AddFeature(DatNonMergedFlag); AddFeature(DatDeviceNonMergedFlag); diff --git a/SabreTools/Features/DatFromDir.cs b/SabreTools/Features/DatFromDir.cs index 15cc2699..8382e7b4 100644 --- a/SabreTools/Features/DatFromDir.cs +++ b/SabreTools/Features/DatFromDir.cs @@ -63,6 +63,7 @@ namespace SabreTools.Features bool addBlankFiles = GetBoolean(features, AddBlankFilesValue); bool addFileDates = GetBoolean(features, AddDateValue); TreatAsFile asFiles = GetTreatAsFiles(features); + bool forceAddRoms = GetBoolean(features, ForceRomParentingValue); bool noAutomaticDate = GetBoolean(features, NoAutomaticDateValue); var includeInScan = GetIncludeInScan(features); var skipFileType = GetSkipFileType(features); @@ -100,7 +101,7 @@ namespace SabreTools.Features { // Perform additional processing steps Extras.ApplyExtras(datdata); - Splitter.ApplySplitting(datdata, false, false); + Splitter.ApplySplitting(datdata, useTags: false, forceAddRoms); Filter.ApplyFilters(datdata); Cleaner.ApplyCleaning(datdata); Remover.ApplyRemovals(datdata); diff --git a/SabreTools/Features/Update.cs b/SabreTools/Features/Update.cs index 95a4595a..d558a24a 100644 --- a/SabreTools/Features/Update.cs +++ b/SabreTools/Features/Update.cs @@ -91,6 +91,7 @@ namespace SabreTools.Features return false; // Get feature flags + bool forceAddRoms = GetBoolean(features, ForceRomParentingValue); var updateDatItemFields = GetUpdateDatItemFields(features); var updateMachineFields = GetUpdateMachineFields(features); var updateMode = GetUpdateMode(features); @@ -165,7 +166,7 @@ namespace SabreTools.Features // Perform additional processing steps Extras.ApplyExtras(datFile); - Splitter.ApplySplitting(datFile, false, false); + Splitter.ApplySplitting(datFile, useTags: false, forceAddRoms); Filter.ApplyFilters(datFile); Cleaner.ApplyCleaning(datFile); Remover.ApplyRemovals(datFile); @@ -204,7 +205,7 @@ namespace SabreTools.Features // Perform additional processing steps Extras.ApplyExtras(userInputDat); - Splitter.ApplySplitting(userInputDat, false, false); + Splitter.ApplySplitting(userInputDat, useTags: false, forceAddRoms); Filter.ApplyFilters(userInputDat); Cleaner.ApplyCleaning(userInputDat); Remover.ApplyRemovals(userInputDat); @@ -297,7 +298,7 @@ namespace SabreTools.Features // Perform additional processing steps Extras.ApplyExtras(repDat); - Splitter.ApplySplitting(repDat, false, false); + Splitter.ApplySplitting(repDat, useTags: false, forceAddRoms); Filter.ApplyFilters(repDat); Cleaner.ApplyCleaning(repDat); Remover.ApplyRemovals(repDat); @@ -323,7 +324,7 @@ namespace SabreTools.Features // Perform additional processing steps Extras.ApplyExtras(repDat); - Splitter.ApplySplitting(repDat, false, false); + Splitter.ApplySplitting(repDat, useTags: false, forceAddRoms); Filter.ApplyFilters(repDat); Cleaner.ApplyCleaning(repDat); Remover.ApplyRemovals(repDat); diff --git a/SabreTools/Features/Verify.cs b/SabreTools/Features/Verify.cs index 434d01f0..42a2d7d4 100644 --- a/SabreTools/Features/Verify.cs +++ b/SabreTools/Features/Verify.cs @@ -53,6 +53,7 @@ namespace SabreTools.Features // Get feature flags TreatAsFile asFiles = GetTreatAsFiles(features); + bool forceAddRoms = GetBoolean(features, ForceRomParentingValue); bool hashOnly = GetBoolean(features, HashOnlyValue); bool quickScan = GetBoolean(features, QuickValue); @@ -67,7 +68,7 @@ namespace SabreTools.Features // Perform additional processing steps Extras.ApplyExtras(datdata); - Splitter.ApplySplitting(datdata, true, false); + Splitter.ApplySplitting(datdata, useTags: true, forceAddRoms); Filter.ApplyFilters(datdata); Cleaner.ApplyCleaning(datdata); Remover.ApplyRemovals(datdata); @@ -115,7 +116,7 @@ namespace SabreTools.Features // Perform additional processing steps Extras.ApplyExtras(datdata); - Splitter.ApplySplitting(datdata, true, false); + Splitter.ApplySplitting(datdata, useTags: true, forceAddRoms); Filter.ApplyFilters(datdata); Cleaner.ApplyCleaning(datdata); Remover.ApplyRemovals(datdata);