diff --git a/SabreTools.Helper/Data/Build.cs b/SabreTools.Helper/Data/Build.cs
index f6b7c0d4..9bd79890 100644
--- a/SabreTools.Helper/Data/Build.cs
+++ b/SabreTools.Helper/Data/Build.cs
@@ -317,7 +317,7 @@ namespace SabreTools.Helper.Data
helptext.Add(" -sl, --softlist Use Software List name instead of description");
helptext.Add(" -dnm, --dat-nm Create non-merged sets in the output DAT");
helptext.Add(" -dm, --dat-merge Create merged sets in the output DAT");
- helptext.Add(" -df, --dat-fm Create fully merged sets in the output");
+ helptext.Add(" -df, --dat-fnm Create fully merged sets in the output");
helptext.Add(" -trim Trim file names to fit NTFS length");
helptext.Add(" -rd=, --root-dir= Set the root directory for calc");
helptext.Add(" -si, --single All game names replaced by '!'");
diff --git a/SabreTools.Helper/Data/Enums.cs b/SabreTools.Helper/Data/Enums.cs
index d77227b8..d826befe 100644
--- a/SabreTools.Helper/Data/Enums.cs
+++ b/SabreTools.Helper/Data/Enums.cs
@@ -262,7 +262,7 @@
None = 0,
NonMerged,
Merged,
- NotMergedWithDevice,
+ FullNonMerged,
}
#endregion
diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs b/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs
index 41c324c9..4678a985 100644
--- a/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs
+++ b/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs
@@ -378,6 +378,8 @@ namespace SabreTools.Helper.Dats
/// True if the number of hashes counted is to be output (default), false otherwise
public void CreateFullyNonMergedSets(bool mergeroms, Logger logger, bool output = true)
{
+ logger.User("Creating fully non-merged sets from the DAT");
+
// For sake of ease, the first thing we want to do is sort by game
BucketByGame(mergeroms, true, logger, output);
_sortedBy = SortedBy.Default;
@@ -604,6 +606,8 @@ namespace SabreTools.Helper.Dats
/// True if the number of hashes counted is to be output (default), false otherwise
public void CreateMergedSets(bool mergeroms, Logger logger, bool output = true)
{
+ logger.User("Creating merged sets from the DAT");
+
// For sake of ease, the first thing we want to do is sort by game
BucketByGame(mergeroms, true, logger, output);
_sortedBy = SortedBy.Default;
@@ -651,6 +655,8 @@ namespace SabreTools.Helper.Dats
/// True if the number of hashes counted is to be output (default), false otherwise
public void CreateNonMergedSets(bool mergeroms, Logger logger, bool output = true)
{
+ logger.User("Creating non-merged sets from the DAT");
+
// For sake of ease, the first thing we want to do is sort by game
BucketByGame(mergeroms, true, logger, output);
_sortedBy = SortedBy.Default;
@@ -659,6 +665,12 @@ namespace SabreTools.Helper.Dats
List games = Keys.ToList();
foreach (string game in games)
{
+ // If the game has no items in it, we want to continue
+ if (this[game].Count == 0)
+ {
+ continue;
+ }
+
// Determine if the game has a parent or not
string parent = null;
if (!String.IsNullOrEmpty(this[game][0].Machine.CloneOf))
@@ -666,29 +678,22 @@ namespace SabreTools.Helper.Dats
parent = this[game][0].Machine.CloneOf;
}
- // If there is no parent, then we continue
+ // If the parent doesnt exist, we want to continue
if (String.IsNullOrEmpty(parent))
{
continue;
}
- // If the parent doesn't exist, then we continue and remove
+ // If the parent doesn't have any items, we want to continue
if (this[parent].Count == 0)
{
- List curitems = this[game];
- foreach (DatItem item in curitems)
- {
- item.Machine.CloneOf = null;
- item.Machine.RomOf = null;
- }
-
continue;
}
- // Otherwise, copy the items from the parent to the current game
+ // If the parent exists and has items, we copy the items from the parent to the current game
Machine currentMachine = this[game][0].Machine;
- List items = this[parent];
- foreach (DatItem item in items)
+ List parentItems = this[parent];
+ foreach (DatItem item in parentItems)
{
// Figure out the type of the item and add it accordingly
switch (item.Type)
@@ -700,7 +705,7 @@ namespace SabreTools.Helper.Dats
{
this[game].Add(archive);
}
-
+
break;
case ItemType.BiosSet:
BiosSet biosSet = ((BiosSet)item).Clone() as BiosSet;
@@ -750,14 +755,115 @@ namespace SabreTools.Helper.Dats
}
}
- // Finally, remove the romof and cloneof tags so it's not picked up by the manager
- items = this[game];
+ // Now we want to get the parent romof tag and put it in each of the items
+ List items = this[game];
+ string romof = this[parent][0].Machine.RomOf;
+ foreach (DatItem item in items)
+ {
+ item.Machine.RomOf = romof;
+ }
+ }
+
+ // Now that we have looped through the cloneof tags, we loop through the romof tags
+ games = Keys.ToList();
+ foreach (string game in games)
+ {
+ // If the game has no items in it, we want to continue
+ if (this[game].Count == 0)
+ {
+ continue;
+ }
+
+ // Determine if the game has a parent or not
+ string parent = null;
+ if (!String.IsNullOrEmpty(this[game][0].Machine.RomOf))
+ {
+ parent = this[game][0].Machine.RomOf;
+ }
+
+ // If the parent doesnt exist, we want to continue
+ if (String.IsNullOrEmpty(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 remove the items that are in the parent from the current game
+ Machine currentMachine = this[game][0].Machine;
+ List parentItems = this[parent];
+ foreach (DatItem item in parentItems)
+ {
+ // Figure out the type of the item and add it accordingly
+ switch (item.Type)
+ {
+ case ItemType.Archive:
+ Archive archive = ((Archive)item).Clone() as Archive;
+ if (this[game].Contains(archive))
+ {
+ this[game].Remove(archive);
+ }
+
+ break;
+ case ItemType.BiosSet:
+ BiosSet biosSet = ((BiosSet)item).Clone() as BiosSet;
+ if (this[game].Contains(biosSet))
+ {
+ this[game].Remove(biosSet);
+ }
+
+ break;
+ case ItemType.Disk:
+ Disk disk = ((Disk)item).Clone() as Disk;
+ if (this[game].Contains(disk))
+ {
+ this[game].Remove(disk);
+ }
+
+ break;
+ case ItemType.Release:
+ Release release = ((Release)item).Clone() as Release;
+ if (this[game].Contains(release))
+ {
+ this[game].Remove(release);
+ }
+
+ break;
+ case ItemType.Rom:
+ Rom rom = ((Rom)item).Clone() as Rom;
+ if (this[game].Contains(rom))
+ {
+ this[game].Remove(rom);
+ }
+
+ break;
+ case ItemType.Sample:
+ Sample sample = ((Sample)item).Clone() as Sample;
+ if (this[game].Contains(sample))
+ {
+ this[game].Remove(sample);
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Finally, remove the romof and cloneof tags so it's not picked up by the manager
+ games = Keys.ToList();
+ foreach (string game in games)
+ {
+ List items = this[game];
foreach (DatItem item in items)
{
item.Machine.CloneOf = null;
item.Machine.RomOf = null;
}
- }
+ }
}
#endregion
diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs b/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs
index e3e797bf..ed39dfc7 100644
--- a/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs
+++ b/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs
@@ -135,7 +135,7 @@ namespace SabreTools.Helper.Dats
{
CreateMergedSets(false, logger, output: false);
}
- else if (splitType == SplitType.NotMergedWithDevice)
+ else if (splitType == SplitType.FullNonMerged)
{
CreateFullyNonMergedSets(false, logger, output: false);
}
diff --git a/SabreTools.Helper/README.1ST b/SabreTools.Helper/README.1ST
index 32d34369..5b2b3554 100644
--- a/SabreTools.Helper/README.1ST
+++ b/SabreTools.Helper/README.1ST
@@ -732,7 +732,7 @@ Options:
-dnm, --dat-nm Create non-merged sets in the output DAT
-dm, --dat-merge Create merged sets in the output DAT
- -df, --dat-fm Create fully merged sets (including devices) in the output DAT
+ -df, --dat-fnm Create fully merged sets (including devices) in the output DAT
Each of the above flags allow for preprocessing an outputted DAT in the case that
your DAT manager of choice doesn't allow these on the fly. Non-merged will copy all
parent items to the children so that each archive or folder contains everything
diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs
index 0b745d93..493b8daa 100644
--- a/SabreTools/SabreTools.cs
+++ b/SabreTools/SabreTools.cs
@@ -257,8 +257,8 @@ namespace SabreTools
delete = true;
break;
case "-df":
- case "--dat-fm":
- splitType = SplitType.NotMergedWithDevice;
+ case "--dat-fnm":
+ splitType = SplitType.FullNonMerged;
break;
case "-di":
case "--diff":