From 2aeedf074e2974ffa313a53f8957b8034a27fda3 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 22 Apr 2012 13:56:34 +0000 Subject: [PATCH] Fix Load/Save Named State to default to the correct savestate path rather than the most recently used path. Fix so that these functions can not be accessed during Null emulator via hotkey --- BizHawk.MultiClient/MainForm.cs | 6 ++++-- BizHawk.MultiClient/config/PathManager.cs | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index fc0e5e6f5f..6a3f4b4ae7 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -2021,8 +2021,9 @@ namespace BizHawk.MultiClient private void SaveStateAs() { + if (IsNullEmulator()) return; var sfd = new SaveFileDialog(); - string path = PathManager.SaveStatePrefix(Global.Game); + string path = PathManager.GetSaveStatePath(Global.Game); sfd.InitialDirectory = path; sfd.FileName = PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave0.State"; var file = new FileInfo(path); @@ -2078,8 +2079,9 @@ namespace BizHawk.MultiClient private void LoadStateAs() { + if (IsNullEmulator()) return; var ofd = new OpenFileDialog(); - ofd.InitialDirectory = PathManager.SaveStatePrefix(Global.Game); + ofd.InitialDirectory = PathManager.GetSaveStatePath(Global.Game); ofd.Filter = "Save States (*.State)|*.State|All Files|*.*"; ofd.RestoreDirectory = true; diff --git a/BizHawk.MultiClient/config/PathManager.cs b/BizHawk.MultiClient/config/PathManager.cs index b0dc53c8c8..d6a628158f 100644 --- a/BizHawk.MultiClient/config/PathManager.cs +++ b/BizHawk.MultiClient/config/PathManager.cs @@ -310,6 +310,25 @@ namespace BizHawk.MultiClient } } + public static string GetSaveStatePath(GameInfo game) + { + switch (game.System) + { + default: return GetRomsPath(game.System); + case "A26": return MakeAbsolutePath(Global.Config.PathAtariSavestates, "A26"); + 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": return MakeAbsolutePath(Global.Config.PathGBSavestates, "GB"); + case "GEN": return MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN"); + case "NES": return MakeAbsolutePath(Global.Config.PathNESSavestates, "NES"); + case "TI83": return MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83"); + } + } + public static string SaveStatePrefix(GameInfo game) { string name = FilesystemSafeName(game);