mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add Romba output to Miss files
This commit is contained in:
@@ -73,6 +73,7 @@ namespace SabreTools
|
|||||||
old = false,
|
old = false,
|
||||||
quotes = false,
|
quotes = false,
|
||||||
rem = false,
|
rem = false,
|
||||||
|
romba = false,
|
||||||
trim = false,
|
trim = false,
|
||||||
skip = false,
|
skip = false,
|
||||||
usegame = true;
|
usegame = true;
|
||||||
@@ -193,6 +194,10 @@ namespace SabreTools
|
|||||||
case "--remove":
|
case "--remove":
|
||||||
rem = true;
|
rem = true;
|
||||||
break;
|
break;
|
||||||
|
case "-ro":
|
||||||
|
case "--romba":
|
||||||
|
romba = true;
|
||||||
|
break;
|
||||||
case "--skip":
|
case "--skip":
|
||||||
skip = true;
|
skip = true;
|
||||||
break;
|
break;
|
||||||
@@ -356,7 +361,7 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
foreach (string input in inputs)
|
foreach (string input in inputs)
|
||||||
{
|
{
|
||||||
InitConvertMiss(input, usegame, prefix, postfix, quotes, repext, addext, gamename);
|
InitConvertMiss(input, usegame, prefix, postfix, quotes, repext, addext, gamename, romba);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -784,7 +789,8 @@ Make a selection:
|
|||||||
7) Replace all extensions with another" + (repext != "" ? ":\t" + repext : "") + @"
|
7) Replace all extensions with another" + (repext != "" ? ":\t" + repext : "") + @"
|
||||||
8) Add extensions to each item" + (addext != "" ? ":\n\t" + addext : "") + @"
|
8) Add extensions to each item" + (addext != "" ? ":\n\t" + addext : "") + @"
|
||||||
" + (!usegame ? " 9) " + (gamename ? "Don't add game name before every item" : "Add game name before every item") + "\n" : "") +
|
" + (!usegame ? " 9) " + (gamename ? "Don't add game name before every item" : "Add game name before every item") + "\n" : "") +
|
||||||
@" 10) Begin conversion
|
@" 10) " + (romba ? "Don't output items in Romba format" : "Output items in Romba format") + @"
|
||||||
|
11) Begin conversion
|
||||||
B) Go back to the previous menu
|
B) Go back to the previous menu
|
||||||
");
|
");
|
||||||
Console.Write("Enter selection: ");
|
Console.Write("Enter selection: ");
|
||||||
@@ -829,8 +835,11 @@ Make a selection:
|
|||||||
gamename = !gamename;
|
gamename = !gamename;
|
||||||
break;
|
break;
|
||||||
case "10":
|
case "10":
|
||||||
|
romba = !romba;
|
||||||
|
break;
|
||||||
|
case "11":
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
InitConvertMiss(input, usegame, prefix, postfix, quotes, repext, addext, gamename);
|
InitConvertMiss(input, usegame, prefix, postfix, quotes, repext, addext, gamename, romba);
|
||||||
Console.Write("\nPress any key to continue...");
|
Console.Write("\nPress any key to continue...");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
input = ""; prefix = ""; postfix = ""; addext = ""; repext = "";
|
input = ""; prefix = ""; postfix = ""; addext = ""; repext = "";
|
||||||
@@ -1419,7 +1428,8 @@ Make a selection:
|
|||||||
/// <param name="repext">Replace all extensions with another</param>
|
/// <param name="repext">Replace all extensions with another</param>
|
||||||
/// <param name="addext">Add an extension to all items</param>
|
/// <param name="addext">Add an extension to all items</param>
|
||||||
/// <param name="gamename">Add the dat name as a directory prefix</param>
|
/// <param name="gamename">Add the dat name as a directory prefix</param>
|
||||||
private static void InitConvertMiss(string input, bool usegame, string prefix, string postfix, bool quotes, string repext, string addext, bool gamename)
|
/// <param name="romba">Output files in romba format</param>
|
||||||
|
private static void InitConvertMiss(string input, bool usegame, string prefix, string postfix, bool quotes, string repext, string addext, bool gamename, bool romba)
|
||||||
{
|
{
|
||||||
// Strip any quotations from the name
|
// Strip any quotations from the name
|
||||||
input = input.Replace("\"", "");
|
input = input.Replace("\"", "");
|
||||||
@@ -1456,6 +1466,7 @@ Make a selection:
|
|||||||
RepExt = repext,
|
RepExt = repext,
|
||||||
Quotes = quotes,
|
Quotes = quotes,
|
||||||
GameName = gamename,
|
GameName = gamename,
|
||||||
|
Romba = romba,
|
||||||
};
|
};
|
||||||
datdata = RomManipulation.Parse(input, 0, 0, datdata, logger);
|
datdata = RomManipulation.Parse(input, 0, 0, datdata, logger);
|
||||||
datdata.Name += "-miss";
|
datdata.Name += "-miss";
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ Options:
|
|||||||
-q, --quotes Put double-quotes around each item
|
-q, --quotes Put double-quotes around each item
|
||||||
-ae=, --add-ext= Add an extension to each item
|
-ae=, --add-ext= Add an extension to each item
|
||||||
-re=, --rep-ext= Replace all extensions with specified
|
-re=, --rep-ext= Replace all extensions with specified
|
||||||
|
-ro, --romba Output roms in Romba format (requires SHA-1)
|
||||||
-cr, --convert-rc Convert any DAT to RomCenter
|
-cr, --convert-rc Convert any DAT to RomCenter
|
||||||
-out= Output directory
|
-out= Output directory
|
||||||
-cx, --convert-xml Convert any DAT to XML
|
-cx, --convert-xml Convert any DAT to XML
|
||||||
|
|||||||
@@ -179,31 +179,47 @@ namespace SabreTools.Helper
|
|||||||
case OutputFormat.MissFile:
|
case OutputFormat.MissFile:
|
||||||
string pre = datdata.Prefix + (datdata.Quotes ? "\"" : "");
|
string pre = datdata.Prefix + (datdata.Quotes ? "\"" : "");
|
||||||
string post = (datdata.Quotes ? "\"" : "") + datdata.Postfix;
|
string post = (datdata.Quotes ? "\"" : "") + datdata.Postfix;
|
||||||
string name = (datdata.UseGame ? rom.Game : rom.Name);
|
|
||||||
if (datdata.RepExt != "")
|
|
||||||
{
|
|
||||||
string dir = Path.GetDirectoryName(name);
|
|
||||||
dir = (dir.EndsWith(Path.DirectorySeparatorChar.ToString()) ? dir : dir + Path.DirectorySeparatorChar);
|
|
||||||
dir = (dir.StartsWith(Path.DirectorySeparatorChar.ToString()) ? dir.Remove(0, 1) : dir);
|
|
||||||
name = dir + Path.GetFileNameWithoutExtension(name) + datdata.RepExt;
|
|
||||||
}
|
|
||||||
if (datdata.AddExt != "")
|
|
||||||
{
|
|
||||||
name += datdata.AddExt;
|
|
||||||
}
|
|
||||||
if (!datdata.UseGame && datdata.GameName)
|
|
||||||
{
|
|
||||||
name = (rom.Game.EndsWith(Path.DirectorySeparatorChar.ToString()) ? rom.Game : rom.Game + Path.DirectorySeparatorChar) + name;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datdata.UseGame && rom.Game != lastgame)
|
// If we're in Romba mode, the state is consistent
|
||||||
|
if (datdata.Romba)
|
||||||
{
|
{
|
||||||
state += pre + name + post + "\n";
|
// We can only write out if there's a SHA-1
|
||||||
lastgame = rom.Game;
|
if (rom.SHA1 != "")
|
||||||
|
{
|
||||||
|
string name = "/" + rom.SHA1.Substring(0, 2) + "/" + rom.SHA1.Substring(2, 2) + "/" + rom.SHA1.Substring(4, 2) + "/" +
|
||||||
|
rom.SHA1.Substring(6, 2) + "/" + rom.SHA1 + ".gz";
|
||||||
|
state += pre + name + post;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!datdata.UseGame)
|
// Otherwise, use any flags
|
||||||
|
else
|
||||||
{
|
{
|
||||||
state += pre + name + post + "\n";
|
string name = (datdata.UseGame ? rom.Game : rom.Name);
|
||||||
|
if (datdata.RepExt != "")
|
||||||
|
{
|
||||||
|
string dir = Path.GetDirectoryName(name);
|
||||||
|
dir = (dir.EndsWith(Path.DirectorySeparatorChar.ToString()) ? dir : dir + Path.DirectorySeparatorChar);
|
||||||
|
dir = (dir.StartsWith(Path.DirectorySeparatorChar.ToString()) ? dir.Remove(0, 1) : dir);
|
||||||
|
name = dir + Path.GetFileNameWithoutExtension(name) + datdata.RepExt;
|
||||||
|
}
|
||||||
|
if (datdata.AddExt != "")
|
||||||
|
{
|
||||||
|
name += datdata.AddExt;
|
||||||
|
}
|
||||||
|
if (!datdata.UseGame && datdata.GameName)
|
||||||
|
{
|
||||||
|
name = (rom.Game.EndsWith(Path.DirectorySeparatorChar.ToString()) ? rom.Game : rom.Game + Path.DirectorySeparatorChar) + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (datdata.UseGame && rom.Game != lastgame)
|
||||||
|
{
|
||||||
|
state += pre + name + post + "\n";
|
||||||
|
lastgame = rom.Game;
|
||||||
|
}
|
||||||
|
else if (!datdata.UseGame)
|
||||||
|
{
|
||||||
|
state += pre + name + post + "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OutputFormat.RomCenter:
|
case OutputFormat.RomCenter:
|
||||||
|
|||||||
Reference in New Issue
Block a user