Added a utility function to simplify the hint handling logic

This commit is contained in:
Sam Lantinga 2019-11-13 21:53:01 -08:00
parent a63e93a193
commit cf33f1f0ef
5 changed files with 52 additions and 20 deletions

View file

@ -31,6 +31,7 @@
#include "SDL_joystick.h"
#include "../SDL_sysjoystick.h"
#include "SDL_hidapijoystick_c.h"
#include "../../SDL_hints_c.h"
#if defined(__WIN32__)
#include "../../core/windows/SDL_windows.h"
@ -641,7 +642,7 @@ SDL_HIDAPIDriverHintChanged(void *userdata, const char *name, const char *oldVal
{
int i;
SDL_HIDAPI_Device *device = SDL_HIDAPI_devices;
SDL_bool enabled = (!hint || !*hint || ((*hint != '0') && (SDL_strcasecmp(hint, "false") != 0)));
SDL_bool enabled = SDL_GetStringBoolean(hint, SDL_TRUE);
if (SDL_strcmp(name, SDL_HINT_JOYSTICK_HIDAPI) == 0) {
for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) {