mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-05 15:48:53 +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);
|
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
|
// Await for server without blocking Ctrl+C handling
|
||||||
bool connected;
|
bool connected;
|
||||||
if (!await_for_server(&connected)) {
|
if (!await_for_server(&connected)) {
|
||||||
|
@ -384,6 +379,14 @@ scrcpy(struct scrcpy_options *options) {
|
||||||
goto end;
|
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
|
// It is necessarily initialized here, since the device is connected
|
||||||
struct sc_server_info *info = &s->server.info;
|
struct sc_server_info *info = &s->server.info;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue