Merge branch 'master' of https://github.com/TASVideos/BizHawk
This commit is contained in:
commit
1a15403690
|
@ -217,8 +217,8 @@ namespace BizHawk.Client.Common
|
|||
Bind("Ram Search", "Previous Operator"),
|
||||
Bind("Ram Search", "Next Operator"),
|
||||
|
||||
Bind("TAStudio", "Add Branch"),
|
||||
Bind("TAStudio", "Delete Branch"),
|
||||
Bind("TAStudio", "Add Branch", "Alt+Insert"),
|
||||
Bind("TAStudio", "Delete Branch", "Alt+Delete"),
|
||||
|
||||
Bind("SNES", "Toggle BG 1"),
|
||||
Bind("SNES", "Toggle BG 2"),
|
||||
|
|
|
@ -91,8 +91,8 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public TasBranch GetBranch(int index)
|
||||
{
|
||||
if (index >= Branches.Count)
|
||||
return null; // are we allowed?
|
||||
if (index >= Branches.Count || index < 0)
|
||||
return null;
|
||||
else
|
||||
return Branches[index];
|
||||
}
|
||||
|
|
|
@ -409,12 +409,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
}
|
||||
|
||||
bool swallow = !GlobalWin.MainForm.AllowInput;
|
||||
bool swallow = !GlobalWin.MainForm.AllowInput(false);
|
||||
|
||||
foreach (var ie in _NewEvents)
|
||||
{
|
||||
//events are swallowed in some cases:
|
||||
if (ie.EventType == InputEventType.Press && swallow)
|
||||
if (ie.LogicalButton.Alt && !GlobalWin.MainForm.AllowInput(true))
|
||||
{ }
|
||||
else if (ie.EventType == InputEventType.Press && swallow)
|
||||
{ }
|
||||
else
|
||||
EnqueueEvent(ie);
|
||||
|
@ -471,7 +473,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
lock (this)
|
||||
{
|
||||
if (InputEvents.Count == 0) return null;
|
||||
if (!GlobalWin.MainForm.AllowInput) return null;
|
||||
if (!GlobalWin.MainForm.AllowInput(false)) return null;
|
||||
|
||||
//we only listen to releases for input binding, because we need to distinguish releases of pure modifierkeys from modified keys
|
||||
//if you just pressed ctrl, wanting to bind ctrl, we'd see: pressed:ctrl, unpressed:ctrl
|
||||
|
|
|
@ -1267,7 +1267,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
try
|
||||
{
|
||||
externalToolFile = Assembly.ReflectionOnlyLoadFrom(fi.FullName);
|
||||
//externalToolFile = Assembly.ReflectionOnlyLoadFrom(fi.FullName);
|
||||
externalToolFile = Assembly.LoadFrom(fi.FullName);
|
||||
}
|
||||
catch (BadImageFormatException)
|
||||
{
|
||||
|
@ -1286,10 +1287,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
existing in another assembly, it raises the exception.
|
||||
|
||||
But the advantage of this is that memory footprint is reduced
|
||||
|
||||
EDIT: In fact, I have some trouble when loading Reflection only... moved to regular load
|
||||
*/
|
||||
try
|
||||
{
|
||||
assemblyTypes = externalToolFile.GetTypes();
|
||||
assemblyTypes = externalToolFile.GetTypes().Where<Type>(t => t != null && t.FullName == "BizHawk.Client.EmuHawk.CustomMainForm").ToArray<Type>();
|
||||
}
|
||||
catch (ReflectionTypeLoadException ex)
|
||||
{
|
||||
|
|
|
@ -341,6 +341,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.Tools.RamSearch.NextOperator();
|
||||
break;
|
||||
|
||||
//TAStudio
|
||||
case "Add Branch":
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.AddBranchExternal();
|
||||
break;
|
||||
case "Delete Branch":
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.RemoveBranchExtrenal();
|
||||
break;
|
||||
|
||||
// SNES
|
||||
case "Toggle BG 1":
|
||||
SNES_ToggleBG1();
|
||||
|
|
|
@ -667,33 +667,40 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <summary>
|
||||
/// Controls whether the app generates input events. should be turned off for most modal dialogs
|
||||
/// </summary>
|
||||
public bool AllowInput
|
||||
public bool AllowInput(bool yield_alt)
|
||||
{
|
||||
get
|
||||
// the main form gets input
|
||||
if (ActiveForm == this)
|
||||
{
|
||||
// the main form gets input
|
||||
if (ActiveForm == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// modals that need to capture input for binding purposes get input, of course
|
||||
if (ActiveForm is HotkeyConfig ||
|
||||
ActiveForm is ControllerConfig ||
|
||||
ActiveForm is TAStudio ||
|
||||
ActiveForm is VirtualpadTool)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// if no form is active on this process, then the background input setting applies
|
||||
if (ActiveForm == null && Global.Config.AcceptBackgroundInput)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//even more special logic for TAStudio:
|
||||
//TODO - implement by event filter in TAStudio
|
||||
if (ActiveForm is TAStudio)
|
||||
{
|
||||
if(yield_alt) return false;
|
||||
var ts = ActiveForm as TAStudio;
|
||||
if(ts.IsInMenuLoop)
|
||||
return false;
|
||||
}
|
||||
|
||||
// modals that need to capture input for binding purposes get input, of course
|
||||
if (ActiveForm is HotkeyConfig ||
|
||||
ActiveForm is ControllerConfig ||
|
||||
ActiveForm is TAStudio ||
|
||||
ActiveForm is VirtualpadTool)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// if no form is active on this process, then the background input setting applies
|
||||
if (ActiveForm == null && Global.Config.AcceptBackgroundInput)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1567,8 +1574,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Global.Emulator.HasSavestates())
|
||||
{
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
if (GlobalWin.Tools.Has<TAStudio>())
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.SelectBranchExternal(num);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1887,7 +1895,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
if (GlobalWin.Tools.Has<TAStudio>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1923,7 +1931,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
if (GlobalWin.Tools.Has<TAStudio>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2192,8 +2200,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Global.Emulator.HasSavestates())
|
||||
{
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
if (GlobalWin.Tools.Has<TAStudio>())
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.SelectBranchExternal(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2219,8 +2228,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Global.Emulator.HasSavestates())
|
||||
{
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
if (GlobalWin.Tools.Has<TAStudio>())
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.SelectBranchExternal(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2698,6 +2708,11 @@ 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())
|
||||
|
@ -2705,8 +2720,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
if (GlobalWin.Tools.Has<TAStudio>())
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.LoadBranchExternal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2752,8 +2768,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
if (GlobalWin.Tools.Has<TAStudio>())
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.LoadBranchExternal(SlotToInt(quickSlotName));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2775,8 +2792,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
if (GlobalWin.Tools.Has<TAStudio>())
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.UpdateBranchExternal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3715,8 +3733,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
if (GlobalWin.Tools.Has<TAStudio>())
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.UpdateBranchExternal(SlotToInt(quickSlotName));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,8 +174,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void UpdateBranch(TasBranch branch)
|
||||
{
|
||||
Movie.UpdateBranch(branch, CreateBranch());
|
||||
BranchView.Refresh();
|
||||
Tastudio.RefreshDialog();
|
||||
//BranchView.Refresh();
|
||||
}
|
||||
|
||||
private void LoadSelectedBranch()
|
||||
|
@ -188,6 +188,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Movie.CurrentBranch = index;
|
||||
LoadBranch(SelectedBranch);
|
||||
BranchView.Refresh();
|
||||
GlobalWin.OSD.AddMessage("Loaded branch " + Movie.CurrentBranch.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,12 +204,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void AddBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Branch();
|
||||
GlobalWin.OSD.AddMessage("Added branch " + Movie.CurrentBranch.ToString());
|
||||
}
|
||||
|
||||
private void AddBranchWithTexToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Branch();
|
||||
EditBranchTextPopUp(Movie.CurrentBranch);
|
||||
GlobalWin.OSD.AddMessage("Added branch " + Movie.CurrentBranch.ToString());
|
||||
}
|
||||
|
||||
private void LoadBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -220,8 +223,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (SelectedBranch != null)
|
||||
{
|
||||
UpdateBranch(SelectedBranch);
|
||||
Movie.CurrentBranch = BranchView.SelectedRows.First();
|
||||
UpdateBranch(SelectedBranch);
|
||||
GlobalWin.OSD.AddMessage("Saved branch " + Movie.CurrentBranch.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,6 +235,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
int index = BranchView.SelectedRows.First();
|
||||
EditBranchTextPopUp(index);
|
||||
GlobalWin.OSD.AddMessage("Edited branch " + index.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,16 +256,112 @@ namespace BizHawk.Client.EmuHawk
|
|||
Movie.RemoveBranch(SelectedBranch);
|
||||
BranchView.RowCount = Movie.BranchCount;
|
||||
|
||||
if (index == BranchView.SelectedRows.FirstOrDefault())
|
||||
if (index == Movie.BranchCount)
|
||||
{
|
||||
BranchView.ClearSelectedRows();
|
||||
BranchView.SelectRow(Movie.BranchCount - 1, true);
|
||||
}
|
||||
|
||||
BranchView.Refresh();
|
||||
//BranchView.Refresh();
|
||||
Tastudio.RefreshDialog();
|
||||
GlobalWin.OSD.AddMessage("Removed branch " + index.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void AddBranchExternal()
|
||||
{
|
||||
AddBranchToolStripMenuItem_Click(null, null);
|
||||
BranchView.SelectRow(Movie.CurrentBranch, true);
|
||||
BranchView.Refresh();
|
||||
}
|
||||
|
||||
public void LoadBranchExternal(int slot = -1)
|
||||
{
|
||||
if (slot != -1)
|
||||
{
|
||||
if (GetBranch(slot) != null)
|
||||
{
|
||||
BranchView.SelectRow(slot, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
NonExistentBranchMessage(slot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
LoadBranchToolStripMenuItem_Click(null, null);
|
||||
}
|
||||
|
||||
public void UpdateBranchExternal(int slot = -1)
|
||||
{
|
||||
if (slot != -1)
|
||||
{
|
||||
if (GetBranch(slot) != null)
|
||||
{
|
||||
BranchView.SelectRow(slot, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
NonExistentBranchMessage(slot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
UpdateBranchToolStripMenuItem_Click(null, null);
|
||||
}
|
||||
|
||||
public void RemoveBranchExtrenal()
|
||||
{
|
||||
RemoveBranchToolStripMenuItem_Click(null, null);
|
||||
}
|
||||
|
||||
public void SelectBranchExternal(int slot)
|
||||
{
|
||||
if (GetBranch(slot) != null)
|
||||
{
|
||||
BranchView.SelectRow(slot, true);
|
||||
BranchView.Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
NonExistentBranchMessage(slot);
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectBranchExternal(bool next)
|
||||
{
|
||||
if (SelectedBranch == null)
|
||||
{
|
||||
BranchView.SelectRow(Movie.CurrentBranch, true);
|
||||
BranchView.Refresh();
|
||||
return;
|
||||
}
|
||||
int sel = BranchView.SelectedRows.First();
|
||||
if (next)
|
||||
{
|
||||
if (GetBranch(sel + 1) != null)
|
||||
{
|
||||
BranchView.SelectRow(sel, false);
|
||||
BranchView.SelectRow(sel + 1, true);
|
||||
}
|
||||
}
|
||||
else // previous
|
||||
{
|
||||
if (GetBranch(sel - 1) != null)
|
||||
{
|
||||
BranchView.SelectRow(sel, false);
|
||||
BranchView.SelectRow(sel - 1, true);
|
||||
}
|
||||
}
|
||||
BranchView.Refresh();
|
||||
}
|
||||
|
||||
public void NonExistentBranchMessage(int slot)
|
||||
{
|
||||
string binding = Global.Config.HotkeyBindings.Where(x => x.DisplayName == "Add Branch").FirstOrDefault().Bindings;
|
||||
GlobalWin.OSD.AddMessage("Branch " + slot.ToString() + " does not exist");
|
||||
GlobalWin.OSD.AddMessage("Use " + binding + " to add branches");
|
||||
}
|
||||
|
||||
public void UpdateValues()
|
||||
{
|
||||
BranchView.RowCount = Movie.BranchCount;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -47,6 +47,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
get { return PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null); }
|
||||
}
|
||||
|
||||
public bool IsInMenuLoop { get; private set; }
|
||||
|
||||
[ConfigPersist]
|
||||
public TAStudioSettings Settings { get; set; }
|
||||
|
||||
|
@ -883,5 +885,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
CurrentTasMovie.InputLogLength > 0
|
||||
&& SaveRamEmulator != null;
|
||||
}
|
||||
|
||||
private void TASMenu_MenuActivate(object sender, EventArgs e)
|
||||
{
|
||||
IsInMenuLoop = true;
|
||||
}
|
||||
|
||||
private void TASMenu_MenuDeactivate(object sender, EventArgs e)
|
||||
{
|
||||
IsInMenuLoop = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,18 +124,18 @@
|
|||
<data name="RecentSubMenu.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALCgAA
|
||||
CwoBv0NmUwAAAllJREFUOE+VU8tuUlEUFR+x0ehEB40DhyZ+gQ78BSca/QUTB5oOdGLiTGnQFkmtqY2J
|
||||
aYO8Cp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
treT58BVRVnWl8vBbLEg7wNC/QPaMrwb4GT/jFa024mzQLe56c9GwjM7klXXlcw6ksyPSbLoKByc/lUq
|
||||
+TbQMwrODARAGAF3SxtexSMbf8vOCVp9ZyK+/euaW9TO+SfksOlprSjvoteAjU5rAYqSuFyvR1PR8Ewv
|
||||
GJii8rcAoYFSb+d4gDAgNI/8jGTHOFUroT3410QAHuk4Am4Vi/KOzz2JGxfFcLMZI3wK5T7ZqaXEhcYb
|
||||
WU2PKJM2H7Ra8XE14AQO91dTpk4k9JLq9YgYHghoxcWZPa/bSCH/C2o0orPaBo1GbDQee9VJxF+zoYFP
|
||||
wtpGWgpN0/uMRWgcyiG1WsSkBhxFwG0E7AV8z2lrKyxuYvgBs2kLr4z1XcLj4SA2gD+nBhxB8p1sxtKZ
|
||||
t4xR/otTDNdqS1oQw7ezx2/AfxVok1oAmh+WSt7v/MKLLgOtr3tEQD+sseeyPyX0dqHdVAOGq9XQPazX
|
||||
/JyzH9itY+SQ9LSSnKV8fkHANWvsoYc/JYaZERHAPzicBw9AoZBf+BnwTZEN/4G2N4egZg1eDz05cIHn
|
||||
tACmUgmeAtdhRsvlwH6x6Dr4+EESoO5B68JLo+eSOjMQwKDpGLgCJtDoBysgBXzQDOBifz8zcPh/aOgP
|
||||
7nYTiVA2JaoAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="TasStatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
T existingTool = (T)_tools.FirstOrDefault(x => x is T);
|
||||
|
||||
if (existingTool != null)
|
||||
if (existingTool != null && typeof(T) != typeof(IExternalToolForm))
|
||||
{
|
||||
if (existingTool.IsDisposed)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue