diff --git a/.gitignore b/.gitignore index a90c9a98..b0c8bf4d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ /DatSplit/obj /DatSplit/obj/Debug /DatSplit/obj/Release +/DatToMiss/obj +/DatToMiss/obj/Debug +/DatToMiss/obj/Release /Deheader/obj /Deheader/obj/Debug /Deheader/obj/Release diff --git a/DatToMiss/App.config b/DatToMiss/App.config new file mode 100644 index 00000000..88fa4027 --- /dev/null +++ b/DatToMiss/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DatToMiss/DatToMiss.cs b/DatToMiss/DatToMiss.cs new file mode 100644 index 00000000..e878fad3 --- /dev/null +++ b/DatToMiss/DatToMiss.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.IO; + +using SabreTools.Helper; + +namespace SabreTools +{ + public class DatToMiss + { + private static Logger logger; + + public static void Main(string[] args) + { + Console.Clear(); + + // Credits take precidence over all + if ((new List(args)).Contains("--credits")) + { + Build.Credits(); + return; + } + + if (args.Length == 0) + { + Build.Help(); + return; + } + + logger = new Logger(false, "dattomiss.log"); + logger.Start(); + + // Output the title + Build.Start("DatToMiss"); + + string prefix = "", postfix = "", input = ""; + bool tofile = false, help = false, usegame = true; + foreach (string arg in args) + { + switch (arg) + { + case "-h": + case "-?": + case "--help": + help = true; + break; + case "-l": + case "--log": + tofile = true; + break; + case "-r": + case "--roms": + usegame = false; + break; + default: + if ((arg.StartsWith("-pre=") || arg.StartsWith("--prefix=")) && prefix == "") + { + prefix = arg.Split('=')[1]; + } + else if ((arg.StartsWith("-post=") || arg.StartsWith("--postfix=")) && postfix == "") + { + postfix = arg.Split('=')[1]; + } + else if (input == "" && File.Exists(arg.Replace("\"", ""))) + { + input = arg.Replace("\"", ""); + } + break; + } + } + + // Set the possibly new value for logger + logger.ToFile = tofile; + + // Show help if explicitly asked for it or if not enough files are supplied + if (help || input == "") + { + Build.Help(); + logger.Close(); + return; + } + + // Read in the roms from the DAT and then write them to the file + Output.WriteToText(Path.GetDirectoryName(input) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(input) + "-miss.txt", + RomManipulation.Parse(input, 0, 0, logger), logger, usegame, prefix, postfix); + } + } +} diff --git a/DatToMiss/DatToMiss.csproj b/DatToMiss/DatToMiss.csproj new file mode 100644 index 00000000..5d977d57 --- /dev/null +++ b/DatToMiss/DatToMiss.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {5AB8A989-21FC-4491-B8DB-E0C5B3983896} + Exe + Properties + DatToMiss + DatToMiss + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + ..\..\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + ..\..\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + {225a1afd-0890-44e8-b779-7502665c23a5} + SabreHelper + + + + + \ No newline at end of file diff --git a/DatToMiss/Properties/AssemblyInfo.cs b/DatToMiss/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0099f0c9 --- /dev/null +++ b/DatToMiss/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DatToMiss")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DatToMiss")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5ab8a989-21fc-4491-b8db-e0c5b3983896")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DiffDat/DiffDat.cs b/DiffDat/DiffDat.cs index 54d1f4e2..4f61c854 100644 --- a/DiffDat/DiffDat.cs +++ b/DiffDat/DiffDat.cs @@ -80,11 +80,11 @@ namespace SabreTools return; } - // Otherwise, read in the two files, diff them, and write the result to the file type that the first one is + // Otherwise, read in the files, diff them, and write the result to the file type that the first one is List A = new List(); foreach (string input in inputs) { - logger.Log("Merging in DAT: " + input); + logger.Log("Adding DAT: " + input); List B = RomManipulation.Parse(input, 0, 0, logger); A = RomManipulation.Diff(A, B); } diff --git a/README.MD b/README.MD index 2c895897..9ea9f919 100644 --- a/README.MD +++ b/README.MD @@ -79,7 +79,7 @@ A program to create a DAT based on the differences between two or more input DAT DatToMiss

-CURRENTLY UNCODED - A program to convert a DAT to a miss file either for the games or the roms with the option to add a generic preface or postface to all of the outputted lines. +A program to convert a DAT to a miss file either for the games or the roms with the option to add a generic preface and postface to all of the outputted lines. MergeDAT

diff --git a/SabreHelper/Build.cs b/SabreHelper/Build.cs index 38353c47..690df534 100644 --- a/SabreHelper/Build.cs +++ b/SabreHelper/Build.cs @@ -166,6 +166,18 @@ Options: -l, --log Enable log to file -m, --merge Enable merging in the created DAT"); break; + case "DatToMiss": + Console.WriteLine(@"DatToMiss - Generate a miss file from a DAT +----------------------------------------- +Usage: DatToMiss [options] [filename] + +Options: + -h, -?, --help Show this help dialog + -l, --log Enable log to file + -r, --roms Output roms to miss instead of sets + -pre=, --prefix= Set prefix to be printed in front of all lines + -post=, --postfix= Set postfix to be printed behind all lines"); + break; default: Console.Write("This is the default help output"); break; diff --git a/SabreTools.sln b/SabreTools.sln index 7e909153..9b700a04 100644 --- a/SabreTools.sln +++ b/SabreTools.sln @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DATFromDir", "DATFromDir\DA EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiffDat", "DiffDat\DiffDat.csproj", "{785A4E9E-0DC1-4FAD-AA3A-57B5B122CD8E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatToMiss", "DatToMiss\DatToMiss.csproj", "{5AB8A989-21FC-4491-B8DB-E0C5B3983896}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -58,6 +60,10 @@ Global {785A4E9E-0DC1-4FAD-AA3A-57B5B122CD8E}.Debug|Any CPU.Build.0 = Debug|Any CPU {785A4E9E-0DC1-4FAD-AA3A-57B5B122CD8E}.Release|Any CPU.ActiveCfg = Release|Any CPU {785A4E9E-0DC1-4FAD-AA3A-57B5B122CD8E}.Release|Any CPU.Build.0 = Release|Any CPU + {5AB8A989-21FC-4491-B8DB-E0C5B3983896}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5AB8A989-21FC-4491-B8DB-E0C5B3983896}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5AB8A989-21FC-4491-B8DB-E0C5B3983896}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5AB8A989-21FC-4491-B8DB-E0C5B3983896}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE