diff --git a/BizHawk.Client.Common/SaveSlotManager.cs b/BizHawk.Client.Common/SaveSlotManager.cs index b5ac274971..38ad60b82b 100644 --- a/BizHawk.Client.Common/SaveSlotManager.cs +++ b/BizHawk.Client.Common/SaveSlotManager.cs @@ -99,5 +99,32 @@ namespace BizHawk.Client.Common ClearRedoList(); Update(); } + + public void SwapBackupSavestate(string path) + { + // Takes the .state and .bak files and swaps them + var state = new FileInfo(path); + var backup = new FileInfo(path + ".bak"); + var temp = new FileInfo(path + ".bak.tmp"); + + if (!state.Exists || !backup.Exists) + { + return; + } + + if (temp.Exists) + { + temp.Delete(); + } + + backup.CopyTo(path + ".bak.tmp"); + backup.Delete(); + state.CopyTo(path + ".bak"); + state.Delete(); + temp.CopyTo(path); + temp.Delete(); + + ToggleRedo(Global.Config.SaveSlot); + } } } diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index 8f34a0df82..9f6d03acf0 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -1874,7 +1874,7 @@ namespace BizHawk.Client.EmuHawk private void UndoSavestateContextMenuItem_Click(object sender, EventArgs e) { - SwapBackupSavestate( + _stateSlots.SwapBackupSavestate( PathManager.SaveStatePrefix(Global.Game) + ".QuickSave" + Global.Config.SaveSlot + diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 3724aa9849..64e9a8531d 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -3571,33 +3571,6 @@ namespace BizHawk.Client.EmuHawk } } - private void SwapBackupSavestate(string path) // Move inside Saveslot Manager - { - // Takes the .state and .bak files and swaps them - var state = new FileInfo(path); - var backup = new FileInfo(path + ".bak"); - var temp = new FileInfo(path + ".bak.tmp"); - - if (!state.Exists || !backup.Exists) - { - return; - } - - if (temp.Exists) - { - temp.Delete(); - } - - backup.CopyTo(path + ".bak.tmp"); - backup.Delete(); - state.CopyTo(path + ".bak"); - state.Delete(); - temp.CopyTo(path); - temp.Delete(); - - _stateSlots.ToggleRedo(Global.Config.SaveSlot); - } - private static void ProcessMovieImport(string fn) // Nothing Winform Specific here, move to Movie import { var d = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null);