Add a global tools path in path config, have various tool related paths fallback to this tools folder, wire it up to hex editor .tbl files and basic bot .bot files. Change various tool paths to be . by default to point to the tools folder instead. Add tools folder to version control and builds

This commit is contained in:
adelikat 2016-02-05 20:46:18 -05:00
parent ec3c862f4a
commit 7885934a1e
6 changed files with 53 additions and 18 deletions

View File

@ -127,11 +127,47 @@ namespace BizHawk.Client.Common
} }
} }
public string ToolsPathFragment
{
get { return Global.Config.PathEntries["Global", "Tools"].Path; }
}
private static string ResolveToolsPath(string subPath)
{
if (Path.IsPathRooted(subPath))
{
return subPath;
}
var toolsPath = Global.Config.PathEntries["Global", "Tools"].Path;
// Hack for backwards compabitilbity, preior to 1.11.5, .wch files were in .\Tools, we don't want that to turn into .Tools\Tools
if (subPath == "Tools")
{
return toolsPath;
}
return Path.Combine(toolsPath, subPath);
}
//Some frequently requested paths, made into a property for convenience //Some frequently requested paths, made into a property for convenience
public string WatchPathFragment { get { return Global.Config.PathEntries["Global", "Watch (.wch)"].Path; } } public string WatchPathFragment
{
get { return ResolveToolsPath(Global.Config.PathEntries["Global", "Watch (.wch)"].Path); }
}
public string MultiDiskBundlesFragment
{
get { return ResolveToolsPath(Global.Config.PathEntries["Global", "Multi-Disk Bundles"].Path); }
}
public string LogPathFragment
{
get { return ResolveToolsPath(Global.Config.PathEntries["Global", "Debug Logs"].Path); }
}
public string MoviesPathFragment { get { return Global.Config.PathEntries["Global", "Movies"].Path; } } public string MoviesPathFragment { get { return Global.Config.PathEntries["Global", "Movies"].Path; } }
public string LuaPathFragment { get { return Global.Config.PathEntries["Global", "Lua"].Path; } } public string LuaPathFragment { get { return Global.Config.PathEntries["Global", "Lua"].Path; } }
public string LogPathFragment { get { return Global.Config.PathEntries["Global", "Debug Logs"].Path; } }
public string FirmwaresPathFragment { get { return Global.Config.PathEntries["Global", "Firmware"].Path; } } public string FirmwaresPathFragment { get { return Global.Config.PathEntries["Global", "Firmware"].Path; } }
public string AvPathFragment { get { return Global.Config.PathEntries["Global", "A/V Dumps"].Path; } } public string AvPathFragment { get { return Global.Config.PathEntries["Global", "A/V Dumps"].Path; } }
public string GlobalRomFragment { get { return Global.Config.PathEntries["Global", "ROM"].Path; } } public string GlobalRomFragment { get { return Global.Config.PathEntries["Global", "ROM"].Path; } }
@ -150,16 +186,17 @@ namespace BizHawk.Client.Common
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Firmware", Path = Path.Combine(".", "Firmware"), Ordinal = 3 }, new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Firmware", Path = Path.Combine(".", "Firmware"), Ordinal = 3 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Movies", Path = Path.Combine(".", "Movies"), Ordinal = 4 }, new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Movies", Path = Path.Combine(".", "Movies"), Ordinal = 4 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Movie backups", Path = Path.Combine(".", "Movies", "backup"), Ordinal = 5 }, new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Movie backups", Path = Path.Combine(".", "Movies", "backup"), Ordinal = 5 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Lua", Path = Path.Combine(".", "Lua"), Ordinal = 6 }, new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "A/V Dumps", Path = ".", Ordinal = 6 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Watch (.wch)", Path = Path.Combine(".", "Tools"), Ordinal = 7 }, new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Tools", Path = Path.Combine(".", "Tools"), Ordinal = 7 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "A/V Dumps", Path = ".", Ordinal = 8 }, new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Lua", Path = Path.Combine(".", "Lua"), Ordinal = 8 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Debug Logs", Path = Path.Combine(".", "Tools"), Ordinal = 9 }, new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Watch (.wch)", Path = Path.Combine(".", "."), Ordinal = 9 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Macros", Path = Path.Combine(".", "Movies", "Macros"), Ordinal = 10 }, new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Debug Logs", Path = Path.Combine(".", ""), Ordinal = 10 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "TAStudio states", Path = Path.Combine(".", "Movies", "TAStudio states"), Ordinal = 11 }, new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Macros", Path = Path.Combine(".", "Movies", "Macros"), Ordinal = 11 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Multi-Disk Bundles", Path = Path.Combine(".", "Tools"), Ordinal = 12 }, new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "TAStudio states", Path = Path.Combine(".", "Movies", "TAStudio states"), Ordinal = 12 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "External Tools", Path = Path.Combine(".", "ExternalTools"), Ordinal = 13 }, new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Multi-Disk Bundles", Path = Path.Combine(".", ""), Ordinal = 13 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "External Tools", Path = Path.Combine(".", "ExternalTools"), Ordinal = 14 },
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "Base", Path = Path.Combine(".", "Intellivision"), Ordinal = 0 }, 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 = "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 = "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 = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },

