mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Enable AB mode
This mode outputs all necessary differences between two DATs, especially if combined with Diff mode.
This commit is contained in:
@@ -874,7 +874,7 @@ Make a selection:
|
|||||||
4) Category" + (cat != "" ? ":\t" + cat : "") + @"
|
4) Category" + (cat != "" ? ":\t" + cat : "") + @"
|
||||||
5) Version" + (version != "" ? ":\t" + version : "") + @"
|
5) Version" + (version != "" ? ":\t" + version : "") + @"
|
||||||
6) Author" + (author != "" ? ":\t" + author : "") + @"
|
6) Author" + (author != "" ? ":\t" + author : "") + @"
|
||||||
7) " + (ad ? "Only output normal diff" : "Output all diff variants") + @"
|
7) " + (ad ? "Only output normal diff" : "Output all diff variants (2 files only)") + @"
|
||||||
8) " + (dedup ? "Don't dedup files in output" : "Dedup files in output") + @"
|
8) " + (dedup ? "Don't dedup files in output" : "Dedup files in output") + @"
|
||||||
9) " + (diff ? "Only merge the input files" : "Diff the input files") + @"
|
9) " + (diff ? "Only merge the input files" : "Diff the input files") + @"
|
||||||
10) " + (bare ? "Don't append the date to the name" : "Append the date to the name") + @"
|
10) " + (bare ? "Don't append the date to the name" : "Append the date to the name") + @"
|
||||||
|
|||||||
@@ -81,29 +81,7 @@ namespace SabreTools
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<RomData> A = new List<RomData>();
|
// Get the values that will be used
|
||||||
|
|
||||||
foreach (string input in _inputs)
|
|
||||||
{
|
|
||||||
_logger.Log("Adding DAT: " + input);
|
|
||||||
List<RomData> B = RomManipulation.Parse(input, 0, 0, _logger);
|
|
||||||
if (_diff)
|
|
||||||
{
|
|
||||||
A = RomManipulation.Diff(A, B);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
A.AddRange(B);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we want a merged list, send it for merging before outputting
|
|
||||||
if (_dedup)
|
|
||||||
{
|
|
||||||
A = RomManipulation.Merge(A);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the names that will be used
|
|
||||||
if (_name == "")
|
if (_name == "")
|
||||||
{
|
{
|
||||||
_name = (_diff ? "diffdat" : "mergedat") + (_dedup ? "-merged" : "");
|
_name = (_diff ? "diffdat" : "mergedat") + (_dedup ? "-merged" : "");
|
||||||
@@ -125,6 +103,46 @@ namespace SabreTools
|
|||||||
_author = "SabreTools";
|
_author = "SabreTools";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<RomData> A = new List<RomData>();
|
||||||
|
|
||||||
|
foreach (string input in _inputs)
|
||||||
|
{
|
||||||
|
_logger.Log("Adding DAT: " + input);
|
||||||
|
List<RomData> B = RomManipulation.Parse(input, 0, 0, _logger);
|
||||||
|
if (_diff)
|
||||||
|
{
|
||||||
|
A = RomManipulation.Diff(A, B);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
A.AddRange(B);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're in Alldiff mode, we can only use the first 2 inputs
|
||||||
|
if (_ad)
|
||||||
|
{
|
||||||
|
List<RomData> AB1 = RomManipulation.Parse(_inputs[0], 0, 0, _logger);
|
||||||
|
List<RomData> AB2 = RomManipulation.Parse(_inputs[1], 0, 0, _logger);
|
||||||
|
|
||||||
|
List<RomData> OnlyA = RomManipulation.DiffOnlyInA(AB1, AB2);
|
||||||
|
List<RomData> OnlyB = RomManipulation.DiffOnlyInA(AB2, AB1);
|
||||||
|
List<RomData> BothAB = RomManipulation.DiffInAB(AB1, AB2);
|
||||||
|
|
||||||
|
string input0 = Path.GetFileNameWithoutExtension(_inputs[0]);
|
||||||
|
string input1 = Path.GetFileNameWithoutExtension(_inputs[1]);
|
||||||
|
|
||||||
|
Output.WriteToDat(_name + "-" + input0 + "-only", _desc + "-" + input0 + "-only", _version, _date, _cat, _author, _forceunpack, _old, "", OnlyA, _logger);
|
||||||
|
Output.WriteToDat(_name + "-" + input1 + "-only", _desc + "-" + input1 + "-only", _version, _date, _cat, _author, _forceunpack, _old, "", OnlyB, _logger);
|
||||||
|
Output.WriteToDat(_name + "-inboth", _desc + "-inboth", _version, _date, _cat, _author, _forceunpack, _old, "", BothAB, _logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we want a merged list, send it for merging before outputting
|
||||||
|
if (_dedup)
|
||||||
|
{
|
||||||
|
A = RomManipulation.Merge(A);
|
||||||
|
}
|
||||||
|
|
||||||
// Now write the file out
|
// Now write the file out
|
||||||
Output.WriteToDat(_name, _desc, _version, _date, _cat, _author, _forceunpack, _old, "", A, _logger);
|
Output.WriteToDat(_name, _desc, _version, _date, _cat, _author, _forceunpack, _old, "", A, _logger);
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ Options:
|
|||||||
-lso, --list-sources List all sources (id <= name)
|
-lso, --list-sources List all sources (id <= name)
|
||||||
-lsy, --list-systems List all systems (id <= name)
|
-lsy, --list-systems List all systems (id <= name)
|
||||||
-m, --merge Merge two or more DATs
|
-m, --merge Merge two or more DATs
|
||||||
-ad, --all-diff Enable output of all diff variants
|
-ad, --all-diff Enable output of all diff variants (2 DATs only)
|
||||||
-di, --diff Switch to diffdat mode
|
-di, --diff Switch to diffdat mode
|
||||||
-dd, --dedup Enable deduping in the created DAT
|
-dd, --dedup Enable deduping in the created DAT
|
||||||
-b, --bare Don't include date in file name
|
-b, --bare Don't include date in file name
|
||||||
|
|||||||
Reference in New Issue
Block a user