From 8a0c2577ed314d502e319f035c7dbcb681d51bc2 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 24 Feb 2025 03:42:03 +0300 Subject: [PATCH] engine: platform: sdl: exclude fake game controller found on Android emulator --- engine/platform/sdl/joy_sdl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/engine/platform/sdl/joy_sdl.c b/engine/platform/sdl/joy_sdl.c index c8fc91a1..d593963e 100644 --- a/engine/platform/sdl/joy_sdl.c +++ b/engine/platform/sdl/joy_sdl.c @@ -171,6 +171,18 @@ static void SDLash_GameControllerAdded( int device_index ) return; } + // this "game controller" only exists on Android within emulator and tries to map + // keyboard events into game controller events, which as you can expect, doesn't + // work and I don't understand the intention here. When debugging Xash in Android + // Studio emulator, just enable hardware input passthrough. +#if XASH_ANDROID + if( !Q_strcmp( SDL_GameControllerName( gc ), "qwerty2" )) + { + SDL_GameControllerClose( gc ); + return; + } +#endif // XASH_ANDROID + list = Mem_Realloc( host.mempool, g_gamepads, sizeof( *list ) * ( g_num_gamepads + 1 )); list[g_num_gamepads++] = gc;