@@ -760,6 +760,12 @@ static int16_t input_state_wrap(
760760 }
761761 }
762762 }
763+ else if (device == RETRO_DEVICE_KEYBOARD )
764+ {
765+ /* Always ignore null key. */
766+ if (id == RETROK_UNKNOWN )
767+ return ret ;
768+ }
763769
764770 if (current_input && current_input -> input_state )
765771 ret |= current_input -> input_state (
@@ -773,6 +779,22 @@ static int16_t input_state_wrap(
773779 device ,
774780 idx ,
775781 id );
782+
783+ /* No binds, no input. This is for ignoring RETROK_UNKNOWN
784+ * if the driver allows setting the key down somehow.
785+ * Otherwise all hotkeys and inputs with null bind get triggered. */
786+ if (device == RETRO_DEVICE_JOYPAD )
787+ {
788+ /* Drivers can also overflow when sending all keys at once,
789+ * resulting in negative values which also need to be ignored.. */
790+ if ( (id == RETRO_DEVICE_ID_JOYPAD_MASK && ret < 0 )
791+ || ( binds [_port ][id ].key == RETROK_UNKNOWN
792+ && binds [_port ][id ].mbutton == NO_BTN
793+ && binds [_port ][id ].joykey == NO_BTN
794+ && binds [_port ][id ].joyaxis == AXIS_NONE ))
795+ return 0 ;
796+ }
797+
776798 return ret ;
777799}
778800
@@ -6341,7 +6363,7 @@ void input_driver_collect_system_input(input_driver_state_t *input_st,
63416363
63426364 for (i = 0 ; i < ARRAY_SIZE (ids ); i ++ )
63436365 {
6344- if (current_input -> input_state (
6366+ if (ids [ i ][ 0 ] && current_input -> input_state (
63456367 input_st -> current_data ,
63466368 joypad ,
63476369 sec_joypad ,
0 commit comments