pathmanager: ad hoc support for unknown systemIDs, which are all labeled as INTERIM

This commit is contained in:
goyuken 2014-01-02 02:18:16 +00:00
parent 008a29fc41
commit 5fa141b3ef
1 changed files with 29 additions and 1 deletions

View File

@ -64,7 +64,35 @@ namespace BizHawk.Client.Common
{
get
{
return Paths.FirstOrDefault(x => x.HasSystem(system) && x.Type == type);
return Paths.FirstOrDefault(x => x.HasSystem(system) && x.Type == type) ?? TryGetDebugPath(system, type);
}
}
private PathEntry TryGetDebugPath(string system, string type)
{
if (Paths.Any(p => p.HasSystem(system)))
{
// we have the system, but not the type. don't attempt to add an unknown type
return null;
}
else
{
// we don't have anything for the system in question. add a set of stock paths
string systempath = PathManager.RemoveInvalidFileSystemChars(system) + "_INTERIM";
string systemdisp = system + " (INTERIM)";
Paths.AddRange(new[]
{
new PathEntry { System = system, SystemDisplayName=systemdisp, Type = "Base", Path= Path.Combine(".", systempath), Ordinal = 0 },
new PathEntry { System = system, SystemDisplayName=systemdisp, Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry { System = system, SystemDisplayName=systemdisp, Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry { System = system, SystemDisplayName=systemdisp, Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry { System = system, SystemDisplayName=systemdisp, Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry { System = system, SystemDisplayName=systemdisp, Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
});
return this[system, type];
}
}