From ba297f12cd28554cb40748d5df76bdcb94117acb Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 3 Aug 2022 21:46:01 -0700
Subject: [PATCH] Use the Nintendo controller type to determine whether to
always use button labels
---
src/joystick/hidapi/SDL_hidapi_switch.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c
index 7a90ecda267..185335bfbb2 100644
--- a/src/joystick/hidapi/SDL_hidapi_switch.c
+++ b/src/joystick/hidapi/SDL_hidapi_switch.c
@@ -326,16 +326,15 @@ static SDL_bool
AlwaysUsesLabels(int vendor_id, int product_id, ESwitchDeviceInfoControllerType eControllerType)
{
/* These controllers don't have a diamond button configuration, so always use labels */
- if (vendor_id == USB_VENDOR_NINTENDO &&
- (product_id == USB_PRODUCT_NINTENDO_N64_CONTROLLER ||
- product_id == USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER)) {
- return SDL_TRUE;
- }
- if (eControllerType == k_eSwitchDeviceInfoControllerType_NESLeft ||
- eControllerType == k_eSwitchDeviceInfoControllerType_NESRight) {
+ switch (eControllerType) {
+ case k_eSwitchDeviceInfoControllerType_NESLeft:
+ case k_eSwitchDeviceInfoControllerType_NESRight:
+ case k_eSwitchDeviceInfoControllerType_N64:
+ case k_eSwitchDeviceInfoControllerType_SEGA_Genesis:
return SDL_TRUE;
+ default:
+ return SDL_FALSE;
}
- return SDL_FALSE;
}
static SDL_bool