mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-22 04:25:01 +00:00
Fix SDL game controller init timing
This commit is contained in:
parent
8df26fef2b
commit
88b8f1c6d7
1 changed files with 8 additions and 5 deletions
|
@ -367,11 +367,6 @@ scrcpy(struct scrcpy_options *options) {
|
|||
|
||||
sdl_configure(options->display, options->disable_screensaver);
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)) {
|
||||
LOGE("Could not initialize SDL: %s", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Await for server without blocking Ctrl+C handling
|
||||
bool connected;
|
||||
if (!await_for_server(&connected)) {
|
||||
|
@ -384,6 +379,14 @@ scrcpy(struct scrcpy_options *options) {
|
|||
goto end;
|
||||
}
|
||||
|
||||
// Initialize GAMECONTROLLER subsystem after server connected
|
||||
// Otherwise the initial CONTROLLERDEVICEADDED event might
|
||||
// be handled by `await_for_server`
|
||||
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)) {
|
||||
LOGE("Could not initialize SDL: %s", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
// It is necessarily initialized here, since the device is connected
|
||||
struct sc_server_info *info = &s->server.info;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue