diff --git a/SabreTools.Helper/Data/Build.cs b/SabreTools.Helper/Data/Build.cs index c268fb05..4036ab7c 100644 --- a/SabreTools.Helper/Data/Build.cs +++ b/SabreTools.Helper/Data/Build.cs @@ -175,6 +175,7 @@ Options: -b, --bare Don't include date in automatic name -c, --cascade Enable cascaded diffing -ip, --inplace Enable inplace, cascaded diff + -sf, --skip Skip output of first DAT -gn=, --game-name= Filter by game name -rn=, --rom-name= Filter by rom name -rt=, --rom-type= Filter by rom type diff --git a/SabreTools.Helper/Tools/DatTools.cs b/SabreTools.Helper/Tools/DatTools.cs index 7a0dee82..e102123b 100644 --- a/SabreTools.Helper/Tools/DatTools.cs +++ b/SabreTools.Helper/Tools/DatTools.cs @@ -1522,6 +1522,7 @@ namespace SabreTools.Helper /// True if the input files should be diffed with each other, false otherwise /// True if the diffed files should be cascade diffed, false otherwise /// True if the cascade-diffed files should overwrite their inputs, false otherwise + /// True if the first cascaded diff file should be skipped on output, false otherwise /// True if the date should not be appended to the default name, false otherwise [OBSOLETE] /// True to clean the game names to WoD standard, false otherwise (default) /// True to allow SL DATs to have game names used instead of descriptions, false otherwise (default) @@ -1540,8 +1541,8 @@ namespace SabreTools.Helper /// String representing root directory to compare against for length calculation /// Logging object for console and file output public static void Update(List inputFileNames, Dat datdata, string outputDirectory, bool merge, bool diff, bool cascade, bool inplace, - bool bare, bool clean, bool softlist, string gamename, string romname, string romtype, long sgt, long slt, long seq, string crc, string md5, - string sha1, bool? nodump, bool trim, bool single, string root, Logger logger) + bool skip, bool bare, bool clean, bool softlist, string gamename, string romname, string romtype, long sgt, long slt, long seq, string crc, + string md5, string sha1, bool? nodump, bool trim, bool single, string root, Logger logger) { // If we're in merging or diffing mode, use the full list of inputs if (merge || diff) @@ -1601,7 +1602,7 @@ namespace SabreTools.Helper // If we're in cascade and diff, output only cascaded diffs else if (diff && cascade) { - DiffCascade(outputDirectory, inplace, userData, newInputFileNames, datHeaders, logger); + DiffCascade(outputDirectory, inplace, userData, newInputFileNames, datHeaders, skip, logger); } // Output all entries with user-defined merge else @@ -2049,8 +2050,9 @@ namespace SabreTools.Helper /// Main DatData to draw information from /// List of inputs to write out from /// Dat headers used optionally + /// True if the first cascaded diff file should be skipped on output, false otherwise /// Logging object for console and file output - public static void DiffCascade(string outdir, bool inplace, Dat userData, List inputs, List datHeaders, Logger logger) + public static void DiffCascade(string outdir, bool inplace, Dat userData, List inputs, List datHeaders, bool skip, Logger logger) { string post = ""; @@ -2085,6 +2087,7 @@ namespace SabreTools.Helper start = DateTime.Now; logger.User("Populating all output DATs"); List keys = userData.Roms.Keys.ToList(); + foreach (string key in keys) { List roms = RomTools.Merge(userData.Roms[key], logger); @@ -2111,7 +2114,7 @@ namespace SabreTools.Helper // Finally, loop through and output each of the DATs start = DateTime.Now; logger.User("Outputting all created DATs"); - for (int j = 0; j < inputs.Count; j++) + for (int j = (skip ? 1 : 0); j < inputs.Count; j++) { // If we have an output directory set, replace the path string path = ""; diff --git a/SabreTools/Partials/SabreTools_Inits.cs b/SabreTools/Partials/SabreTools_Inits.cs index 6325c52a..ef5f9935 100644 --- a/SabreTools/Partials/SabreTools_Inits.cs +++ b/SabreTools/Partials/SabreTools_Inits.cs @@ -113,6 +113,7 @@ namespace SabreTools /// True if the input files should be diffed with each other, false otherwise /// True if the diffed files should be cascade diffed, false otherwise /// True if the cascade-diffed files should overwrite their inputs, false otherwise + /// True if the first cascaded diff file should be skipped on output, false otherwise /// True if the date should not be appended to the default name, false otherwise [OBSOLETE] /// /* Filtering info */ /// Name of the game to match (can use asterisk-partials) @@ -175,6 +176,7 @@ namespace SabreTools bool diff, bool cascade, bool inplace, + bool skip, bool bare, /* Filtering info */ @@ -319,31 +321,31 @@ namespace SabreTools if (outputCMP) { userInputDat.OutputFormat = OutputFormat.ClrMamePro; - DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist, + DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger); } if (outputMiss) { userInputDat.OutputFormat = OutputFormat.MissFile; - DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist, + DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger); } if (outputRC) { userInputDat.OutputFormat = OutputFormat.RomCenter; - DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist, + DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger); } if (outputSD) { userInputDat.OutputFormat = OutputFormat.SabreDat; - DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist, + DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger); } if (outputXML) { userInputDat.OutputFormat = OutputFormat.Xml; - DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist, + DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger); } if (!outputCMP && !outputMiss && !outputRC && !outputSD && !outputXML) @@ -352,7 +354,7 @@ namespace SabreTools { userInputDat.OutputFormat = OutputFormat.Xml; } - DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist, + DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger); } } diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs index 49c4c4c8..53a9c8c9 100644 --- a/SabreTools/SabreTools.cs +++ b/SabreTools/SabreTools.cs @@ -347,6 +347,10 @@ namespace SabreTools case "--superdat": superdat = true; break; + case "-sf": + case "--skip": + skip = true; + break; case "-si": case "--single": single = true; @@ -359,9 +363,6 @@ namespace SabreTools case "--stats": stats = true; break; - case "--skip": - skip = true; - break; case "-trim": trim = true; break; @@ -573,12 +574,6 @@ namespace SabreTools } } - // If skip is set, it's being called from the UI so we just exit - if (skip) - { - return; - } - // If help is set, show the help screen if (help) { @@ -647,7 +642,7 @@ namespace SabreTools { InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header, superdat, forcemerge, forcend, forcepack, outputCMP, outputMiss, outputRC, outputSD, outputXML, usegame, prefix, - postfix, quotes, repext, addext, datprefix, romba, tsv, merge, diff, cascade, inplace, bare, gamename, romname, + postfix, quotes, repext, addext, datprefix, romba, tsv, merge, diff, cascade, inplace, skip, bare, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, outdir, clean, softlist, dedup); }