Macro tool button select works
-Recent macros list now saves -Macros can now be saved/loaded from TAStudio.
This commit is contained in:
parent
db9fbced86
commit
c283f2d55a
|
@ -357,6 +357,9 @@ namespace BizHawk.Client.Common
|
|||
// TAStudio
|
||||
public TasStateManagerSettings DefaultTasProjSettings = new TasStateManagerSettings();
|
||||
|
||||
// Macro Tool
|
||||
public RecentFiles RecentMacros = new RecentFiles(8);
|
||||
|
||||
// Movie Settings
|
||||
public RecentFiles RecentMovies = new RecentFiles(8);
|
||||
public string DefaultAuthor = "default user";
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void RemoveFrom(int frame)
|
||||
{
|
||||
if (LagLog.Count >= frame)
|
||||
if (LagLog.Count >= frame && frame >= 0)
|
||||
LagLog.RemoveRange(frame, LagLog.Count - frame);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ using BizHawk.Client.Common;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class MacroInputTool
|
||||
public partial class MacroInputTool
|
||||
{
|
||||
private CheckBox[] _buttonBoxes;
|
||||
private void SetUpButtonBoxes()
|
||||
|
@ -33,32 +33,48 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_buttonBoxes[i].Parent = this;
|
||||
_buttonBoxes[i].AutoSize = true;
|
||||
_buttonBoxes[i].Checked = true;
|
||||
_buttonBoxes[i].CheckedChanged += ButtonBox_CheckedChanged;
|
||||
}
|
||||
|
||||
PositionBoxes();
|
||||
}
|
||||
|
||||
private bool _setting = false;
|
||||
private void ButtonBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (selectedZone == null)
|
||||
if (selectedZone == null || _setting)
|
||||
return;
|
||||
|
||||
CheckBox s = sender as CheckBox;
|
||||
s.ForeColor = s.Checked ? SystemColors.ControlText : SystemColors.ControlLight;
|
||||
s.ForeColor = s.Checked ? SystemColors.ControlText : SystemColors.ButtonShadow;
|
||||
s.Refresh();
|
||||
|
||||
// Update the selected zone's key
|
||||
var lg = Global.MovieSession.LogGeneratorInstance() as Bk2LogEntryGenerator;
|
||||
lg.SetSource(Global.MovieSession.MovieControllerAdapter);
|
||||
string key = lg.GenerateLogKey();
|
||||
key = key.Replace("LogKey:", "").Replace("#", "");
|
||||
key = key.Substring(0, key.Length - 1);
|
||||
|
||||
for (int i = 0; i < _buttonBoxes.Length; i++)
|
||||
key = key.Replace(_buttonBoxes[i].Text + "|", "");
|
||||
{
|
||||
if (!_buttonBoxes[i].Checked)
|
||||
key = key.Replace(_buttonBoxes[i].Text + "|", "");
|
||||
}
|
||||
key = key.Substring(0, key.Length - 1);
|
||||
|
||||
selectedZone.InputKey = key;
|
||||
}
|
||||
private void SetButtonBoxes()
|
||||
{
|
||||
if (selectedZone == null)
|
||||
return;
|
||||
|
||||
_setting = true;
|
||||
for (int i = 0; i < _buttonBoxes.Length; i++)
|
||||
_buttonBoxes[i].Checked = selectedZone.InputKey.Contains(_buttonBoxes[i].Text);
|
||||
_setting = false;
|
||||
}
|
||||
|
||||
private void PositionBoxes()
|
||||
{
|
||||
|
|
|
@ -26,19 +26,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
get { return Global.MovieSession.Movie as TasMovie; }
|
||||
}
|
||||
|
||||
[ConfigPersist]
|
||||
private MacroSettings Settings { get; set; }
|
||||
|
||||
class MacroSettings
|
||||
{
|
||||
public MacroSettings()
|
||||
{
|
||||
RecentMacro = new RecentFiles(8);
|
||||
}
|
||||
|
||||
public RecentFiles RecentMacro { get; set; }
|
||||
}
|
||||
|
||||
private bool _initializing = false;
|
||||
public MacroInputTool()
|
||||
{
|
||||
|
@ -60,8 +47,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
ReplaceBox.Enabled = CurrentTasMovie is TasMovie;
|
||||
PlaceNum.Enabled = CurrentTasMovie is TasMovie;
|
||||
|
||||
Settings = new MacroSettings();
|
||||
|
||||
MovieZone main = new MovieZone(CurrentTasMovie, 0, CurrentTasMovie.InputLogLength);
|
||||
main.Name = "Entire Movie";
|
||||
|
||||
|
@ -206,6 +191,41 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
SaveMacroAs(selectedZone);
|
||||
}
|
||||
|
||||
private void loadMacroToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MovieZone loadZone = LoadMacro();
|
||||
if (loadZone != null)
|
||||
{
|
||||
zones.Add(loadZone);
|
||||
ZonesList.Items.Add(loadZone.Name + " - length: " + loadZone.Length);
|
||||
}
|
||||
}
|
||||
|
||||
private void RecentToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
RecentToolStripMenuItem.DropDownItems.Clear();
|
||||
RecentToolStripMenuItem.DropDownItems.AddRange(
|
||||
Global.Config.RecentMacros.RecentMenu(DummyLoadMacro, true));
|
||||
}
|
||||
private void DummyLoadMacro(string path)
|
||||
{
|
||||
MovieZone loadZone = new MovieZone(path);
|
||||
zones.Add(loadZone);
|
||||
ZonesList.Items.Add(loadZone.Name + " - length: " + loadZone.Length);
|
||||
}
|
||||
|
||||
private static string SuggestedFolder()
|
||||
{
|
||||
return PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null) +
|
||||
"\\Macros";
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static void SaveMacroAs(MovieZone macro)
|
||||
{
|
||||
SaveFileDialog dialog = new SaveFileDialog();
|
||||
dialog.InitialDirectory = SuggestedFolder();
|
||||
dialog.Filter = "Movie Macros (*.bk2m)|*.bk2m|All Files|*.*";
|
||||
|
@ -214,11 +234,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (result != DialogResult.OK)
|
||||
return;
|
||||
|
||||
selectedZone.Save(dialog.FileName);
|
||||
Settings.RecentMacro.Add(dialog.FileName);
|
||||
macro.Save(dialog.FileName);
|
||||
Global.Config.RecentMacros.Add(dialog.FileName);
|
||||
}
|
||||
|
||||
private void loadMacroToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
public static MovieZone LoadMacro()
|
||||
{
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
dialog.InitialDirectory = SuggestedFolder();
|
||||
|
@ -226,34 +245,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
DialogResult result = dialog.ShowHawkDialog();
|
||||
if (result != DialogResult.OK)
|
||||
return;
|
||||
return null;
|
||||
|
||||
MovieZone loadZone = new MovieZone(dialog.FileName);
|
||||
zones.Add(loadZone);
|
||||
ZonesList.Items.Add(loadZone.Name + " - length: " + loadZone.Length);
|
||||
MovieZone ret = new MovieZone(dialog.FileName);
|
||||
if (ret != null)
|
||||
Global.Config.RecentMacros.Add(dialog.FileName);
|
||||
|
||||
Settings.RecentMacro.Add(dialog.FileName);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void RecentToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
RecentToolStripMenuItem.DropDownItems.Clear();
|
||||
RecentToolStripMenuItem.DropDownItems.AddRange(
|
||||
Settings.RecentMacro.RecentMenu(DummyLoadProject, true));
|
||||
}
|
||||
private void DummyLoadProject(string path)
|
||||
{
|
||||
MovieZone loadZone = new MovieZone(path);
|
||||
zones.Add(loadZone);
|
||||
ZonesList.Items.Add(loadZone.Name + " - length: " + loadZone.Length);
|
||||
}
|
||||
|
||||
private string SuggestedFolder()
|
||||
{
|
||||
return PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null) +
|
||||
"\\Macros";
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,13 +10,18 @@ using BizHawk.Client.Common.InputAdapterExtensions;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
class MovieZone
|
||||
public class MovieZone
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public int Start;
|
||||
public int Length;
|
||||
public string InputKey;
|
||||
private string _inputKey;
|
||||
public string InputKey
|
||||
{
|
||||
get { return _inputKey; }
|
||||
set { _inputKey = value; ReSetLog(); }
|
||||
}
|
||||
private string[] _log;
|
||||
|
||||
public bool Replace = true;
|
||||
|
@ -34,13 +39,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
lg.SetSource(Global.MovieSession.MovieControllerAdapter);
|
||||
targetController = new Bk2ControllerAdapter();
|
||||
targetController.Type = Global.Emulator.ControllerDefinition;
|
||||
targetController.LatchFromSource(targetController); // Reference and create all buttons
|
||||
|
||||
if (key == "")
|
||||
key = lg.GenerateLogKey();
|
||||
key = key.Replace("LogKey:", "").Replace("#", "");
|
||||
key = key.Substring(0, key.Length - 1);
|
||||
|
||||
InputKey = key;
|
||||
_inputKey = key;
|
||||
Length = length;
|
||||
_log = new string[length];
|
||||
|
||||
|
@ -57,15 +63,45 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
controller = new Bk2ControllerAdapter() { Type = d };
|
||||
Bk2LogEntryGenerator logGenerator = new Bk2LogEntryGenerator("");
|
||||
logGenerator.SetSource(targetController);
|
||||
logGenerator.SetSource(controller);
|
||||
logGenerator.GenerateLogEntry(); // Reference and create all buttons.
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
controller.LatchFromSource(movie.GetInputState(i + start));
|
||||
LatchFromSourceButtons(targetController, controller);
|
||||
_log[i] = logGenerator.GenerateLogEntry();
|
||||
}
|
||||
}
|
||||
private void ReSetLog()
|
||||
{
|
||||
// Get a IController that only contains buttons in key.
|
||||
string[] keys = _inputKey.Split('|');
|
||||
ControllerDefinition d = new ControllerDefinition();
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
{
|
||||
if (Global.Emulator.ControllerDefinition.BoolButtons.Contains(keys[i]))
|
||||
d.BoolButtons.Add(keys[i]);
|
||||
else
|
||||
d.FloatControls.Add(keys[i]);
|
||||
}
|
||||
Bk2ControllerAdapter newController = new Bk2ControllerAdapter() { Type = d };
|
||||
|
||||
Bk2LogEntryGenerator logGenerator = new Bk2LogEntryGenerator("");
|
||||
logGenerator.SetSource(newController);
|
||||
logGenerator.GenerateLogEntry(); // Reference and create all buttons.
|
||||
// Reset all buttons in targetController (it may still have buttons that aren't being set here set true)
|
||||
Bk2LogEntryGenerator tC = new Bk2LogEntryGenerator("");
|
||||
tC.SetSource(targetController);
|
||||
targetController.SetControllersAsMnemonic(tC.EmptyEntry);
|
||||
for (int i = 0; i < Length; i++)
|
||||
{
|
||||
controller.SetControllersAsMnemonic(_log[i]);
|
||||
LatchFromSourceButtons(targetController, controller);
|
||||
newController.LatchFromSource(targetController);
|
||||
_log[i] = logGenerator.GenerateLogEntry();
|
||||
}
|
||||
|
||||
controller = newController;
|
||||
}
|
||||
|
||||
public void PlaceZone(TasMovie movie)
|
||||
{
|
||||
|
@ -80,12 +116,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Bk2LogEntryGenerator logGenerator = new Bk2LogEntryGenerator("");
|
||||
logGenerator.SetSource(targetController);
|
||||
targetController.SetControllersAsMnemonic(logGenerator.EmptyEntry);
|
||||
if (Overlay)
|
||||
{
|
||||
for (int i = 0; i < Length; i++)
|
||||
{ // Overlay the frames.
|
||||
targetController.SetControllersAsMnemonic(_log[i]);
|
||||
controller.SetControllersAsMnemonic(_log[i]);
|
||||
LatchFromSourceButtons(targetController, controller);
|
||||
ORLatchFromSource(targetController, movie.GetInputState(i + Start));
|
||||
movie.SetFrame(i + Start, logGenerator.GenerateLogEntry());
|
||||
}
|
||||
|
@ -94,7 +130,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
for (int i = 0; i < Length; i++)
|
||||
{ // Copy over the frame.
|
||||
targetController.SetControllersAsMnemonic(_log[i]);
|
||||
controller.SetControllersAsMnemonic(_log[i]);
|
||||
LatchFromSourceButtons(targetController, controller);
|
||||
movie.SetFrame(i + Start, logGenerator.GenerateLogEntry());
|
||||
}
|
||||
}
|
||||
|
@ -108,8 +145,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
// TasMovie.InvalidateAfter(Start) [this is private]
|
||||
// Load last state, Emulate to Start
|
||||
|
||||
// Or do this, if we can accept that TAStudio has to be open.
|
||||
(GlobalWin.Tools.Get<TAStudio>() as TAStudio).GoToFrame(Start);
|
||||
// Or do this, if TAStudio has to be open.
|
||||
if (GlobalWin.Tools.IsLoaded<TAStudio>())
|
||||
(GlobalWin.Tools.Get<TAStudio>() as TAStudio).GoToFrame(Start);
|
||||
|
||||
GlobalWin.Tools.UpdateBefore();
|
||||
GlobalWin.Tools.UpdateAfter();
|
||||
|
@ -143,13 +181,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
string[] readText = File.ReadAllLines(fileName);
|
||||
// If the LogKey contains buttons/controls not accepted by the emulator,
|
||||
// tell the user and display the macro's controller name and player count
|
||||
_inputKey = readText[0];
|
||||
Bk2LogEntryGenerator lg = Global.MovieSession.LogGeneratorInstance() as Bk2LogEntryGenerator;
|
||||
lg.SetSource(Global.MovieSession.MovieControllerAdapter);
|
||||
string key = lg.GenerateLogKey();
|
||||
key = key.Replace("LogKey:", "").Replace("#", "");
|
||||
key = key.Substring(0, key.Length - 1);
|
||||
string[] emuKeys = key.Split('|');
|
||||
string[] macroKeys = readText[0].Split('|');
|
||||
string[] macroKeys = _inputKey.Split('|');
|
||||
for (int i = 0; i < macroKeys.Length; i++)
|
||||
{
|
||||
if (!emuKeys.Contains(macroKeys[i]))
|
||||
|
@ -172,10 +211,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Name = Path.GetFileNameWithoutExtension(fileName);
|
||||
|
||||
// Adapter
|
||||
// Adapters
|
||||
targetController = new Bk2ControllerAdapter();
|
||||
targetController.Type = Global.Emulator.ControllerDefinition;
|
||||
targetController.LatchFromSource(targetController); // Reference and create all buttons
|
||||
string[] keys = _inputKey.Split('|');
|
||||
ControllerDefinition d = new ControllerDefinition();
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
{
|
||||
if (Global.Emulator.ControllerDefinition.BoolButtons.Contains(keys[i]))
|
||||
d.BoolButtons.Add(keys[i]);
|
||||
else
|
||||
d.FloatControls.Add(keys[i]);
|
||||
}
|
||||
controller = new Bk2ControllerAdapter() { Type = d };
|
||||
}
|
||||
|
||||
#region "Custom Latch"
|
||||
|
|
|
@ -41,6 +41,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.RecentSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.saveSelectionToMacroToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.placeMacroAtSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator20 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.ToBk2MenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -155,6 +158,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.StartFromNowSeparator = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.StartNewProjectFromNowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.recentMacrosToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator22 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.TASMenu.SuspendLayout();
|
||||
this.TasStatusStrip.SuspendLayout();
|
||||
this.MarkerContextMenu.SuspendLayout();
|
||||
|
@ -188,6 +193,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.SaveAsTASMenuItem,
|
||||
this.RecentSubMenu,
|
||||
this.toolStripSeparator1,
|
||||
this.saveSelectionToMacroToolStripMenuItem,
|
||||
this.placeMacroAtSelectionToolStripMenuItem,
|
||||
this.recentMacrosToolStripMenuItem,
|
||||
this.toolStripSeparator20,
|
||||
this.ToBk2MenuItem,
|
||||
this.toolStripSeparator2,
|
||||
this.ExitMenuItem});
|
||||
|
@ -200,7 +209,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//
|
||||
this.NewTASMenuItem.Name = "NewTASMenuItem";
|
||||
this.NewTASMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
|
||||
this.NewTASMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.NewTASMenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.NewTASMenuItem.Text = "&New";
|
||||
this.NewTASMenuItem.Click += new System.EventHandler(this.NewTasMenuItem_Click);
|
||||
//
|
||||
|
@ -208,7 +217,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//
|
||||
this.OpenTASMenuItem.Name = "OpenTASMenuItem";
|
||||
this.OpenTASMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
|
||||
this.OpenTASMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.OpenTASMenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.OpenTASMenuItem.Text = "&Open";
|
||||
this.OpenTASMenuItem.Click += new System.EventHandler(this.OpenTasMenuItem_Click);
|
||||
//
|
||||
|
@ -216,7 +225,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//
|
||||
this.SaveTASMenuItem.Name = "SaveTASMenuItem";
|
||||
this.SaveTASMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
|
||||
this.SaveTASMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.SaveTASMenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.SaveTASMenuItem.Text = "&Save";
|
||||
this.SaveTASMenuItem.Click += new System.EventHandler(this.SaveTasMenuItem_Click);
|
||||
//
|
||||
|
@ -225,7 +234,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.SaveAsTASMenuItem.Name = "SaveAsTASMenuItem";
|
||||
this.SaveAsTASMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||
| System.Windows.Forms.Keys.S)));
|
||||
this.SaveAsTASMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.SaveAsTASMenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.SaveAsTASMenuItem.Text = "Save As";
|
||||
this.SaveAsTASMenuItem.Click += new System.EventHandler(this.SaveAsTasMenuItem_Click);
|
||||
//
|
||||
|
@ -235,37 +244,56 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.toolStripSeparator3});
|
||||
this.RecentSubMenu.Image = ((System.Drawing.Image)(resources.GetObject("RecentSubMenu.Image")));
|
||||
this.RecentSubMenu.Name = "RecentSubMenu";
|
||||
this.RecentSubMenu.Size = new System.Drawing.Size(186, 22);
|
||||
this.RecentSubMenu.Size = new System.Drawing.Size(203, 22);
|
||||
this.RecentSubMenu.Text = "Recent";
|
||||
this.RecentSubMenu.DropDownOpened += new System.EventHandler(this.RecentSubMenu_DropDownOpened);
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(57, 6);
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(183, 6);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(200, 6);
|
||||
//
|
||||
// saveSelectionToMacroToolStripMenuItem
|
||||
//
|
||||
this.saveSelectionToMacroToolStripMenuItem.Name = "saveSelectionToMacroToolStripMenuItem";
|
||||
this.saveSelectionToMacroToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.saveSelectionToMacroToolStripMenuItem.Text = "Save Selection to Macro";
|
||||
this.saveSelectionToMacroToolStripMenuItem.Click += new System.EventHandler(this.saveSelectionToMacroToolStripMenuItem_Click);
|
||||
//
|
||||
// placeMacroAtSelectionToolStripMenuItem
|
||||
//
|
||||
this.placeMacroAtSelectionToolStripMenuItem.Name = "placeMacroAtSelectionToolStripMenuItem";
|
||||
this.placeMacroAtSelectionToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.placeMacroAtSelectionToolStripMenuItem.Text = "Place Macro at Selection";
|
||||
this.placeMacroAtSelectionToolStripMenuItem.Click += new System.EventHandler(this.placeMacroAtSelectionToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator20
|
||||
//
|
||||
this.toolStripSeparator20.Name = "toolStripSeparator20";
|
||||
this.toolStripSeparator20.Size = new System.Drawing.Size(200, 6);
|
||||
//
|
||||
// ToBk2MenuItem
|
||||
//
|
||||
this.ToBk2MenuItem.Name = "ToBk2MenuItem";
|
||||
this.ToBk2MenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.ToBk2MenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.ToBk2MenuItem.Text = "&Export to Bk2";
|
||||
this.ToBk2MenuItem.Click += new System.EventHandler(this.ToBk2MenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(183, 6);
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(200, 6);
|
||||
//
|
||||
// ExitMenuItem
|
||||
//
|
||||
this.ExitMenuItem.Name = "ExitMenuItem";
|
||||
this.ExitMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
|
||||
this.ExitMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.ExitMenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.ExitMenuItem.Text = "E&xit";
|
||||
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
|
||||
//
|
||||
|
@ -877,6 +905,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TasView.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.TasView.FullRowSelect = true;
|
||||
this.TasView.HideWasLagFrames = false;
|
||||
this.TasView.HorizontalOrientation = false;
|
||||
this.TasView.LagFramesToHide = 0;
|
||||
this.TasView.Location = new System.Drawing.Point(8, 27);
|
||||
|
@ -1193,6 +1222,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Markers";
|
||||
//
|
||||
// recentMacrosToolStripMenuItem
|
||||
//
|
||||
this.recentMacrosToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripSeparator22});
|
||||
this.recentMacrosToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Recent;
|
||||
this.recentMacrosToolStripMenuItem.Name = "recentMacrosToolStripMenuItem";
|
||||
this.recentMacrosToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.recentMacrosToolStripMenuItem.Text = "Recent Macros";
|
||||
this.recentMacrosToolStripMenuItem.DropDownOpened += new System.EventHandler(this.recentMacrosToolStripMenuItem_DropDownOpened);
|
||||
//
|
||||
// toolStripSeparator22
|
||||
//
|
||||
this.toolStripSeparator22.Name = "toolStripSeparator22";
|
||||
this.toolStripSeparator22.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// TAStudio
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
@ -1257,7 +1301,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
private System.Windows.Forms.ToolStripMenuItem PasteMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem PasteInsertMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem CutMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ToBk2MenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem UndoMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem RedoMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SelectionUndoMenuItem;
|
||||
|
@ -1352,5 +1395,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
private System.Windows.Forms.ToolStripMenuItem setCustomsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator12;
|
||||
private System.Windows.Forms.ToolStripMenuItem hideWasLagFramesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveSelectionToMacroToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem placeMacroAtSelectionToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator20;
|
||||
private System.Windows.Forms.ToolStripMenuItem ToBk2MenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem recentMacrosToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator22;
|
||||
}
|
||||
}
|
|
@ -118,6 +118,34 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void saveSelectionToMacroToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TasView.SelectedRows.Any())
|
||||
return;
|
||||
|
||||
MovieZone macro = new MovieZone(CurrentTasMovie, TasView.FirstSelectedIndex.Value,
|
||||
TasView.LastSelectedIndex.Value - TasView.FirstSelectedIndex.Value + 1);
|
||||
MacroInputTool.SaveMacroAs(macro);
|
||||
}
|
||||
private void placeMacroAtSelectionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TasView.SelectedRows.Any())
|
||||
return;
|
||||
|
||||
MovieZone macro = MacroInputTool.LoadMacro();
|
||||
if (macro != null)
|
||||
{
|
||||
macro.Start = TasView.FirstSelectedIndex.Value;
|
||||
macro.PlaceZone(CurrentTasMovie);
|
||||
}
|
||||
}
|
||||
|
||||
private void recentMacrosToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
recentMacrosToolStripMenuItem.DropDownItems.Clear();
|
||||
recentMacrosToolStripMenuItem.DropDownItems.AddRange(Global.Config.RecentMacros.RecentMenu(DummyLoadMacro));
|
||||
}
|
||||
|
||||
private void ToBk2MenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var bk2 = CurrentTasMovie.ToBk2(true);
|
||||
|
|
|
@ -220,6 +220,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
LoadProject(path);
|
||||
}
|
||||
|
||||
private void DummyLoadMacro(string path)
|
||||
{
|
||||
if (!TasView.SelectedRows.Any())
|
||||
return;
|
||||
|
||||
MovieZone loadZone = new MovieZone(path);
|
||||
if (loadZone != null)
|
||||
{
|
||||
loadZone.Start = TasView.FirstSelectedIndex.Value;
|
||||
loadZone.PlaceZone(CurrentTasMovie);
|
||||
}
|
||||
}
|
||||
|
||||
private string ClientSettingsForSave()
|
||||
{
|
||||
return TasView.UserSettingsSerialized();
|
||||
|
|
Loading…
Reference in New Issue