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

@@ -33,6 +33,7 @@
#include "SDL_gamecontroller.h"
#include "../SDL_sysjoystick.h"
#include "SDL_hidapijoystick_c.h"
#include "../../SDL_hints_c.h"
#ifdef SDL_JOYSTICK_HIDAPI_SWITCH
@@ -591,7 +592,7 @@ static Sint16 ApplyStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, i
static void SDLCALL SDL_GameControllerButtonReportingHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)userdata;
ctx->m_bUseButtonLabels = (!hint || !*hint || ((*hint != '0') && (SDL_strcasecmp(hint, "false") != 0)));
ctx->m_bUseButtonLabels = SDL_GetStringBoolean(hint, SDL_TRUE);
}
static Uint8 RemapButton(SDL_DriverSwitch_Context *ctx, Uint8 button)