Fix path exceptions for various systems like GBC, and also clean up some terrible hacky code and do it in a nicer way

This commit is contained in:
adelikat 2013-08-23 16:03:57 +00:00
parent 42d93afe57
commit a71837c3aa
3 changed files with 257 additions and 343 deletions

View File

@ -829,14 +829,14 @@ namespace BizHawk.MultiClient
{
get
{
return Paths.FirstOrDefault(x => x.System == system && x.Type == type);
return Paths.FirstOrDefault(x => x.System.Contains(system) && x.Type == type);
}
}
public void ResolveWithDefaults()
{
//Add missing entries
foreach(PathEntry defaultpath in DefaultValues)
foreach (PathEntry defaultpath in DefaultValues)
{
var path = Paths.FirstOrDefault(x => x.System == defaultpath.System && x.Type == defaultpath.Type);
if (path == null)
@ -861,6 +861,14 @@ namespace BizHawk.MultiClient
{
Paths.Remove(entry);
}
//Add missing displaynames
var missingDisplayPaths = Paths.Where(x => x.SystemDisplayName == null).ToList();
foreach (PathEntry path in missingDisplayPaths)
{
path.SystemDisplayName = DefaultValues.FirstOrDefault(x => x.System == path.System).SystemDisplayName;
}
}
//Some frequently requested paths, made into a property for convenience
@ -878,141 +886,141 @@ namespace BizHawk.MultiClient
{
return new List<PathEntry>()
{
new PathEntry() { System = "Global", Type = "Movies", Path = Path.Combine(".", "Movies"), Ordinal = 0 },
new PathEntry() { System = "Global", Type = "Movie backups", Path = Path.Combine(".", "Movies", "backup"), Ordinal = 1 },
new PathEntry() { System = "Global", Type = "Lua", Path = Path.Combine(".", "Lua"), Ordinal = 2 },
new PathEntry() { System = "Global", Type = "Watch (.wch)", Path = ".", Ordinal = 3 },
new PathEntry() { System = "Global", Type = "A/V Dumps", Path = ".", Ordinal = 4 },
new PathEntry() { System = "Global", Type = "Debug Logs", Path = ".", Ordinal = 5 },
new PathEntry() { System = "Global", Type = "Firmware", Path = Path.Combine(".", "Firmware"), Ordinal = 6 },
new PathEntry() { System = "Global", Type = "Base ROM", Path = ".", Ordinal = 6 },
new PathEntry() { System = "Global", Type = "Base", Path = ".", Ordinal = 6 },
new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Movies", Path = Path.Combine(".", "Movies"), Ordinal = 0 },
new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Movie backups", Path = Path.Combine(".", "Movies", "backup"), Ordinal = 1 },
new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Lua", Path = Path.Combine(".", "Lua"), Ordinal = 2 },
new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Watch (.wch)", Path = ".", Ordinal = 3 },
new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "A/V Dumps", Path = ".", Ordinal = 4 },
new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Debug Logs", Path = ".", Ordinal = 5 },
new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Firmware", Path = Path.Combine(".", "Firmware"), Ordinal = 6 },
new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Base ROM", Path = ".", Ordinal = 6 },
new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Base", Path = ".", Ordinal = 6 },
new PathEntry() { System = "INTV", Type = "Base", Path = Path.Combine(".", "Intellivision"), Ordinal = 0 },
new PathEntry() { System = "INTV", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "INTV", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "INTV", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "INTV", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "INTV", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "INTV", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 },
new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Base", Path = Path.Combine(".", "Intellivision"), Ordinal = 0 },
new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 },
new PathEntry() { System = "NES", Type = "Base", Path = Path.Combine(".", "NES"), Ordinal = 0 },
new PathEntry() { System = "NES", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "NES", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "NES", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "NES", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "NES", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "NES", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 },
new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Base", Path = Path.Combine(".", "NES"), Ordinal = 0 },
new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 },
new PathEntry() { System = "SNES", Type = "Base", Path= Path.Combine(".", "SNES"), Ordinal = 0 },
new PathEntry() { System = "SNES", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "SNES", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "SNES", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "SNES", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "SNES", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Base", Path= Path.Combine(".", "SNES"), Ordinal = 0 },
new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "GBA", Type = "Base", Path= Path.Combine(".", "GBA"), Ordinal = 0 },
new PathEntry() { System = "GBA", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "GBA", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "GBA", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "GBA", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "GBA", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "Base", Path= Path.Combine(".", "GBA"), Ordinal = 0 },
new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "SMS", Type = "Base", Path= Path.Combine(".", "SMS"), Ordinal = 0 },
new PathEntry() { System = "SMS", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "SMS", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "SMS", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "SMS", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "SMS", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "Base", Path= Path.Combine(".", "SMS"), Ordinal = 0 },
new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "GG", Type = "Base", Path= Path.Combine(".", "Game Gear"), Ordinal = 0 },
new PathEntry() { System = "GG", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "GG", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "GG", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "GG", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "GG", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "Base", Path= Path.Combine(".", "Game Gear"), Ordinal = 0 },
new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "SG", Type = "Base", Path= Path.Combine(".", "SG-1000"), Ordinal = 0 },
new PathEntry() { System = "SG", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "SG", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "SG", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "SG", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "SG", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "Base", Path= Path.Combine(".", "SG-1000"), Ordinal = 0 },
new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "GEN", Type = "Base", Path= Path.Combine(".", "Genesis"), Ordinal = 0 },
new PathEntry() { System = "GEN", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "GEN", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "GEN", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "GEN", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "GEN", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "Base", Path= Path.Combine(".", "Genesis"), Ordinal = 0 },
new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "PCE", Type = "Base", Path= Path.Combine(".", "PC Engine"), Ordinal = 0 },
new PathEntry() { System = "PCE", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "PCE", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "PCE", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "PCE", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "PCE", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Base", Path= Path.Combine(".", "PC Engine"), Ordinal = 0 },
new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "GB", Type = "Base", Path= Path.Combine(".", "Gameboy"), Ordinal = 0 },
new PathEntry() { System = "GB", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "GB", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "GB", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "GB", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "GB", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "GB", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 },
new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Base", Path= Path.Combine(".", "Gameboy"), Ordinal = 0 },
new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 },
new PathEntry() { System = "TI83", Type = "Base", Path= Path.Combine(".", "TI83"), Ordinal = 0 },
new PathEntry() { System = "TI83", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "TI83", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "TI83", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "TI83", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "TI83", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "Base", Path= Path.Combine(".", "TI83"), Ordinal = 0 },
new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "A26", Type = "Base", Path= Path.Combine(".", "Atari 2600"), Ordinal = 0 },
new PathEntry() { System = "A26", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "A26", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "A26", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "A26", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "A26", SystemDisplayName="Atari 2600", Type = "Base", Path= Path.Combine(".", "Atari 2600"), Ordinal = 0 },
new PathEntry() { System = "A26", SystemDisplayName="Atari 2600", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "A26", SystemDisplayName="Atari 2600", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "A26", SystemDisplayName="Atari 2600", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "A26", SystemDisplayName="Atari 2600", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "A78", Type = "Base", Path= Path.Combine(".", "Atari 7800"), Ordinal = 0 },
new PathEntry() { System = "A78", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "A78", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "A78", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "A78", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "A78", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "Base", Path= Path.Combine(".", "Atari 7800"), Ordinal = 0 },
new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "C64", Type = "Base", Path= Path.Combine(".", "C64"), Ordinal = 0 },
new PathEntry() { System = "C64", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "C64", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "C64", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "C64", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "C64", SystemDisplayName="Commodore 64", Type = "Base", Path= Path.Combine(".", "C64"), Ordinal = 0 },
new PathEntry() { System = "C64", SystemDisplayName="Commodore 64", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "C64", SystemDisplayName="Commodore 64", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "C64", SystemDisplayName="Commodore 64", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "C64", SystemDisplayName="Commodore 64", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "PSX", Type = "Base", Path= Path.Combine(".", "PSX"), Ordinal = 0 },
new PathEntry() { System = "PSX", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "PSX", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "PSX", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "PSX", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "PSX", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "Base", Path= Path.Combine(".", "PSX"), Ordinal = 0 },
new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "Coleco", Type = "Base", Path= Path.Combine(".", "Coleco"), Ordinal = 0 },
new PathEntry() { System = "Coleco", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "Coleco", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "Coleco", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "Coleco", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "Coleco", SystemDisplayName = "Coleco", Type = "Base", Path= Path.Combine(".", "Coleco"), Ordinal = 0 },
new PathEntry() { System = "Coleco", SystemDisplayName = "Coleco", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "Coleco", SystemDisplayName = "Coleco", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "Coleco", SystemDisplayName = "Coleco", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "Coleco", SystemDisplayName = "Coleco", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "N64", Type = "Base", Path= Path.Combine(".", "N64"), Ordinal = 0 },
new PathEntry() { System = "N64", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "N64", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "N64", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "N64", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "N64", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "Base", Path= Path.Combine(".", "N64"), Ordinal = 0 },
new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "SAT", Type = "Base", Path= Path.Combine(".", "Saturn"), Ordinal = 0 },
new PathEntry() { System = "SAT", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "SAT", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "SAT", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "SAT", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "SAT", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "Base", Path= Path.Combine(".", "Saturn"), Ordinal = 0 },
new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
};
}
}
@ -1020,6 +1028,7 @@ namespace BizHawk.MultiClient
public class PathEntry
{
public string SystemDisplayName;
public string Type;
public string Path;
public string System;

View File

@ -20,7 +20,7 @@ namespace BizHawk.MultiClient
{
string[] coresToHide = { "PSX", "GBA", "INTV", "C64", "GEN" };
foreach(string core in coresToHide)
foreach (string core in coresToHide)
{
TabPage tp = AllTabPages.FirstOrDefault(x => x.Name == core);
PathTabControl.TabPages.Remove(tp);
@ -82,33 +82,13 @@ namespace BizHawk.MultiClient
private void SetDefaultFocusedTab()
{
switch (Global.Game.System)
{
case "NULL":
PathTabControl.SelectTab(FindTabByName("Global"));
break;
default:
PathTabControl.SelectTab(FindTabByName(Global.Game.System));
break;
//"Sub" Systems and other exceptions go here
case "PCECD":
case "SGX":
PathTabControl.SelectTab(FindTabByName("PCE"));
break;
case "GBC":
PathTabControl.SelectTab(FindTabByName("GB"));
break;
case "SGB":
PathTabControl.SelectTab(FindTabByName("SNES"));
break;
}
}
private TabPage FindTabByName(string name)
{
IEnumerable<TabPage> query = from p in PathTabControl.TabPages.OfType<TabPage>() select p;
var tab = query.FirstOrDefault(x => x.Name.ToUpper() == name.ToUpper());
var tab = query.FirstOrDefault(x => x.Name.ToUpper().Contains(name.ToUpper()));
if (tab == null)
{
return new TabPage();
@ -125,7 +105,7 @@ namespace BizHawk.MultiClient
PathTabControl.TabPages.Clear();
//Separate by system
List<string> systems = Global.Config.PathEntries.Select(x => x.System).Distinct().ToList();
List<string> systems = Global.Config.PathEntries.Select(x => x.SystemDisplayName).Distinct().ToList();
systems.Sort();
//Hacky way to put global first
@ -133,11 +113,12 @@ namespace BizHawk.MultiClient
systems.Remove(global);
systems.Insert(0, global);
foreach (string systemId in systems)
foreach (string systemDisplayName in systems)
{
string systemId = Global.Config.PathEntries.FirstOrDefault(x => x.SystemDisplayName == systemDisplayName).System;
TabPage t = new TabPage()
{
Text = systemId == "SG" ? "SG-1000" : systemId == "GEN" ? "Genesis" : systemId, //TODO: don't be hacky
Text = systemDisplayName,
Name = systemId,
};
List<PathEntry> paths = PathCollection.Where(x => x.System == systemId).OrderBy(x => x.Ordinal).ThenBy(x => x.Type).ToList();
@ -198,8 +179,8 @@ namespace BizHawk.MultiClient
_y += row_height;
}
string sys = systemId;
if (systemId == "PCE") //Hack
string sys = systemDisplayName;
if (systemDisplayName == "PCE") //Hack
{
sys = "PCECD";
}

View File

@ -71,10 +71,6 @@ namespace BizHawk.MultiClient
public static string GetPlatformBase(string system)
{
if (system == "SGX" || system == "PCECD")
{
system = "PCE";
}
return Global.Config.PathEntries[system, "Base"].Path;
}
@ -187,10 +183,7 @@ namespace BizHawk.MultiClient
public static bool IsRecent(string path)
{
if (path == "%recent%")
return true;
else
return false;
return path == "%recent%";
}
public static string GetLuaPath()
@ -205,15 +198,6 @@ namespace BizHawk.MultiClient
return Environment.SpecialFolder.Recent.ToString();
}
if (sysID == "SGX" || sysID == "PCECD") //Yucky
{
sysID = "PCE";
}
else if (sysID == "NULL")
{
sysID = "Global";
}
PathEntry path = Global.Config.PathEntries[sysID, "ROM"];
if (path == null)
@ -249,22 +233,7 @@ namespace BizHawk.MultiClient
name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename);
}
string sysId = "";
switch (game.System)
{
case "SGX":
case "PCECD":
sysId = "PCE";
break;
case "NULL":
sysId = "Global";
break;
default:
sysId = game.System;
break;
}
PathEntry pathEntry = Global.Config.PathEntries[sysId, "Save RAM"];
PathEntry pathEntry = Global.Config.PathEntries[game.System, "Save RAM"];
if (pathEntry == null)
{
@ -276,29 +245,14 @@ namespace BizHawk.MultiClient
public static string GetSaveStatePath(GameInfo game)
{
string sysId = "";
switch (game.System)
{
case "SGX":
case "PCECD":
sysId = "PCE";
break;
case "NULL":
sysId = "Global";
break;
default:
sysId = game.System;
break;
}
PathEntry pathEntry = Global.Config.PathEntries[sysId, "Savestates"];
PathEntry pathEntry = Global.Config.PathEntries[game.System, "Savestates"];
if (pathEntry == null)
{
pathEntry = Global.Config.PathEntries[game.System, "Base"];
}
return MakeAbsolutePath(pathEntry.Path, sysId == "Global" ? null : sysId);
return MakeAbsolutePath(pathEntry.Path, game.System);
}
public static string SaveStatePrefix(GameInfo game)
@ -310,51 +264,21 @@ namespace BizHawk.MultiClient
name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename);
}
string sysId = "";
switch (game.System)
{
case "SGX":
case "PCECD":
sysId = "PCE";
break;
case "NULL":
sysId = "Global";
break;
default:
sysId = game.System;
break;
}
PathEntry pathEntry = Global.Config.PathEntries[sysId, "Savestates"];
PathEntry pathEntry = Global.Config.PathEntries[game.System, "Savestates"];
if (pathEntry == null)
{
pathEntry = Global.Config.PathEntries[sysId, "Base"];
pathEntry = Global.Config.PathEntries[game.System, "Base"];
}
return Path.Combine(MakeAbsolutePath(pathEntry.Path, sysId == "Global" ? null : sysId), name);
return Path.Combine(MakeAbsolutePath(pathEntry.Path, game.System), name);
}
public static string ScreenshotPrefix(GameInfo game)
{
string name = FilesystemSafeName(game);
string sysId = "";
switch (game.System)
{
case "SGX":
case "PCECD":
sysId = "PCE";
break;
case "NULL":
sysId = "Global";
break;
default:
sysId = game.System;
break;
}
PathEntry pathEntry = Global.Config.PathEntries[sysId, "Screenshots"];
PathEntry pathEntry = Global.Config.PathEntries[game.System, "Screenshots"];
if (pathEntry == null)
{