diff --git a/SabreTools.Helper/Data/Flags.cs b/SabreTools.Helper/Data/Flags.cs index 10c6d267..f607a8d8 100644 --- a/SabreTools.Helper/Data/Flags.cs +++ b/SabreTools.Helper/Data/Flags.cs @@ -264,12 +264,12 @@ namespace SabreTools.Helper.Data [Flags] public enum ItemStatus { - NULL = -0x01, // This is a fake flag that is used for filter only - None = 0x00, - Good = 0x01, - BadDump = 0x02, - Nodump = 0x04, - Verified = 0x08, + NULL = 0x00, // This is a fake flag that is used for filter only + None = 0x01, + Good = 0x02, + BadDump = 0x04, + Nodump = 0x08, + Verified = 0x10, } /// @@ -278,11 +278,11 @@ namespace SabreTools.Helper.Data [Flags] public enum MachineType { - NULL = -0x01, // This is a fake flag used for filter only - None = 0x00, - Bios = 0x01, - Device = 0x02, - Mechanical = 0x04, + NULL = 0x00, // This is a fake flag used for filter only + None = 0x01, + Bios = 0x02, + Device = 0x04, + Mechanical = 0x08, } #endregion diff --git a/SabreTools/Partials/SabreTools_Inits.cs b/SabreTools/Partials/SabreTools_Inits.cs index 8a091d27..2d8fe1e4 100644 --- a/SabreTools/Partials/SabreTools_Inits.cs +++ b/SabreTools/Partials/SabreTools_Inits.cs @@ -436,16 +436,16 @@ namespace SabreTools /// CRC of the rom to match (can use asterisk-partials) /// MD5 of the rom to match (can use asterisk-partials) /// SHA-1 of the rom to match (can use asterisk-partials) - /// Select roms with the given item status - /// Select games with the given type + /// Select roms with the given item statuses + /// Select games with the given types /// Name of the game to match (can use asterisk-partials) /// Name of the rom to match (can use asterisk-partials) /// Type of the rom to match /// CRC of the rom to match (can use asterisk-partials) /// MD5 of the rom to match (can use asterisk-partials) /// SHA-1 of the rom to match (can use asterisk-partials) - /// Select roms without the given item status - /// Select games without the given type + /// Select roms without the given item statuses + /// Select games without the given types /// Select games with the given runability /// /* Trimming info */ /// Type of the split that should be performed (split, merged, fully merged) @@ -509,16 +509,16 @@ namespace SabreTools string crc, string md5, string sha1, - string status, - string gametype, + List statuses, + List gametypes, string notgamename, string notromname, string notromtype, string notcrc, string notmd5, string notsha1, - string notstatus, - string notgametype, + List notstatuses, + List notgametypes, bool? runnable, /* Trimming info */ @@ -587,83 +587,96 @@ namespace SabreTools // Set the status flag for filtering ItemStatus itemStatus = ItemStatus.NULL; - switch(status?.ToLowerInvariant()) + foreach (string status in statuses) { - case "none": - itemStatus = ItemStatus.None; - break; - case "good": - itemStatus = ItemStatus.Good; - break; - case "baddump": - itemStatus = ItemStatus.BadDump; - break; - case "nodump": - itemStatus = ItemStatus.Nodump; - break; - case "verified": - itemStatus = ItemStatus.Verified; - break; + switch (status.ToLowerInvariant()) + { + case "none": + itemStatus |= ItemStatus.None; + break; + case "good": + itemStatus |= ItemStatus.Good; + break; + case "baddump": + itemStatus |= ItemStatus.BadDump; + break; + case "nodump": + itemStatus |= ItemStatus.Nodump; + break; + case "verified": + itemStatus |= ItemStatus.Verified; + break; + } } // Set the not status flag for filtering ItemStatus itemNotStatus = ItemStatus.NULL; - switch (notstatus?.ToLowerInvariant()) + foreach (string status in notstatuses) { - case "none": - itemNotStatus = ItemStatus.None; - break; - case "good": - itemNotStatus = ItemStatus.Good; - break; - case "baddump": - itemNotStatus = ItemStatus.BadDump; - break; - case "nodump": - itemNotStatus = ItemStatus.Nodump; - break; - case "verified": - itemNotStatus = ItemStatus.Verified; - break; + switch (status.ToLowerInvariant()) + { + case "none": + itemNotStatus |= ItemStatus.None; + break; + case "good": + itemNotStatus |= ItemStatus.Good; + break; + case "baddump": + itemNotStatus |= ItemStatus.BadDump; + break; + case "nodump": + itemNotStatus |= ItemStatus.Nodump; + break; + case "verified": + itemNotStatus |= ItemStatus.Verified; + break; + } } // Set the machine type flag for filtering MachineType machineType = MachineType.NULL; - switch(gametype?.ToLowerInvariant()) + foreach (string gametype in gametypes) { - case "none": - machineType = MachineType.None; - break; - case "bios": - machineType = MachineType.Bios; - break; - case "device": - machineType = MachineType.Device; - break; - case "mech": - case "mechanical": - machineType = MachineType.Mechanical; - break; + switch (gametype.ToLowerInvariant()) + { + case "none": + machineType |= MachineType.None; + break; + case "bios": + machineType |= MachineType.Bios; + break; + case "dev": + case "device": + machineType |= MachineType.Device; + break; + case "mech": + case "mechanical": + machineType |= MachineType.Mechanical; + break; + } } // Set the not machine type flag for filtering MachineType machineNotType = MachineType.NULL; - switch (notgametype?.ToLowerInvariant()) + foreach (string gametype in notgametypes) { - case "none": - machineNotType = MachineType.None; - break; - case "bios": - machineNotType = MachineType.Bios; - break; - case "dev": - case "device": - machineNotType = MachineType.Device; - break; - case "mech": - case "mechanical": - machineNotType = MachineType.Mechanical; - break; + switch (gametype.ToLowerInvariant()) + { + case "none": + machineNotType = MachineType.None; + break; + case "bios": + machineNotType = MachineType.Bios; + break; + case "dev": + case "device": + machineNotType = MachineType.Device; + break; + case "mech": + case "mechanical": + machineNotType = MachineType.Mechanical; + break; + } } // Normalize the extensions diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs index 95eeb67d..cb0924e1 100644 --- a/SabreTools/SabreTools.cs +++ b/SabreTools/SabreTools.cs @@ -129,19 +129,16 @@ namespace SabreTools forcend = "", forcepack = "", gamename = "", - gametype = "", header = null, homepage = null, md5 = "", name = null, notcrc = null, notgamename = null, - notgametype = "", notmd5 = null, notromname = null, notromtype = null, notsha1 = null, - notstatus = null, outDir = "", postfix = "", prefix = "", @@ -151,12 +148,15 @@ namespace SabreTools root = "", rootdir = null, sha1 = "", - status = "", tempDir = "", url = null, version = null; List datfiles = new List(); // SimpleSort + List gametype = new List(); List inputs = new List(); + List notgametype = new List(); + List notstatus = new List(); + List status = new List(); // Determine which switches are enabled (with values if necessary) for (int i = 0; i < args.Length; i++) @@ -570,7 +570,7 @@ namespace SabreTools break; case "-gt": case "--game-type": - gametype = args[++i]; + gametype.Add(args[++i]); break; case "-gz": case "--gz": @@ -589,7 +589,7 @@ namespace SabreTools break; case "-is": case "--status": - status = args[++i]; + status.Add(args[++i]); break; case "-md5": case "--md5": @@ -613,11 +613,11 @@ namespace SabreTools break; case "-ngt": case "--not-gtype": - notgametype = args[++i]; + notgametype.Add(args[++i]); break; case "-nis": case "--not-status": - notstatus = args[++i]; + notstatus.Add(args[++i]); break; case "-nmd5": case "--not-md5": @@ -803,7 +803,7 @@ namespace SabreTools break; case "-gt": case "--game-type": - gametype = split[1]; + gametype.Add(split[1]); break; case "-gz": case "--gz": @@ -822,7 +822,7 @@ namespace SabreTools break; case "-is": case "--status": - status = split[1]; + status.Add(split[1]); break; case "-md5": case "--md5": @@ -846,11 +846,11 @@ namespace SabreTools break; case "-ngt": case "--not-gtype": - notgametype = split[1]; + notgametype.Add(split[1]); break; case "-nis": case "--not-status": - notstatus = split[1]; + notstatus.Add(split[1]); break; case "-nmd5": case "--not-md5":