From 625f9c2fcd0a1028b87d0cfbfc6ed30da3f5b145 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 11 Aug 2013 21:48:17 +0000 Subject: [PATCH] Rip out old path system and replace with new --- .../BizHawk.MultiClient.csproj | 9 - BizHawk.MultiClient/Config.cs | 152 +-------- BizHawk.MultiClient/FirmwareManager.cs | 2 +- .../GBtools/ColorChooserForm.cs | 4 +- .../GBtools/DualGBFileSelector.cs | 2 +- BizHawk.MultiClient/MainForm.MenuItems.cs | 11 +- BizHawk.MultiClient/MainForm.cs | 12 +- .../NEStools/NESGraphicsConfig.cs | 2 +- .../NEStools/NameTableViewer.cs | 2 +- BizHawk.MultiClient/NEStools/PaletteViewer.cs | 2 +- BizHawk.MultiClient/NEStools/PatternViewer.cs | 2 +- BizHawk.MultiClient/NEStools/SpriteViewer.cs | 2 +- BizHawk.MultiClient/PlayMovie.cs | 4 +- BizHawk.MultiClient/RecordMovie.cs | 4 +- BizHawk.MultiClient/config/FirmwaresConfig.cs | 4 +- BizHawk.MultiClient/config/NewPathConfig.cs | 4 +- BizHawk.MultiClient/config/PathManager.cs | 316 +++++++----------- BizHawk.MultiClient/movie/Movie.cs | 2 +- BizHawk.MultiClient/tools/CheatList.cs | 43 +-- BizHawk.MultiClient/tools/RamSearch.cs | 2 +- BizHawk.MultiClient/tools/RamWatch.cs | 2 +- BizHawk.MultiClient/tools/TAStudio.cs | 2 +- BizHawk.MultiClient/tools/TraceLogger.cs | 6 +- BizHawk.MultiClient/tools/WatchCommon.cs | 4 +- 24 files changed, 173 insertions(+), 422 deletions(-) diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index 740c2c9c55..68dd454763 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -215,12 +215,6 @@ NewHotkeyWindow.cs - - Form - - - PathConfig.cs - Form @@ -942,9 +936,6 @@ MessageConfig.cs Designer - - PathConfig.cs - SoundConfig.cs Designer diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 729a982996..9ddcf9fab6 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -18,149 +18,9 @@ namespace BizHawk.MultiClient PathEntries.ResolveWithDefaults(); } - public string BaseINTV = Path.Combine(".", "Intellivision"); - public string PathINTVROMs = "."; - public string PathINTVSavestates = Path.Combine(".", "State"); - public string PathINTVSaveRAM = Path.Combine(".", "SaveRAM"); - public string PathINTVScreenshots = Path.Combine(".", "Screenshots"); - public string PathINTVCheats = Path.Combine(".", "Cheats"); - - public string BaseNES = Path.Combine(".", "NES"); - public string PathNESROMs = "."; - public string PathNESSavestates = Path.Combine(".", "State"); - public string PathNESSaveRAM = Path.Combine(".", "SaveRAM"); - public string PathNESScreenshots = Path.Combine(".", "Screenshots"); - public string PathNESCheats = Path.Combine(".", "Cheats"); - public string PathNESPalette = Path.Combine(".", "Palettes"); - - public string BaseSNES = Path.Combine(".", "SNES"); - public string PathSNESROMs = "."; - public string PathSNESSavestates = Path.Combine(".", "State"); - public string PathSNESSaveRAM = Path.Combine(".", "SaveRAM"); - public string PathSNESScreenshots = Path.Combine(".", "Screenshots"); - public string PathSNESCheats = Path.Combine(".", "Cheats"); - //public string PathSNESFirmwares = Path.Combine(".", "Firmwares"); - - public string BaseGBA = Path.Combine(".", "GBA"); - public string PathGBAROMs = "."; - public string PathGBASavestates = Path.Combine(".", "State"); - public string PathGBASaveRAM = Path.Combine(".", "SaveRAM"); - public string PathGBAScreenshots = Path.Combine(".", "Screenshots"); - public string PathGBACheats = Path.Combine(".", "Cheats"); - - public string BaseSMS = Path.Combine(".", "SMS"); - public string PathSMSROMs = "."; - public string PathSMSSavestates = Path.Combine(".", "State"); - public string PathSMSSaveRAM = Path.Combine(".", "SaveRAM"); - public string PathSMSScreenshots = Path.Combine(".", "Screenshots"); - public string PathSMSCheats = Path.Combine(".", "Cheats"); - - public string BaseGG = Path.Combine(".", "Game Gear"); - public string PathGGROMs = "."; - public string PathGGSavestates = Path.Combine(".", "State"); - public string PathGGSaveRAM = Path.Combine(".", "SaveRAM"); - public string PathGGScreenshots = Path.Combine(".", "Screenshots"); - public string PathGGCheats = Path.Combine(".", "Cheats"); - - public string BaseSG = Path.Combine(".", "SG-1000"); - public string PathSGROMs = "."; - public string PathSGSavestates = Path.Combine(".", "State"); - public string PathSGSaveRAM = Path.Combine(".", "SaveRAM"); - public string PathSGScreenshots = Path.Combine(".", "Screenshots"); - public string PathSGCheats = Path.Combine(".", "Cheats"); - - public string BaseGenesis = Path.Combine(".", "Genesis"); - public string PathGenesisROMs = "."; - public string PathGenesisSavestates = Path.Combine(".", "State"); - public string PathGenesisSaveRAM = Path.Combine(".", "SaveRAM"); - public string PathGenesisScreenshots = Path.Combine(".", "Screenshots"); - public string PathGenesisCheats = Path.Combine(".", "Cheats"); - - public string BasePCE = Path.Combine(".", "PC Engine"); - public string PathPCEROMs = "."; - public string PathPCESavestates = Path.Combine(".", "State"); - public string PathPCESaveRAM = Path.Combine(".", "SaveRAM"); - public string PathPCEScreenshots = Path.Combine(".", "Screenshots"); - public string PathPCECheats = Path.Combine(".", "Cheats"); - - public string BaseGameboy = Path.Combine(".", "Gameboy"); - public string PathGBROMs = "."; - public string PathGBSavestates = Path.Combine(".", "State"); - public string PathGBSaveRAM = Path.Combine(".", "SaveRAM"); - public string PathGBScreenshots = Path.Combine(".", "Screenshots"); - public string PathGBCheats = Path.Combine(".", "Cheats"); - public string PathGBPalettes = Path.Combine(".", "Palettes"); - - public string BaseTI83 = Path.Combine(".", "TI83"); - public string PathTI83ROMs = "."; - public string PathTI83Savestates = Path.Combine(".", "State"); - public string PathTI83SaveRAM = Path.Combine(".", "SaveRAM"); - public string PathTI83Screenshots = Path.Combine(".", "Screenshots"); - public string PathTI83Cheats = Path.Combine(".", "Cheats"); - - public string BaseAtari2600 = Path.Combine(".", "Atari 2600"); - public string PathAtari2600ROMs = "."; - public string PathAtari2600Savestates = Path.Combine(".", "State"); - public string PathAtari2600Screenshots = Path.Combine(".", "Screenshots"); - public string PathAtari2600Cheats = Path.Combine(".", "Cheats"); - - public string BaseAtari7800 = Path.Combine(".", "Atari 7800"); - public string PathAtari7800ROMs = "."; - public string PathAtari7800Savestates = Path.Combine(".", "State"); - public string PathAtari7800SaveRAM = Path.Combine(".", "SaveRAM"); - public string PathAtari7800Screenshots = Path.Combine(".", "Screenshots"); - public string PathAtari7800Cheats = Path.Combine(".", "Cheats"); - //public string PathAtari7800Firmwares = Path.Combine(".", "Firmwares"); - - public string BaseC64 = Path.Combine(".", "C64"); - public string PathC64ROMs = "."; - public string PathC64Savestates = Path.Combine(".", "State"); - public string PathC64Screenshots = Path.Combine(".", "Screenshots"); - public string PathC64Cheats = Path.Combine(".", "Cheats"); - //public string PathC64Firmwares = Path.Combine(".", "Firmwares"); - - public string BasePSX = Path.Combine(".", "PSX"); - public string PathPSXROMs = "."; - public string PathPSXSavestates = Path.Combine(".", "State"); - public string PathPSXSaveRAM = Path.Combine(".", "SaveRAM"); - public string PathPSXScreenshots = Path.Combine(".", "Screenshots"); - public string PathPSXCheats = Path.Combine(".", "Cheats"); - //public string PathPSXFirmwares = Path.Combine(".", "Firmwares"); - - public string BaseCOL = Path.Combine(".", "Coleco"); - public string PathCOLROMs = "."; - public string PathCOLSavestates = Path.Combine(".", "State"); - public string PathCOLScreenshots = Path.Combine(".", "Screenshots"); - public string PathCOLCheats = Path.Combine(".", "Cheats"); - - public string BaseN64 = Path.Combine(".", "N64"); - public string PathN64ROMs = "."; - public string PathN64Savestates = Path.Combine(".", "State"); - public string PathN64SaveRAM = Path.Combine(".", "SaveRAM"); - public string PathN64Screenshots = Path.Combine(".", "Screenshots"); - public string PathN64Cheats = Path.Combine(".", "Cheats"); - - public string BaseSaturn = Path.Combine(".", "Saturn"); - public string PathSaturnROMs = "."; - public string PathSaturnSavestates = Path.Combine(".", "State"); - public string PathSaturnSaveRAM = Path.Combine(".", "SaveRAM"); - public string PathSaturnScreenshots = Path.Combine(".", "Screenshots"); - public string PathSaturnCheats = Path.Combine(".", "Cheats"); - - public string MoviesPath = Path.Combine(".", "Movies"); - public string MoviesBackupPath = Path.Combine(".", "Movies", "backup"); - public string LuaPath = Path.Combine(".", "Lua"); - public string WatchPath = "."; - public string AVIPath = "."; - public string LogPath = "."; - public string FirmwaresPath = Path.Combine(".", "Firmware"); - - //Path Settings ************************************/ public bool UseRecentForROMs = false; public string LastRomPath = "."; - public string BasePath = "."; - public string BaseROMPath = "."; public PathEntryCollection PathEntries = new PathEntryCollection(); //BIOS Paths @@ -913,7 +773,7 @@ namespace BizHawk.MultiClient { get { - return Paths.FirstOrDefault(x => x.System == system && x.Type == type) ?? new PathEntry(); + return Paths.FirstOrDefault(x => x.System == system && x.Type == type); } } @@ -947,6 +807,15 @@ namespace BizHawk.MultiClient } } + //Some frequently requested paths, made into a property for convenience + public string WatchPath { get { return Global.Config.PathEntries["Global", "Watch (.wch)"].Path; } } + public string MoviesPath { get { return Global.Config.PathEntries["Global", "Movies"].Path; } } + public string LuaPath { get { return Global.Config.PathEntries["Global", "Lua"].Path; } } + public string LogPath { get { return Global.Config.PathEntries["Global", "Debug Logs"].Path; } } + public string FirmwaresPath { get { return Global.Config.PathEntries["Global", "Firmware"].Path; } } + public string AVPath { get { return Global.Config.PathEntries["Global", "A/V Dumps"].Path; } } + public string GlobalBase { get { return Global.Config.PathEntries["Global", "Base"].Path; } } + public static List DefaultValues { get @@ -961,6 +830,7 @@ namespace BizHawk.MultiClient 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 = "INTV", Type = "Base", Path = Path.Combine(".", "Intellivision"), Ordinal = 0 }, new PathEntry() { System = "INTV", Type = "ROM", Path = ".", Ordinal = 1 }, diff --git a/BizHawk.MultiClient/FirmwareManager.cs b/BizHawk.MultiClient/FirmwareManager.cs index e7a2e4f111..514dcb0c26 100644 --- a/BizHawk.MultiClient/FirmwareManager.cs +++ b/BizHawk.MultiClient/FirmwareManager.cs @@ -87,7 +87,7 @@ namespace BizHawk.MultiClient RealFirmwareReader reader = new RealFirmwareReader(); //build a list of files under the global firmwares path, and build a hash for each of them while we're at it - var todo = new Queue(new[] { new DirectoryInfo(Global.Config.FirmwaresPath) }); + var todo = new Queue(new[] { new DirectoryInfo(Global.Config.PathEntries.FirmwaresPath) }); while (todo.Count != 0) { diff --git a/BizHawk.MultiClient/GBtools/ColorChooserForm.cs b/BizHawk.MultiClient/GBtools/ColorChooserForm.cs index df9e9bb72c..337b031e1e 100644 --- a/BizHawk.MultiClient/GBtools/ColorChooserForm.cs +++ b/BizHawk.MultiClient/GBtools/ColorChooserForm.cs @@ -316,7 +316,7 @@ namespace BizHawk.MultiClient.GBtools { using (var ofd = new OpenFileDialog()) { - ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathGBPalettes, "GB"); + ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["GB", "Palettes"].Path, "GB"); ofd.Filter = "Gambatte Palettes (*.pal)|*.pal|All Files|*.*"; ofd.RestoreDirectory = true; @@ -361,7 +361,7 @@ namespace BizHawk.MultiClient.GBtools } else { - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathGBPalettes, "GB"); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["GB", "Palettes"].Path, "GB"); sfd.FileName = Global.Game.Name + ".pal"; } sfd.Filter = "Gambatte Palettes (*.pal)|*.pal|All Files|*.*"; diff --git a/BizHawk.MultiClient/GBtools/DualGBFileSelector.cs b/BizHawk.MultiClient/GBtools/DualGBFileSelector.cs index ab3d3032d9..e58461da12 100644 --- a/BizHawk.MultiClient/GBtools/DualGBFileSelector.cs +++ b/BizHawk.MultiClient/GBtools/DualGBFileSelector.cs @@ -60,7 +60,7 @@ namespace BizHawk.MultiClient.GBtools { using (var ofd = new OpenFileDialog()) { - ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathGBROMs, "GB"); + ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["GB", "Palettes"].Path, "GB"); ofd.Filter = "GB Roms (*.gb,*.gbc)|*.gb;*.gbc|All Files|*.*"; ofd.RestoreDirectory = true; var result = ofd.ShowDialog(this); diff --git a/BizHawk.MultiClient/MainForm.MenuItems.cs b/BizHawk.MultiClient/MainForm.MenuItems.cs index 312f0a942b..2a04e299db 100644 --- a/BizHawk.MultiClient/MainForm.MenuItems.cs +++ b/BizHawk.MultiClient/MainForm.MenuItems.cs @@ -700,14 +700,7 @@ namespace BizHawk.MultiClient private void pathsToolStripMenuItem_Click(object sender, EventArgs e) { - if (INTERIM) - { - new NewPathConfig().ShowDialog(); - } - else - { - new PathConfig().ShowDialog(); - } + new NewPathConfig().ShowDialog(); } private void displayRerecordCountToolStripMenuItem_Click(object sender, EventArgs e) @@ -2393,7 +2386,7 @@ namespace BizHawk.MultiClient private void pathsToolStripMenuItem1_Click(object sender, EventArgs e) { - new PathConfig().ShowDialog(); + new NewPathConfig().ShowDialog(); } private void soundToolStripMenuItem1_Click(object sender, EventArgs e) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 6d39dcfd18..49bf75c84d 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -455,11 +455,11 @@ namespace BizHawk.MultiClient target.SMS_ShowBG = Global.Config.SMSDispBG; target.SMS_ShowOBJ = Global.Config.SMSDispOBJ; - target.PSX_FirmwaresPath = PathManager.MakeAbsolutePath(Global.Config.FirmwaresPath); // PathManager.MakeAbsolutePath(Global.Config.PathPSXFirmwares, "PSX"); + target.PSX_FirmwaresPath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPath); // PathManager.MakeAbsolutePath(Global.Config.PathPSXFirmwares, "PSX"); - target.C64_FirmwaresPath = PathManager.MakeAbsolutePath(Global.Config.FirmwaresPath); // PathManager.MakeAbsolutePath(Global.Config.PathC64Firmwares, "C64"); + target.C64_FirmwaresPath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPath); // PathManager.MakeAbsolutePath(Global.Config.PathC64Firmwares, "C64"); - target.SNES_FirmwaresPath = PathManager.MakeAbsolutePath(Global.Config.FirmwaresPath); // PathManager.MakeAbsolutePath(Global.Config.PathSNESFirmwares, "SNES"); + target.SNES_FirmwaresPath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPath); // PathManager.MakeAbsolutePath(Global.Config.PathSNESFirmwares, "SNES"); target.SNES_ShowBG1_0 = Global.Config.SNES_ShowBG1_0; target.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_1; target.SNES_ShowBG2_0 = Global.Config.SNES_ShowBG2_0; @@ -3618,12 +3618,12 @@ namespace BizHawk.MultiClient if (!(Global.Emulator is NullEmulator)) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game); - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.AVIPath); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AVPath); } else { sfd.FileName = "NULL"; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.AVIPath); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AVPath); } sfd.Filter = String.Format("{0} (*.{0})|*.{0}|All Files|*.*", aw.DesiredExtension()); @@ -3819,7 +3819,7 @@ namespace BizHawk.MultiClient void ProcessMovieImport(string fn) { - string d = PathManager.MakeAbsolutePath(Global.Config.MoviesPath); + string d = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath); string errorMsg; string warningMsg; Movie m = MovieImport.ImportFile(fn, out errorMsg, out warningMsg); diff --git a/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs b/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs index bee0f76de1..828d3842d9 100644 --- a/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs +++ b/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs @@ -47,7 +47,7 @@ namespace BizHawk.MultiClient { OpenFileDialog ofd = new OpenFileDialog { - InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathNESPalette, "NES"), + InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Palettes"].Path, "NES"), Filter = "Palette Files (.pal)|*.PAL|All Files (*.*)|*.*", RestoreDirectory = true }; diff --git a/BizHawk.MultiClient/NEStools/NameTableViewer.cs b/BizHawk.MultiClient/NEStools/NameTableViewer.cs index 793292a1b2..916d2f0ef9 100644 --- a/BizHawk.MultiClient/NEStools/NameTableViewer.cs +++ b/BizHawk.MultiClient/NEStools/NameTableViewer.cs @@ -69,7 +69,7 @@ namespace BizHawk.MultiClient var sfd = new SaveFileDialog { FileName = PathManager.FilesystemSafeName(Global.Game) + "-Nametables", - InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), + InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"), Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*", RestoreDirectory = true }; diff --git a/BizHawk.MultiClient/NEStools/PaletteViewer.cs b/BizHawk.MultiClient/NEStools/PaletteViewer.cs index e97212c244..66da77995c 100644 --- a/BizHawk.MultiClient/NEStools/PaletteViewer.cs +++ b/BizHawk.MultiClient/NEStools/PaletteViewer.cs @@ -76,7 +76,7 @@ namespace BizHawk.MultiClient var sfd = new SaveFileDialog { FileName = PathManager.FilesystemSafeName(Global.Game) + "-Palettes", - InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), + InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"), Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*", RestoreDirectory = true }; diff --git a/BizHawk.MultiClient/NEStools/PatternViewer.cs b/BizHawk.MultiClient/NEStools/PatternViewer.cs index 00a4ed0b0a..181d18dabd 100644 --- a/BizHawk.MultiClient/NEStools/PatternViewer.cs +++ b/BizHawk.MultiClient/NEStools/PatternViewer.cs @@ -37,7 +37,7 @@ namespace BizHawk.MultiClient var sfd = new SaveFileDialog { FileName = PathManager.FilesystemSafeName(Global.Game) + "-Patterns", - InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), + InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"), Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*", RestoreDirectory = true }; diff --git a/BizHawk.MultiClient/NEStools/SpriteViewer.cs b/BizHawk.MultiClient/NEStools/SpriteViewer.cs index 413452a17f..973dc11252 100644 --- a/BizHawk.MultiClient/NEStools/SpriteViewer.cs +++ b/BizHawk.MultiClient/NEStools/SpriteViewer.cs @@ -42,7 +42,7 @@ namespace BizHawk.MultiClient var sfd = new SaveFileDialog { FileName = PathManager.FilesystemSafeName(Global.Game) + "-Sprites", - InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), + InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"), Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*", RestoreDirectory = true }; diff --git a/BizHawk.MultiClient/PlayMovie.cs b/BizHawk.MultiClient/PlayMovie.cs index 70e23066a8..c17b2058f5 100644 --- a/BizHawk.MultiClient/PlayMovie.cs +++ b/BizHawk.MultiClient/PlayMovie.cs @@ -77,7 +77,7 @@ namespace BizHawk.MultiClient private void BrowseMovies_Click(object sender, EventArgs e) { - OpenFileDialog ofd = new OpenFileDialog {InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath)}; + OpenFileDialog ofd = new OpenFileDialog { InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath) }; string filter = "Movie Files (*." + Global.Config.MovieExtension + ")|*." + Global.Config.MovieExtension + "|Savestates|*.state|All Files|*.*"; ofd.Filter = filter; @@ -286,7 +286,7 @@ namespace BizHawk.MultiClient { ClearList(); - string d = PathManager.MakeAbsolutePath(Global.Config.MoviesPath); + string d = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath); if (!Directory.Exists(d)) { Directory.CreateDirectory(d); diff --git a/BizHawk.MultiClient/RecordMovie.cs b/BizHawk.MultiClient/RecordMovie.cs index 4f23913c7a..0cad38f1be 100644 --- a/BizHawk.MultiClient/RecordMovie.cs +++ b/BizHawk.MultiClient/RecordMovie.cs @@ -31,7 +31,7 @@ namespace BizHawk.MultiClient { if (path[0] != '\\') path = path.Insert(0, "\\"); - path = PathManager.MakeAbsolutePath(Global.Config.MoviesPath) + path; + path = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath) + path; if (path[path.Length - 4] != '.') //If no file extension, add movie extension path += "." + Global.Config.MovieExtension; @@ -181,7 +181,7 @@ namespace BizHawk.MultiClient string filename = ""; SaveFileDialog sfd = new SaveFileDialog { - InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath), + InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath), DefaultExt = "." + Global.Config.MovieExtension, FileName = RecordBox.Text, OverwritePrompt = false diff --git a/BizHawk.MultiClient/config/FirmwaresConfig.cs b/BizHawk.MultiClient/config/FirmwaresConfig.cs index a564733569..ba13ecf9a2 100644 --- a/BizHawk.MultiClient/config/FirmwaresConfig.cs +++ b/BizHawk.MultiClient/config/FirmwaresConfig.cs @@ -78,7 +78,7 @@ namespace BizHawk.MultiClient listviewSorter = new ListViewSorter(this, -1); - currSelectorDir = PathManager.MakeAbsolutePath(Global.Config.FirmwaresPath); + currSelectorDir = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPath); } //makes sure that the specified SystemId is selected in the list (and that all the firmwares for it are visible) @@ -197,7 +197,7 @@ namespace BizHawk.MultiClient else { //lazy substring extraction. really should do a better job - var basePath = PathManager.MakeAbsolutePath(Global.Config.FirmwaresPath) + Path.DirectorySeparatorChar; + var basePath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPath) + Path.DirectorySeparatorChar; var path = ri.FilePath.Replace(basePath, ""); diff --git a/BizHawk.MultiClient/config/NewPathConfig.cs b/BizHawk.MultiClient/config/NewPathConfig.cs index 11b414b1eb..662fdca803 100644 --- a/BizHawk.MultiClient/config/NewPathConfig.cs +++ b/BizHawk.MultiClient/config/NewPathConfig.cs @@ -42,7 +42,7 @@ namespace BizHawk.MultiClient private void LoadSettings() { RecentForROMs.Checked = Global.Config.UseRecentForROMs; - BasePathBox.Text = Global.Config.BasePath; + BasePathBox.Text = Global.Config.PathEntries.GlobalBase; DoTabs(Global.Config.PathEntries.Paths); SetDefaultFocusedTab(); DoROMToggle(); @@ -216,7 +216,7 @@ namespace BizHawk.MultiClient private void SaveSettings() { Global.Config.UseRecentForROMs = RecentForROMs.Checked; - Global.Config.BasePath = BasePathBox.Text; + Global.Config.PathEntries["Global", "Base"].Path = BasePathBox.Text; foreach (TextBox t in AllPathBoxes) { diff --git a/BizHawk.MultiClient/config/PathManager.cs b/BizHawk.MultiClient/config/PathManager.cs index 91d4a18941..2900138154 100644 --- a/BizHawk.MultiClient/config/PathManager.cs +++ b/BizHawk.MultiClient/config/PathManager.cs @@ -37,24 +37,24 @@ namespace BizHawk.MultiClient /// public static string GetBasePathAbsolute() { - if (Global.Config.BasePath.Length < 1) //If empty, then EXE path + if (Global.Config.PathEntries.GlobalBase.Length < 1) //If empty, then EXE path return GetExeDirectoryAbsolute(); - if (Global.Config.BasePath.Length >= 5 && - Global.Config.BasePath.Substring(0, 5) == "%exe%") + if (Global.Config.PathEntries.GlobalBase.Length >= 5 && + Global.Config.PathEntries.GlobalBase.Substring(0, 5) == "%exe%") return GetExeDirectoryAbsolute(); - if (Global.Config.BasePath[0] == '.') + if (Global.Config.PathEntries.GlobalBase[0] == '.') { - if (Global.Config.BasePath.Length == 1) + if (Global.Config.PathEntries.GlobalBase.Length == 1) return GetExeDirectoryAbsolute(); else { - if (Global.Config.BasePath.Length == 2 && - Global.Config.BasePath == ".\\") + if (Global.Config.PathEntries.GlobalBase.Length == 2 && + Global.Config.PathEntries.GlobalBase == ".\\") return GetExeDirectoryAbsolute(); else { - string tmp = Global.Config.BasePath; + string tmp = Global.Config.PathEntries.GlobalBase; tmp = tmp.Remove(0, 1); tmp = tmp.Insert(0, GetExeDirectoryAbsolute()); return tmp; @@ -62,8 +62,8 @@ namespace BizHawk.MultiClient } } - if (Global.Config.BasePath.Substring(0, 2) == "..") - return RemoveParents(Global.Config.BasePath, GetExeDirectoryAbsolute()); + if (Global.Config.PathEntries.GlobalBase.Substring(0, 2) == "..") + return RemoveParents(Global.Config.PathEntries.GlobalBase, GetExeDirectoryAbsolute()); //In case of error, return EXE path return GetExeDirectoryAbsolute(); @@ -71,55 +71,16 @@ namespace BizHawk.MultiClient public static string GetPlatformBase(string system) { - switch (system) + if (system == "SGX" || system == "PCECD") { - case "C64": - return Global.Config.BaseC64; - case "PSX": - return Global.Config.BasePSX; - case "INTV": - return Global.Config.BaseINTV; - case "A26": - return Global.Config.BaseAtari2600; - case "A78": - return Global.Config.BaseAtari7800; - case "NES": - return Global.Config.BaseNES; - case "SG": - return Global.Config.BaseSG; - case "GG": - return Global.Config.BaseGG; - case "SMS": - return Global.Config.BaseSMS; - case "SGX": - case "PCE": - case "PCECD": - return Global.Config.BasePCE; - case "TI83": - return Global.Config.BaseTI83; - case "GEN": - return Global.Config.BaseGenesis; - case "GB": - return Global.Config.BaseGameboy; - case "SNES": - return Global.Config.BaseSNES; - case "Coleco": - return Global.Config.BaseCOL; - case "GBA": - return Global.Config.BaseGBA; - case "N64": - return Global.Config.BaseN64; - case "SAT": - return Global.Config.BaseSaturn; - case "NULL": - default: - return ""; + system = "PCE"; } + return Global.Config.PathEntries[system, "Base"].Path; } public static string StandardFirmwareName(string name) { - return Path.Combine(MakeAbsolutePath(Global.Config.FirmwaresPath), name); + return Path.Combine(MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPath), name); } public static string MakeAbsolutePath(string path, string system = null) @@ -228,80 +189,33 @@ namespace BizHawk.MultiClient public static string GetLuaPath() { - return MakeAbsolutePath(Global.Config.LuaPath); + return MakeAbsolutePath(Global.Config.PathEntries.LuaPath); } public static string GetRomsPath(string sysID) { - string path; - if (Global.Config.UseRecentForROMs) - return Environment.SpecialFolder.Recent.ToString(); - - switch (sysID) { - case "C64": - path = MakeAbsolutePath(Global.Config.PathC64ROMs, "C64"); - break; - case "PSX": - path = MakeAbsolutePath(Global.Config.PathPSXROMs, "PSX"); - break; - case "INTV": - path = MakeAbsolutePath(Global.Config.PathINTVROMs, "INTV"); - break; - case "SNES": - path = MakeAbsolutePath(Global.Config.PathSNESROMs, "SNES"); - break; - case "A26": - path = MakeAbsolutePath(Global.Config.PathAtari2600ROMs, "A26"); - break; - case "A78": - path = MakeAbsolutePath(Global.Config.PathAtari7800ROMs, "A78"); - break; - case "NES": - path = MakeAbsolutePath(Global.Config.PathNESROMs, "NES"); - break; - case "SMS": - path = MakeAbsolutePath(Global.Config.PathSMSROMs, "SMS"); - break; - case "SG": - path = MakeAbsolutePath(Global.Config.PathSGROMs, "SG"); - break; - case "GG": - path = MakeAbsolutePath(Global.Config.PathGGROMs, "GG"); - break; - case "GEN": - path = MakeAbsolutePath(Global.Config.PathGenesisROMs, "GEN"); - break; - case "SFX": - case "PCE": - case "PCECD": - path = MakeAbsolutePath(Global.Config.PathPCEROMs, "PCE"); - break; - case "GB": - path = MakeAbsolutePath(Global.Config.PathGBROMs, "GB"); - break; - case "GBA": - path = MakeAbsolutePath(Global.Config.PathGBAROMs, "GBA"); - break; - case "TI83": - path = MakeAbsolutePath(Global.Config.PathTI83ROMs, "TI83"); - break; - case "Coleco": - path = MakeAbsolutePath(Global.Config.PathCOLROMs, "Coleco"); - break; - case "N64": - path = MakeAbsolutePath(Global.Config.PathN64ROMs, "N64"); - break; - case "SAT": - path = MakeAbsolutePath(Global.Config.PathSaturnROMs, "SAT"); - break; - default: - path = MakeAbsolutePath(Global.Config.BaseROMPath); - break; + return Environment.SpecialFolder.Recent.ToString(); } - return path; + if (sysID == "SGX" || sysID == "PCECD") //Yucky + { + sysID = "PCE"; + } + else if (sysID == "NULL") + { + sysID = "Global"; + } + + PathEntry path = Global.Config.PathEntries[sysID, "ROM"]; + + if (path == null) + { + path = Global.Config.PathEntries[sysID, "Base"]; + } + + return path.Path; } public static string RemoveInvalidFileSystemChars(string name) @@ -326,59 +240,59 @@ namespace BizHawk.MultiClient string name = FilesystemSafeName(game); if (Global.MovieSession.Movie.IsActive) { - name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename); } + string sysId = ""; switch (game.System) { - case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathINTVSaveRAM, "INTV"), name + ".SaveRAM"); - case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSSaveRAM, "SMS"), name + ".SaveRAM"); - case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGSaveRAM, "GG"), name + ".SaveRAM"); - case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSaveRAM, "SG"), name + ".SaveRAM"); - case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM"); - case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM"); - case "PCECD": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM"); - case "GB": case "GBC": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSaveRAM, "GB"), name + ".SaveRAM"); - case "GBA": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBASaveRAM, "GBA"), name + ".SaveRAM"); - case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSaveRAM, "GEN"), name + ".SaveRAM"); - case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSaveRAM, "NES"), name + ".SaveRAM"); - case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83SaveRAM, "TI83"), name + ".SaveRAM"); - case "A78": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtari7800SaveRAM, "A78"), name + ".SaveRAM"); - case "SNES": return Path.Combine(MakeAbsolutePath(Global.Config.PathSNESSaveRAM, "SNES"), name + ".SaveRAM"); - case "PSX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPSXSaveRAM, "PSX"), name + ".SaveRAM"); - case "SAT": return Path.Combine(MakeAbsolutePath(Global.Config.PathSaturnSaveRAM, "SAT"), name + ".SaveRAM"); - case "N64": return Path.Combine(MakeAbsolutePath(Global.Config.PathN64SaveRAM, "N64"), name + ".SaveRAM"); - default: return Path.Combine(GetBasePathAbsolute(), name + ".SaveRAM"); + 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"]; + + if (pathEntry == null) + { + pathEntry = Global.Config.PathEntries[game.System, "Base"]; + } + + return Path.Combine(MakeAbsolutePath(pathEntry.Path), name); } public static string GetSaveStatePath(GameInfo game) { + string sysId = ""; switch (game.System) { - default: return GetRomsPath(game.System); - case "INTV": return MakeAbsolutePath(Global.Config.PathINTVSavestates, "INTV"); - case "A26": return MakeAbsolutePath(Global.Config.PathAtari2600Savestates, "A26"); - case "A78": return MakeAbsolutePath(Global.Config.PathAtari7800Savestates, "A78"); - case "SMS": return MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS"); - case "GG": return MakeAbsolutePath(Global.Config.PathGGSavestates, "GG"); - case "SG": return MakeAbsolutePath(Global.Config.PathSGSavestates, "SG"); - case "SGX": return MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"); - case "PCE": return MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"); - case "PCECD": return MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"); - case "GB": case "GBC": return MakeAbsolutePath(Global.Config.PathGBSavestates, "GB"); - case "GBA": return MakeAbsolutePath(Global.Config.PathGBASavestates, "GBA"); - case "GEN": return MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN"); - case "NES": return MakeAbsolutePath(Global.Config.PathNESSavestates, "NES"); - case "TI83": return MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83"); - case "SNES": return MakeAbsolutePath(Global.Config.PathSNESSavestates, "SNES"); - case "PSX": return MakeAbsolutePath(Global.Config.PathPSXSavestates, "PSX"); - case "C64": return MakeAbsolutePath(Global.Config.PathC64Savestates, "C64"); - case "Coleco": return MakeAbsolutePath(Global.Config.PathCOLSavestates, "Coleco"); - case "SAT": return MakeAbsolutePath(Global.Config.PathSaturnSavestates, "SAT"); - case "N64": return MakeAbsolutePath(Global.Config.PathN64Savestates, "N64"); + case "SGX": + case "PCECD": + sysId = "PCE"; + break; + case "NULL": + sysId = "Global"; + break; + default: + sysId = game.System; + break; } + + PathEntry pathEntry = Global.Config.PathEntries[sysId, "Savestates"]; + + if (pathEntry == null) + { + pathEntry = Global.Config.PathEntries[game.System, "Base"]; + } + + return MakeAbsolutePath(pathEntry.Path, sysId == "Global" ? null : sysId); } public static string SaveStatePrefix(GameInfo game) @@ -389,59 +303,59 @@ namespace BizHawk.MultiClient { name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename); } - + + string sysId = ""; switch (game.System) { - case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathINTVSavestates, "INTV"), name); - case "A26": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtari2600Savestates, "A26"), name); - case "A78": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtari7800Savestates, "A78"), name); - case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS"), name); - case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGSavestates, "GG"), name); - case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSavestates, "SG"), name); - case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name); - case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name); - case "PCECD": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name); - case "GB": case "GBC": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSavestates, "GB"), name); - case "GBA": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBASavestates, "GBA"), name); - case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN"), name); - case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSavestates, "NES"), name); - case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83"), name); - case "SNES": return Path.Combine(MakeAbsolutePath(Global.Config.PathSNESSavestates, "SNES"), name); - case "PSX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPSXSavestates, "PSX"), name); - case "C64": return Path.Combine(MakeAbsolutePath(Global.Config.PathC64Savestates, "C64"), name); - case "Coleco": return Path.Combine(MakeAbsolutePath(Global.Config.PathCOLSavestates, "Coleco"), name); - case "SAT": return Path.Combine(MakeAbsolutePath(Global.Config.PathSaturnSavestates, "SAT"), name); - case "N64": return Path.Combine(MakeAbsolutePath(Global.Config.PathN64Savestates, "N64"), name); + case "SGX": + case "PCECD": + sysId = "PCE"; + break; + case "NULL": + sysId = "Global"; + break; + default: + sysId = game.System; + break; } - return ""; + + PathEntry pathEntry = Global.Config.PathEntries[sysId, "Savestates"]; + + if (pathEntry == null) + { + pathEntry = Global.Config.PathEntries[sysId, "Base"]; + } + + return Path.Combine(pathEntry.Path, name); } public static string ScreenshotPrefix(GameInfo game) { string name = FilesystemSafeName(game); + + string sysId = ""; switch (game.System) { - case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathINTVScreenshots, "INTV"), name); - case "A26": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtari2600Screenshots, "A26"), name); - case "A78": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtari7800Screenshots, "A78"), name); - case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSScreenshots, "SMS"), name); - case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGScreenshots, "GG"), name); - case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGScreenshots, "SG"), name); - case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name); - case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name); - case "PCECD": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name); - case "GB": case "GBC": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBScreenshots, "GB"), name); - case "GBA": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBAScreenshots, "GBA"), name); - case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisScreenshots, "GEN"), name); - case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), name); - case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Screenshots, "TI83"), name); - case "SNES": return Path.Combine(MakeAbsolutePath(Global.Config.PathSNESScreenshots, "SNES"), name); - case "PSX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPSXScreenshots, "PSX"), name); - case "Coleco": return Path.Combine(MakeAbsolutePath(Global.Config.PathCOLScreenshots, "Coleco"), name); - case "SAT": return Path.Combine(MakeAbsolutePath(Global.Config.PathSaturnScreenshots, "SAT"), name); - case "N64": return Path.Combine(MakeAbsolutePath(Global.Config.PathN64Screenshots, "N64"), name); + case "SGX": + case "PCECD": + sysId = "PCE"; + break; + case "NULL": + sysId = "Global"; + break; + default: + sysId = game.System; + break; } - return ""; + + PathEntry pathEntry = Global.Config.PathEntries[sysId, "Screenshots"]; + + if (pathEntry == null) + { + pathEntry = Global.Config.PathEntries[game.System, "Base"]; + } + + return Path.Combine(MakeAbsolutePath(pathEntry.Path), name); } } } diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index 5bfd6d8419..fa70c5711c 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -367,7 +367,7 @@ namespace BizHawk.MultiClient string BackupName = Filename; BackupName = BackupName.Insert(Filename.LastIndexOf("."), String.Format(".{0:yyyy-MM-dd HH.mm.ss}", DateTime.Now)); - BackupName = Global.Config.MoviesBackupPath + "\\" + Path.GetFileName(BackupName); + BackupName = Path.Combine(Global.Config.PathEntries["Global", "Movie backups"].Path, Path.GetFileName(BackupName)); var directory_info = new FileInfo(BackupName).Directory; if (directory_info != null) Directory.CreateDirectory(directory_info.FullName); diff --git a/BizHawk.MultiClient/tools/CheatList.cs b/BizHawk.MultiClient/tools/CheatList.cs index d39dc5cd36..01270135ae 100644 --- a/BizHawk.MultiClient/tools/CheatList.cs +++ b/BizHawk.MultiClient/tools/CheatList.cs @@ -168,38 +168,21 @@ namespace BizHawk.MultiClient { get { - string path; - switch (Global.Emulator.SystemId) + string sysId = Global.Emulator.SystemId; + + //Exceptions. TODO: There are more of these I'm sure + if (sysId == "SGX" || sysId == "PCECD") { - case "NES": - path = PathManager.MakeAbsolutePath(Global.Config.PathNESCheats, "NES"); - break; - case "SMS": - path = PathManager.MakeAbsolutePath(Global.Config.PathSMSCheats, "SMS"); - break; - case "SG": - path = PathManager.MakeAbsolutePath(Global.Config.PathSGCheats, "SG"); - break; - case "GG": - path = PathManager.MakeAbsolutePath(Global.Config.PathGGCheats, "GG"); - break; - case "GEN": - path = PathManager.MakeAbsolutePath(Global.Config.PathGenesisCheats, "GEN"); - break; - case "SFX": - case "PCE": - path = PathManager.MakeAbsolutePath(Global.Config.PathPCECheats, "PCE"); - break; - case "GB": - path = PathManager.MakeAbsolutePath(Global.Config.PathGBCheats, "GB"); - break; - case "TI83": - path = PathManager.MakeAbsolutePath(Global.Config.PathTI83Cheats, "TI83"); - break; - default: - path = PathManager.GetBasePathAbsolute(); - break; + sysId = "PCE"; } + + PathEntry pathEntry = Global.Config.PathEntries[sysId, "Cheats"]; + if (pathEntry == null) + { + pathEntry = Global.Config.PathEntries[sysId, "Base"]; + } + string path = pathEntry.Path; + var f = new FileInfo(path); if (f.Directory != null && f.Directory.Exists == false) { diff --git a/BizHawk.MultiClient/tools/RamSearch.cs b/BizHawk.MultiClient/tools/RamSearch.cs index a62cc91998..7aa610ebe8 100644 --- a/BizHawk.MultiClient/tools/RamSearch.cs +++ b/BizHawk.MultiClient/tools/RamSearch.cs @@ -1878,7 +1878,7 @@ namespace BizHawk.MultiClient var ofd = new OpenFileDialog(); if (currentFile.Length > 0) ofd.FileName = Path.GetFileNameWithoutExtension(currentFile); - ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath); + ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath); ofd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; ofd.RestoreDirectory = true; if (currentFile.Length > 0) diff --git a/BizHawk.MultiClient/tools/RamWatch.cs b/BizHawk.MultiClient/tools/RamWatch.cs index ac715dff17..4f58f61bd4 100644 --- a/BizHawk.MultiClient/tools/RamWatch.cs +++ b/BizHawk.MultiClient/tools/RamWatch.cs @@ -562,7 +562,7 @@ namespace BizHawk.MultiClient var ofd = new OpenFileDialog(); if (currentFile.Length > 0) ofd.FileName = Path.GetFileNameWithoutExtension(currentFile); - ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath); + ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath); ofd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; ofd.RestoreDirectory = true; diff --git a/BizHawk.MultiClient/tools/TAStudio.cs b/BizHawk.MultiClient/tools/TAStudio.cs index bd0533c624..03b581b947 100644 --- a/BizHawk.MultiClient/tools/TAStudio.cs +++ b/BizHawk.MultiClient/tools/TAStudio.cs @@ -451,7 +451,7 @@ namespace BizHawk.MultiClient { SaveFileDialog sfd = new SaveFileDialog { - InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath), + InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath), DefaultExt = "." + Global.Config.MovieExtension, FileName = Global.MovieSession.Movie.Filename }; diff --git a/BizHawk.MultiClient/tools/TraceLogger.cs b/BizHawk.MultiClient/tools/TraceLogger.cs index e25b06c72e..1a3115e371 100644 --- a/BizHawk.MultiClient/tools/TraceLogger.cs +++ b/BizHawk.MultiClient/tools/TraceLogger.cs @@ -232,7 +232,7 @@ namespace BizHawk.MultiClient FileBox.Visible = true; BrowseBox.Visible = true; string name = PathManager.FilesystemSafeName(Global.Game); - string filename = Path.Combine(PathManager.MakeAbsolutePath(Global.Config.LogPath), name) + ".txt"; + string filename = Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath), name) + ".txt"; LogFile = new FileInfo(filename); if (LogFile.Directory != null && !LogFile.Directory.Exists) { @@ -303,7 +303,7 @@ namespace BizHawk.MultiClient { string name = PathManager.FilesystemSafeName(Global.Game); sfd.FileName = name + ".txt"; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.LogPath); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath); } else if (!String.IsNullOrWhiteSpace(LogFile.FullName)) { @@ -313,7 +313,7 @@ namespace BizHawk.MultiClient else { sfd.FileName = Path.GetFileNameWithoutExtension(LogFile.FullName); - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.LogPath); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath); } sfd.Filter = "Text Files (*.txt)|*.txt|Log Files (*.log)|*.log|All Files|*.*"; diff --git a/BizHawk.MultiClient/tools/WatchCommon.cs b/BizHawk.MultiClient/tools/WatchCommon.cs index 95b5399a4f..70427e5b2a 100644 --- a/BizHawk.MultiClient/tools/WatchCommon.cs +++ b/BizHawk.MultiClient/tools/WatchCommon.cs @@ -187,12 +187,12 @@ namespace BizHawk.MultiClient else if (!(Global.Emulator is NullEmulator)) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game); - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath); } else { sfd.FileName = "NULL"; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath); } sfd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; sfd.RestoreDirectory = true;