Add experimental DATabaseTwo and update 64-bit

DATabaseTwo is a standalone version of what will be replacing "Import" and "Generate" and thus eliminating the need for a complex import and export process. Custom DATs can be cared by Dir2DAT features and merging so there is no use to have advanced DB features. The new database, dats..sqlite, is a much lighter version, only holding the DAT information, systems, and sources.
This commit is contained in:
Matt Nadareski
2016-05-05 10:13:57 -07:00
parent 9daad48f50
commit 4e3e3f950c
21 changed files with 1174 additions and 56 deletions

3
.gitignore vendored
View File

@@ -2,6 +2,9 @@
/DATabase/obj
/DATabase/obj/Debug
/DATabase/obj/Release
/DATabaseTwo/obj
/DATabaseTwo/obj/Debug
/DATabaseTwo/obj/Release
/DATFromDir/obj
/DATFromDir/obj/Debug
/DATFromDir/obj/Release

6
DATabaseTwo/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

902
DATabaseTwo/DATabaseTwo.cs Normal file
View File

@@ -0,0 +1,902 @@
using System;
using System.Collections.Generic;
using Mono.Data.Sqlite;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using SabreTools.Helper;
namespace SabreTools
{
/// <summary>
/// This is meant to be a replacement for Import and Generate
/// that currently reside in DATabase. Import is no longer
/// going to be a function. Rather, on run, a subfolder called
/// "DATS" is going to be created in the folder the program
/// is run from. Inside, it will create a folder for every
/// System that is in the database at the time. It then audits
/// the files it finds inside of each folder. If the file
/// already exists in the database (by SHA-1 hash) then it
/// is not added. Otherwise, it is added with the System ID
/// of the folder it is in. Along the way, it also checks to
/// see what source each file belongs to for reference. If
/// the source cannot be automatically determined, then the user
/// is prompted to either pick from the list or enter a new
/// source for the DAT. New sources are added to the end
/// of the database.
///
/// Once the intial setup is done, the user can choose
/// a system to generate a merged DAT for, generate all
/// DATs, or create a merged DAT from all sources. This will
/// use the dictionary-based merging that DATabase has been
/// using for MergeDiff. The files will all be written out
/// as System (merged Date) as is customary. The files will
/// always be written out to "Output" or "Created".
///
/// The below code still has to sanitize the rom names and
/// game names according to the WoD standard as seen in
/// Import.cs.
///
/// The database will be set up as follows:
/// dats
/// id
/// sha1
/// name
/// datsdata
/// id
/// key
/// value
/// system
/// id
/// manufacturer
/// name
/// source
/// id
/// name
/// url
/// </summary>
public class DATabaseTwo
{
// Private required variables
private static string _datroot = "DATS";
private static string _outroot = "Output";
private static string _dbName = "dats.sqlite";
private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;";
private static Logger _logger;
// Regex File Name Patterns
private static string _defaultPattern = @"^(.+?) - (.+?) \((.*) (.*)\)\.dat$";
private static string _defaultSpecialPattern = @"^(.+?) - (.+?) \((.*) (.*)\)\.xml$";
private static string _goodPattern = @"^(Good.*?)_.*\.dat";
private static string _goodXmlPattern = @"^(Good.*?)_.*\.xml";
private static string _mamePattern = @"^(.*)\.xml$";
private static string _maybeIntroPattern = @"(.*?) \[T-En\].*\((\d{8})\)\.dat$";
private static string _noIntroPattern = @"^(.*?) \((\d{8}-\d{6})_CM\)\.dat$";
private static string _noIntroNumberedPattern = @"(.*? - .*?) \(\d.*?_CM\).dat";
private static string _noIntroSpecialPattern = @"(.*? - .*?) \((\d{8})\)\.dat";
private static string _nonGoodPattern = @"^(NonGood.*?)( .*?)?.xml";
private static string _nonGoodSpecialPattern = @"^(NonGood.*?)( .*)?.dat";
private static string _redumpPattern = @"^(.*?) \((\d{8} \d{2}-\d{2}-\d{2})\)\.dat$";
private static string _redumpBiosPattern = @"^(.*?) \(\d+\) \((\d{4}-\d{2}-\d{2})\)\.dat$";
private static string _tosecPattern = @"^(.*?) - .* \(TOSEC-v(\d{4}-\d{2}-\d{2})_CM\)\.dat$";
private static string _tosecSpecialPatternA = @"^(.*? - .*?) - .* \(TOSEC-v(\d{4}-\d{2}-\d{2})_CM\)\.dat$";
private static string _tosecSpecialPatternB = @"^(.*? - .*? - .*?) - .* \(TOSEC-v(\d{4}-\d{2}-\d{2})_CM\)\.dat$";
private static string _truripPattern = @"^(.*) - .* \(trurip_XML\)\.dat$";
private static string _zandroPattern = @"^SMW-.*.xml";
public static void Main(string[] args)
{
Console.Clear();
// Credits take precidence over all
if ((new List<string>(args)).Contains("--credits"))
{
Build.Credits();
return;
}
_logger = new Logger(true, "database2.log");
_logger.Start();
// Call initial setup
Setup();
// If there's no arguments, show the menu
if (args.Length == 0)
{
_logger.ToFile = true;
ShowMainMenu();
_logger.Close();
return;
}
// Set all default values
bool help = false,
genall = false,
listsys = false,
norename = false,
old = false;
string system = "";
// Determine which switches are enabled (with values if necessary)
foreach (string arg in args)
{
switch (arg)
{
case "-?":
case "-h":
case "--help":
help = true;
break;
case "-ga":
case "--generate-all":
genall = true;
break;
case "-lsy":
case "--list-systems":
listsys = true;
break;
case "-nr":
case "--no-rename":
norename = true;
break;
case "-o":
case "--old":
old = true;
break;
default:
if (arg.StartsWith("-sys=") || arg.StartsWith("--system="))
{
system = arg.Split('=')[1];
}
else
{
_logger.Warning("Invalid input detected: " + arg);
Console.WriteLine();
Build.Help();
_logger.Close();
return;
}
break;
}
}
// If help is set or system is blank, show the help screen
if (help || (system == "" && !listsys))
{
Build.Help();
_logger.Close();
return;
}
// If we want a list of systems
if (listsys)
{
ListSystems();
}
// If we want to generate all DATs
else if (genall)
{
InitGenerateAll(norename, old);
}
// If we want to generate a DAT
else
{
InitGenerate(system, norename, old);
}
_logger.Close();
}
#region Menus
/// <summary>
/// Show the text-based main menu
/// </summary>
private static void ShowMainMenu()
{
string selection = "";
while (selection.ToLowerInvariant() != "x")
{
Console.Clear();
Build.Start("DATabaseTwo");
Console.WriteLine(@"MAIN MENU
===========================
Make a selection:
1) Show command line usage
2) Generate System DATs
3) List all available systems
4) " + (_logger.ToFile ? "Disable Logging" : "Enable Logging") + @"
5) Show credits
X) Exit Program
");
Console.Write("Enter selection: ");
selection = Console.ReadLine();
switch (selection)
{
case "1":
Console.Clear();
Build.Help();
Console.Write("\nPress any key to continue...");
Console.ReadKey();
break;
case "2":
GenerateMenu();
break;
case "3":
Console.Clear();
Build.Start("DATabaseTwo");
ListSystems();
Console.Write("\nPress any key to continue...");
Console.ReadKey();
break;
case "4":
_logger.ToFile = !_logger.ToFile;
break;
case "5":
Console.Clear();
Build.Credits();
Console.Write("\nPress any key to continue...");
Console.ReadKey();
break;
}
}
}
/// <summary>
/// Show the text-based generate menu
/// </summary>
private static void GenerateMenu()
{
string selection = "", system = "";
bool norename = false, old = false;
while (selection.ToLowerInvariant() != "b")
{
Console.Clear();
Build.Start("DATabase");
Console.WriteLine(@"GENERATE MENU
===========================
Make a selection:
1) " + (norename ? "Enable game renaming" : "Disable game renaming") + @"
2) " + (old ? "Enable XML output" : "Enable ClrMamePro output") + @"
3) System ID to generate from" + (system != "" ? ": " + system : "") + @"
4) Generate the DAT file for the specified system
5) Generate all DAT files
B) Go back to the previous menu
");
Console.Write("Enter selection: ");
selection = Console.ReadLine();
switch (selection)
{
case "1":
norename = !norename;
break;
case "2":
old = !old;
break;
case "3":
Console.Clear();
ListSystems();
Console.Write("Please enter the System ID: ");
system = Console.ReadLine();
break;
case "4":
Console.Clear();
InitGenerate(system, norename, old);
Console.Write("\nPress any key to continue...");
Console.ReadKey();
system = "";
norename = false; old = false;
break;
case "5":
Console.Clear();
InitGenerateAll(norename, old);
Console.Write("\nPress any key to continue...");
Console.ReadKey();
system = "";
norename = false; old = false;
break;
}
}
return;
}
#endregion
#region Function Methods
/// <summary>
/// Wrap generating a DAT from the library
/// </summary>
/// <param name="system">System ID to be used in the DAT (blank means all)</param>
/// <param name="norename">True if files should not be renamed with system and/or source in merged mode (default false)</param>
/// <param name="old">True if the output file should be in ClrMamePro format (default false)</param>
private static void InitGenerate(string systemid, bool norename, bool old)
{
string name = "";
string path = _datroot;
// If the System ID isn't set, then we will merge everything
if (systemid != "")
{
string system = "";
// First get the name of the system, if possible
string query = "SELECT manufacturer, name FROM system WHERE id=" + systemid;
using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{
dbc.Open();
using (SqliteCommand slc = new SqliteCommand(query, dbc))
{
using (SqliteDataReader sldr = slc.ExecuteReader())
{
if (sldr.Read())
{
system = sldr.GetString(0) + " - " + sldr.GetString(1);
}
}
}
}
// If we didn't find anything, then return
if (system == "")
{
_logger.Warning("No system could be found with id " + systemid);
return;
}
path += Path.DirectorySeparatorChar + system;
name = system;
}
else
{
name = "ALL";
}
// Get the rest of the info as well
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
string description = name + " (merged " + date + ")";
name += " (merged)";
// For good measure, get all sources
Dictionary<int, string> sources = new Dictionary<int, string>();
sources.Add(0, "Default");
string squery = "SELECT id, name FROM source";
using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{
dbc.Open();
using (SqliteCommand slc = new SqliteCommand(squery, dbc))
{
using (SqliteDataReader sldr = slc.ExecuteReader())
{
while (sldr.Read())
{
sources.Add(sldr.GetInt32(0), sldr.GetString(1));
}
}
}
}
// Get a list of files to sourceid mappings
Dictionary<string, string> sourcemap = new Dictionary<string, string>();
using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{
dbc.Open();
string tquery = "SELECT DISTINCT dats.name, datsdata.value FROM dats JOIN datsdata ON dats.id=datsdata.id WHERE key='source'";
using (SqliteCommand slc = new SqliteCommand(tquery, dbc))
{
using (SqliteDataReader sldr = slc.ExecuteReader())
{
while (sldr.Read())
{
string tempname = sldr.GetString(0);
string tempval = sldr.GetString(1);
if (!sourcemap.ContainsKey(tempname))
{
sourcemap.Add(tempname, tempval);
}
}
}
}
}
// Now read in all of the files
Dictionary<string, List<RomData>> roms = new Dictionary<string, List<RomData>>();
foreach (string file in Directory.GetFiles(path, "*", SearchOption.AllDirectories))
{
int tempSrcId = 0;
if (sourcemap.ContainsKey(file))
{
Int32.TryParse(sourcemap[file], out tempSrcId);
}
roms = RomManipulation.ParseDict(file, 0, tempSrcId, roms, _logger);
}
// Now process all of the roms
_logger.Log("Cleaning rom data");
List<string> keys = roms.Keys.ToList();
foreach (string key in keys)
{
List<RomData> temp = new List<RomData>();
List<RomData> newroms = roms[key];
for (int i = 0; i < newroms.Count; i++)
{
RomData rom = newroms[i];
// WOD origninally stripped out any subdirs from the imported files, we do the same
rom.Name = Path.GetFileName(rom.Name);
// Run the name through the filters to make sure that it's correct
rom.Name = Style.NormalizeChars(rom.Name);
rom.Name = Style.RussianToLatin(rom.Name);
rom.Name = Regex.Replace(rom.Name, @"(.*) \.(.*)", "$1.$2");
// WoD gets rid of anything past the first "(" or "[" as the name, we will do the same
string stripPattern = @"(([[(].*[\)\]] )?([^([]+))";
Regex stripRegex = new Regex(stripPattern);
Match stripMatch = stripRegex.Match(rom.Game);
rom.Game = stripMatch.Groups[1].Value;
// Run the name through the filters to make sure that it's correct
rom.Game = Style.NormalizeChars(rom.Game);
rom.Game = Style.RussianToLatin(rom.Game);
rom.Game = Style.SearchPattern(rom.Game);
rom.Game = rom.Game.Trim();
if (!norename)
{
rom.Game += " [" + sources[rom.SourceID] + "]";
}
temp.Add(rom);
}
roms[key] = temp;
}
// Then write out the file
Output.WriteToDatFromDict(name, description, "", date, "SabreTools", "SabreTools", false, old, true, _outroot, roms, _logger);
}
/// <summary>
/// Wrap generating all standard DATs from the library
/// </summary>
private static void InitGenerateAll(bool norename, bool old)
{
List<string> systems = new List<string>();
using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{
dbc.Open();
string query = "SELECT id FROM system";
using (SqliteCommand slc = new SqliteCommand(query, dbc))
{
using (SqliteDataReader sldr = slc.ExecuteReader())
{
// If nothing is found, tell the user and exit
if (!sldr.HasRows)
{
_logger.Warning("No systems found! Please add a system and then try again.");
return;
}
while (sldr.Read())
{
systems.Add(sldr.GetInt32(0).ToString());
}
}
}
// Loop through the inputs
foreach (string system in systems)
{
InitGenerate(system, norename, old);
}
}
}
/// <summary>
/// List systems in the database
/// </summary>
private static void ListSystems()
{
string query = @"
SELECT DISTINCT system.id, system.manufacturer, system.name
FROM system
ORDER BY system.manufacturer, system.name";
using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{
dbc.Open();
using (SqliteCommand slc = new SqliteCommand(query, dbc))
{
using (SqliteDataReader sldr = slc.ExecuteReader())
{
// If nothing is found, tell the user and exit
if (!sldr.HasRows)
{
_logger.Warning("No systems found! Please add a system and then try again.");
return;
}
Console.WriteLine("Available Systems (id <= name):\n");
while (sldr.Read())
{
Console.WriteLine(sldr.GetInt32(0) + "\t<=\t" + sldr.GetString(1) + " - " + sldr.GetString(2));
}
}
}
}
return;
}
#endregion
#region Helper Methods
/// <summary>
/// Perform initial setup for the program
/// </summary>
private static void Setup()
{
Remapping.CreateRemappings();
Build.Start("DATabaseTwo");
_logger.Log("Beginning setup...");
// Perform initial database and folder setup
if (!Directory.Exists(_datroot))
{
Directory.CreateDirectory(_datroot);
}
if (!Directory.Exists(_outroot))
{
Directory.CreateDirectory(_outroot);
}
DBTools.EnsureDatabase(_dbName, _connectionString);
using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{
dbc.Open();
Dictionary<string, int> hashes = new Dictionary<string, int>();
string query = "SELECT sha1, id FROM dats";
using (SqliteCommand slc = new SqliteCommand(query, dbc))
{
using (SqliteDataReader sldr = slc.ExecuteReader())
{
while (sldr.Read())
{
hashes.Add(sldr.GetString(0), sldr.GetInt32(1));
}
}
}
SHA1 sha1 = SHA1.Create();
query = "SELECT * FROM system";
using (SqliteCommand slc = new SqliteCommand(query, dbc))
{
using (SqliteDataReader sldr = slc.ExecuteReader())
{
while (sldr.Read())
{
int id = sldr.GetInt32(0);
string system = _datroot + Path.DirectorySeparatorChar + sldr.GetString(1) + " - " + sldr.GetString(2);
system = system.Trim();
_logger.Log("System: " + system.Remove(0, 5));
if (!Directory.Exists(system))
{
Directory.CreateDirectory(system);
}
// Audit all DATs in the folder
foreach (string file in Directory.GetFiles(system, "*", SearchOption.AllDirectories))
{
string hash = "";
using (FileStream fs = File.Open(file, FileMode.Open))
{
hash = BitConverter.ToString(sha1.ComputeHash(fs)).Replace("-", "");
}
// If the hash isn't in add it and all required information
int hashid = -1;
if (!hashes.ContainsKey(hash))
{
_logger.Log("Adding file information for " + Path.GetFileName(file));
string squery = @"BEGIN;
INSERT INTO dats (size, sha1, name)
VALUES (" + (new FileInfo(file)).Length + ", '" + hash + "', '" + file.Replace("'", "''") + @"');
SELECT last_insert_rowid();
COMMIT;";
using (SqliteCommand sslc = new SqliteCommand(squery, dbc))
{
using (SqliteDataReader ssldr = sslc.ExecuteReader())
{
if (ssldr.Read())
{
hashid = ssldr.GetInt32(0);
}
}
}
// Add the hash to the temporary Dictionary
hashes.Add(hash, hashid);
// Now try to determine the source for the file based on the name
string source = GetSourceFromFileName(Path.GetFileName(file));
int sourceid = 0;
Dictionary<string, int> sources = new Dictionary<string, int>();
query = "SELECT name, id FROM source";
using (SqliteCommand sslc = new SqliteCommand(query, dbc))
{
using (SqliteDataReader ssldr = sslc.ExecuteReader())
{
while (ssldr.Read())
{
sources.Add(ssldr.GetString(0), ssldr.GetInt32(1));
}
}
}
// If the source is blank, ask the user to supply one
while (source == "" && sourceid == 0)
{
Console.Clear();
Build.Start("DATabaseTwo");
Console.WriteLine("Sources:");
foreach (KeyValuePair<string, int> pair in sources)
{
Console.WriteLine(" " + pair.Value + " - " + pair.Key);
}
Console.WriteLine("\nFor file name: " + Path.GetFileName(file));
Console.Write("Select a source above or enter a new one: ");
source = Console.ReadLine();
Int32.TryParse(source, out sourceid);
// If the value could be parsed, reset the source string
if (sourceid != 0)
{
source = "";
}
// If the source ID is set check to see if it's valid
if (sourceid != 0 && !sources.ContainsValue(sourceid))
{
Console.WriteLine("Invalid selection: " + sourceid);
Console.ReadLine();
sourceid = 0;
}
}
// If the source isn't in, add it and get the insert id
if (source != "" && sourceid == 0 && !sources.ContainsKey(source))
{
string tquery = @"BEGIN;
INSERT INTO source (name, url)
VALUES ('" + source + @"', '');
SELECT last_insert_rowid();
COMMIT;";
using (SqliteCommand sslc = new SqliteCommand(tquery, dbc))
{
using (SqliteDataReader ssldr = sslc.ExecuteReader())
{
if (ssldr.Read())
{
sourceid = ssldr.GetInt32(0);
}
}
}
// Add the new source to the temporary Dictionary
sources.Add(source, sourceid);
}
// Otherwise, get the ID
else if (source != "" && sourceid == 0 && sources.ContainsKey(source))
{
sourceid = sources[source];
}
// Otherwise, we should already have an ID
// Add the source link to the database
string uquery = "INSERT OR IGNORE INTO datsdata (id, key, value) VALUES (" + hashid + ", 'source', '" + sourceid + "')";
using (SqliteCommand uslc = new SqliteCommand(uquery, dbc))
{
uslc.ExecuteNonQuery();
}
}
}
}
}
}
}
_logger.Log("Setup complete!");
}
/// <summary>
/// Determine the source name from the file name, if possible
/// </summary>
/// <param name="filename">The name of the file to be checked</param>
/// <returns>The name of the source if determined, blank otherwise</returns>
private static string GetSourceFromFileName (string filename)
{
string source = "";
// Determine which dattype we have
GroupCollection fileinfo;
if (Regex.IsMatch(filename, _nonGoodPattern))
{
fileinfo = Regex.Match(filename, _nonGoodPattern).Groups;
if (!Remapping.NonGood.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as NonGood but could not be mapped.");
return source;
}
source = "NonGood";
}
else if (Regex.IsMatch(filename, _nonGoodSpecialPattern))
{
fileinfo = Regex.Match(filename, _nonGoodSpecialPattern).Groups;
if (!Remapping.NonGood.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as NonGood but could not be mapped.");
return source;
}
source = "NonGood";
}
else if (Regex.IsMatch(filename, _goodPattern))
{
fileinfo = Regex.Match(filename, _goodPattern).Groups;
if (!Remapping.Good.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as Good but could not be mapped.");
return source;
}
source = "Good";
}
else if (Regex.IsMatch(filename, _goodXmlPattern))
{
fileinfo = Regex.Match(filename, _goodXmlPattern).Groups;
}
else if (Regex.IsMatch(filename, _maybeIntroPattern))
{
fileinfo = Regex.Match(filename, _maybeIntroPattern).Groups;
if (!Remapping.MaybeIntro.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as Maybe-Intro but could not be mapped.");
return source;
}
source = "Maybe-Intro";
}
else if (Regex.IsMatch(filename, _noIntroPattern))
{
fileinfo = Regex.Match(filename, _noIntroPattern).Groups;
if (!Remapping.NoIntro.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as No-Intro but could not be mapped.");
return source;
}
source = "no-Intro";
}
// For numbered DATs only
else if (Regex.IsMatch(filename, _noIntroNumberedPattern))
{
fileinfo = Regex.Match(filename, _noIntroNumberedPattern).Groups;
if (!Remapping.NoIntro.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as No-Intro but could not be mapped.");
return source;
}
source = "no-Intro";
}
// For N-Gage and Gizmondo only
else if (Regex.IsMatch(filename, _noIntroSpecialPattern))
{
fileinfo = Regex.Match(filename, _noIntroSpecialPattern).Groups;
if (!Remapping.NoIntro.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as No-Intro but could not be mapped.");
return source;
}
source = "no-Intro";
}
else if (Regex.IsMatch(filename, _redumpPattern))
{
fileinfo = Regex.Match(filename, _redumpPattern).Groups;
if (!Remapping.Redump.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as Redump but could not be mapped.");
return source;
}
source = "Redump";
}
// For special BIOSes only
else if (Regex.IsMatch(filename, _redumpBiosPattern))
{
fileinfo = Regex.Match(filename, _redumpBiosPattern).Groups;
if (!Remapping.Redump.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as Redump but could not be mapped.");
return source;
}
source = "Redump";
}
else if (Regex.IsMatch(filename, _tosecPattern))
{
fileinfo = Regex.Match(filename, _tosecPattern).Groups;
if (!Remapping.TOSEC.ContainsKey(fileinfo[1].Value))
{
// Handle special case mappings found only in TOSEC
fileinfo = Regex.Match(filename, _tosecSpecialPatternA).Groups;
if (!Remapping.TOSEC.ContainsKey(fileinfo[1].Value))
{
fileinfo = Regex.Match(filename, _tosecSpecialPatternB).Groups;
if (!Remapping.TOSEC.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as TOSEC but could not be mapped.");
return source;
}
}
}
source = "TOSEC";
}
else if (Regex.IsMatch(filename, _truripPattern))
{
fileinfo = Regex.Match(filename, _truripPattern).Groups;
if (!Remapping.TruRip.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as TruRip but could not be mapped.");
return source;
}
source = "trurip";
}
else if (Regex.IsMatch(filename, _zandroPattern))
{
source = "Zandro";
}
else if (Regex.IsMatch(filename, _defaultPattern))
{
fileinfo = Regex.Match(filename, _defaultPattern).Groups;
source = fileinfo[3].Value;
}
else if (Regex.IsMatch(filename, _defaultSpecialPattern))
{
fileinfo = Regex.Match(filename, _defaultSpecialPattern).Groups;
source = fileinfo[3].Value;
}
else if (Regex.IsMatch(filename, _mamePattern))
{
fileinfo = Regex.Match(filename, _mamePattern).Groups;
if (!Remapping.MAME.ContainsKey(fileinfo[1].Value))
{
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as MAME but could not be mapped.");
return source;
}
source = "MAME";
}
return source;
}
#endregion
}
}

