mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	Don't modify the Nintendo Switch home LED state by default
This commit is contained in:
		| @@ -711,8 +711,10 @@ extern "C" { | |||||||
|  *  \brief  A variable controlling whether the Home button LED should be turned on when a Nintendo Switch controller is opened |  *  \brief  A variable controlling whether the Home button LED should be turned on when a Nintendo Switch controller is opened | ||||||
|  * |  * | ||||||
|  *  This variable can be set to the following values: |  *  This variable can be set to the following values: | ||||||
|  *    "0"       - home button LED is left off |  *    "0"       - home button LED is turned off | ||||||
|  *    "1"       - home button LED is turned on (the default) |  *    "1"       - home button LED is turned on | ||||||
|  |  * | ||||||
|  |  *  By default the Home button LED state is not changed. | ||||||
|  */ |  */ | ||||||
| #define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED "SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED" | #define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED "SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -936,10 +936,13 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti | |||||||
|  |  | ||||||
|         /* Set the LED state */ |         /* Set the LED state */ | ||||||
|         if (ctx->m_bHasHomeLED) { |         if (ctx->m_bHasHomeLED) { | ||||||
|             if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED, SDL_TRUE)) { |             const char *hint = SDL_GetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED); | ||||||
|                 SetHomeLED(ctx, 100); |             if (hint && *hint) { | ||||||
|             } else { |                 if (SDL_GetStringBoolean(hint, SDL_TRUE)) { | ||||||
|                 SetHomeLED(ctx, 0); |                     SetHomeLED(ctx, 100); | ||||||
|  |                 } else { | ||||||
|  |                     SetHomeLED(ctx, 0); | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         SetSlotLED(ctx, (joystick->instance_id % 4)); |         SetSlotLED(ctx, (joystick->instance_id % 4)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sam Lantinga
					Sam Lantinga