mirror of
https://github.com/encounter/SDL.git
synced 2025-12-14 07:36:09 +00:00
Added a utility function to simplify the hint handling logic
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user