comparison controller_info.c @ 2624:6bd492b8172e

Update gamecontrollerdb.txt and tweak the entries and controller type heuristics so they work out of the box (at least on Win/Linux)
author Michael Pavone <pavone@retrodev.com>
date Sat, 22 Feb 2025 22:14:03 -0800
parents 639561060a28
children 36aa9ead0e62
comparison
equal deleted inserted replaced
2623:07faf0f5466f 2624:6bd492b8172e
28 {"X-box One", {.type = TYPE_XBOX, .subtype = SUBTYPE_XBONE}}, 28 {"X-box One", {.type = TYPE_XBOX, .subtype = SUBTYPE_XBONE}},
29 {"WiiU", {.type = TYPE_NINTENDO, .subtype = SUBTYPE_WIIU}}, 29 {"WiiU", {.type = TYPE_NINTENDO, .subtype = SUBTYPE_WIIU}},
30 {"Wii U", {.type = TYPE_NINTENDO, .subtype = SUBTYPE_WIIU}}, 30 {"Wii U", {.type = TYPE_NINTENDO, .subtype = SUBTYPE_WIIU}},
31 {"Nintendo Switch", {.type = TYPE_NINTENDO, .subtype = SUBTYPE_SWITCH}}, 31 {"Nintendo Switch", {.type = TYPE_NINTENDO, .subtype = SUBTYPE_SWITCH}},
32 {"Saturn", {.type = TYPE_SEGA, .subtype = SUBTYPE_SATURN}}, 32 {"Saturn", {.type = TYPE_SEGA, .subtype = SUBTYPE_SATURN}},
33 {"8BitDo M30", {.type = TYPE_SEGA, .subtype = SUBTYPE_GENESIS, .variant = VARIANT_8BUTTON}} 33 {"8BitDo M30", {.type = TYPE_SEGA, .subtype = SUBTYPE_GENESIS, .variant = VARIANT_8BUTTON}},
34 {"Mini 3B Controller", {.type = TYPE_SEGA, .subtype = SUBTYPE_GENESIS, .variant = VARIANT_3BUTTON}},
35 {"Mini 6B Controller", {.type = TYPE_SEGA, .subtype = SUBTYPE_GENESIS, .variant = VARIANT_6B_BUMPERS}}
34 }; 36 };
35 const uint32_t num_heuristics = sizeof(heuristics)/sizeof(*heuristics); 37 const uint32_t num_heuristics = sizeof(heuristics)/sizeof(*heuristics);
36 38
37 static tern_node *info_config; 39 static tern_node *info_config;
38 static uint8_t loaded; 40 static uint8_t loaded;
69 static const char *variant_names[] = { 71 static const char *variant_names[] = {
70 "normal", 72 "normal",
71 "6b bumpers", 73 "6b bumpers",
72 "6b right", 74 "6b right",
73 "3button", 75 "3button",
74 "6button",
75 "8button" 76 "8button"
76 }; 77 };
77 78
78 static void load_ctype_config(void) 79 static void load_ctype_config(void)
79 { 80 {
138 break; 139 break;
139 } 140 }
140 char *variant = tern_find_ptr(info, "variant"); 141 char *variant = tern_find_ptr(info, "variant");
141 res.variant = VARIANT_NORMAL; 142 res.variant = VARIANT_NORMAL;
142 if (variant) { 143 if (variant) {
143 for (int i = 0; i < VARIANT_NUM; i++) 144 int i;
145 for (i = 0; i < VARIANT_NUM; i++)
144 { 146 {
145 if (!strcmp(variant_names[i], variant)) { 147 if (!strcmp(variant_names[i], variant)) {
146 res.variant = i; 148 res.variant = i;
147 break; 149 break;
148 } 150 }
151 }
152 if (i == VARIANT_NUM && !strcmp("6button", variant)) {
153 //workaround for some bad saved configs caused by a silly bug
154 res.variant = VARIANT_8BUTTON;
149 } 155 }
150 } 156 }
151 res.name = control ? SDL_GameControllerName(control) : SDL_JoystickName(stick); 157 res.name = control ? SDL_GameControllerName(control) : SDL_JoystickName(stick);
152 res.stick_deadzone = atoi(tern_find_ptr_default(info, "stick_deadzone", DEFAULT_DEADZONE_STR)); 158 res.stick_deadzone = atoi(tern_find_ptr_default(info, "stick_deadzone", DEFAULT_DEADZONE_STR));
153 res.trigger_deadzone = atoi(tern_find_ptr_default(info, "trigger_deadzone", DEFAULT_DEADZONE_STR)); 159 res.trigger_deadzone = atoi(tern_find_ptr_default(info, "trigger_deadzone", DEFAULT_DEADZONE_STR));