This diff should do the trick, clearing also any keyboard type controllers
diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp
index 26faeb2..26bc328 100644
--- a/es-app/src/main.cpp
+++ b/es-app/src/main.cpp
@@ -320,6 +320,9 @@ int main(int argc, char* argv[])
bool splashScreen = Settings::getInstance()->getBool("SplashScreen");
bool splashScreenProgress = Settings::getInstance()->getBool("SplashScreenProgress");
+ //dont generate joystick events while we're loading (hopefully fixes "automatically started emulator" bug)
+ SDL_JoystickEventState(SDL_DISABLE);
+
if(!scrape_cmdline)
{
if(!window.init())
@@ -365,9 +368,6 @@ int main(int argc, char* argv[])
return run_scraper_cmdline();
}
- //dont generate joystick events while we're loading (hopefully fixes "automatically started emulator" bug)
- SDL_JoystickEventState(SDL_DISABLE);
-
// preload what we can right away instead of waiting for the user to select it
// this makes for no delays when accessing content, but a longer startup time
ViewController::get()->preload();
@@ -386,7 +386,10 @@ int main(int argc, char* argv[])
}
}
- //generate joystick events since we're done loading
+ //generate joystick events since we're done loading and clear the input event queue
+ SDL_PumpEvents();
+ SDL_FlushEvent(SDL_KEYDOWN);
+ SDL_FlushEvent(SDL_KEYUP);
SDL_JoystickEventState(SDL_ENABLE);
int lastTime = SDL_GetTicks();
I don't think it's 100% correct, since any errors during startup would leave the joystick disabled, further testing is needed.