Add external flag for force adding roms

This commit is contained in:
Matt Nadareski
2023-04-17 14:02:11 -04:00
parent 3ae002a153
commit 237f04491e
5 changed files with 47 additions and 7 deletions

View File

@@ -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<string>() { "-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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);