diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 340bab98f..1ea0d21b0 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1968,6 +1968,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic { for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1)) { + HandleGamepadDeviceEvents(&events[eventtail]); G_MapEventsToControls(&events[eventtail]); } diff --git a/src/d_main.c b/src/d_main.c index 7a69925b5..cf24bdf37 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -203,7 +203,7 @@ static void HandleGamepadDeviceRemoved(event_t *ev) } /// Respond to added/removed device events, for bookkeeping available gamepads. -static void HandleGamepadDeviceEvents(event_t *ev) +void HandleGamepadDeviceEvents(event_t *ev) { I_Assert(ev != NULL); diff --git a/src/g_input.h b/src/g_input.h index 610c3afdc..bee3ff8cc 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -165,6 +165,8 @@ boolean G_IsDeviceResponding(INT32 device); void G_SetDeviceResponding(INT32 device, boolean responding); void G_ResetAllDeviceResponding(void); +void HandleGamepadDeviceEvents(event_t *ev); + // remaps the input event to a game control. void G_MapEventsToControls(event_t *ev); diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 23189b741..852b8c8c5 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -871,10 +871,15 @@ INT32 I_GetKey (void) event_t *ev; INT32 rc = 0; + G_ResetAllDeviceResponding(); + // return the first keypress from the event queue for (; eventtail != eventhead; eventtail = (eventtail+1)&(MAXEVENTS-1)) { ev = &events[eventtail]; + + HandleGamepadDeviceEvents(ev); + if (ev->type == ev_keydown || ev->type == ev_console) { rc = ev->data1; diff --git a/src/sdl12/i_system.c b/src/sdl12/i_system.c index b388a9bf5..7c0abb998 100644 --- a/src/sdl12/i_system.c +++ b/src/sdl12/i_system.c @@ -910,10 +910,15 @@ INT32 I_GetKey (void) event_t *ev; INT32 rc = 0; + G_ResetAllDeviceResponding(); + // return the first keypress from the event queue for (; eventtail != eventhead; eventtail = (eventtail+1)&(MAXEVENTS-1)) { ev = &events[eventtail]; + + HandleGamepadDeviceEvents(ev); + if (ev->type == ev_keydown || ev->type == ev_console) { rc = ev->data1; diff --git a/src/win32ce/win_sys.c b/src/win32ce/win_sys.c index 091171b52..b261a7a50 100644 --- a/src/win32ce/win_sys.c +++ b/src/win32ce/win_sys.c @@ -3067,9 +3067,12 @@ INT32 I_GetKey(void) { event_t *ev; + G_ResetAllDeviceResponding(); + if (eventtail != eventhead) { ev = &events[eventtail]; + HandleGamepadDeviceEvents(ev); eventtail = (eventtail+1) & (MAXEVENTS-1); if (ev->type == ev_keydown || ev->type == ev_console) return ev->data1;