@@ -4947,9 +4947,8 @@ bool config_load_remap(const char *directory_input_remapping,
49474947 const char * rarch_path_basename = path_get (RARCH_PATH_BASENAME );
49484948 enum msg_hash_enums msg_remap_loaded = MSG_GAME_REMAP_FILE_LOADED ;
49494949 settings_t * settings = config_st ;
4950- bool notification_show_remap_load = settings -> bools .notification_show_remap_load ;
49514950 unsigned joypad_port = settings -> uints .input_joypad_index [0 ];
4952- const char * inp_dev_name = input_config_get_device_display_name ( joypad_port ) ;
4951+ bool notification_show_remap_load = settings -> bools . notification_show_remap_load ;
49534952 bool sort_remaps_by_controller = settings -> bools .input_remap_sort_by_controller_enable ;
49544953
49554954 /* > Cannot load remaps if we have no core
@@ -4958,28 +4957,24 @@ bool config_load_remap(const char *directory_input_remapping,
49584957 || string_is_empty (directory_input_remapping ))
49594958 return false;
49604959
4961- game_path [0 ] = '\0' ;
4962- content_path [0 ] = '\0' ;
4960+ core_path [0 ] = '\0' ;
4961+ game_path [0 ] = '\0' ;
4962+ content_path [0 ] = '\0' ;
4963+
4964+ strlcpy (remap_path , core_name , sizeof (remap_path ));
49634965
4964- if ( sort_remaps_by_controller
4965- && !string_is_empty (inp_dev_name )
4966- )
4966+ if (sort_remaps_by_controller )
49674967 {
4968- /* Ensure directory does not contain special chars */
4969- const char * inp_dev_dir = sanitize_path_part (
4970- inp_dev_name , strlen (inp_dev_name ));
4971- /* Build the new path with the controller name */
4972- size_t _len = strlcpy (remap_path , core_name , sizeof (remap_path ));
4973- _len += strlcpy (remap_path + _len , PATH_DEFAULT_SLASH (),
4974- sizeof (remap_path ) - _len );
4975- strlcpy (remap_path + _len , inp_dev_dir ,
4976- sizeof (remap_path ) - _len );
4977- /* Deallocate as we no longer need this */
4978- free ((char * )inp_dev_dir );
4979- inp_dev_dir = NULL ;
4968+ const char * input_device_name = input_config_get_device_display_name (joypad_port );
4969+
4970+ if (!string_is_empty (input_device_name ))
4971+ {
4972+ /* Ensure directory does not contain special chars */
4973+ const char * input_device_dir = sanitize_path_part (input_device_name , strlen (input_device_name ));
4974+
4975+ fill_pathname_join_special (remap_path , core_name , input_device_dir , sizeof (remap_path ));
4976+ }
49804977 }
4981- else /* We're not using controller path, just use core name */
4982- strlcpy (remap_path , core_name , sizeof (remap_path ));
49834978
49844979 if (!string_is_empty (rarch_path_basename ))
49854980 {
0 commit comments