View File

@ -468,7 +468,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var file = OpenFileDialog( var file = OpenFileDialog(
CurrentFileName, CurrentFileName,
PathManager.GetRomsPath(Global.Game.System), // TODO: bot path PathManager.MakeAbsolutePath(Global.Config.PathEntries.ToolsPathFragment, null),
"Bot files", "Bot files",
"bot" "bot"
); );
@ -491,7 +491,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var file = SaveFileDialog( var file = SaveFileDialog(
CurrentFileName, CurrentFileName,
PathManager.GetRomsPath(Global.Game.System), // TODO: bot path PathManager.MakeAbsolutePath(Global.Config.PathEntries.ToolsPathFragment, null),
"Bot files", "Bot files",
"bot" "bot"
); );

View File

@ -1272,16 +1272,14 @@ namespace BizHawk.Client.EmuHawk
private void LoadTableFileMenuItem_Click(object sender, EventArgs e) private void LoadTableFileMenuItem_Click(object sender, EventArgs e)
{ {
string romName; string romName;
string intialDirectory; string intialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.ToolsPathFragment, null);
if (Global.Config.RecentRoms.MostRecent.Contains('|')) if (Global.Config.RecentRoms.MostRecent.Contains('|'))
{ {
romName = Global.Config.RecentRoms.MostRecent.Split('|').Last(); romName = Global.Config.RecentRoms.MostRecent.Split('|').Last();
intialDirectory = Global.Config.RecentRoms.MostRecent.Split('|').First();
} }
else else
{ {
romName = Global.Config.RecentRoms.MostRecent; romName = Global.Config.RecentRoms.MostRecent;
intialDirectory = Path.GetDirectoryName(PathManager.MakeAbsolutePath(romName, null));
} }
var ofd = new OpenFileDialog var ofd = new OpenFileDialog

View File

@ -224,7 +224,7 @@ namespace BizHawk.Client.EmuHawk
private void BrowseBtn_Click(object sender, EventArgs e) private void BrowseBtn_Click(object sender, EventArgs e)
{ {
string filename = string.Empty; string filename = string.Empty;
string initialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global_NULL", "Multi-Disk Bundles"].Path, "Global_NULL"); string initialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MultiDiskBundlesFragment, "Global_NULL");
if (!Global.Game.IsNullInstance) if (!Global.Game.IsNullInstance)
{ {

View File

@ -33,7 +33,7 @@ rem explicitly list the OK ones here as individual copies. until then....
copy *.dll dll copy *.dll dll
rem Now, we're about to zip and then unzip. Why, you ask? Because that's just the way this evolved. rem Now, we're about to zip and then unzip. Why, you ask? Because that's just the way this evolved.
..\dist\zip.exe -X -r ..\Dist\%NAME% EmuHawk.exe DiscoHawk.exe defctrl.json dll shaders gamedb NES\Palettes Lua Gameboy\Palettes -x *.pdb -x *.lib -x *.pgd -x *.ipdb -x *.iobj -x *.exp -x dll\libsneshawk-64*.exe -x *.ilk -x dll\gpgx.elf -x dll\miniclient.* -x dll\*.xml ..\dist\zip.exe -X -r ..\Dist\%NAME% EmuHawk.exe DiscoHawk.exe defctrl.json dll shaders gamedb Tools NES\Palettes Lua Gameboy\Palettes -x *.pdb -x *.lib -x *.pgd -x *.ipdb -x *.iobj -x *.exp -x dll\libsneshawk-64*.exe -x *.ilk -x dll\gpgx.elf -x dll\miniclient.* -x dll\*.xml
cd ..\Dist cd ..\Dist
.\unzip.exe %NAME% -d temp .\unzip.exe %NAME% -d temp

0
output/Tools/.gitempty Normal file
View File