tastudio: properly save/load column settings.
wrap MainForm savestate functions that tastudio can now control into IControlMainform.
This commit is contained in:
parent
12388cbe3d
commit
72b650d606
|
@ -2,6 +2,18 @@
|
||||||
{
|
{
|
||||||
public interface IControlMainform
|
public interface IControlMainform
|
||||||
{
|
{
|
||||||
|
bool WantsToControlSavestates { get; }
|
||||||
|
|
||||||
|
void SaveState();
|
||||||
|
void LoadState();
|
||||||
|
void SaveStateAs();
|
||||||
|
void LoadStateAs();
|
||||||
|
void SaveQuickSave(int slot);
|
||||||
|
void LoadQuickSave(int slot);
|
||||||
|
void SelectSlot(int slot);
|
||||||
|
void PreviousSlot();
|
||||||
|
void NextSlot();
|
||||||
|
|
||||||
bool WantsToControlReadOnly { get; }
|
bool WantsToControlReadOnly { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -343,10 +343,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
//TAStudio
|
//TAStudio
|
||||||
case "Add Branch":
|
case "Add Branch":
|
||||||
GlobalWin.Tools.TAStudio.BookMarkControl.AddBranchExternal();
|
GlobalWin.Tools.TAStudio.AddBranchExternal();
|
||||||
break;
|
break;
|
||||||
case "Delete Branch":
|
case "Delete Branch":
|
||||||
GlobalWin.Tools.TAStudio.BookMarkControl.RemoveBranchExtrenal();
|
GlobalWin.Tools.TAStudio.RemoveBranchExtrenal();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// SNES
|
// SNES
|
||||||
|
|
|
@ -1570,22 +1570,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectSlot(int num)
|
|
||||||
{
|
|
||||||
if (Global.Emulator.HasSavestates())
|
|
||||||
{
|
|
||||||
if (GlobalWin.Tools.Has<TAStudio>())
|
|
||||||
{
|
|
||||||
GlobalWin.Tools.TAStudio.BookMarkControl.SelectBranchExternal(num);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Global.Config.SaveSlot = num;
|
|
||||||
SaveSlotSelectedMessage();
|
|
||||||
UpdateStatusSlots();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RewireSound()
|
private void RewireSound()
|
||||||
{
|
{
|
||||||
if (_dumpProxy != null)
|
if (_dumpProxy != null)
|
||||||
|
@ -1888,75 +1872,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveStateAs()
|
|
||||||
{
|
|
||||||
if (!Global.Emulator.HasSavestates())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GlobalWin.Tools.Has<TAStudio>())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = PathManager.GetSaveStatePath(Global.Game);
|
|
||||||
|
|
||||||
var file = new FileInfo(path);
|
|
||||||
if (file.Directory != null && file.Directory.Exists == false)
|
|
||||||
{
|
|
||||||
file.Directory.Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
var sfd = new SaveFileDialog
|
|
||||||
{
|
|
||||||
AddExtension = true,
|
|
||||||
DefaultExt = "State",
|
|
||||||
Filter = "Save States (*.State)|*.State|All Files|*.*",
|
|
||||||
InitialDirectory = path,
|
|
||||||
FileName = PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave0.State"
|
|
||||||
};
|
|
||||||
|
|
||||||
var result = sfd.ShowHawkDialog();
|
|
||||||
if (result == DialogResult.OK)
|
|
||||||
{
|
|
||||||
SaveState(sfd.FileName, sfd.FileName, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadStateAs()
|
|
||||||
{
|
|
||||||
if (!Global.Emulator.HasSavestates())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GlobalWin.Tools.Has<TAStudio>())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ofd = new OpenFileDialog
|
|
||||||
{
|
|
||||||
InitialDirectory = PathManager.GetSaveStatePath(Global.Game),
|
|
||||||
Filter = "Save States (*.State)|*.State|All Files|*.*",
|
|
||||||
RestoreDirectory = true
|
|
||||||
};
|
|
||||||
|
|
||||||
var result = ofd.ShowHawkDialog();
|
|
||||||
if (result != DialogResult.OK)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (File.Exists(ofd.FileName) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadState(ofd.FileName, Path.GetFileName(ofd.FileName));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveSlotSelectedMessage()
|
private void SaveSlotSelectedMessage()
|
||||||
{
|
{
|
||||||
int slot = Global.Config.SaveSlot;
|
int slot = Global.Config.SaveSlot;
|
||||||
|
@ -2196,62 +2111,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
ConfigService.Save(PathManager.DefaultIniPath, Global.Config);
|
ConfigService.Save(PathManager.DefaultIniPath, Global.Config);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PreviousSlot()
|
|
||||||
{
|
|
||||||
if (Global.Emulator.HasSavestates())
|
|
||||||
{
|
|
||||||
if (GlobalWin.Tools.Has<TAStudio>())
|
|
||||||
{
|
|
||||||
GlobalWin.Tools.TAStudio.BookMarkControl.SelectBranchExternal(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Global.Config.SaveSlot == 0)
|
|
||||||
{
|
|
||||||
Global.Config.SaveSlot = 9; // Wrap to end of slot list
|
|
||||||
}
|
|
||||||
else if (Global.Config.SaveSlot > 9)
|
|
||||||
{
|
|
||||||
Global.Config.SaveSlot = 9; // Meh, just in case
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Global.Config.SaveSlot--;
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveSlotSelectedMessage();
|
|
||||||
UpdateStatusSlots();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NextSlot()
|
|
||||||
{
|
|
||||||
if (Global.Emulator.HasSavestates())
|
|
||||||
{
|
|
||||||
if (GlobalWin.Tools.Has<TAStudio>())
|
|
||||||
{
|
|
||||||
GlobalWin.Tools.TAStudio.BookMarkControl.SelectBranchExternal(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Global.Config.SaveSlot >= 9)
|
|
||||||
{
|
|
||||||
Global.Config.SaveSlot = 0; // Wrap to beginning of slot list
|
|
||||||
}
|
|
||||||
else if (Global.Config.SaveSlot < 0)
|
|
||||||
{
|
|
||||||
Global.Config.SaveSlot = 0; // Meh, just in case
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Global.Config.SaveSlot++;
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveSlotSelectedMessage();
|
|
||||||
UpdateStatusSlots();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void ToggleFPS()
|
private static void ToggleFPS()
|
||||||
{
|
{
|
||||||
Global.Config.DisplayFPS ^= true;
|
Global.Config.DisplayFPS ^= true;
|
||||||
|
@ -2708,112 +2567,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int SlotToInt(string slot)
|
|
||||||
{
|
|
||||||
return int.Parse(slot.Substring(slot.Length - 1, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadState(string path, string userFriendlyStateName, bool fromLua = false, bool supressOSD = false) // Move to client.common
|
|
||||||
{
|
|
||||||
if (!Global.Emulator.HasSavestates())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GlobalWin.Tools.Has<TAStudio>())
|
|
||||||
{
|
|
||||||
GlobalWin.Tools.TAStudio.BookMarkControl.LoadBranchExternal();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If from lua, disable counting rerecords
|
|
||||||
bool wasCountingRerecords = Global.MovieSession.Movie.IsCountingRerecords;
|
|
||||||
|
|
||||||
if (fromLua)
|
|
||||||
Global.MovieSession.Movie.IsCountingRerecords = false;
|
|
||||||
|
|
||||||
GlobalWin.DisplayManager.NeedsToPaint = true;
|
|
||||||
|
|
||||||
if (SavestateManager.LoadStateFile(path, userFriendlyStateName))
|
|
||||||
{
|
|
||||||
SetMainformMovieInfo();
|
|
||||||
GlobalWin.OSD.ClearGUIText();
|
|
||||||
GlobalWin.Tools.UpdateToolsBefore(fromLua);
|
|
||||||
UpdateToolsAfter(fromLua);
|
|
||||||
UpdateToolsLoadstate();
|
|
||||||
Global.AutoFireController.ClearStarts();
|
|
||||||
|
|
||||||
if (!supressOSD)
|
|
||||||
{
|
|
||||||
GlobalWin.OSD.AddMessage("Loaded state: " + userFriendlyStateName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GlobalWin.Tools.Has<LuaConsole>())
|
|
||||||
{
|
|
||||||
GlobalWin.Tools.LuaConsole.LuaImp.CallLoadStateEvent(userFriendlyStateName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GlobalWin.OSD.AddMessage("Loadstate error!");
|
|
||||||
}
|
|
||||||
|
|
||||||
Global.MovieSession.Movie.IsCountingRerecords = wasCountingRerecords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadQuickSave(string quickSlotName, bool fromLua = false, bool supressOSD = false)
|
|
||||||
{
|
|
||||||
if (!Global.Emulator.HasSavestates())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GlobalWin.Tools.Has<TAStudio>())
|
|
||||||
{
|
|
||||||
GlobalWin.Tools.TAStudio.BookMarkControl.LoadBranchExternal(SlotToInt(quickSlotName));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = PathManager.SaveStatePrefix(Global.Game) + "." + quickSlotName + ".State";
|
|
||||||
if (File.Exists(path) == false)
|
|
||||||
{
|
|
||||||
GlobalWin.OSD.AddMessage("Unable to load " + quickSlotName + ".State");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadState(path, quickSlotName, fromLua, supressOSD);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveState(string path, string userFriendlyStateName, bool fromLua)
|
|
||||||
{
|
|
||||||
if (!Global.Emulator.HasSavestates())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GlobalWin.Tools.Has<TAStudio>())
|
|
||||||
{
|
|
||||||
GlobalWin.Tools.TAStudio.BookMarkControl.UpdateBranchExternal();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SavestateManager.SaveStateFile(path, userFriendlyStateName);
|
|
||||||
|
|
||||||
GlobalWin.OSD.AddMessage("Saved state: " + userFriendlyStateName);
|
|
||||||
}
|
|
||||||
catch (IOException)
|
|
||||||
{
|
|
||||||
GlobalWin.OSD.AddMessage("Unable to save state " + path);
|
|
||||||
}
|
|
||||||
if (!fromLua)
|
|
||||||
{
|
|
||||||
UpdateStatusSlots();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alt key hacks
|
// Alt key hacks
|
||||||
protected override void WndProc(ref Message m)
|
protected override void WndProc(ref Message m)
|
||||||
{
|
{
|
||||||
|
@ -3725,50 +3478,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: should backup logic be stuffed in into Client.Common.SaveStateManager?
|
|
||||||
public void SaveQuickSave(string quickSlotName)
|
|
||||||
{
|
|
||||||
if (!Global.Emulator.HasSavestates())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GlobalWin.Tools.Has<TAStudio>())
|
|
||||||
{
|
|
||||||
GlobalWin.Tools.TAStudio.BookMarkControl.UpdateBranchExternal(SlotToInt(quickSlotName));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = PathManager.SaveStatePrefix(Global.Game) + "." + quickSlotName + ".State";
|
|
||||||
|
|
||||||
var file = new FileInfo(path);
|
|
||||||
if (file.Directory != null && file.Directory.Exists == false)
|
|
||||||
{
|
|
||||||
file.Directory.Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Make backup first
|
|
||||||
if (Global.Config.BackupSavestates && file.Exists)
|
|
||||||
{
|
|
||||||
var backup = path + ".bak";
|
|
||||||
var backupFile = new FileInfo(backup);
|
|
||||||
if (backupFile.Exists)
|
|
||||||
{
|
|
||||||
backupFile.Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
File.Move(path, backup);
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveState(path, quickSlotName, false);
|
|
||||||
|
|
||||||
if (GlobalWin.Tools.Has<LuaConsole>())
|
|
||||||
{
|
|
||||||
GlobalWin.Tools.LuaConsole.LuaImp.CallSaveStateEvent(quickSlotName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void CommitCoreSettingsToConfig()
|
private static void CommitCoreSettingsToConfig()
|
||||||
{
|
{
|
||||||
// save settings object
|
// save settings object
|
||||||
|
@ -3894,11 +3603,305 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
// TODO: move me
|
// TODO: move me
|
||||||
public IControlMainform master { get; private set; }
|
public IControlMainform master { get; private set; }
|
||||||
|
|
||||||
public void RelinquishControl(IControlMainform master)
|
public void RelinquishControl(IControlMainform master)
|
||||||
{
|
{
|
||||||
this.master = master;
|
this.master = master;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int SlotToInt(string slot)
|
||||||
|
{
|
||||||
|
return int.Parse(slot.Substring(slot.Length - 1, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadState(string path, string userFriendlyStateName, bool fromLua = false, bool supressOSD = false) // Move to client.common
|
||||||
|
{
|
||||||
|
if (!Global.Emulator.HasSavestates())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsSlave && master.WantsToControlSavestates)
|
||||||
|
{
|
||||||
|
master.LoadState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If from lua, disable counting rerecords
|
||||||
|
bool wasCountingRerecords = Global.MovieSession.Movie.IsCountingRerecords;
|
||||||
|
|
||||||
|
if (fromLua)
|
||||||
|
Global.MovieSession.Movie.IsCountingRerecords = false;
|
||||||
|
|
||||||
|
GlobalWin.DisplayManager.NeedsToPaint = true;
|
||||||
|
|
||||||
|
if (SavestateManager.LoadStateFile(path, userFriendlyStateName))
|
||||||
|
{
|
||||||
|
SetMainformMovieInfo();
|
||||||
|
GlobalWin.OSD.ClearGUIText();
|
||||||
|
GlobalWin.Tools.UpdateToolsBefore(fromLua);
|
||||||
|
UpdateToolsAfter(fromLua);
|
||||||
|
UpdateToolsLoadstate();
|
||||||
|
Global.AutoFireController.ClearStarts();
|
||||||
|
|
||||||
|
if (!supressOSD)
|
||||||
|
{
|
||||||
|
GlobalWin.OSD.AddMessage("Loaded state: " + userFriendlyStateName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GlobalWin.Tools.Has<LuaConsole>())
|
||||||
|
{
|
||||||
|
GlobalWin.Tools.LuaConsole.LuaImp.CallLoadStateEvent(userFriendlyStateName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GlobalWin.OSD.AddMessage("Loadstate error!");
|
||||||
|
}
|
||||||
|
|
||||||
|
Global.MovieSession.Movie.IsCountingRerecords = wasCountingRerecords;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadQuickSave(string quickSlotName, bool fromLua = false, bool supressOSD = false)
|
||||||
|
{
|
||||||
|
if (!Global.Emulator.HasSavestates())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsSlave && master.WantsToControlSavestates)
|
||||||
|
{
|
||||||
|
master.LoadQuickSave(SlotToInt(quickSlotName));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var path = PathManager.SaveStatePrefix(Global.Game) + "." + quickSlotName + ".State";
|
||||||
|
if (File.Exists(path) == false)
|
||||||
|
{
|
||||||
|
GlobalWin.OSD.AddMessage("Unable to load " + quickSlotName + ".State");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadState(path, quickSlotName, fromLua, supressOSD);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveState(string path, string userFriendlyStateName, bool fromLua)
|
||||||
|
{
|
||||||
|
if (!Global.Emulator.HasSavestates())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsSlave && master.WantsToControlSavestates)
|
||||||
|
{
|
||||||
|
master.SaveState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SavestateManager.SaveStateFile(path, userFriendlyStateName);
|
||||||
|
|
||||||
|
GlobalWin.OSD.AddMessage("Saved state: " + userFriendlyStateName);
|
||||||
|
}
|
||||||
|
catch (IOException)
|
||||||
|
{
|
||||||
|
GlobalWin.OSD.AddMessage("Unable to save state " + path);
|
||||||
|
}
|
||||||
|
if (!fromLua)
|
||||||
|
{
|
||||||
|
UpdateStatusSlots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: should backup logic be stuffed in into Client.Common.SaveStateManager?
|
||||||
|
public void SaveQuickSave(string quickSlotName)
|
||||||
|
{
|
||||||
|
if (!Global.Emulator.HasSavestates())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsSlave && master.WantsToControlSavestates)
|
||||||
|
{
|
||||||
|
master.SaveQuickSave(SlotToInt(quickSlotName));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var path = PathManager.SaveStatePrefix(Global.Game) + "." + quickSlotName + ".State";
|
||||||
|
|
||||||
|
var file = new FileInfo(path);
|
||||||
|
if (file.Directory != null && file.Directory.Exists == false)
|
||||||
|
{
|
||||||
|
file.Directory.Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Make backup first
|
||||||
|
if (Global.Config.BackupSavestates && file.Exists)
|
||||||
|
{
|
||||||
|
var backup = path + ".bak";
|
||||||
|
var backupFile = new FileInfo(backup);
|
||||||
|
if (backupFile.Exists)
|
||||||
|
{
|
||||||
|
backupFile.Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
File.Move(path, backup);
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveState(path, quickSlotName, false);
|
||||||
|
|
||||||
|
if (GlobalWin.Tools.Has<LuaConsole>())
|
||||||
|
{
|
||||||
|
GlobalWin.Tools.LuaConsole.LuaImp.CallSaveStateEvent(quickSlotName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveStateAs()
|
||||||
|
{
|
||||||
|
if (!Global.Emulator.HasSavestates())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsSlave && master.WantsToControlSavestates)
|
||||||
|
{
|
||||||
|
master.SaveStateAs();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var path = PathManager.GetSaveStatePath(Global.Game);
|
||||||
|
|
||||||
|
var file = new FileInfo(path);
|
||||||
|
if (file.Directory != null && file.Directory.Exists == false)
|
||||||
|
{
|
||||||
|
file.Directory.Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
var sfd = new SaveFileDialog
|
||||||
|
{
|
||||||
|
AddExtension = true,
|
||||||
|
DefaultExt = "State",
|
||||||
|
Filter = "Save States (*.State)|*.State|All Files|*.*",
|
||||||
|
InitialDirectory = path,
|
||||||
|
FileName = PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave0.State"
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = sfd.ShowHawkDialog();
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
SaveState(sfd.FileName, sfd.FileName, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadStateAs()
|
||||||
|
{
|
||||||
|
if (!Global.Emulator.HasSavestates())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsSlave && master.WantsToControlSavestates)
|
||||||
|
{
|
||||||
|
master.LoadStateAs();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ofd = new OpenFileDialog
|
||||||
|
{
|
||||||
|
InitialDirectory = PathManager.GetSaveStatePath(Global.Game),
|
||||||
|
Filter = "Save States (*.State)|*.State|All Files|*.*",
|
||||||
|
RestoreDirectory = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = ofd.ShowHawkDialog();
|
||||||
|
if (result != DialogResult.OK)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (File.Exists(ofd.FileName) == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadState(ofd.FileName, Path.GetFileName(ofd.FileName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectSlot(int slot)
|
||||||
|
{
|
||||||
|
if (Global.Emulator.HasSavestates())
|
||||||
|
{
|
||||||
|
if (IsSlave && master.WantsToControlSavestates)
|
||||||
|
{
|
||||||
|
master.SelectSlot(slot);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Global.Config.SaveSlot = slot;
|
||||||
|
SaveSlotSelectedMessage();
|
||||||
|
UpdateStatusSlots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PreviousSlot()
|
||||||
|
{
|
||||||
|
if (Global.Emulator.HasSavestates())
|
||||||
|
{
|
||||||
|
if (IsSlave && master.WantsToControlSavestates)
|
||||||
|
{
|
||||||
|
master.PreviousSlot();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Global.Config.SaveSlot == 0)
|
||||||
|
{
|
||||||
|
Global.Config.SaveSlot = 9; // Wrap to end of slot list
|
||||||
|
}
|
||||||
|
else if (Global.Config.SaveSlot > 9)
|
||||||
|
{
|
||||||
|
Global.Config.SaveSlot = 9; // Meh, just in case
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Global.Config.SaveSlot--;
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveSlotSelectedMessage();
|
||||||
|
UpdateStatusSlots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NextSlot()
|
||||||
|
{
|
||||||
|
if (Global.Emulator.HasSavestates())
|
||||||
|
{
|
||||||
|
if (IsSlave && master.WantsToControlSavestates)
|
||||||
|
{
|
||||||
|
master.NextSlot();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Global.Config.SaveSlot >= 9)
|
||||||
|
{
|
||||||
|
Global.Config.SaveSlot = 0; // Wrap to beginning of slot list
|
||||||
|
}
|
||||||
|
else if (Global.Config.SaveSlot < 0)
|
||||||
|
{
|
||||||
|
Global.Config.SaveSlot = 0; // Meh, just in case
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Global.Config.SaveSlot++;
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveSlotSelectedMessage();
|
||||||
|
UpdateStatusSlots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ToggleReadOnly()
|
private void ToggleReadOnly()
|
||||||
{
|
{
|
||||||
if (IsSlave && master.WantsToControlReadOnly)
|
if (IsSlave && master.WantsToControlReadOnly)
|
||||||
|
|
|
@ -7,6 +7,18 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class GenericDebugger : IControlMainform
|
public partial class GenericDebugger : IControlMainform
|
||||||
{
|
{
|
||||||
|
public bool WantsToControlSavestates { get { return false; } }
|
||||||
|
|
||||||
|
public void SaveState() { }
|
||||||
|
public void LoadState() { }
|
||||||
|
public void SaveStateAs() { }
|
||||||
|
public void LoadStateAs() { }
|
||||||
|
public void SaveQuickSave(int slot) { }
|
||||||
|
public void LoadQuickSave(int slot) { }
|
||||||
|
public void SelectSlot(int slot) { }
|
||||||
|
public void PreviousSlot() { }
|
||||||
|
public void NextSlot() { }
|
||||||
|
|
||||||
public bool WantsToControlReadOnly { get { return false; } }
|
public bool WantsToControlReadOnly { get { return false; } }
|
||||||
public void ToggleReadOnly() { }
|
public void ToggleReadOnly() { }
|
||||||
|
|
||||||
|
|
|
@ -1674,7 +1674,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private System.Windows.Forms.ToolStripMenuItem scrollToCenterToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem scrollToCenterToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem applyPatternToPaintedInputToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem applyPatternToPaintedInputToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem onlyOnAutoFireColumnsToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem onlyOnAutoFireColumnsToolStripMenuItem;
|
||||||
public BookmarksBranchesBox BookMarkControl;
|
private BookmarksBranchesBox BookMarkControl;
|
||||||
private System.Windows.Forms.ToolStripMenuItem BranchContextMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem BranchContextMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator25;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator25;
|
||||||
private System.Windows.Forms.ToolStripMenuItem wheelScrollSpeedToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem wheelScrollSpeedToolStripMenuItem;
|
||||||
|
|
|
@ -6,7 +6,47 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
private bool _suppressAskSave = false;
|
private bool _suppressAskSave = false;
|
||||||
|
|
||||||
|
public bool WantsToControlSavestates { get { return true; } }
|
||||||
|
|
||||||
|
public void SaveState()
|
||||||
|
{
|
||||||
|
BookMarkControl.UpdateBranchExternal();
|
||||||
|
}
|
||||||
|
public void LoadState()
|
||||||
|
{
|
||||||
|
BookMarkControl.LoadBranchExternal();
|
||||||
|
}
|
||||||
|
public void SaveStateAs()
|
||||||
|
{
|
||||||
|
// dummy
|
||||||
|
}
|
||||||
|
public void LoadStateAs()
|
||||||
|
{
|
||||||
|
// dummy
|
||||||
|
}
|
||||||
|
public void SaveQuickSave(int slot)
|
||||||
|
{
|
||||||
|
BookMarkControl.UpdateBranchExternal(slot);
|
||||||
|
}
|
||||||
|
public void LoadQuickSave(int slot)
|
||||||
|
{
|
||||||
|
BookMarkControl.LoadBranchExternal(slot);
|
||||||
|
}
|
||||||
|
public void SelectSlot(int slot)
|
||||||
|
{
|
||||||
|
BookMarkControl.SelectBranchExternal(slot);
|
||||||
|
}
|
||||||
|
public void PreviousSlot()
|
||||||
|
{
|
||||||
|
BookMarkControl.SelectBranchExternal(false);
|
||||||
|
}
|
||||||
|
public void NextSlot()
|
||||||
|
{
|
||||||
|
BookMarkControl.SelectBranchExternal(true);
|
||||||
|
}
|
||||||
|
|
||||||
public bool WantsToControlReadOnly { get { return false; } }
|
public bool WantsToControlReadOnly { get { return false; } }
|
||||||
|
|
||||||
public void ToggleReadOnly()
|
public void ToggleReadOnly()
|
||||||
{
|
{
|
||||||
GlobalWin.OSD.AddMessage("TAStudio does not allow manual readonly toggle");
|
GlobalWin.OSD.AddMessage("TAStudio does not allow manual readonly toggle");
|
||||||
|
@ -31,7 +71,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public bool Rewind()
|
public bool Rewind()
|
||||||
{
|
{
|
||||||
GoToPreviousFrame();
|
GoToPreviousFrame(); // todo: behave as normal rewind in differentiating between hitting rewind once and holding it.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,10 +296,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetTasMovieCallbacks()
|
private void SetTasMovieCallbacks(TasMovie movie = null)
|
||||||
{
|
{
|
||||||
CurrentTasMovie.ClientSettingsForSave = ClientSettingsForSave;
|
if (movie == null)
|
||||||
CurrentTasMovie.GetClientSettingsOnLoad = GetClientSettingsOnLoad;
|
movie = CurrentTasMovie;
|
||||||
|
movie.ClientSettingsForSave = ClientSettingsForSave;
|
||||||
|
movie.GetClientSettingsOnLoad = GetClientSettingsOnLoad;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ClientSettingsForSave()
|
private string ClientSettingsForSave()
|
||||||
|
@ -343,8 +345,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
column.Visible = false;
|
column.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TasView.AllColumns.ColumnsChanged();
|
TasView.AllColumns.ColumnsChanged();
|
||||||
|
|
||||||
|
|
||||||
// Patterns
|
// Patterns
|
||||||
int bStart = 0;
|
int bStart = 0;
|
||||||
|
@ -437,7 +438,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (!HandleMovieLoadStuff(newMovie))
|
if (!HandleMovieLoadStuff(newMovie))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SetUpColumns();
|
if (TasView.AllColumns.Count() == 0)
|
||||||
|
SetUpColumns();
|
||||||
GoToFrame(CurrentTasMovie.Session.CurrentFrame);
|
GoToFrame(CurrentTasMovie.Session.CurrentFrame);
|
||||||
CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch;
|
CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch;
|
||||||
|
|
||||||
|
@ -476,9 +478,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private bool HandleMovieLoadStuff(TasMovie movie = null)
|
private bool HandleMovieLoadStuff(TasMovie movie = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
WantsToControlStopMovie = false;
|
|
||||||
bool result;
|
bool result;
|
||||||
|
WantsToControlStopMovie = false;
|
||||||
|
|
||||||
if (movie == null)
|
if (movie == null)
|
||||||
{
|
{
|
||||||
movie = CurrentTasMovie;
|
movie = CurrentTasMovie;
|
||||||
|
@ -486,8 +488,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = StartNewMovieWrapper(false, movie);
|
result = StartNewMovieWrapper(false, movie);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
WantsToControlStopMovie = true;
|
WantsToControlStopMovie = true;
|
||||||
|
|
||||||
CurrentTasMovie.ChangeLog.ClearLog();
|
CurrentTasMovie.ChangeLog.ClearLog();
|
||||||
|
@ -503,6 +507,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_initializing = true;
|
_initializing = true;
|
||||||
if (movie == null)
|
if (movie == null)
|
||||||
movie = CurrentTasMovie;
|
movie = CurrentTasMovie;
|
||||||
|
SetTasMovieCallbacks(movie as TasMovie);
|
||||||
bool result = GlobalWin.MainForm.StartNewMovie(movie, record);
|
bool result = GlobalWin.MainForm.StartNewMovie(movie, record);
|
||||||
_initializing = false;
|
_initializing = false;
|
||||||
|
|
||||||
|
@ -686,6 +691,16 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_hackyDontUpdate = false;
|
_hackyDontUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddBranchExternal()
|
||||||
|
{
|
||||||
|
BookMarkControl.AddBranchExternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveBranchExtrenal()
|
||||||
|
{
|
||||||
|
BookMarkControl.RemoveBranchExtrenal();
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateOtherTools() // a hack probably, surely there is a better way to do this
|
private void UpdateOtherTools() // a hack probably, surely there is a better way to do this
|
||||||
{
|
{
|
||||||
_hackyDontUpdate = true;
|
_hackyDontUpdate = true;
|
||||||
|
|
Loading…
Reference in New Issue