Skip to content

Commit 498fabc

Browse files
committed
Make binding an axis to the same mouse axis twice switch to relative
resolves #4310
1 parent f614b01 commit 498fabc

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/BizHawk.Client.EmuHawk/config/ControllerConfig/AnalogBindControl.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,25 @@ private void Timer1_Tick(object sender, EventArgs e)
3737
{
3838
timer1.Stop();
3939
_listening = false;
40-
_bind.Value = bindValue;
41-
textBox1.Text = Bind.Value;
4240
buttonBind.Text = "Bind!";
4341
Input.Instance.StopListeningForAxisEvents();
42+
// rebinding the same mouse axis toggles between relative and absolute
43+
const string AXIS_MX = "WMouse X";
44+
const string AXIS_MRX = "RMouse X";
45+
const string AXIS_MY = "WMouse Y";
46+
const string AXIS_MRY = "RMouse Y";
47+
var oldBind = _bind.Value;
48+
if (bindValue is AXIS_MX)
49+
{
50+
if (oldBind is AXIS_MX) bindValue = AXIS_MRX;
51+
else if (oldBind is AXIS_MRX) bindValue = AXIS_MX;
52+
}
53+
else if (bindValue is AXIS_MY)
54+
{
55+
if (oldBind is AXIS_MY) bindValue = AXIS_MRY;
56+
else if (oldBind is AXIS_MRY) bindValue = AXIS_MY;
57+
}
58+
textBox1.Text = _bind.Value = bindValue;
4459
}
4560
}
4661

0 commit comments

Comments
 (0)