View File

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DATabaseTwo</RootNamespace>
<AssemblyName>DATabaseTwo</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Debug-x64\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\..\Release-x64\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\lib\net4\Mono.Data.Sqlite.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Portable, Version=4.0.0.0, Culture=neutral, PublicKeyToken=59e704a76bc4613a, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\lib\net4\System.Data.Portable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Transactions.Portable, Version=4.0.0.0, Culture=neutral, PublicKeyToken=59e704a76bc4613a, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\lib\net4\System.Transactions.Portable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DATabaseTwo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SabreHelper\SabreHelper.csproj">
<Project>{225a1afd-0890-44e8-b779-7502665c23a5}</Project>
<Name>SabreHelper</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\tools\Mono.Data.Sqlite.Portable.targets" Condition="Exists('..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\tools\Mono.Data.Sqlite.Portable.targets')" />
<Target Name="EnsureMonoDataSqlitePortableImported" BeforeTargets="BeforeBuild" Condition="'$(MonoDataSqlitePortableImported)' == ''">
<Error Condition="!Exists('..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\tools\Mono.Data.Sqlite.Portable.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them." />
<Error Condition="Exists('..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\tools\Mono.Data.Sqlite.Portable.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build." />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -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("DATabaseTwo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DATabaseTwo")]
[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("c7732a05-1f96-43ed-ac8c-0e388f37ebc1")]
// 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")]

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Mono.Data.Sqlite.Portable" version="1.0.3.5" targetFramework="net452" />
</packages>

