@@ -1505,19 +1505,20 @@ static int16_t input_state_device(
15051505#endif
15061506 }
15071507
1508- /* Don't allow turbo for D-pad unless explicitly allowed. */
1509- if ( (id < RETRO_DEVICE_ID_JOYPAD_UP )
1510- || ( ((settings -> bools .input_turbo_allow_dpad || settings -> ints .input_turbo_bind != -1 )
1511- || (id > RETRO_DEVICE_ID_JOYPAD_RIGHT ))
1512- && (id <= RETRO_DEVICE_ID_JOYPAD_R3 )))
1508+ if (id <= RETRO_DEVICE_ID_JOYPAD_R3 )
15131509 {
1514- /*
1515- * Apply turbo button if activated.
1516- */
1510+ /* Apply turbo button if activated. */
15171511 uint8_t turbo_period = settings -> uints .input_turbo_period ;
15181512 uint8_t turbo_duty_cycle = settings -> uints .input_turbo_duty_cycle ;
15191513 uint8_t turbo_mode = settings -> uints .input_turbo_mode ;
15201514
1515+ /* Don't allow classic mode turbo for D-pad unless explicitly allowed. */
1516+ if ( turbo_mode <= INPUT_TURBO_MODE_CLASSIC_TOGGLE
1517+ && !settings -> bools .input_turbo_allow_dpad
1518+ && id >= RETRO_DEVICE_ID_JOYPAD_UP
1519+ && id <= RETRO_DEVICE_ID_JOYPAD_RIGHT )
1520+ break ;
1521+
15211522 if (turbo_duty_cycle == 0 )
15221523 turbo_duty_cycle = turbo_period / 2 ;
15231524
@@ -1528,9 +1529,16 @@ static int16_t input_state_device(
15281529
15291530 if (turbo_mode > INPUT_TURBO_MODE_CLASSIC_TOGGLE )
15301531 {
1531- /* Pressing turbo button toggles turbo mode on or off.
1532- * Holding the button will
1533- * pass through, else the pressed state will be modulated by a
1532+ unsigned turbo_button = settings -> uints .input_turbo_button ;
1533+ unsigned remap_button = settings -> uints .input_remap_ids [port ][turbo_button ];
1534+
1535+ /* Single button modes only care about the defined button. */
1536+ if (id != remap_button )
1537+ break ;
1538+
1539+ /* Pressing turbo bind toggles turbo button on or off.
1540+ * Holding the button will pass through, else
1541+ * the pressed state will be modulated by a
15341542 * periodic pulse defined by the configured duty cycle.
15351543 */
15361544
@@ -1539,13 +1547,10 @@ static int16_t input_state_device(
15391547 input_st -> turbo_btns .turbo_pressed [port ] &= ~(1 << 31 );
15401548 else if (input_st -> turbo_btns .turbo_pressed [port ] >= 0 )
15411549 {
1542- unsigned turbo_button = settings -> uints .input_turbo_button ;
1543- unsigned remap_button = settings -> uints .input_remap_ids [port ][turbo_button ];
1544-
15451550 input_st -> turbo_btns .turbo_pressed [port ] |= (1 << 31 );
1546- /* Toggle turbo for selected buttons . */
1547- if (input_st -> turbo_btns .enable [port ] != (1 << remap_button ))
1548- input_st -> turbo_btns .enable [port ] = (1 << remap_button );
1551+ /* Toggle turbo for selected button . */
1552+ if (input_st -> turbo_btns .enable [port ] != (1 << id ))
1553+ input_st -> turbo_btns .enable [port ] = (1 << id );
15491554 input_st -> turbo_btns .mode1_enable [port ] ^= 1 ;
15501555 }
15511556
@@ -1559,8 +1564,6 @@ static int16_t input_state_device(
15591564 {
15601565 uint16_t enable_new ;
15611566 input_st -> turbo_btns .turbo_pressed [port ] |= 1 << id ;
1562- /* Toggle turbo for pressed button but make
1563- * sure at least one button has turbo */
15641567 enable_new = input_st -> turbo_btns .enable [port ] ^ (1 << id );
15651568 if (enable_new )
15661569 input_st -> turbo_btns .enable [port ] = enable_new ;
@@ -1579,8 +1582,8 @@ static int16_t input_state_device(
15791582 }
15801583 else if (turbo_mode == INPUT_TURBO_MODE_CLASSIC )
15811584 {
1582- /* If turbo button is held, all buttons pressed except
1583- * for D-pad will go into a turbo mode. Until the button is
1585+ /* If turbo button is held, all buttons pressed
1586+ * will go into a turbo mode. Until the button is
15841587 * released again, the input state will be modulated by a
15851588 * periodic pulse defined by the configured duty cycle.
15861589 */
0 commit comments