mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SabreTools, DatFiles/] Add flag for keeping empty games instead of making it default
This commit is contained in:
@@ -36,7 +36,7 @@ namespace RombaSharp
|
|||||||
/// <param name="useGolangZip">True to use go zip implementation instead of zlib, false otherwise</param>
|
/// <param name="useGolangZip">True to use go zip implementation instead of zlib, false otherwise</param>
|
||||||
/// <param name="noDb">True to archive into depot but do not touch DB index and ignore only-needed flag, false otherwise</param>
|
/// <param name="noDb">True to archive into depot but do not touch DB index and ignore only-needed flag, false otherwise</param>
|
||||||
/// TODO: Add ability to update .romba files with proper size AND use the correct depot if it fills up
|
/// TODO: Add ability to update .romba files with proper size AND use the correct depot if it fills up
|
||||||
/// TODO: Add ability to mark which depot the files are being rebuilt to in the DB
|
/// TODO: Add ability correctly to mark which depot the files are being rebuilt to in the DB
|
||||||
private static void InitArchive(
|
private static void InitArchive(
|
||||||
List<string> inputs,
|
List<string> inputs,
|
||||||
bool onlyNeeded,
|
bool onlyNeeded,
|
||||||
|
|||||||
@@ -652,16 +652,19 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// If no items were found for this machine, add a Blank placeholder
|
// If no items were found for this machine, add a Blank placeholder
|
||||||
if (!containsItems)
|
if (!containsItems)
|
||||||
{
|
{
|
||||||
Blank blank = new Blank()
|
if (this.KeepEmptyGames)
|
||||||
{
|
{
|
||||||
SystemID = sysid,
|
Blank blank = new Blank()
|
||||||
System = filename,
|
{
|
||||||
SourceID = srcid,
|
SystemID = sysid,
|
||||||
};
|
System = filename,
|
||||||
blank.CopyMachineInformation(machine);
|
SourceID = srcid,
|
||||||
|
};
|
||||||
|
blank.CopyMachineInformation(machine);
|
||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
ParseAddHelper(blank, clean, remUnicode);
|
ParseAddHelper(blank, clean, remUnicode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -451,6 +451,27 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.ExcludeOf = value;
|
_datHeader.ExcludeOf = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public bool KeepEmptyGames
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_datHeader == null)
|
||||||
|
{
|
||||||
|
_datHeader = new DatHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _datHeader.KeepEmptyGames;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_datHeader == null)
|
||||||
|
{
|
||||||
|
_datHeader = new DatHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
_datHeader.KeepEmptyGames = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
public bool SceneDateStrip
|
public bool SceneDateStrip
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
private ForcePacking _forcePacking;
|
private ForcePacking _forcePacking;
|
||||||
private DatFormat _datFormat;
|
private DatFormat _datFormat;
|
||||||
private bool _excludeOf;
|
private bool _excludeOf;
|
||||||
|
private bool _keepEmptyGames;
|
||||||
private bool _sceneDateStrip;
|
private bool _sceneDateStrip;
|
||||||
private DedupeType _dedupeRoms;
|
private DedupeType _dedupeRoms;
|
||||||
private Hash _stripHash;
|
private Hash _stripHash;
|
||||||
@@ -147,6 +148,11 @@ namespace SabreTools.Library.DatFiles
|
|||||||
get { return _excludeOf; }
|
get { return _excludeOf; }
|
||||||
set { _excludeOf = value; }
|
set { _excludeOf = value; }
|
||||||
}
|
}
|
||||||
|
public bool KeepEmptyGames
|
||||||
|
{
|
||||||
|
get { return _keepEmptyGames; }
|
||||||
|
set { _keepEmptyGames = value; }
|
||||||
|
}
|
||||||
public bool SceneDateStrip
|
public bool SceneDateStrip
|
||||||
{
|
{
|
||||||
get { return _sceneDateStrip; }
|
get { return _sceneDateStrip; }
|
||||||
@@ -243,6 +249,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_forcePacking = this._forcePacking,
|
_forcePacking = this._forcePacking,
|
||||||
_datFormat = this._datFormat,
|
_datFormat = this._datFormat,
|
||||||
_excludeOf = this._excludeOf,
|
_excludeOf = this._excludeOf,
|
||||||
|
_keepEmptyGames = this._keepEmptyGames,
|
||||||
_sceneDateStrip = this._sceneDateStrip,
|
_sceneDateStrip = this._sceneDateStrip,
|
||||||
_dedupeRoms = this._dedupeRoms,
|
_dedupeRoms = this._dedupeRoms,
|
||||||
_stripHash = this._stripHash,
|
_stripHash = this._stripHash,
|
||||||
|
|||||||
@@ -494,17 +494,19 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// If no items were found for this machine, add a Blank placeholder
|
// If no items were found for this machine, add a Blank placeholder
|
||||||
if (!containsItems)
|
if (!containsItems)
|
||||||
{
|
{
|
||||||
Blank blank = new Blank()
|
if (this.KeepEmptyGames)
|
||||||
{
|
{
|
||||||
SystemID = sysid,
|
Blank blank = new Blank()
|
||||||
System = filename,
|
{
|
||||||
SourceID = srcid,
|
SystemID = sysid,
|
||||||
};
|
System = filename,
|
||||||
|
SourceID = srcid,
|
||||||
|
};
|
||||||
|
blank.CopyMachineInformation(machine);
|
||||||
|
|
||||||
blank.CopyMachineInformation(machine);
|
// Now process and add the rom
|
||||||
|
ParseAddHelper(blank, clean, remUnicode);
|
||||||
// Now process and add the rom
|
}
|
||||||
key = ParseAddHelper(blank, clean, remUnicode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -534,17 +534,19 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// If no items were found for this machine, add a Blank placeholder
|
// If no items were found for this machine, add a Blank placeholder
|
||||||
if (!containsItems)
|
if (!containsItems)
|
||||||
{
|
{
|
||||||
Blank blank = new Blank()
|
if (this.KeepEmptyGames)
|
||||||
{
|
{
|
||||||
SystemID = sysid,
|
Blank blank = new Blank()
|
||||||
System = filename,
|
{
|
||||||
SourceID = srcid,
|
SystemID = sysid,
|
||||||
};
|
System = filename,
|
||||||
|
SourceID = srcid,
|
||||||
|
};
|
||||||
|
blank.CopyMachineInformation(machine);
|
||||||
|
|
||||||
blank.CopyMachineInformation(machine);
|
// Now process and add the rom
|
||||||
|
ParseAddHelper(blank, clean, remUnicode);
|
||||||
// Now process and add the rom
|
}
|
||||||
key = ParseAddHelper(blank, clean, remUnicode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -462,11 +462,18 @@ namespace SabreTools.Library.DatFiles
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// By default, create a new Blank, just in case
|
// By default, create a new Blank, just in case
|
||||||
datItem = new Blank();
|
if (this.KeepEmptyGames)
|
||||||
|
{
|
||||||
|
datItem = new Blank();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
datItem = null;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
datItem.CopyMachineInformation(dir);
|
datItem?.CopyMachineInformation(dir);
|
||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
key = ParseAddHelper(datItem, clean, remUnicode);
|
key = ParseAddHelper(datItem, clean, remUnicode);
|
||||||
|
|||||||
@@ -231,17 +231,19 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// If no items were found for this machine, add a Blank placeholder
|
// If no items were found for this machine, add a Blank placeholder
|
||||||
if (!containsItems)
|
if (!containsItems)
|
||||||
{
|
{
|
||||||
Blank blank = new Blank()
|
if (this.KeepEmptyGames)
|
||||||
{
|
{
|
||||||
SystemID = sysid,
|
Blank blank = new Blank()
|
||||||
System = filename,
|
{
|
||||||
SourceID = srcid,
|
SystemID = sysid,
|
||||||
};
|
System = filename,
|
||||||
|
SourceID = srcid,
|
||||||
|
};
|
||||||
|
blank.CopyMachineInformation(machine);
|
||||||
|
|
||||||
blank.CopyMachineInformation(machine);
|
// Now process and add the rom
|
||||||
|
ParseAddHelper(blank, clean, remUnicode);
|
||||||
// Now process and add the rom
|
}
|
||||||
key = ParseAddHelper(blank, clean, remUnicode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -286,6 +286,11 @@ Options:
|
|||||||
-xof, --exclude-of Exclude romof, cloneof, sampleof tags
|
-xof, --exclude-of Exclude romof, cloneof, sampleof tags
|
||||||
If this flag is enabled, then the romof, cloneof, and sampleof tags
|
If this flag is enabled, then the romof, cloneof, and sampleof tags
|
||||||
will be omitted from the outputted DAT.
|
will be omitted from the outputted DAT.
|
||||||
|
|
||||||
|
-keg, --keep-empty-games Keep originally empty sets from the input(s)
|
||||||
|
Normally, any sets that are considered empty will not be included in
|
||||||
|
the output, this flag allows these empty sets to be added to the
|
||||||
|
output.
|
||||||
|
|
||||||
-sds, --scene-date-strip Remove date from scene-named sets
|
-sds, --scene-date-strip Remove date from scene-named sets
|
||||||
If this flag is enabled, sets with "scene" names will have the date
|
If this flag is enabled, sets with "scene" names will have the date
|
||||||
|
|||||||
@@ -465,6 +465,18 @@ namespace SabreTools
|
|||||||
longDescription: "Instead of the normal behavior of rebuilding using a DAT, this flag allows the user to use the DAT as a filter instead. All files that are found in the DAT will be skipped and everything else will be output in the selected format.");
|
longDescription: "Instead of the normal behavior of rebuilding using a DAT, this flag allows the user to use the DAT as a filter instead. All files that are found in the DAT will be skipped and everything else will be output in the selected format.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private static Feature keepEmptyGamesFlag
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new Feature(
|
||||||
|
"keep-empty-games",
|
||||||
|
new List<string>() { "-keg", "--keep-empty-games" },
|
||||||
|
"Keep originally empty sets from the input(s)",
|
||||||
|
FeatureType.Flag,
|
||||||
|
longDescription: "Normally, any sets that are considered empty will not be included in the output, this flag allows these empty sets to be added to the output.");
|
||||||
|
}
|
||||||
|
}
|
||||||
private static Feature levelFlag
|
private static Feature levelFlag
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -2550,6 +2562,7 @@ The stats that are outputted are as follows:
|
|||||||
update[outputTsvFlag].AddFeature(quotesFlag);
|
update[outputTsvFlag].AddFeature(quotesFlag);
|
||||||
update.AddFeature(outputXmlFlag);
|
update.AddFeature(outputXmlFlag);
|
||||||
update[outputXmlFlag].AddFeature(depreciatedFlag);
|
update[outputXmlFlag].AddFeature(depreciatedFlag);
|
||||||
|
// End OLD
|
||||||
update.AddFeature(filenameStringInput);
|
update.AddFeature(filenameStringInput);
|
||||||
update.AddFeature(nameStringInput);
|
update.AddFeature(nameStringInput);
|
||||||
update.AddFeature(descriptionStringInput);
|
update.AddFeature(descriptionStringInput);
|
||||||
@@ -2568,6 +2581,7 @@ The stats that are outputted are as follows:
|
|||||||
update.AddFeature(forcenodumpStringInput);
|
update.AddFeature(forcenodumpStringInput);
|
||||||
update.AddFeature(forcepackingStringInput);
|
update.AddFeature(forcepackingStringInput);
|
||||||
update.AddFeature(excludeOfFlag);
|
update.AddFeature(excludeOfFlag);
|
||||||
|
update.AddFeature(keepEmptyGamesFlag);
|
||||||
update.AddFeature(sceneDateStripFlag);
|
update.AddFeature(sceneDateStripFlag);
|
||||||
update.AddFeature(cleanFlag);
|
update.AddFeature(cleanFlag);
|
||||||
update.AddFeature(removeUnicodeFlag);
|
update.AddFeature(removeUnicodeFlag);
|
||||||
|
|||||||
@@ -317,6 +317,9 @@ namespace SabreTools
|
|||||||
case "inverse":
|
case "inverse":
|
||||||
inverse = true;
|
inverse = true;
|
||||||
break;
|
break;
|
||||||
|
case "keep-empty-games":
|
||||||
|
datHeader.KeepEmptyGames = true;
|
||||||
|
break;
|
||||||
case "level":
|
case "level":
|
||||||
splittingMode |= SplittingMode.Level;
|
splittingMode |= SplittingMode.Level;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user