45
45
#include "joystick/SDL_gamepad_c.h"
46
46
#include "joystick/SDL_joystick_c.h"
47
47
#include "sensor/SDL_sensor_c.h"
48
+ #include "actionset/SDL_actionset_c.h"
48
49
49
50
/* Initialization/Cleanup routines */
50
51
#ifndef SDL_TIMERS_DISABLED
@@ -175,6 +176,11 @@ int SDL_InitSubSystem(Uint32 flags)
175
176
SDL_DBus_Init ();
176
177
#endif
177
178
179
+ if (flags & SDL_INIT_ACTIONSET ) {
180
+ /* action set implies gamepad, sensor, and haptic */
181
+ flags |= SDL_INIT_GAMEPAD | SDL_INIT_SENSOR | SDL_INIT_HAPTIC ;
182
+ }
183
+
178
184
if (flags & SDL_INIT_GAMEPAD ) {
179
185
/* game controller implies joystick */
180
186
flags |= SDL_INIT_JOYSTICK ;
@@ -348,6 +354,24 @@ int SDL_InitSubSystem(Uint32 flags)
348
354
#endif
349
355
}
350
356
357
+ if (flags & SDL_INIT_ACTIONSET ) {
358
+ #ifndef SDL_ACTIONSET_DISABLED
359
+ if (SDL_ShouldInitSubsystem (SDL_INIT_ACTIONSET )) {
360
+ SDL_IncrementSubsystemRefCount (SDL_INIT_ACTIONSET );
361
+ if (SDL_InitActionSet () < 0 ) {
362
+ SDL_DecrementSubsystemRefCount (SDL_INIT_ACTIONSET );
363
+ goto quit_and_error ;
364
+ }
365
+ } else {
366
+ SDL_IncrementSubsystemRefCount (SDL_INIT_ACTIONSET );
367
+ }
368
+ flags_initialized |= SDL_INIT_ACTIONSET ;
369
+ #else
370
+ SDL_SetError ("SDL not built with actionset support" );
371
+ goto quit_and_error ;
372
+ #endif
373
+ }
374
+
351
375
(void )flags_initialized ; /* make static analysis happy, since this only gets used in error cases. */
352
376
353
377
return 0 ;
@@ -365,6 +389,15 @@ int SDL_Init(Uint32 flags)
365
389
void SDL_QuitSubSystem (Uint32 flags )
366
390
{
367
391
/* Shut down requested initialized subsystems */
392
+ #ifndef SDL_ACTIONSET_DISABLED
393
+ if (flags & SDL_INIT_ACTIONSET ) {
394
+ if (SDL_ShouldQuitSubsystem (SDL_INIT_ACTIONSET )) {
395
+ SDL_QuitActionSet ();
396
+ }
397
+ SDL_DecrementSubsystemRefCount (SDL_INIT_ACTIONSET );
398
+ }
399
+ #endif
400
+
368
401
#ifndef SDL_SENSOR_DISABLED
369
402
if (flags & SDL_INIT_SENSOR ) {
370
403
if (SDL_ShouldQuitSubsystem (SDL_INIT_SENSOR )) {
0 commit comments