From bf0693fcb0b8a5de93392fca31ae629ea8f6250d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 27 Mar 2015 17:34:09 +0100 Subject: [PATCH] (input_autodetect.c ) Cleanups pt. 4 --- input/input_autodetect.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/input/input_autodetect.c b/input/input_autodetect.c index 589910ea45..2f24ab3467 100644 --- a/input/input_autodetect.c +++ b/input/input_autodetect.c @@ -86,6 +86,9 @@ static void input_autoconfigure_joypad_add( { char msg[PATH_MAX_LENGTH]; settings_t *settings = config_get_ptr(); + + /* This will be the case if input driver is reinitialized. + * No reason to spam autoconfigure messages every time. */ bool block_osd_spam = settings && settings->input.autoconfigured[params->idx] && params->name; @@ -133,9 +136,6 @@ void input_config_autoconfigure_joypad(autoconfig_params_t *params) if (!settings || !settings->input.autodetect_enable) return; - /* This will be the case if input driver is reinitialized. - * No reason to spam autoconfigure messages every time. */ - for (i = 0; i < RARCH_BIND_LIST_END; i++) { settings->input.autoconf_binds[params->idx][i].joykey = NO_BTN; @@ -184,7 +184,10 @@ void input_config_autoconfigure_joypad(autoconfig_params_t *params) const struct retro_keybind *input_get_auto_bind(unsigned port, unsigned id) { settings_t *settings = config_get_ptr(); - unsigned joy_idx = settings->input.joypad_map[port]; + unsigned joy_idx = 0; + + if (settings) + joy_idx = settings->input.joypad_map[port]; if (joy_idx < MAX_USERS) return &settings->input.autoconf_binds[joy_idx][id];