@@ -77,17 +77,6 @@ public void SyncControls(IEmulator emulator, IMovieSession session, Config confi
77
77
ControllerOutput . Source = session . MovieOut ;
78
78
}
79
79
80
- public void ToggleStickies ( )
81
- {
82
- StickyHoldController . MassToggleStickyState ( ActiveController . PressedButtons ) ;
83
- StickyAutofireController . MassToggleStickyState ( AutoFireController . PressedButtons ) ; // does this even make sense?
84
- }
85
-
86
- public void ToggleAutoStickies ( )
87
- {
88
- StickyAutofireController . MassToggleStickyState ( ActiveController . PressedButtons ) ;
89
- }
90
-
91
80
private static Controller BindToDefinition (
92
81
ControllerDefinition def ,
93
82
IDictionary < string , Dictionary < string , string > > allBinds ,
@@ -157,6 +146,8 @@ private static AutofireController BindToDefinitionAF(
157
146
/// caller if the input didn't alrady do something else.</param>
158
147
public void ProcessInput ( IInputSource source , Func < string , bool > processHotkey , Config config , Action < InputEvent > processUnboundInput )
159
148
{
149
+ List < string > oldPressedButtons = ActiveController . PressedButtons ;
150
+
160
151
// loop through all available events
161
152
InputEvent ie ;
162
153
while ( ( ie = source . DequeueEvent ( ) ) != null )
@@ -230,13 +221,25 @@ public void ProcessInput(IInputSource source, Func<string, bool> processHotkey,
230
221
ActiveController . ApplyAxisConstraints ( "Natural Circle" ) ;
231
222
}
232
223
233
- if ( ClientControls [ "Autohold" ] )
234
- {
235
- ToggleStickies ( ) ;
236
- }
237
- else if ( ClientControls [ "Autofire" ] )
224
+ if ( ClientControls [ "Autohold" ] || ClientControls [ "Autofire" ] )
238
225
{
239
- ToggleAutoStickies ( ) ;
226
+ List < string > newPressedButtons = ActiveController . PressedButtons ;
227
+ List < string > justPressedButtons = new ( ) ;
228
+ foreach ( string button in newPressedButtons )
229
+ {
230
+ if ( ! oldPressedButtons . Contains ( button ) ) justPressedButtons . Add ( button ) ;
231
+ }
232
+ if ( justPressedButtons . Count != 0 )
233
+ {
234
+ if ( ClientControls [ "Autohold" ] )
235
+ {
236
+ StickyHoldController . MassToggleStickyState ( justPressedButtons ) ;
237
+ }
238
+ else
239
+ {
240
+ StickyAutofireController . MassToggleStickyState ( justPressedButtons ) ;
241
+ }
242
+ }
240
243
}
241
244
242
245
// autohold/autofire must not be affected by the following inputs
0 commit comments