diff --git a/cfg.cpp b/cfg.cpp index 4644cf9..e030040 100644 --- a/cfg.cpp +++ b/cfg.cpp @@ -119,7 +119,7 @@ static const ini_var_t ini_vars[] = { "HDR_AVG_NITS", (void*)(&(cfg.hdr_avg_nits)), UINT16, 100, 10000}, { "VGA_MODE", (void*)(&(cfg.vga_mode)), STRING, 0, sizeof(cfg.vga_mode) - 1 }, { "NTSC_MODE", (void *)(&(cfg.ntsc_mode)), UINT8, 0, 2}, - { "UNIQUE_MAPPING", (void *)(&(cfg.unique_mapping)), UINT8, 0, 1}, + { "CONTROLLER_UNIQUE_MAPPING", (void *)(&(cfg.controller_unique_mapping)), UINT8, 0, 1}, }; static const int nvars = (int)(sizeof(ini_vars) / sizeof(ini_var_t)); diff --git a/cfg.h b/cfg.h index a5cdeca..e7bac8e 100644 --- a/cfg.h +++ b/cfg.h @@ -91,7 +91,7 @@ typedef struct { char vga_mode[16]; char vga_mode_int; char ntsc_mode; - uint8_t unique_mapping; + uint8_t controller_unique_mapping; } cfg_t; extern cfg_t cfg; diff --git a/input.cpp b/input.cpp index 010d47a..8ec4a22 100644 --- a/input.cpp +++ b/input.cpp @@ -1443,8 +1443,8 @@ static char *get_map_name(int dev, int def) { static char name[128]; char id[32]; - - if (cfg.unique_mapping) sprintfz(id, "%08x", input[dev].unique_hash); + + if (cfg.controller_unique_mapping) sprintfz(id, "%08x", input[dev].unique_hash); else strcpyz(id, input[dev].idstr); if (def || is_menu()) sprintf(name, "input_%s%s_v3.map", id, input[dev].mod ? "_m" : ""); @@ -1455,10 +1455,10 @@ static char *get_map_name(int dev, int def) static char *get_kbdmap_name(int dev) { static char name[128]; - - if (cfg.unique_mapping) sprintfz(name, "kbd_%08x.map", input[dev].unique_hash); + + if (cfg.controller_unique_mapping) sprintfz(name, "kbd_%08x.map", input[dev].unique_hash); else sprintfz(name, "kbd_%s.map", input[dev].idstr); - + return name; } @@ -3399,6 +3399,7 @@ void mergedevs() int unique_hash = str_hash(input[i].id); unique_hash = str_hash(input[i].mac, unique_hash); unique_hash = str_hash(input[i].idstr, unique_hash); + unique_hash = str_hash(input[i].sysfs, unique_hash); input[i].unique_hash = unique_hash; input[i].timeout = (strlen(uniq) && strstr(sysfs, "bluetooth")) ? (cfg.bt_auto_disconnect * 10) : 0; diff --git a/str_util.cpp b/str_util.cpp index 92a44e1..e9b59fb 100644 --- a/str_util.cpp +++ b/str_util.cpp @@ -38,7 +38,7 @@ unsigned int str_hash(const char *s, unsigned int initial) unsigned int hash = initial; int c; - while( c = *s++ ) + while((c = *s++)) { hash = ((hash << 5) + hash) + c; }