comparison controller_info.c @ 2634:023aa4839ff6

Make Hori Fighting Commander controllers work out of the box
author Michael Pavone <pavone@retrodev.com>
date Mon, 24 Feb 2025 23:15:14 -0800
parents 36aa9ead0e62
children
comparison
equal deleted inserted replaced
2633:1ef2734ac052 2634:023aa4839ff6
174 } 174 }
175 const char *name = SDL_GameControllerName(control); 175 const char *name = SDL_GameControllerName(control);
176 SDL_GameControllerClose(control); 176 SDL_GameControllerClose(control);
177 for (uint32_t i = 0; i < num_heuristics; i++) 177 for (uint32_t i = 0; i < num_heuristics; i++)
178 { 178 {
179 if (strstr(name, "Hori Fighting Commander")) {
180 uint8_t is_xbox = strstr(name, "Xbox") || strstr(name, "ONE");
181 controller_info res = {
182 .variant = VARIANT_6B_RIGHT,
183 .name = name,
184 .stick_deadzone = DEFAULT_DEADZONE,
185 .trigger_deadzone = DEFAULT_DEADZONE
186 };
187 if (is_xbox) {
188 res.type = TYPE_XBOX;
189 res.subtype = strstr(name, "ONE") ? SUBTYPE_XBONE : SUBTYPE_X360;
190 } else {
191 res.type = TYPE_PSX;
192 res.subtype = strstr(name, "PS3") ? SUBTYPE_PS3 : SUBTYPE_PS4;
193 }
194 return res;
195 }
179 if (strstr(name, heuristics[i].name)) { 196 if (strstr(name, heuristics[i].name)) {
180 controller_info res = heuristics[i].info; 197 controller_info res = heuristics[i].info;
181 res.name = name; 198 res.name = name;
182 res.stick_deadzone = DEFAULT_DEADZONE; 199 res.stick_deadzone = DEFAULT_DEADZONE;
183 res.trigger_deadzone = DEFAULT_DEADZONE; 200 res.trigger_deadzone = DEFAULT_DEADZONE;