diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs
index 4267af7a..c48d2b63 100644
--- a/SabreTools.Library/DatFiles/DatFile.cs
+++ b/SabreTools.Library/DatFiles/DatFile.cs
@@ -1581,9 +1581,10 @@ namespace SabreTools.Library.DatFiles
/// True to allow SL DATs to have game names used instead of descriptions, false otherwise (default)
/// Filter object to be passed to the DatItem level
/// Type of the split that should be performed (split, merged, fully merged)
- /// True if hashes should be updated along with names, false otherwise [Only for base replacement]
+ /// True if names should be updated, false otherwise [only for base replacement]
+ /// True if hashes should be updated, false otherwise [only for base replacement]
public void DetermineUpdateType(List inputPaths, List basePaths, string outDir, UpdateMode updateMode, bool inplace, bool skip,
- bool bare, bool clean, bool remUnicode, bool descAsName, Filter filter, SplitType splitType, bool updateHashes)
+ bool bare, bool clean, bool remUnicode, bool descAsName, Filter filter, SplitType splitType, bool updateNames, bool updateHashes)
{
// Ensure we only have files in the inputs
List inputFileNames = Utilities.GetOnlyFilesFromInputs(inputPaths, appendparent: true);
@@ -1637,7 +1638,7 @@ namespace SabreTools.Library.DatFiles
else if ((updateMode & UpdateMode.BaseReplace) != 0
|| (updateMode & UpdateMode.ReverseBaseReplace) != 0)
{
- BaseReplace(inputFileNames, baseFileNames, outDir, inplace, clean, remUnicode, descAsName, filter, splitType, updateHashes);
+ BaseReplace(inputFileNames, baseFileNames, outDir, inplace, clean, remUnicode, descAsName, filter, splitType, updateNames, updateHashes);
}
return;
@@ -1705,7 +1706,7 @@ namespace SabreTools.Library.DatFiles
}
///
- /// Replace item names from on a base set
+ /// Replace item values from the base set
///
/// Names of the input files
/// Names of base files
@@ -1719,9 +1720,10 @@ namespace SabreTools.Library.DatFiles
/// True if we are supposed to trim names to NTFS length, false otherwise
/// True if all games should be replaced by '!', false otherwise
/// String representing root directory to compare against for length calculation
- /// True if hashes should be updated along with names, false otherwise
+ /// True if names should be updated, false otherwise
+ /// True if hashes should be updated, false otherwise
public void BaseReplace(List inputFileNames, List baseFileNames, string outDir, bool inplace, bool clean, bool remUnicode,
- bool descAsName, Filter filter, SplitType splitType, bool updateHashes)
+ bool descAsName, Filter filter, SplitType splitType, bool updateNames, bool updateHashes)
{
// First we want to parse all of the base DATs into the input
InternalStopwatch watch = new InternalStopwatch("Populating base DAT for replacement...");
@@ -1770,9 +1772,13 @@ namespace SabreTools.Library.DatFiles
if (dupes.Count > 0)
{
- newDatItem.Name = dupes[0].Name;
+ // If we're updating names, replace using the first found name
+ if (updateNames)
+ {
+ newDatItem.Name = dupes[0].Name;
+ }
- // If we're updating hashes too, only replace if the current item doesn't have them
+ // If we're updating hashes, only replace if the current item doesn't have them
if (updateHashes)
{
if (newDatItem.Type == ItemType.Rom)
diff --git a/SabreTools.Library/README.1ST b/SabreTools.Library/README.1ST
index 7eb58ce2..4d3cb960 100644
--- a/SabreTools.Library/README.1ST
+++ b/SabreTools.Library/README.1ST
@@ -1142,22 +1142,25 @@ Options:
a second time, this will skip writing it. This can often
speed up the output process.
- -bn, --base-name Replace item names from base DATs in order
- -rbn, --reverse-base-name Replace item names from base DATs in reverse
+ -bn, --base-replace Replace item from base DATs in order
+ -rbn, --reverse-base-replace Replace item from base DATs in reverse
By default, no item names are changed except when there is a merge
occurring. This flag enables users to define a DAT or set of base
- DATs to use as "replacement names" for all input DATs. Note that
+ DATs to use as "replacements" for all input DATs. Note that
the first found instance of an item in the base DAT(s) will be
used and all others will be disgarded. For reverse, the first
- instance found in the last DAT inputted will be used.
+ instance found in the last DAT inputted will be used. If no
+ additional flag is given, it will default to updating names.
-bd=, --base-dat= Add a base DAT for replacing
Add a DAT or folder of DATs to the base set to be used in
item name replacement
-
- -uh, --update-hashes Update hashes along with the names
- By default, only names are updated during the replacement. This
- flag also allows updating of missing hashes at the same time.
+
+ -un, --update-names Update names from base DATs
+ This flag enables updating of names from base DATs.
+
+ -uh, --update-hashes Update hashes from base DATs
+ This flag enables updating of hashes from base DATs.
-gn=, --not-game= Filter by game name
-ngn=, --game-name= Exclude by game name
diff --git a/SabreTools/SabreTools.Help.cs b/SabreTools/SabreTools.Help.cs
index d5d67c52..dd278a13 100644
--- a/SabreTools/SabreTools.Help.cs
+++ b/SabreTools/SabreTools.Help.cs
@@ -1260,36 +1260,46 @@ namespace SabreTools
"Don't include the date in automatic name",
FeatureType.Flag,
null));
- update.AddFeature("base-name", new Feature(
- new List() { "-bn", "-br", "--base-name", "--base-replace" },
- "Replace item names from base DATs in order",
+ update.AddFeature("base-replace", new Feature(
+ new List() { "-br", "--base-replace" },
+ "Replace from base DATs in order",
FeatureType.Flag,
null));
- update["base-name"].AddFeature("base-dat", new Feature(
+ update["base-replace"].AddFeature("base-dat", new Feature(
new List() { "-bd", "--base-dat" },
"Add a base DAT for replacing",
FeatureType.List,
null));
- update["base-name"].AddFeature("update-hashes", new Feature(
- new List() { "-uh", "--update-hashes" },
- "Update hashes along with the names",
- FeatureType.Flag,
- null));
- update.AddFeature("reverse-base-name", new Feature(
- new List() { "-rbn", "-rbr", "--reverse-base-name", "--reverse-base-replace" },
+ update["base-replace"].AddFeature("update-names", new Feature(
+ new List() { "-un", "--update-names" },
+ "Update names from base DATs",
+ FeatureType.Flag,
+ null));
+ update["base-replace"].AddFeature("update-hashes", new Feature(
+ new List() { "-uh", "--update-hashes" },
+ "Update hashes from base DATs",
+ FeatureType.Flag,
+ null));
+ update.AddFeature("reverse-base-replace", new Feature(
+ new List() { "-rbr", "--reverse-base-replace" },
"Replace item names from base DATs in reverse",
FeatureType.Flag,
null));
- update["reverse-base-name"].AddFeature("base-dat", new Feature(
+ update["reverse-base-replace"].AddFeature("base-dat", new Feature(
new List() { "-bd", "--base-dat" },
"Add a base DAT for replacing",
FeatureType.List,
null));
- update["reverse-base-name"].AddFeature("update-hashes", new Feature(
- new List() { "-uh", "--update-hashes" },
- "Update hashes along with the names",
- FeatureType.Flag,
- null));
+ update["reverse-base-replace"].AddFeature("update-names", new Feature(
+ new List() { "-un", "--update-names" },
+ "Update names from base DATs",
+ FeatureType.Flag,
+ null));
+ update["reverse-base-replace"].AddFeature("update-hashes", new Feature(
+ new List() { "-uh", "--update-hashes" },
+ "Update hashes from base DATs",
+ FeatureType.Flag,
+ null));
update.AddFeature("game-name", new Feature(
new List() { "-gn", "--game-name" },
"Filter by game name",
diff --git a/SabreTools/SabreTools.Inits.cs b/SabreTools/SabreTools.Inits.cs
index 838de6e6..e87dcf25 100644
--- a/SabreTools/SabreTools.Inits.cs
+++ b/SabreTools/SabreTools.Inits.cs
@@ -233,7 +233,8 @@ namespace SabreTools
/// True to clean the game names to WoD standard, false otherwise (default)
/// True if we should remove non-ASCII characters from output, false otherwise (default)
/// True if descriptions should be used as names, false otherwise (default)
- /// True if hashes should be updated along with names, false otherwise [Only for base replacement]
+ /// True if names should be updated, false otherwise [only for base replacement]
+ /// True if hashes should be updated, false otherwise [only for base replacement]
private static void InitUpdate(
List inputPaths,
List basePaths,
@@ -256,6 +257,7 @@ namespace SabreTools
bool clean,
bool remUnicode,
bool descAsName,
+ bool updateNames,
bool updateHashes)
{
// Normalize the extensions
@@ -300,11 +302,17 @@ namespace SabreTools
}
}
+ // If neither the names or hashes are set, select names
+ if (!updateNames && !updateHashes)
+ {
+ updateNames = true;
+ }
+
// Populate the DatData object
DatFile userInputDat = new DatFile(datHeader);
userInputDat.DetermineUpdateType(inputPaths, basePaths, outDir, updateMode, inplace, skip, bare, clean,
- remUnicode, descAsName, filter, splitType, updateHashes);
+ remUnicode, descAsName, filter, splitType, updateNames, updateHashes);
}
///
diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs
index 60cd7595..01665cd2 100644
--- a/SabreTools/SabreTools.cs
+++ b/SabreTools/SabreTools.cs
@@ -94,7 +94,8 @@ namespace SabreTools
shortname = false,
skip = false,
updateDat = false,
- updateHashes = false;
+ updateHashes = false,
+ updateNames = false;
Hash omitFromScan = Hash.DeepHashes; // TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
OutputFormat outputFormat = OutputFormat.Folder;
SkipFileType skipFileType = SkipFileType.None;
@@ -200,7 +201,7 @@ namespace SabreTools
case "baddump-col":
showBaddumpColumn = true;
break;
- case "base-name":
+ case "base-replace":
updateMode |= UpdateMode.BaseReplace;
break;
case "cascade":
@@ -491,6 +492,9 @@ namespace SabreTools
case "update-hashes":
updateHashes = true;
break;
+ case "update-names":
+ updateNames = true;
+ break;
case "exclude-of":
datHeader.ExcludeOf = true;
break;
@@ -720,7 +724,7 @@ namespace SabreTools
case "Update":
VerifyInputs(inputs, feature);
InitUpdate(inputs, basePaths, datHeader, updateMode, inplace, skip, removeDateFromAutomaticName, filter,
- splitType, outDir, cleanGameNames, removeUnicode, descAsName, updateHashes);
+ splitType, outDir, cleanGameNames, removeUnicode, descAsName, updateNames, updateHashes);
break;
// If we're using the verifier
case "Verify":