| 108 | } |
| 109 | |
| 110 | void CInput::InitJoysticks() |
| 111 | { |
| 112 | if(!SDL_WasInit(SDL_INIT_JOYSTICK)) |
| 113 | { |
| 114 | if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0) |
| 115 | { |
| 116 | dbg_msg("joystick", "Unable to init SDL joystick system: %s", SDL_GetError()); |
| 117 | return; |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | const int NumJoysticks = SDL_NumJoysticks(); |
| 122 | dbg_msg("joystick", "%d joystick(s) found", NumJoysticks); |
| 123 | for(int i = 0; i < NumJoysticks; i++) |
| 124 | OpenJoystick(i); |
| 125 | UpdateActiveJoystick(); |
| 126 | |
| 127 | Console()->Chain("inp_controller_guid", ConchainJoystickGuidChanged, this); |
| 128 | } |
| 129 | |
| 130 | bool CInput::OpenJoystick(int JoystickIndex) |
| 131 | { |