Start using input_config_get_device_name

This commit is contained in:
twinaphex 2017-04-25 16:04:28 +02:00
parent f4b168f9b6
commit 20ed6eb90a
6 changed files with 14 additions and 22 deletions

View File

@ -1129,15 +1129,11 @@ static void handle_hotplug(android_input_t *android,
productId))
input_config_set_device_name(*port, name_buf);
if (!string_is_empty(name_buf))
{
settings_t *settings = config_get_ptr();
strlcpy(settings->input.device_names[*port],
name_buf, sizeof(settings->input.device_names[*port]));
}
input_config_set_device_name(*port, name_buf);
android->pad_states[android->pads_connected].id = id;
android->pad_states[android->pads_connected].id = id;
android->pad_states[android->pads_connected].port = *port;
strlcpy(android->pad_states[*port].name, name_buf,
sizeof(android->pad_states[*port].name));

View File

@ -15,13 +15,12 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../configuration.h"
#include "../input_config.h"
#include "../drivers_keyboard/keyboard_event_android.h"
static const char *android_joypad_name(unsigned pad)
{
settings_t *settings = config_get_ptr();
return settings ? settings->input.device_names[pad] : NULL;
return input_config_get_device_name(pad);
}
static bool android_joypad_init(void *data)

View File

@ -32,7 +32,6 @@
#include "../input_config.h"
#include "../input_joypad_driver.h"
#include "../input_keymaps.h"
#include "../../configuration.h"
#include "../../verbosity.h"
struct dinput_joypad
@ -66,7 +65,6 @@ extern LPDIRECTINPUT8 g_dinput_ctx;
static void dinput_joypad_destroy(void)
{
unsigned i;
settings_t *settings = config_get_ptr();
for (i = 0; i < MAX_USERS; i++)
{
@ -80,7 +78,8 @@ static void dinput_joypad_destroy(void)
g_pads[i].joy_name = NULL;
free(g_pads[i].joy_friendly_name);
g_pads[i].joy_friendly_name = NULL;
*settings->input.device_names[i] = '\0';
input_config_clear_device_name(i);
}
g_joypad_cnt = 0;

View File

@ -20,8 +20,7 @@
static const char *qnx_joypad_name(unsigned pad)
{
settings_t *settings = config_get_ptr();
return settings ? settings->input.device_names[pad] : NULL;
return input_config_get_device_name(pad);
}
static bool qnx_joypad_init(void *data)

View File

@ -16,7 +16,7 @@
#include <stdint.h>
#include "../../configuration.h"
#include "../input_config.h"
#include "../../tasks/tasks_internal.h"
static uint64_t pad_state[MAX_PADS];
@ -38,8 +38,7 @@ static const char* const XBOX_CONTROLLER_NAMES[4] =
static const char *xdk_joypad_name(unsigned pad)
{
settings_t *settings = config_get_ptr();
return settings ? settings->input.device_names[pad] : NULL;
return input_config_get_device_name(pad);
}
static void xdk_joypad_autodetect_add(unsigned autoconf_pad)

View File

@ -1304,17 +1304,16 @@ static int setting_action_ok_bind_all(void *data, bool wraparound)
static int setting_action_ok_bind_all_save_autoconfig(void *data, bool wraparound)
{
unsigned index_offset;
settings_t *settings = config_get_ptr();
rarch_setting_t *setting = (rarch_setting_t*)data;
const char *name = NULL;
(void)wraparound;
if (!settings || !setting)
if (!setting)
return -1;
index_offset = setting->index_offset;
name = settings->input.device_names[index_offset];
name = input_config_get_device_name(index_offset);
if(!string_is_empty(name) && config_save_autoconf_profile(name, index_offset))
runloop_msg_queue_push(
@ -1323,6 +1322,7 @@ static int setting_action_ok_bind_all_save_autoconfig(void *data, bool wraparoun
runloop_msg_queue_push(
msg_hash_to_str(MSG_AUTOCONFIG_FILE_ERROR_SAVING), 1, 100, true);
return 0;
}
@ -1424,7 +1424,7 @@ static void get_string_representation_bind_device(void * data, char *s,
if (map < settings->input.max_users)
{
const char *device_name = settings->input.device_names[map];
const char *device_name = input_config_get_device_name(map);
if (!string_is_empty(device_name))
snprintf(s, len,