N64: Wired up the analog control in the virtual controller. I probably did the float wiring badly, but it works for now.
This commit is contained in:
parent
e25d58eecb
commit
0811ff4e41
|
@ -84,7 +84,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
||||||
float X_Axis = Controller.GetFloat("P1 X Axis");
|
float X_Axis = Controller.GetFloat("P1 X Axis");
|
||||||
float Y_Axis = Controller.GetFloat("P1 Y Axis");
|
float Y_Axis = Controller.GetFloat("P1 Y Axis");
|
||||||
|
|
||||||
// ... convert the float values to a signed bytes somehow ...
|
// Analog stick right = +X
|
||||||
|
// Analog stick up = +Y
|
||||||
|
|
||||||
|
x = (sbyte)X_Axis;
|
||||||
|
y = (sbyte)Y_Axis;
|
||||||
|
|
||||||
api.set_buttons(0, ReadController(1), x, y);
|
api.set_buttons(0, ReadController(1), x, y);
|
||||||
api.frame_advance();
|
api.frame_advance();
|
||||||
|
|
|
@ -144,7 +144,7 @@ namespace BizHawk.MultiClient
|
||||||
public class ForceOffAdaptor : IController
|
public class ForceOffAdaptor : IController
|
||||||
{
|
{
|
||||||
public bool IsPressed(string button) { return this[button]; }
|
public bool IsPressed(string button) { return this[button]; }
|
||||||
public float GetFloat(string name) { return 0.0f; } //TODO
|
public float GetFloat(string name) { return Source.GetFloat(name); } //TODO
|
||||||
public void UpdateControls(int frame) { }
|
public void UpdateControls(int frame) { }
|
||||||
|
|
||||||
protected HashSet<string> stickySet = new HashSet<string>();
|
protected HashSet<string> stickySet = new HashSet<string>();
|
||||||
|
@ -185,7 +185,16 @@ namespace BizHawk.MultiClient
|
||||||
public bool Locked = false; //Pretty much a hack,
|
public bool Locked = false; //Pretty much a hack,
|
||||||
|
|
||||||
public bool IsPressed(string button) { return this[button]; }
|
public bool IsPressed(string button) { return this[button]; }
|
||||||
public float GetFloat(string name) { return 0.0f; } //TODO
|
|
||||||
|
WorkingDictionary<string,float> FloatSet = new WorkingDictionary<string,float>();
|
||||||
|
public void SetFloat(string name, float value)
|
||||||
|
{
|
||||||
|
FloatSet[name] = value;
|
||||||
|
}
|
||||||
|
public float GetFloat(string name)
|
||||||
|
{
|
||||||
|
return FloatSet[name];
|
||||||
|
}
|
||||||
public void UpdateControls(int frame) { }
|
public void UpdateControls(int frame) { }
|
||||||
|
|
||||||
public bool this[string button] {
|
public bool this[string button] {
|
||||||
|
@ -323,7 +332,7 @@ namespace BizHawk.MultiClient
|
||||||
public bool Locked = false; //Pretty much a hack,
|
public bool Locked = false; //Pretty much a hack,
|
||||||
|
|
||||||
|
|
||||||
public float GetFloat(string name) { return 0.0f; } //TODO
|
public float GetFloat(string name) { return Source.GetFloat(name); } //TODO
|
||||||
public void UpdateControls(int frame) { }
|
public void UpdateControls(int frame) { }
|
||||||
|
|
||||||
public void SetSticky(string button, bool isSticky)
|
public void SetSticky(string button, bool isSticky)
|
||||||
|
@ -859,11 +868,12 @@ namespace BizHawk.MultiClient
|
||||||
public ControllerDefinition Type { get; set; }
|
public ControllerDefinition Type { get; set; }
|
||||||
public bool this[string button] { get { return MyBoolButtons[button]; } }
|
public bool this[string button] { get { return MyBoolButtons[button]; } }
|
||||||
public bool IsPressed(string button) { return MyBoolButtons[button]; }
|
public bool IsPressed(string button) { return MyBoolButtons[button]; }
|
||||||
public float GetFloat(string name) { return 0; }
|
public float GetFloat(string name) { return MyFloatControls[name]; }
|
||||||
public void UpdateControls(int frame) { }
|
public void UpdateControls(int frame) { }
|
||||||
//--------
|
//--------
|
||||||
|
|
||||||
private readonly WorkingDictionary<string, bool> MyBoolButtons = new WorkingDictionary<string, bool>();
|
private readonly WorkingDictionary<string, bool> MyBoolButtons = new WorkingDictionary<string, bool>();
|
||||||
|
private readonly WorkingDictionary<string, float> MyFloatControls = new WorkingDictionary<string, float>();
|
||||||
|
|
||||||
void Force(string button, bool state)
|
void Force(string button, bool state)
|
||||||
{
|
{
|
||||||
|
@ -911,6 +921,11 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
MyBoolButtons[button] = source[button];
|
MyBoolButtons[button] = source[button];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (string name in Type.FloatControls)
|
||||||
|
{
|
||||||
|
MyFloatControls[name] = source.GetFloat(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Redundancy beats crazy if logic that makes new consoles annoying to add
|
//Redundancy beats crazy if logic that makes new consoles annoying to add
|
||||||
|
|
|
@ -215,10 +215,13 @@
|
||||||
// AnalogControl1
|
// AnalogControl1
|
||||||
//
|
//
|
||||||
this.AnalogControl1.BackColor = System.Drawing.Color.Transparent;
|
this.AnalogControl1.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
this.AnalogControl1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
this.AnalogControl1.Location = new System.Drawing.Point(24, 14);
|
this.AnalogControl1.Location = new System.Drawing.Point(24, 14);
|
||||||
this.AnalogControl1.Name = "AnalogControl1";
|
this.AnalogControl1.Name = "AnalogControl1";
|
||||||
this.AnalogControl1.Size = new System.Drawing.Size(128, 128);
|
this.AnalogControl1.Size = new System.Drawing.Size(132, 132);
|
||||||
this.AnalogControl1.TabIndex = 0;
|
this.AnalogControl1.TabIndex = 0;
|
||||||
|
this.AnalogControl1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.AnalogControl1_MouseClick);
|
||||||
|
this.AnalogControl1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.AnalogControl1_MouseMove);
|
||||||
//
|
//
|
||||||
// VirtualPadN64
|
// VirtualPadN64
|
||||||
//
|
//
|
||||||
|
|
|
@ -156,5 +156,17 @@ namespace BizHawk.MultiClient
|
||||||
Global.StickyXORAdapter.SetSticky(Controller + " DPad R", PR.Checked);
|
Global.StickyXORAdapter.SetSticky(Controller + " DPad R", PR.Checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AnalogControl1_MouseClick(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
Global.StickyXORAdapter.SetFloat("P1 X Axis", AnalogControl1.X);
|
||||||
|
Global.StickyXORAdapter.SetFloat("P1 Y Axis", -AnalogControl1.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AnalogControl1_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
Global.StickyXORAdapter.SetFloat("P1 X Axis", AnalogControl1.X);
|
||||||
|
Global.StickyXORAdapter.SetFloat("P1 Y Axis", -AnalogControl1.Y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue