fix:xinput disconnect lost gamepad (#15819)

Co-authored-by: ChenX <maple6@vip.qq.com>
This commit is contained in:
Mike Erickson 2023-10-24 15:28:10 +08:00 committed by GitHub
parent 57e9a3e876
commit 7df3ca3064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -242,6 +242,11 @@ static BOOL CALLBACK enum_joypad_cb_hybrid(
if (g_joypad_cnt == MAX_USERS) if (g_joypad_cnt == MAX_USERS)
return DIENUM_STOP; return DIENUM_STOP;
while (!g_xinput_states[g_last_xinput_pad_idx].connected && g_last_xinput_pad_idx < 3)
{
g_last_xinput_pad_idx++;
}
pad = &g_pads[g_joypad_cnt].joypad; pad = &g_pads[g_joypad_cnt].joypad;
#ifdef __cplusplus #ifdef __cplusplus