relaxed the digital hat deadzone slightly, and fixed typo in DEBUG_GAMEPAD_MAPPING define

This commit is contained in:
atfrase 2022-01-14 13:14:42 -06:00 committed by Sam Lantinga
parent 3696e23d09
commit f7a19f9ea8
1 changed files with 5 additions and 5 deletions

View File

@ -83,7 +83,7 @@
#endif #endif
#if 1 #if 1
#define DEBUG_GAMEPAD_MAPPINGS 1 #define DEBUG_GAMEPAD_MAPPING 1
#endif #endif
typedef enum typedef enum
@ -1357,7 +1357,7 @@ HandleHat(SDL_Joystick *stick, int hatidx, int axis, int value)
if (value <= correct->minimum[axis]) { if (value <= correct->minimum[axis]) {
correct->minimum[axis] = value; correct->minimum[axis] = value;
value = 0; value = 0;
} else if (!correct->use_deadzones || value < correct->minimum[axis] / 2) { } else if (!correct->use_deadzones || value < correct->minimum[axis] / 3) {
value = 0; value = 0;
} else { } else {
value = 1; value = 1;
@ -1366,7 +1366,7 @@ HandleHat(SDL_Joystick *stick, int hatidx, int axis, int value)
if (value >= correct->maximum[axis]) { if (value >= correct->maximum[axis]) {
correct->maximum[axis] = value; correct->maximum[axis] = value;
value = 2; value = 2;
} else if (!correct->use_deadzones || value > correct->maximum[axis] / 2) { } else if (!correct->use_deadzones || value > correct->maximum[axis] / 3) {
value = 2; value = 2;
} else { } else {
value = 1; value = 1;
@ -1716,7 +1716,7 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
if (item->mapping) { if (item->mapping) {
SDL_memcpy(out, item->mapping, sizeof(*out)); SDL_memcpy(out, item->mapping, sizeof(*out));
#ifdef DEBUG_GAMEPAD_MAPPING #ifdef DEBUG_GAMEPAD_MAPPING
SDL_Log("Prior mapping for device %d: %s", device_index, out); SDL_Log("Prior mapping for device %d", device_index);
#endif #endif
return SDL_TRUE; return SDL_TRUE;
} else { } else {
@ -2076,7 +2076,7 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
SDL_memcpy(item->mapping, out, sizeof(*out)); SDL_memcpy(item->mapping, out, sizeof(*out));
} }
#ifdef DEBUG_GAMEPAD_MAPPING #ifdef DEBUG_GAMEPAD_MAPPING
SDL_Log("Generated mapping for device %d: %s", device_index, out); SDL_Log("Generated mapping for device %d", device_index);
#endif #endif
return SDL_TRUE; return SDL_TRUE;