From c87eed91ec5de4f94ee7a8e29d2f5f0351afbc8c Mon Sep 17 00:00:00 2001 From: standardtoaster Date: Sun, 22 Jun 2014 11:41:36 -0700 Subject: [PATCH] [joystickcls] GetLastChange button diffs Ensure that when generating changes between the last joystick state and the current one that we actually compare button states. This causes another bug with the joystick axis frequently becoming selected, which will be fixed in a further commit --- Joystick/JoystickCls.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Joystick/JoystickCls.cs b/Joystick/JoystickCls.cs index 67a8fe1..25fd8bc 100644 --- a/Joystick/JoystickCls.cs +++ b/Joystick/JoystickCls.cs @@ -219,8 +219,10 @@ namespace SCJMapper_V2 if ( pov[3] >= 0 ) if ( pov[3] != ppov[3] ) m_lastItem = "hat4_" + HatDir( pov[0] ); bool[] buttons = m_state.Buttons; + bool[] prevButtons = m_prevState.Buttons; for ( int bi=0; bi < buttons.Length; bi++ ) { - if ( buttons[bi] ) m_lastItem = "button" + ( bi + 1 ).ToString( ); + if ( buttons[bi] && buttons[bi] != prevButtons[bi]) + m_lastItem = "button" + ( bi + 1 ).ToString( ); } return m_lastItem; }