View File

@@ -145,8 +145,6 @@ namespace SabreTools
return false;
}
Console.WriteLine(_currentAllMerged + " " + _currentMissingMerged + " " + _currentNewMerged);
// If we have all three DATs, then generate everything
if (_currentAllMerged != "" && _currentMissingMerged != "" && _currentNewMerged != "")
{

View File

@@ -192,6 +192,19 @@ This program will output the following DATs:
(d) Have - (NewComplete)-(New Missing)
OR (Complete or NewComplete)-(Missing) if one is missing");
break;
case "DATabaseTwo":
Console.WriteLine(@"DATabaseTwo - Catalog and merge DATs by system
-----------------------------------------
Usage: DATabaseTwo [options]
Options:
-h, -?, --help Show this help dialog
-ga, --generate-all Start tool in generate all mode
-lsy, --list-systems List all systems (id <= name)
-o, --old Output DAT in CMP format instead of XML
-sys=, --system= System ID to generate from
");
break;
default:
Console.Write("This is the default help output");
break;
@@ -207,7 +220,7 @@ Credits
Programmer / Lead: Matt Nadareski (darksabre76)
Additional code: emuLOAD, @tractivo
Testing: emuLOAD, @tractivo, Kludge, Obiwantje
Suggestions: edc, AcidX
Suggestions: edc, AcidX
Based on work by: The Wizard of DATz");
}
}

