changeset 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 1ef2734ac052
children eab8e0396776
files controller_info.c
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/controller_info.c	Sun Feb 23 13:56:22 2025 -0800
+++ b/controller_info.c	Mon Feb 24 23:15:14 2025 -0800
@@ -176,6 +176,23 @@
 	SDL_GameControllerClose(control);
 	for (uint32_t i = 0; i < num_heuristics; i++)
 	{
+		if (strstr(name, "Hori Fighting Commander")) {
+			uint8_t is_xbox = strstr(name, "Xbox") || strstr(name, "ONE");
+			controller_info res = {
+				.variant = VARIANT_6B_RIGHT,
+				.name = name,
+				.stick_deadzone = DEFAULT_DEADZONE,
+				.trigger_deadzone = DEFAULT_DEADZONE
+			};
+			if (is_xbox) {
+				res.type = TYPE_XBOX;
+				res.subtype = strstr(name, "ONE") ? SUBTYPE_XBONE : SUBTYPE_X360;
+			} else {
+				res.type = TYPE_PSX;
+				res.subtype = strstr(name, "PS3") ? SUBTYPE_PS3 : SUBTYPE_PS4;
+			}
+			return res;
+		}
 		if (strstr(name, heuristics[i].name)) {
 			controller_info res = heuristics[i].info;
 			res.name = name;