public void UpdateAutoFire(string button, bool? isOn) { if (!isOn.HasValue) // No value means don't change whether it's on or off. isOn = TasView.AllColumns.Find(c => c.Name == button).Emphasis; int index = 0; if (autoHoldToolStripMenuItem.Checked) index = 1; if (autoFireToolStripMenuItem.Checked) index = 2; if (controllerType.BoolButtons.Contains(button)) { if (index == 0) index = controllerType.BoolButtons.IndexOf(button); else index += controllerType.BoolButtons.Count - 1; AutoPatternBool p = BoolPatterns[index]; Global.AutofireStickyXORAdapter.SetSticky(button, isOn.Value, p); } else { if (index == 0) index = controllerType.FloatControls.IndexOf(button); else index += controllerType.FloatControls.Count - 1; float? value = null; if (isOn.Value) value = 0f; AutoPatternFloat p = FloatPatterns[index]; Global.AutofireStickyXORAdapter.SetFloat(button, value, p); } }
private void SetUpColumns() { TasView.AllColumns.Clear(); AddColumn(MarkerColumnName, string.Empty, 18); AddColumn(FrameColumnName, "Frame#", 68); var columnNames = GenerateColumnNames(); foreach (var kvp in columnNames) { // N64 hack for now, for fake analog if (Emulator.SystemId == "N64") { if (kvp.Key.Contains("A Up") || kvp.Key.Contains("A Down") || kvp.Key.Contains("A Left") || kvp.Key.Contains("A Right")) { continue; } } AddColumn(kvp.Key, kvp.Value, 20 * kvp.Value.Length); } // Patterns int bStart = 0; int fStart = 0; if (BoolPatterns == null) { BoolPatterns = new AutoPatternBool[controllerType.BoolButtons.Count + 2]; FloatPatterns = new AutoPatternFloat[controllerType.FloatControls.Count + 2]; } else { bStart = BoolPatterns.Length - 2; fStart = FloatPatterns.Length - 2; Array.Resize(ref BoolPatterns, controllerType.BoolButtons.Count + 2); Array.Resize(ref FloatPatterns, controllerType.FloatControls.Count + 2); } for (int i = bStart; i < BoolPatterns.Length - 2; i++) { BoolPatterns[i] = new AutoPatternBool(1, 1); } BoolPatterns[BoolPatterns.Length - 2] = new AutoPatternBool(1, 0); BoolPatterns[BoolPatterns.Length - 1] = new AutoPatternBool( Global.Config.AutofireOn, Global.Config.AutofireOff); for (int i = fStart; i < FloatPatterns.Length - 2; i++) { FloatPatterns[i] = new AutoPatternFloat(new float[] { 1f }); } FloatPatterns[FloatPatterns.Length - 2] = new AutoPatternFloat(new float[] { 1f }); FloatPatterns[FloatPatterns.Length - 1] = new AutoPatternFloat( 1f, Global.Config.AutofireOn, 0f, Global.Config.AutofireOff); SetUpToolStripColumns(); }
private void SetupBoolPatterns() { // Patterns int bStart = 0; int fStart = 0; if (BoolPatterns == null) { BoolPatterns = new AutoPatternBool[ControllerType.BoolButtons.Count + 2]; FloatPatterns = new AutoPatternFloat[ControllerType.FloatControls.Count + 2]; } else { bStart = BoolPatterns.Length - 2; fStart = FloatPatterns.Length - 2; Array.Resize(ref BoolPatterns, ControllerType.BoolButtons.Count + 2); Array.Resize(ref FloatPatterns, ControllerType.FloatControls.Count + 2); } for (int i = bStart; i < BoolPatterns.Length - 2; i++) { BoolPatterns[i] = new AutoPatternBool(1, 1); } BoolPatterns[BoolPatterns.Length - 2] = new AutoPatternBool(1, 0); BoolPatterns[BoolPatterns.Length - 1] = new AutoPatternBool( Config.AutofireOn, Config.AutofireOff); for (int i = fStart; i < FloatPatterns.Length - 2; i++) { FloatPatterns[i] = new AutoPatternFloat(new[] { 1f }); } FloatPatterns[FloatPatterns.Length - 2] = new AutoPatternFloat(new[] { 1f }); FloatPatterns[FloatPatterns.Length - 1] = new AutoPatternFloat( 1f, Config.AutofireOn, 0f, Config.AutofireOff); SetUpToolStripColumns(); }
private void SetupBoolPatterns() { // Patterns int bStart = 0; int fStart = 0; if (BoolPatterns == null) { BoolPatterns = new AutoPatternBool[ControllerType.BoolButtons.Count + 2]; AxisPatterns = new AutoPatternAxis[ControllerType.Axes.Count + 2]; } else { bStart = BoolPatterns.Length - 2; fStart = AxisPatterns.Length - 2; Array.Resize(ref BoolPatterns, ControllerType.BoolButtons.Count + 2); Array.Resize(ref AxisPatterns, ControllerType.Axes.Count + 2); } for (int i = bStart; i < BoolPatterns.Length - 2; i++) { BoolPatterns[i] = new AutoPatternBool(1, 1); } BoolPatterns[BoolPatterns.Length - 2] = new AutoPatternBool(1, 0); BoolPatterns[BoolPatterns.Length - 1] = new AutoPatternBool( Config.AutofireOn, Config.AutofireOff); for (int i = fStart; i < AxisPatterns.Length - 2; i++) { AxisPatterns[i] = new AutoPatternAxis(new[] { 1 }); } AxisPatterns[AxisPatterns.Length - 2] = new AutoPatternAxis(new[] { 1 }); AxisPatterns[AxisPatterns.Length - 1] = new AutoPatternAxis(1, Config.AutofireOn, 0, Config.AutofireOff); SetUpToolStripColumns(); }
private void SetUpColumns() { TasView.AllColumns.Clear(); AddColumn(CursorColumnName, "", 18); AddColumn(FrameColumnName, "Frame#", 68); var columnNames = GenerateColumnNames(); foreach (var kvp in columnNames) { InputRoll.RollColumn.InputType type; int digits; if (Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.Contains(kvp.Key)) { ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Definition.FloatRanges [Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(kvp.Key)]; type = InputRoll.RollColumn.InputType.Float; digits = Math.Max(kvp.Value.Length, range.MaxDigits()); } else { type = InputRoll.RollColumn.InputType.Boolean; digits = kvp.Value.Length; } AddColumn(kvp.Key, kvp.Value, (digits * 6) + 14, type); // magic numbers reused in EditBranchTextPopUp() } var columnsToHide = TasView.AllColumns .Where(c => // todo: make a proper user editable list? c.Name == "Power" || c.Name == "Reset" || c.Name == "Light Sensor" || c.Name == "Open" || c.Name == "Close" || c.Name == "Disc Select" || c.Name.StartsWith("Tilt") || c.Name.StartsWith("Key ") || c.Name.EndsWith("Tape") || c.Name.EndsWith("Disk") || c.Name.EndsWith("Block") || c.Name.EndsWith("Status")); foreach (var column in columnsToHide) { column.Visible = false; } TasView.AllColumns.ColumnsChanged(); // Patterns int bStart = 0; int fStart = 0; if (BoolPatterns == null) { BoolPatterns = new AutoPatternBool[ControllerType.BoolButtons.Count + 2]; FloatPatterns = new AutoPatternFloat[ControllerType.FloatControls.Count + 2]; } else { bStart = BoolPatterns.Length - 2; fStart = FloatPatterns.Length - 2; Array.Resize(ref BoolPatterns, ControllerType.BoolButtons.Count + 2); Array.Resize(ref FloatPatterns, ControllerType.FloatControls.Count + 2); } for (int i = bStart; i < BoolPatterns.Length - 2; i++) { BoolPatterns[i] = new AutoPatternBool(1, 1); } BoolPatterns[BoolPatterns.Length - 2] = new AutoPatternBool(1, 0); BoolPatterns[BoolPatterns.Length - 1] = new AutoPatternBool( Global.Config.AutofireOn, Global.Config.AutofireOff); for (int i = fStart; i < FloatPatterns.Length - 2; i++) { FloatPatterns[i] = new AutoPatternFloat(new[] { 1f }); } FloatPatterns[FloatPatterns.Length - 2] = new AutoPatternFloat(new[] { 1f }); FloatPatterns[FloatPatterns.Length - 1] = new AutoPatternFloat( 1f, Global.Config.AutofireOn, 0f, Global.Config.AutofireOff); SetUpToolStripColumns(); }
private void SetUpColumns() { TasView.AllColumns.Clear(); AddColumn(CursorColumnName, string.Empty, 18); AddColumn(FrameColumnName, "Frame#", 68); var columnNames = GenerateColumnNames(); foreach (var kvp in columnNames) { // N64 hack for now, for fake analog if (Emulator.SystemId == "N64") { if (kvp.Key.Contains("A Up") || kvp.Key.Contains("A Down") || kvp.Key.Contains("A Left") || kvp.Key.Contains("A Right")) { continue; } } AddColumn(kvp.Key, kvp.Value, 20 * kvp.Value.Length); } var columnsToHide = TasView.AllColumns .Where(c => // todo: make a proper user editable list? c.Name == "Power" || c.Name == "Reset" || c.Name.StartsWith("Tilt") || c.Name == "Light Sensor" ); foreach (var column in columnsToHide) { column.Visible = false; } TasView.AllColumns.ColumnsChanged(); // Patterns int bStart = 0; int fStart = 0; if (BoolPatterns == null) { BoolPatterns = new AutoPatternBool[controllerType.BoolButtons.Count + 2]; FloatPatterns = new AutoPatternFloat[controllerType.FloatControls.Count + 2]; } else { bStart = BoolPatterns.Length - 2; fStart = FloatPatterns.Length - 2; Array.Resize(ref BoolPatterns, controllerType.BoolButtons.Count + 2); Array.Resize(ref FloatPatterns, controllerType.FloatControls.Count + 2); } for (int i = bStart; i < BoolPatterns.Length - 2; i++) { BoolPatterns[i] = new AutoPatternBool(1, 1); } BoolPatterns[BoolPatterns.Length - 2] = new AutoPatternBool(1, 0); BoolPatterns[BoolPatterns.Length - 1] = new AutoPatternBool( Global.Config.AutofireOn, Global.Config.AutofireOff); for (int i = fStart; i < FloatPatterns.Length - 2; i++) { FloatPatterns[i] = new AutoPatternFloat(new float[] { 1f }); } FloatPatterns[FloatPatterns.Length - 2] = new AutoPatternFloat(new float[] { 1f }); FloatPatterns[FloatPatterns.Length - 1] = new AutoPatternFloat( 1f, Global.Config.AutofireOn, 0f, Global.Config.AutofireOff); SetUpToolStripColumns(); }