diff options
| author | 2016-03-05 09:52:54 -0500 | |
|---|---|---|
| committer | 2016-03-05 09:52:54 -0500 | |
| commit | 50fc05a49fcc6b689271ecff2dfae209bb4bfd47 (patch) | |
| tree | 9bce43cfb23e17399376f45ee18a417b0dee5eef /src/osd/modules/input/input_sdl.cpp | |
| parent | f7b8e47a17efd84963e685c39840ff111787d929 (diff) | |
| parent | 23eaaa9244ffa216e0b8365916d9cf3af785279b (diff) | |
Merge branch 'master' of https://github.com/mamedev/mame.git
Diffstat (limited to 'src/osd/modules/input/input_sdl.cpp')
| -rw-r--r-- | src/osd/modules/input/input_sdl.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp index 3894f25e1b4..43d4cbf6a6c 100644 --- a/src/osd/modules/input/input_sdl.cpp +++ b/src/osd/modules/input/input_sdl.cpp @@ -688,11 +688,20 @@ public: int physical_stick; for (physical_stick = 0; physical_stick < SDL_NumJoysticks(); physical_stick++) { - SDL_Joystick *joy = SDL_JoystickOpen(physical_stick); - std::string joy_name = remove_spaces(SDL_JoystickName(joy)); - SDL_JoystickClose(joy); - - devmap_register(&m_joy_map, physical_stick, joy_name.c_str()); + if (SDL_IsGameController(physical_stick)) { + osd_printf_verbose("Joystick %i is supported by the game controller interface!\n", physical_stick); + osd_printf_verbose("Compatible controller, named \'%s\'\n", SDL_GameControllerNameForIndex(physical_stick)); + SDL_GameController *joy = SDL_GameControllerOpen(physical_stick); + osd_printf_verbose("Controller is mapped as \"%s\".\n", SDL_GameControllerMapping(joy)); + std::string joy_name = remove_spaces(SDL_GameControllerName(joy)); + SDL_GameControllerClose(joy); + devmap_register(&m_joy_map, physical_stick, joy_name.c_str()); + } else { + SDL_Joystick *joy = SDL_JoystickOpen(physical_stick); + std::string joy_name = remove_spaces(SDL_JoystickName(joy)); + SDL_JoystickClose(joy); + devmap_register(&m_joy_map, physical_stick, joy_name.c_str()); + } } for (int stick = 0; stick < MAX_DEVMAP_ENTRIES; stick++) |
