From 63ce5ee4c0077fba06b6beb9aa492e28216c207a Mon Sep 17 00:00:00 2001 From: radius Date: Fri, 10 Jul 2015 22:36:28 -0500 Subject: [PATCH] make the first match work too --- input/input_autodetect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/input/input_autodetect.c b/input/input_autodetect.c index d1135c4ef7..85b3b46e2b 100644 --- a/input/input_autodetect.c +++ b/input/input_autodetect.c @@ -154,7 +154,7 @@ static bool input_autoconfigure_joypad_from_conf_dir( { size_t i; int ret = 0; - int index = 0; + int index = -1; int current_best = 0; config_file_t *conf = NULL; struct string_list *list = NULL; @@ -187,7 +187,7 @@ static bool input_autoconfigure_joypad_from_conf_dir( { conf = config_file_new(list->elems[i].data); ret = input_try_autoconfigure_joypad_from_conf(conf, params); - if(ret > current_best) + if(ret >= current_best) { index = i; current_best = ret; @@ -195,7 +195,7 @@ static bool input_autoconfigure_joypad_from_conf_dir( config_file_free(conf); } - if(index) + if(index >= 0) { RARCH_LOG("Autoconf: best configuration score=%d\n", current_best); conf = config_file_new(list->elems[index].data);