@@ -139,6 +139,57 @@ static int action_right_cheat_num_passes(unsigned type, const char *label,
139139}
140140#endif
141141
142+ static int action_right_input_desc (unsigned type , const char * label ,
143+ bool wraparound )
144+ {
145+ settings_t * settings = config_get_ptr ();
146+ rarch_system_info_t * sys_info = & runloop_state_get_ptr ()-> system ;
147+
148+ if (settings && sys_info )
149+ {
150+ unsigned bind_idx ;
151+ unsigned user_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN ) / (RARCH_FIRST_CUSTOM_BIND + 8 );
152+ unsigned btn_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN ) - (RARCH_FIRST_CUSTOM_BIND + 8 ) * user_idx ;
153+ unsigned mapped_port = settings -> uints .input_remap_ports [user_idx ];
154+ unsigned remap_idx = settings -> uints .input_remap_ids [user_idx ][btn_idx ];
155+
156+ for (bind_idx = 0 ; bind_idx < RARCH_ANALOG_BIND_LIST_END ; bind_idx ++ )
157+ {
158+ if (input_config_bind_order [bind_idx ] == remap_idx )
159+ break ;
160+ }
161+
162+ /* If pressed from unmapped bind, start from the top */
163+ if (label )
164+ {
165+ struct menu_state * menu_st = menu_state_get_ptr ();
166+ menu_entry_t entry ;
167+ MENU_ENTRY_INITIALIZE (entry );
168+ entry .flags |= MENU_ENTRY_FLAG_VALUE_ENABLED ;
169+ menu_entry_get (& entry , 0 , menu_st -> selection_ptr , NULL , true);
170+ if (string_is_equal (entry .value , RARCH_NO_BIND ))
171+ bind_idx = RARCH_UNMAPPED ;
172+ }
173+
174+ if (bind_idx < RARCH_ANALOG_BIND_LIST_END - 1 )
175+ {
176+ bind_idx ++ ;
177+ bind_idx = input_config_bind_order [bind_idx ];
178+ settings -> uints .input_remap_ids [user_idx ][btn_idx ] = bind_idx ;
179+
180+ /* Skip empty descs */
181+ if (string_is_empty (sys_info -> input_desc_btn [mapped_port ][bind_idx ]))
182+ return action_right_input_desc (type , NULL , wraparound );
183+ }
184+ else if (bind_idx == RARCH_ANALOG_BIND_LIST_END - 1 )
185+ settings -> uints .input_remap_ids [user_idx ][btn_idx ] = RARCH_UNMAPPED ;
186+ else
187+ settings -> uints .input_remap_ids [user_idx ][btn_idx ] = input_config_bind_order [0 ];
188+ }
189+
190+ return 0 ;
191+ }
192+
142193static int action_right_input_desc_kbd (unsigned type , const char * label ,
143194 bool wraparound )
144195{
@@ -152,8 +203,7 @@ static int action_right_input_desc_kbd(unsigned type, const char *label,
152203 user_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN ) / RARCH_ANALOG_BIND_LIST_END ;
153204 btn_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN ) - RARCH_ANALOG_BIND_LIST_END * user_idx ;
154205
155- remap_id =
156- settings -> uints .input_keymapper_ids [user_idx ][btn_idx ];
206+ remap_id = settings -> uints .input_keymapper_ids [user_idx ][btn_idx ];
157207
158208 for (key_id = 0 ; key_id < RARCH_MAX_KEYS ; key_id ++ )
159209 {
@@ -171,49 +221,6 @@ static int action_right_input_desc_kbd(unsigned type, const char *label,
171221 return 0 ;
172222}
173223
174- static int action_right_input_desc (unsigned type , const char * label ,
175- bool wraparound )
176- {
177- settings_t * settings = config_get_ptr ();
178- rarch_system_info_t * sys_info = & runloop_state_get_ptr ()-> system ;
179- if (settings && sys_info )
180- {
181- unsigned bind_idx ;
182- unsigned user_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN ) / (RARCH_FIRST_CUSTOM_BIND + 8 );
183- unsigned btn_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN ) - (RARCH_FIRST_CUSTOM_BIND + 8 ) * user_idx ;
184- unsigned mapped_port = settings -> uints .input_remap_ports [user_idx ];
185- unsigned remap_idx = settings -> uints .input_remap_ids [user_idx ][btn_idx ];
186- for (bind_idx = 0 ; bind_idx < RARCH_ANALOG_BIND_LIST_END ; bind_idx ++ )
187- {
188- if (input_config_bind_order [bind_idx ] == remap_idx )
189- break ;
190- }
191-
192- if (bind_idx > RARCH_ANALOG_BIND_LIST_END )
193- settings -> uints .input_remap_ids [user_idx ][btn_idx ]++ ;
194- else
195- {
196- if (bind_idx < RARCH_ANALOG_BIND_LIST_END - 1 )
197- {
198- bind_idx ++ ;
199- bind_idx = input_config_bind_order [bind_idx ];
200- }
201- else if (bind_idx == RARCH_ANALOG_BIND_LIST_END - 1 )
202- bind_idx = RARCH_UNMAPPED ;
203- else
204- bind_idx = input_config_bind_order [0 ];
205-
206- settings -> uints .input_remap_ids [user_idx ][btn_idx ] = bind_idx ;
207- }
208-
209- /* Empty is always last, so right jumps to first */
210- if (string_is_empty (sys_info -> input_desc_btn [mapped_port ][remap_idx ]))
211- settings -> uints .input_remap_ids [user_idx ][btn_idx ] = input_config_bind_order [0 ];
212- }
213-
214- return 0 ;
215- }
216-
217224static int action_right_scroll (unsigned type , const char * label ,
218225 bool wraparound )
219226{
0 commit comments