private void BeforeQuickLoad(object sender, BeforeQuickLoadEventArgs e) { if (treeView.SelectedNode.Tag is FileInfo) { treeView.SelectedNode = treeView.SelectedNode.Parent; } string path = Path.Combine(PathManager.GetSaveStatePath(Global.Game), string.Format(@"{0}\{1}", treeView.SelectedNode.FullPath, e.Name)); if (File.Exists(string.Format("{0}.State", path))) { try { ClientApi.LoadState(path); } #if DEBUG catch (TargetInvocationException ex) { MessageBox.Show(ex.Message); } #else catch (TargetInvocationException) {} #endif } e.Handled = true; }
//We will override F10 quickload behavior private void ClientApi_BeforeQuickLoad(object sender, BeforeQuickLoadEventArgs e) { if (e.Slot == 0) { string basePath = Path.Combine(PathManager.GetSaveStatePath(Global.Game), "Test"); ClientApi.LoadState(Path.Combine(basePath, e.Name)); e.Handled = true; } }
/// <summary> /// Raised before a quickload is done (just after pressing shortcut button) /// </summary> /// <param name="sender">Object who raised the event</param> /// <param name="quickSaveSlotName">Slot used for quickload</param> /// <param name="eventHandled">A boolean that can be set if users want to handle save themselves; if so, BizHawk won't do anything</param> public static void OnBeforeQuickLoad(object sender, string quickSaveSlotName, out bool eventHandled) { eventHandled = false; if (BeforeQuickLoad != null) { var e = new BeforeQuickLoadEventArgs(quickSaveSlotName); BeforeQuickLoad(sender, e); eventHandled = e.Handled; } }