Autofire Input Adaptor, currently no UI for it

This commit is contained in:
andres.delikat 2011-08-07 23:26:06 +00:00
parent f604415c5a
commit d92c27f89d
4 changed files with 57 additions and 4 deletions

View File

@ -60,6 +60,11 @@ namespace BizHawk.MultiClient
/// </summary>
public static StickyXORAdapter StickyXORAdapter = new StickyXORAdapter();
/// <summary>
/// Auto-fire (Rapid fire) of controller buttons
/// </summary>
public static AutoFireAdapter AutoFireAdapter = new AutoFireAdapter();
/// <summary>
/// fire off one-frame logical button clicks here. useful for things like ti-83 virtual pad and reset buttons
/// </summary>

View File

@ -1972,7 +1972,7 @@
this.MainMenuStrip = this.menuStrip1;
this.MaximizeBox = false;
this.Name = "MainForm";
this.Text = "BizHawk";
this.Text = "0";
this.Deactivate += new System.EventHandler(this.MainForm_Deactivate);
this.Load += new System.EventHandler(this.MainForm_Load);
this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.MainForm_MouseClick);

View File

@ -794,12 +794,12 @@ namespace BizHawk.MultiClient
Global.UD_LR_ControllerAdapter.Source = Global.ActiveController;
Global.StickyXORAdapter.Source = Global.UD_LR_ControllerAdapter;
Global.MultitrackRewiringControllerAdapter.Source = Global.StickyXORAdapter;
Global.AutoFireAdapter.Source = Global.StickyXORAdapter;
Global.MultitrackRewiringControllerAdapter.Source = Global.AutoFireAdapter;
Global.MovieInputSourceAdapter.Source = Global.MultitrackRewiringControllerAdapter;
Global.ControllerOutput.Source = Global.MovieOutputAdapter;
Global.Emulator.Controller = Global.ControllerOutput;
Global.MovieSession.MovieControllerAdapter.Type = Global.MovieInputSourceAdapter.Type;
//splice the movie session before MovieOutputAdapter if it is doing anything
@ -1188,6 +1188,7 @@ namespace BizHawk.MultiClient
return false;
case "Record AVI":
RecordAVI();
//Global.AutoFireAdapter.SetAutoFire("P1 A", !Global.AutoFireAdapter.IsAutoFire("P1 A"));
break;
case "Stop AVI":
StopAVI();

View File

@ -130,6 +130,53 @@ namespace BizHawk.MultiClient
}
}
public class AutoFireAdapter : IController
{
private HashSet<string> autoFireSet = new HashSet<string>();
public IController Source;
public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } }
public bool IsPressed(string button) { return this[button]; }
public float GetFloat(string name) { return 0.0f; } //TODO
public void UpdateControls(int frame) { }
public bool this[string button]
{
get
{
bool source = Source[button];
if (source)
{
}
if (autoFireSet.Contains(button))
{
int a = Global.Emulator.Frame % 2;
if (a == 0)
return true;
else
return false;
}
return source;
}
set { throw new InvalidOperationException(); }
}
public void SetAutoFire(string button, bool isSticky)
{
if (isSticky)
autoFireSet.Add(button);
else autoFireSet.Remove(button);
}
public bool IsAutoFire(string button)
{
return autoFireSet.Contains(button);
}
}
public class MnemonicsGenerator
{
IController Source;