mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
Using SDL_INIT_GAMECONTROLLER it explicitly calls SDL_INIT_JOYSTICK some experimental code (nw)
This commit is contained in:
parent
b18ebd99ce
commit
5b549a4fe0
@ -688,11 +688,20 @@ public:
|
|||||||
int physical_stick;
|
int physical_stick;
|
||||||
for (physical_stick = 0; physical_stick < SDL_NumJoysticks(); physical_stick++)
|
for (physical_stick = 0; physical_stick < SDL_NumJoysticks(); physical_stick++)
|
||||||
{
|
{
|
||||||
SDL_Joystick *joy = SDL_JoystickOpen(physical_stick);
|
if (SDL_IsGameController(physical_stick)) {
|
||||||
std::string joy_name = remove_spaces(SDL_JoystickName(joy));
|
osd_printf_verbose("Joystick %i is supported by the game controller interface!\n", physical_stick);
|
||||||
SDL_JoystickClose(joy);
|
osd_printf_verbose("Compatible controller, named \'%s\'\n", SDL_GameControllerNameForIndex(physical_stick));
|
||||||
|
SDL_GameController *joy = SDL_GameControllerOpen(physical_stick);
|
||||||
devmap_register(&m_joy_map, physical_stick, joy_name.c_str());
|
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++)
|
for (int stick = 0; stick < MAX_DEVMAP_ENTRIES; stick++)
|
||||||
|
@ -270,8 +270,7 @@ void sdl_osd_interface::osd_exit()
|
|||||||
|
|
||||||
if (!SDLMAME_INIT_IN_WORKER_THREAD)
|
if (!SDLMAME_INIT_IN_WORKER_THREAD)
|
||||||
{
|
{
|
||||||
/* FixMe: Bug in SDL2.0, Quitting joystick will cause SIGSEGV */
|
SDL_QuitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER );
|
||||||
SDL_QuitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO /*| SDL_INIT_JOYSTICK */);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,9 +489,9 @@ void sdl_osd_interface::init(running_machine &machine)
|
|||||||
{
|
{
|
||||||
#ifdef SDLMAME_EMSCRIPTEN
|
#ifdef SDLMAME_EMSCRIPTEN
|
||||||
// timer brings in threads which are not supported in Emscripten
|
// timer brings in threads which are not supported in Emscripten
|
||||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) {
|
if (SDL_InitSubSystem(SDL_INIT_VIDEO| SDL_INIT_GAMECONTROLLER|SDL_INIT_NOPARACHUTE)) {
|
||||||
#else
|
#else
|
||||||
if (SDL_InitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) {
|
if (SDL_InitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO| SDL_INIT_GAMECONTROLLER|SDL_INIT_NOPARACHUTE)) {
|
||||||
#endif
|
#endif
|
||||||
osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
|
osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
@ -184,7 +184,7 @@ static OSDWORK_CALLBACK(sdlwindow_thread_id)
|
|||||||
|
|
||||||
if (SDLMAME_INIT_IN_WORKER_THREAD)
|
if (SDLMAME_INIT_IN_WORKER_THREAD)
|
||||||
{
|
{
|
||||||
if (SDL_InitSubSystem(SDL_INIT_TIMER|SDL_INIT_AUDIO| SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE))
|
if (SDL_InitSubSystem(SDL_INIT_TIMER|SDL_INIT_AUDIO| SDL_INIT_VIDEO| SDL_INIT_GAMECONTROLLER|SDL_INIT_NOPARACHUTE))
|
||||||
{
|
{
|
||||||
osd_printf_error("Could not initialize SDL: %s.\n", SDL_GetError());
|
osd_printf_error("Could not initialize SDL: %s.\n", SDL_GetError());
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
Loading…
Reference in New Issue
Block a user