[SabreTools, DatFile] Add 1G1R skeleton (nw)

This commit is contained in:
Matt Nadareski
2017-02-27 21:53:20 -08:00
parent 08572a26af
commit 5737fd5175
4 changed files with 68 additions and 26 deletions

View File

@@ -31,6 +31,8 @@ namespace SabreTools.Helper.Dats
private bool _excludeOf; private bool _excludeOf;
private bool _mergeRoms; private bool _mergeRoms;
private Hash _stripHash; private Hash _stripHash;
private bool _oneGameOneRegion;
private List<string> _regions = new List<string>();
private SortedDictionary<string, List<DatItem>> _files = new SortedDictionary<string, List<DatItem>>(); private SortedDictionary<string, List<DatItem>> _files = new SortedDictionary<string, List<DatItem>>();
private SortedBy _sortedBy; private SortedBy _sortedBy;
@@ -168,6 +170,16 @@ namespace SabreTools.Helper.Dats
get { return _stripHash; } get { return _stripHash; }
set { _stripHash = value; } set { _stripHash = value; }
} }
public bool OneGameOneRegion
{
get { return _oneGameOneRegion; }
set { _oneGameOneRegion = value; }
}
public List<string> Regions
{
get { return _regions; }
set { _regions = value; }
}
public SortedBy SortedBy public SortedBy SortedBy
{ {
get { return _sortedBy; } get { return _sortedBy; }

View File

@@ -8,6 +8,7 @@ namespace SabreTools
{ {
public partial class SabreTools public partial class SabreTools
{ {
// TODO: Add 1G1R to the flags for update
public static Help RetrieveHelp() public static Help RetrieveHelp()
{ {
// Create and add the header to the Help object // Create and add the header to the Help object

View File

@@ -459,6 +459,8 @@ namespace SabreTools
/// <param name="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param> /// <param name="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param>
/// /* Filtering info */ /// /* Filtering info */
/// <param name="filter">Pre-populated filter object for DAT filtering</param> /// <param name="filter">Pre-populated filter object for DAT filtering</param>
/// <param name="oneGameOneRegion">True if the outputs should be created in 1G1R mode, false otherwise</param>
/// <param name="regions">List of regions in the order they should be used, blank for default</param>
/// /* Trimming info */ /// /* Trimming info */
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param> /// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param> /// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
@@ -514,6 +516,8 @@ namespace SabreTools
/* Filtering info */ /* Filtering info */
Filter filter, Filter filter,
bool oneGameOneRegion,
List<string> regions,
/* Trimming info */ /* Trimming info */
SplitType splitType, SplitType splitType,
@@ -595,6 +599,35 @@ namespace SabreTools
} }
} }
// Set the 1G1R regions alphabetically if not already set
if (regions == null || regions.Count == 0)
{
regions = new List<string>()
{
"australia",
"canada",
"china",
"denmark",
"europe",
"finland",
"france",
"germany",
"greece",
"italy",
"japan",
"korea",
"netherlands",
"norway",
"russia",
"spain",
"sweden",
"usa",
"usa, australia",
"usa, europe",
"world",
};
}
// Normalize the extensions // Normalize the extensions
addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext); addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext);
repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext); repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext);
@@ -653,6 +686,8 @@ namespace SabreTools
ExcludeOf = excludeOf, ExcludeOf = excludeOf,
DatFormat = datFormat, DatFormat = datFormat,
StripHash = stripHash, StripHash = stripHash,
OneGameOneRegion = oneGameOneRegion,
Regions = regions,
UseGame = usegame, UseGame = usegame,
Prefix = prefix, Prefix = prefix,

View File

@@ -102,6 +102,7 @@ namespace SabreTools
inplace = false, inplace = false,
inverse = false, inverse = false,
merge = false, merge = false,
oneGameOneRegion = false,
parseArchivesAsFiles = false, parseArchivesAsFiles = false,
quickScan = false, quickScan = false,
quotes = false, quotes = false,
@@ -159,6 +160,7 @@ namespace SabreTools
List<string> exta = new List<string>(); List<string> exta = new List<string>();
List<string> extb = new List<string>(); List<string> extb = new List<string>();
List<string> inputs = new List<string>(); List<string> inputs = new List<string>();
List<string> regions = new List<string>();
// Get the first argument as a feature flag // Get the first argument as a feature flag
string feature = args[0]; string feature = args[0];
@@ -270,6 +272,10 @@ namespace SabreTools
switch (args[i]) switch (args[i])
{ {
// User flags // User flags
case "-1g1r":
case "--1g1r":
oneGameOneRegion = true;
break;
case "-ab": case "-ab":
case "--add-blank": case "--add-blank":
addBlankFilesForEmptyFolder = true; addBlankFilesForEmptyFolder = true;
@@ -776,6 +782,10 @@ namespace SabreTools
case "--root-dir": case "--root-dir":
root = args[++i]; root = args[++i];
break; break;
case "-reg":
case "--region":
regions.Add(args[++i]);
break;
case "-rep": case "-rep":
case "--rep-ext": case "--rep-ext":
repext = args[++i]; repext = args[++i];
@@ -1044,6 +1054,10 @@ namespace SabreTools
case "--root-dir": case "--root-dir":
root = split[1]; root = split[1];
break; break;
case "-reg":
case "--region":
regions.Add(split[1]);
break;
case "-rep": case "-rep":
case "--rep-ext": case "--rep-ext":
repext = split[1]; repext = split[1];
@@ -1165,29 +1179,9 @@ namespace SabreTools
// Create a DAT from a directory or set of directories // Create a DAT from a directory or set of directories
if (datFromDir) if (datFromDir)
{ {
InitDatFromDir(inputs, InitDatFromDir(inputs, filename, name, description, category, version, author, forcepack, excludeOf,
filename, datFormat, romba, superdat, omitFromScan, removeDateFromAutomaticName, parseArchivesAsFiles, enableGzip,
name, addBlankFilesForEmptyFolder, addFileDates, tempDir, outDir, copyFiles, header, maxParallelism);
description,
category,
version,
author,
forcepack,
excludeOf,
datFormat,
romba,
superdat,
omitFromScan,
removeDateFromAutomaticName,
parseArchivesAsFiles,
enableGzip,
addBlankFilesForEmptyFolder,
addFileDates,
tempDir,
outDir,
copyFiles,
header,
maxParallelism);
} }
// If we're in header extract and remove mode // If we're in header extract and remove mode
@@ -1250,9 +1244,9 @@ namespace SabreTools
else if (update) else if (update)
{ {
InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header, InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header,
superdat, forcemerge, forcend, forcepack, excludeOf, datFormat, usegame, prefix, superdat, forcemerge, forcend, forcepack, excludeOf, datFormat, usegame, prefix, postfix, quotes, repext, addext, remext,
postfix, quotes, repext, addext, remext, datPrefix, romba, merge, diffMode, inplace, skip, removeDateFromAutomaticName, datPrefix, romba, merge, diffMode, inplace, skip, removeDateFromAutomaticName, filter, oneGameOneRegion, regions,
filter, splitType, trim, single, root, outDir, cleanGameNames, descAsName, dedup, stripHash, maxParallelism); splitType, trim, single, root, outDir, cleanGameNames, descAsName, dedup, stripHash, maxParallelism);
} }
// If we're using the verifier // If we're using the verifier