diff --git a/BizHawk.Client.Common/config/PathEntry.cs b/BizHawk.Client.Common/config/PathEntry.cs index 99d75391c1..19ded05e81 100644 --- a/BizHawk.Client.Common/config/PathEntry.cs +++ b/BizHawk.Client.Common/config/PathEntry.cs @@ -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 - 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 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 AvPathFragment { get { return Global.Config.PathEntries["Global", "A/V Dumps"].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 = "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 = "Lua", Path = Path.Combine(".", "Lua"), 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 = "A/V Dumps", Path = ".", 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 = "Macros", Path = Path.Combine(".", "Movies", "Macros"), 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 = "Multi-Disk Bundles", Path = Path.Combine(".", "Tools"), 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 = "A/V Dumps", Path = ".", Ordinal = 6 }, + new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Tools", Path = Path.Combine(".", "Tools"), Ordinal = 7 }, + new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Lua", Path = Path.Combine(".", "Lua"), Ordinal = 8 }, + new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Watch (.wch)", Path = Path.Combine(".", "."), Ordinal = 9 }, + new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Debug Logs", Path = Path.Combine(".", ""), Ordinal = 10 }, + new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Macros", Path = Path.Combine(".", "Movies", "Macros"), Ordinal = 11 }, + 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 = "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 = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, diff --git a/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs b/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs index cf7b7b6903..08e48ad087 100644 --- a/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs +++ b/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs @@ -468,7 +468,7 @@ namespace BizHawk.Client.EmuHawk { var file = OpenFileDialog( CurrentFileName, - PathManager.GetRomsPath(Global.Game.System), // TODO: bot path + PathManager.MakeAbsolutePath(Global.Config.PathEntries.ToolsPathFragment, null), "Bot files", "bot" ); @@ -491,7 +491,7 @@ namespace BizHawk.Client.EmuHawk { var file = SaveFileDialog( CurrentFileName, - PathManager.GetRomsPath(Global.Game.System), // TODO: bot path + PathManager.MakeAbsolutePath(Global.Config.PathEntries.ToolsPathFragment, null), "Bot files", "bot" ); diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs index dbcbd2d148..cb13337030 100644 --- a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs +++ b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs @@ -1272,16 +1272,14 @@ namespace BizHawk.Client.EmuHawk private void LoadTableFileMenuItem_Click(object sender, EventArgs e) { string romName; - string intialDirectory; + string intialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.ToolsPathFragment, null); if (Global.Config.RecentRoms.MostRecent.Contains('|')) { romName = Global.Config.RecentRoms.MostRecent.Split('|').Last(); - intialDirectory = Global.Config.RecentRoms.MostRecent.Split('|').First(); } else { romName = Global.Config.RecentRoms.MostRecent; - intialDirectory = Path.GetDirectoryName(PathManager.MakeAbsolutePath(romName, null)); } var ofd = new OpenFileDialog diff --git a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs index f9dc7a0f81..cea1038956 100644 --- a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs +++ b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs @@ -224,7 +224,7 @@ namespace BizHawk.Client.EmuHawk private void BrowseBtn_Click(object sender, EventArgs e) { 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) { diff --git a/Dist/BuildAndPackage.bat b/Dist/BuildAndPackage.bat index bf9dd57731..e0cf47a7ed 100644 --- a/Dist/BuildAndPackage.bat +++ b/Dist/BuildAndPackage.bat @@ -33,7 +33,7 @@ rem explicitly list the OK ones here as individual copies. until then.... copy *.dll dll 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 .\unzip.exe %NAME% -d temp diff --git a/output/Tools/.gitempty b/output/Tools/.gitempty new file mode 100644 index 0000000000..e69de29bb2