View File

@@ -161,6 +161,46 @@ CREATE TABLE IF NOT EXISTS gamesource (
'game' TEXT NOT NULL,
'sourceid' INTEGER NOT NULL,
PRIMARY KEY (game, sourceid)
)";
slc = new SqliteCommand(query, dbc);
slc.ExecuteNonQuery();
}
else if (type == "dats")
{
string query = @"
CREATE TABLE IF NOT EXISTS dats (
'id' INTEGER PRIMARY KEY NOT NULL,
'size' INTEGER NOT NULL DEFAULT -1,
'sha1' TEXT NOT NULL,
'name' TEXT NOT NULL
)";
SqliteCommand slc = new SqliteCommand(query, dbc);
slc.ExecuteNonQuery();
query = @"
CREATE TABLE IF NOT EXISTS datsdata (
'id' INTEGER NOT NULL,
'key' TEXT NOT NULL,
'value' TEXT,
PRIMARY KEY (id, key, value)
)";
slc = new SqliteCommand(query, dbc);
slc.ExecuteNonQuery();
query = @"
CREATE TABLE IF NOT EXISTS source (
'id' INTEGER PRIMARY KEY NOT NULL,
'name' TEXT NOT NULL UNIQUE,
'url' TEXT NOT NULL
)";
slc = new SqliteCommand(query, dbc);
slc.ExecuteNonQuery();
query = @"
CREATE TABLE IF NOT EXISTS system (
'id' INTEGER PRIMARY KEY NOT NULL,
'manufacturer' TEXT NOT NULL,
'name' TEXT NOT NULL
)";
slc = new SqliteCommand(query, dbc);
slc.ExecuteNonQuery();

View File

@@ -144,14 +144,14 @@
<mapping from="g7400" to="Philips - Videopac+, Odyssey2" />
<mapping from="galaxy" to="Galaksija - Galaksija, Galaksija Plus" />
<mapping from="gamate" to="Bit Corp - Gamate" />
<mapping from="gameboy" to="Nintendo - Game Boy" />
<mapping from="gameboy" to="Nintendo - Game Boy, Game Boy Color" />
<mapping from="gamecom" to="Tiger Electronics - Game.com" />
<mapping from="gamegear" to="Sega - Game Gear" />
<mapping from="gameking" to="TimeTop - GameKing" />
<mapping from="gameking3" to="TimeTop - GameKing" />
<mapping from="gamepock" to="Epoch - Game Pocket Computer" />
<mapping from="gba" to="Nintendo - Game Boy Advance" />
<mapping from="gbcolor" to="Nintendo - Game Boy Color" />
<mapping from="gbcolor" to="Nintendo - Game Boy, Game Boy Color" />
<mapping from="genius" to="VTech - Genius" />
<mapping from="gimix" to="Gimix - 6809" />
<mapping from="gjmovie" to="VTech - Genius" />
@@ -244,7 +244,7 @@
<mapping from="n64dd" to="Nintendo - Nintendo 64DD" />
<mapping from="nascom_flop" to="Nascom - I, II" />
<mapping from="nascom_socket" to="Nascom - I, II" />
<mapping from="neocd" to="SNK - Neo Geo CD" />
<mapping from="neocd" to="SNK - Neo Geo" />
<mapping from="neogeo" to="SNK - Neo Geo" />
<mapping from="nes" to="Nintendo - Nintendo Entertainment System" />
<mapping from="nes_ade" to="Nintendo - Nintendo Entertainment System" />
@@ -252,8 +252,8 @@
<mapping from="nes_kstudio" to="Nintendo - Nintendo Entertainment System" />
<mapping from="nes_ntbrom" to="Nintendo - Nintendo Entertainment System" />
<mapping from="next" to="NeXT - NeXT" />
<mapping from="ngp" to="SNK - Neo Geo Pocket" />
<mapping from="ngpc" to="SNK - Neo Geo Pocket Color" />
<mapping from="ngp" to="SNK - Neo Geo Pocket, Neo Geo Pocket Color" />
<mapping from="ngpc" to="SNK - Neo Geo Pocket, Neo Geo Pocket Color" />
<mapping from="nimbus" to="RM - Nimbus PC" />
<mapping from="odyssey2" to="Philips - Videopac+, Odyssey2" />
<mapping from="ondra" to="Tesla - Ondra, Ondra ViLi" />
@@ -278,7 +278,7 @@
<mapping from="pc88va" to="NEC - PC-88VA" />
<mapping from="pc98" to="NEC - PC-9801" />
<mapping from="pce" to="NEC - PC Engine, TurboGrafx 16" />
<mapping from="pcecd" to="NEC - PC Engine CD, TurboGrafx 16 CD" />
<mapping from="pcecd" to="NEC - PC Engine, TurboGrafx 16" />
<mapping from="pcw" to="Amstrad - PCW" />
<mapping from="pcw16" to="Amstrad - PCW" />
<mapping from="pecom_cass" to="Elektronska Industrija Nis - PECOM 32, 64" />
@@ -414,8 +414,8 @@
<mapping from="wangpc" to="Wang - PC" />
<mapping from="wicat" to="Millennium Systems - Wicat" />
<mapping from="wmbullet" to="WaveMate - Bullet" />
<mapping from="wscolor" to="Bandai - WonderSwan Color" />
<mapping from="wswan" to="Bandai - WonderSwan" />
<mapping from="wscolor" to="Bandai - WonderSwan, WonderSwan Color" />
<mapping from="wswan" to="Bandai - WonderSwan, WonderSwan Color" />
<mapping from="x07_card" to="Canon - X-07" />
<mapping from="x07_cass" to="Canon - X-07" />
<mapping from="x1_cass" to="Sharp - X1" />

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<mappings>
<mapping from="Bandai WonderSwan Color" to="Bandai - WonderSwan Color" />
<mapping from="Bandai WonderSwan Color" to="Bandai - WonderSwan, WonderSwan Color" />
<mapping from="Fujitsu FM Towns" to="Fujitsu - FM Towns" />
<mapping from="MSX (Cartridges)" to="Microsoft - MSX, MSX 2" />
<mapping from="MSX (Disks)" to="Microsoft - MSX, MSX 2" />
<mapping from="MSX 2 (Cartridges)" to="Microsoft - MSX, MSX 2" />
<mapping from="MSX 2 (Disks)" to="Microsoft - MSX, MSX 2" />
<mapping from="MSX Turbo-R (Disks)" to="Microsoft - MSX, MSX 2" />
<mapping from="NEC PC Engine CD" to="NEC - PC Engine CD, TurboGrafx 16 CD" />
<mapping from="NEC PC Engine CD" to="NEC - PC Engine, TurboGrafx 16" />
<mapping from="NEC PC Engine" to="NEC - PC Engine, TurboGrafx 16" />
<mapping from="NEC PC-6001" to="NEC - PC-6001" />
<mapping from="NEC PC-8801" to="NEC - PC-8801" />
@@ -18,8 +18,8 @@
<mapping from="Nintendo Famicom Disk System" to="Nintendo - Famicom Disk System" />
<mapping from="Nintendo Famicom" to="Nintendo - Nintendo Entertainment System" />
<mapping from="Nintendo Game Boy Advance" to="Nintendo - Game Boy Advance" />
<mapping from="Nintendo Game Boy Color" to="Nintendo - Game Boy Color" />
<mapping from="Nintendo Game Boy" to="Nintendo - Game Boy" />
<mapping from="Nintendo Game Boy Color" to="Nintendo - Game Boy, Game Boy Color" />
<mapping from="Nintendo Game Boy" to="Nintendo - Game Boy, Game Boy Color" />
<mapping from="Nintendo Super Famicom" to="Nintendo - Super Nintendo Entertainment System" />
<mapping from="Nintendo Virtual Boy" to="Nintendo - Virtual Boy" />
<mapping from="Sega Dreamcast" to="Sega - Dreamcast" />
@@ -30,7 +30,7 @@
<mapping from="Sega Saturn" to="Sega - Saturn" />
<mapping from="Sega SG-1000" to="Sega - SG-1000, SC-3000, SF-7000, Othello Multivision" />
<mapping from="Sharp X68000" to="Sharp - X68000" />
<mapping from="SNK Neo Geo Pocket Color" to="SNK - Neo Geo Pocket Color" />
<mapping from="SNK Neo Geo Pocket Color" to="SNK - Neo Geo Pocket, Neo Geo Pocket Color" />
<mapping from="Sony PlayStation 2" to="Sony - PlayStation 2" />
<mapping from="Sony PlayStation" to="Sony - PlayStation" />
</mappings>

View File

@@ -6,8 +6,8 @@
<mapping from="Atari - Jaguar" to="Atari - Jaguar" />
<mapping from="Atari - Lynx" to="Atari - Lynx" />
<mapping from="Atari - ST" to="Atari - ST" />
<mapping from="Bandai - WonderSwan" to="Bandai - WonderSwan" />
<mapping from="Bandai - WonderSwan Color" to="Bandai - WonderSwan Color" />
<mapping from="Bandai - WonderSwan" to="Bandai - WonderSwan, WonderSwan Color" />
<mapping from="Bandai - WonderSwan Color" to="Bandai - WonderSwan, WonderSwan Color" />
<mapping from="Casio - Loopy" to="Casio - Loopy" />
<mapping from="Casio - PV-1000" to="Casio - PV-1000" />
<mapping from="Coleco - ColecoVision" to="Coleco - ColecoVision, ColecoVision ADAM" />
@@ -35,14 +35,14 @@
<mapping from="NEC - PC Engine - TurboGrafx 16" to="NEC - PC Engine, TurboGrafx 16" />
<mapping from="NEC - Super Grafx" to="NEC - Super Grafx" />
<mapping from="Nintendo - Famicom Disk System" to="Nintendo - Famicom Disk System" />
<mapping from="Nintendo - Game Boy" to="Nintendo - Game Boy" />
<mapping from="Nintendo - Game Boy" to="Nintendo - Game Boy, Game Boy Color" />
<mapping from="Nintendo - Game Boy Advance" to="Nintendo - Game Boy Advance" />
<mapping from="Nintendo - Game Boy Advance (e-Cards)" to="Nintendo - Game Boy Advance" />
<mapping from="Nintendo - Game Boy Color" to="Nintendo - Game Boy Color" />
<mapping from="Nintendo - New Nintendo 3DS" to="Nintendo - Nintendo 3DS" />
<mapping from="Nintendo - New Nintendo 3DS (DLC)" to="Nintendo - Nintendo 3DS" />
<mapping from="Nintendo - Nintendo 3DS" to="Nintendo - Nintendo 3DS" />
<mapping from="Nintendo - Nintendo 3DS (DLC)" to="Nintendo - Nintendo 3DS" />
<mapping from="Nintendo - Game Boy Color" to="Nintendo - Game Boy, Game Boy Color" />
<mapping from="Nintendo - New Nintendo 3DS" to="Nintendo - Nintendo 3DS, New Nintendo 3DS" />
<mapping from="Nintendo - New Nintendo 3DS (DLC)" to="Nintendo - Nintendo 3DS, New Nintendo 3DS" />
<mapping from="Nintendo - Nintendo 3DS" to="Nintendo - Nintendo 3DS, New Nintendo 3DS" />
<mapping from="Nintendo - Nintendo 3DS (DLC)" to="Nintendo - Nintendo 3DS, New Nintendo 3DS" />
<mapping from="Nintendo - Nintendo 64" to="Nintendo - Nintendo 64" />
<mapping from="Nintendo - Nintendo 64DD" to="Nintendo - Nintendo 64DD" />
<mapping from="Nintendo - Nintendo DS" to="Nintendo - Nintendo DS" />
@@ -79,8 +79,8 @@
<mapping from="Sony - PlayStation Portable (PSX2PSP)" to="Sony - PlayStation Portable" />
<mapping from="Sony - PlayStation Portable (UMD Music)" to="Sony - PlayStation Portable" />
<mapping from="Sony - PlayStation Portable (UMD Video)" to="Sony - PlayStation Portable" />
<mapping from="SNK - Neo Geo Pocket" to="SNK - Neo Geo Pocket" />
<mapping from="SNK - Neo Geo Pocket Color" to="SNK - Neo Geo Pocket Color" />
<mapping from="SNK - Neo Geo Pocket" to="SNK - Neo Geo Pocket, Neo Geo Pocket Color" />
<mapping from="SNK - Neo Geo Pocket Color" to="SNK - Neo Geo Pocket, Neo Geo Pocket Color" />
<mapping from="Tiger - Game.com" to="Tiger Electronics - Game.com" />
<mapping from="Tiger - Gizmondo" to="Tiger Telematics - Gizmondo" />
<mapping from="VTech - CreatiVision" to="VTech - CreatiVision" />

View File

@@ -8,9 +8,9 @@
<mapping from="NonGoodCol" to="Coleco - ColecoVision, ColecoVision ADAM" />
<mapping from="NonGoodCPC" to="Amstrad - CPC" />
<mapping from="NonGoodGBAv4" to="Nintendo - Game Boy Advance" />
<!-- <mapping from="NonGoodGBX" to="Nintendo - Game Boy Color" /> -->
<mapping from="NonGoodGBX.GB" to="Nintendo - Game Boy" />
<mapping from="NonGoodGBX.GBC" to="Nintendo - Game Boy Color" />
<mapping from="NonGoodGBX" to="Nintendo - Game Boy, Game Boy Color" />
<mapping from="NonGoodGBX.GB" to="Nintendo - Game Boy, Game Boy Color" />
<mapping from="NonGoodGBX.GBC" to="Nintendo - Game Boy, Game Boy Color" />
<mapping from="NonGoodGCom" to="Tiger Electronics - Game.com" />
<mapping from="NonGoodGen" to="Sega - Mega Drive, Genesis" />
<mapping from="NonGoodGG" to="Sega - Game Gear" />
@@ -25,9 +25,9 @@
<mapping from="NonGoodNDS" to="Nintendo - Nintendo DS" />
<mapping from="NonGoodNES" to="Nintendo - Nintendo Entertainment System" />
<mapping from="NonGoodNES CHINESE" to="Nintendo - Nintendo Entertainment System" />
<!-- <mapping from="NonGoodNGPX" to="SNK - Neo Geo Pocket Color" /> -->
<mapping from="NonGoodNGPX.NGP" to="SNK - Neo Geo Pocket" />
<mapping from="NonGoodNGPX.NGC" to="SNK - Neo Geo Pocket Color" />
<mapping from="NonGoodNGPX" to="SNK - Neo Geo Pocket, Neo Geo Pocket Color" />
<mapping from="NonGoodNGPX.NGP" to="SNK - Neo Geo Pocket, Neo Geo Pocket Color" />
<mapping from="NonGoodNGPX.NGC" to="SNK - Neo Geo Pocket, Neo Geo Pocket Color" />
<mapping from="NonGoodOric" to="Tangerine - Oric-1, Oric Atmos" />
<mapping from="NonGoodPCE" to="NEC - PC Engine, TurboGrafx 16" />
<mapping from="NonGoodPico" to="Sega - PICO" />
@@ -37,7 +37,7 @@
<mapping from="NonGoodVboy" to="Nintendo - Virtual Boy" />
<mapping from="NonGoodVect" to="GCE - Vectrex" />
<mapping from="NonGoodVPac" to="Philips - Videopac+, Odyssey2" />
<!-- <mapping from="NonGoodWSX" to="Bandai - WonderSwan Color" /> -->
<mapping from="NonGoodWSX.WS" to="Bandai - WonderSwan" />
<mapping from="NonGoodWSX.WSC" to="Bandai - WonderSwan Color" />
<mapping from="NonGoodWSX" to="Bandai - WonderSwan, WonderSwan Color" />
<mapping from="NonGoodWSX.WS" to="Bandai - WonderSwan, WonderSwan Color" />
<mapping from="NonGoodWSX.WSC" to="Bandai - WonderSwan, WonderSwan Color" />
</mappings>

View File

@@ -18,7 +18,7 @@
<mapping from="Microsoft - Xbox" to="Microsoft - Xbox" />
<mapping from="Microsoft - Xbox 360" to="Microsoft - Xbox 360" />
<mapping from="Microsoft - Xbox One" to="Microsoft - Xbox One" />
<mapping from="NEC - PC Engine CD - TurboGrafx-CD" to="NEC - PC Engine CD, TurboGrafx 16 CD" />
<mapping from="NEC - PC Engine CD - TurboGrafx-CD" to="NEC - PC Engine, TurboGrafx 16" />
<mapping from="NEC - PC-88 series" to="NEC - PC-8801" />
<mapping from="NEC - PC-98 series" to="NEC - PC-9801" />
<mapping from="NEC - PC-FX - PC-FXGA" to="NEC - PC FX, PC FXGA" />

View File

@@ -26,7 +26,7 @@
<mapping from="Atari 5200" to="Atari - 5200" />
<mapping from="Atari 7800" to="Atari - 7800" />
<mapping from="Atari 8bit" to="Atari - 8bit" />
<mapping from="Atari Jaguar CD" to="Atari - Jaguar CD" />
<mapping from="Atari Jaguar CD" to="Atari - Jaguar" />
<mapping from="Atari Jaguar" to="Atari - Jaguar" />
<mapping from="Atari Lynx" to="Atari - Lynx" />
<mapping from="Atari ST" to="Atari - ST" />
@@ -35,8 +35,8 @@
<mapping from="Bandai Pippin @World &amp; Pippin Atmark" to="Bandai - Pippin" />
<mapping from="Bandai Pippin Atmark" to="Bandai - Pippin" />
<mapping from="Bandai Playdia" to="Bandai - Playdia" />
<mapping from="Bandai WonderSwan Color" to="Bandai - WonderSwan Color" />
<mapping from="Bandai WonderSwan" to="Bandai - WonderSwan" />
<mapping from="Bandai WonderSwan Color" to="Bandai - WonderSwan, WonderSwan Color" />
<mapping from="Bandai WonderSwan" to="Bandai - WonderSwan, WonderSwan Color" />
<mapping from="Bondwell 12" to="Bondwell - 12" />
<mapping from="Bondwell 2" to="Bondwell - 2" />
<mapping from="Bondwell Model 2" to="Bondwell - 2" />
@@ -158,7 +158,7 @@
<mapping from="NEC PC-9801" to="NEC - PC-9801" />
<mapping from="NEC PC-9821" to="NEC - PC-9801" />
<mapping from="NEC PC-Engine &amp; TurboGrafx-16" to="NEC - PC Engine, TurboGrafx 16" />
<mapping from="NEC PC-Engine CD &amp; TurboGrafx-16 CD" to="NEC - PC Engine CD, TurboGrafx 16 CD" />
<mapping from="NEC PC-Engine CD &amp; TurboGrafx-16 CD" to="NEC - PC Engine, TurboGrafx 16" />
<mapping from="NEC PC-FX" to="NEC - PC FX, PC FXGA" />
<mapping from="NEC PC-FXGA" to="NEC - PC FX, PC FXGA" />
<mapping from="NEC PC6001" to="NEC - PC-6001" />
@@ -169,8 +169,8 @@
<mapping from="Nintendo Famicom &amp; Entertainment System" to="Nintendo - Nintendo Entertainment System" />
<mapping from="Nintendo Famicom Disk System" to="Nintendo - Famicom Disk System" />
<mapping from="Nintendo Game Boy Advance" to="Nintendo - Game Boy Advance" />
<mapping from="Nintendo Game Boy Color" to="Nintendo - Game Boy Color" />
<mapping from="Nintendo Game Boy" to="Nintendo - Game Boy" />
<mapping from="Nintendo Game Boy Color" to="Nintendo - Game Boy, Game Boy Color" />
<mapping from="Nintendo Game Boy" to="Nintendo - Game Boy, Game Boy Color" />
<mapping from="Nintendo GameCube" to="Nintendo - GameCube" />
<mapping from="Nintendo N64" to="Nintendo - Nintendo 64" />
<mapping from="Nintendo Pokemon Mini" to="Nintendo - Pokemon Mini" />
@@ -212,9 +212,9 @@
<mapping from="Robotron Z9001" to="Robotron - KC85" />
<mapping from="SABA Videoplay" to="Fairchild - Channel F" />
<mapping from="SNK Hyper Neo-Geo 64" to="SNK - Hyper Neo Geo 64" />
<mapping from="SNK Neo-Geo CD" to="SNK - Neo Geo CD" />
<mapping from="SNK Neo-Geo Pocket Color" to="SNK - Neo Geo Pocket Color" />
<mapping from="SNK Neo-Geo Pocket" to="SNK - Neo Geo Pocket" />
<mapping from="SNK Neo-Geo CD" to="SNK - Neo Geo" />
<mapping from="SNK Neo-Geo Pocket Color" to="SNK - Neo Geo Pocket, Neo Geo Pocket Color" />
<mapping from="SNK Neo-Geo Pocket" to="SNK - Neo Geo Pocket, Neo Geo Pocket Color" />
<mapping from="Sega 32X" to="Sega - 32X" />
<mapping from="Sega Computer 3000" to="Sega - SG-1000, SC-3000, SF-7000, Othello Multivision" />
<mapping from="Sega Dreamcast" to="Sega - Dreamcast" />

View File

@@ -10,12 +10,12 @@
<mapping from="Apple Macintosh CD" to="Apple - Macintosh" />
<mapping from="Atari 5200" to="Atari - 5200" />
<mapping from="Atari 7800" to="Atari - 7800" />
<mapping from="Atari Jaguar CD" to="Atari - Jaguar CD" />
<mapping from="Atari Jaguar CD" to="Atari - Jaguar" />
<mapping from="Atari Lynx" to="Atari - Lynx" />
<mapping from="Bandai Pippin @World &amp; Atmark" to="Bandai - Pippin" />
<mapping from="Bandai Playdia" to="Bandai - Playdia" />
<mapping from="Bandai WonderSwan Color (SwanCrystal)" to="Bandai - WonderSwan Color" />
<mapping from="Bandai WonderSwan" to="Bandai - WonderSwan" />
<mapping from="Bandai WonderSwan Color (SwanCrystal)" to="Bandai - WonderSwan, WonderSwan Color" />
<mapping from="Bandai WonderSwan" to="Bandai - WonderSwan, WonderSwan Color" />
<mapping from="Capcom CP SYSTEM III" to="Capcom - CPS III" />
<mapping from="Capcom CP SYSTEM III (CPS3)" to="Capcom - CPS III" />
<mapping from="Commodore Amiga CD" to="Commodore - Amiga" />
@@ -37,7 +37,7 @@
<mapping from="Namco - Sega - Nintendo Triforce" to="Namco - Triforce" />
<mapping from="Namco System 2x6" to="Namco - System 246, System 256" />
<mapping from="NCR Decision Mate V" to="NCR - Decision Mate V" />
<mapping from="NEC PC Engine CD &amp; TurboGrafx CD" to="NEC - PC Engine CD, TurboGrafx 16 CD" />
<mapping from="NEC PC Engine CD &amp; TurboGrafx CD" to="NEC - PC Engine, TurboGrafx 16" />
<mapping from="NEC PC-FX" to="NEC - PC FX, PC FXGA" />
<mapping from="NEC PC-FXGA" to="NEC - PC FX, PC FXGA" />
<mapping from="Panasonic 3DO Interactive Multiplayer" to="Panasonic - 3DO Interactive Multiplayer" />
@@ -47,13 +47,13 @@
<mapping from="Sega Dreamcast" to="Sega - Dreamcast" />
<mapping from="Sega Lindbergh" to="Sega - Lindbergh" />
<mapping from="Sega Mega-CD &amp; Sega CD" to="Sega - Mega-CD, Sega CD" />
<mapping from="Sega Mega-CD &amp; Sega CD - Games" to="Sega - 32X CD" />
<mapping from="Sega Mega-CD &amp; Sega CD - Games" to="Sega - Mega-CD, Sega CD" />
<mapping from="Sega NAOMI 2" to="Sega - Naomi, Naomi 2, Atomiswave" />
<mapping from="Sega NAOMI" to="Sega - Naomi, Naomi 2, Atomiswave" />
<mapping from="Sega RingWide" to="Sega - RingWide" />
<mapping from="Sega Saturn" to="Sega - Saturn" />
<mapping from="Sharp X1" to="Sharp - X1" />
<mapping from="SNK Neo-Geo CD" to="SNK - Neo Geo CD" />
<mapping from="SNK Neo-Geo CD" to="SNK - Neo Geo" />
<mapping from="Sony PlayStation &amp; PSone" to="Sony - PlayStation" />
<mapping from="Sord CGL M 5 (M 5, Game M 5)" to="Sord - M5" />
<mapping from="Spectravideo SV-318 &amp; SV-328" to="Spectravideo - SVI-318, SVI-328" />

View File

@@ -107,6 +107,9 @@
<None Include="DATabase.sqlite">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="dats.sqlite">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="LICENSE">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

BIN
SabreHelper/dats.sqlite Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OfflineMerge", "OfflineMerg
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UncompressedSize", "UncompressedSize\UncompressedSize.csproj", "{E21ABB36-C6D9-4FD6-802E-EC0D05284E0A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DATabaseTwo", "DATabaseTwo\DATabaseTwo.csproj", "{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -82,6 +84,14 @@ Global
{E21ABB36-C6D9-4FD6-802E-EC0D05284E0A}.Release|Any CPU.Build.0 = Release|Any CPU
{E21ABB36-C6D9-4FD6-802E-EC0D05284E0A}.Release|x64.ActiveCfg = Release|x64
{E21ABB36-C6D9-4FD6-802E-EC0D05284E0A}.Release|x64.Build.0 = Release|x64
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Debug|x64.ActiveCfg = Debug|x64
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Debug|x64.Build.0 = Debug|x64
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Release|Any CPU.Build.0 = Release|Any CPU
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Release|x64.ActiveCfg = Release|x64
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SabreTools.Helper;
@@ -13,6 +9,8 @@ namespace SabreTools
{
public static void Main(string[] args)
{
Build.Start("UncompressedSize");
List<string> inputs = new List<string>();
foreach (string arg in args)