Merge pull request #5965 from fr500/master

avoid dinput reinitialization on unrelated WM_DEVICECHANGE events
This commit is contained in:
Twinaphex 2017-12-27 05:55:38 +01:00 committed by GitHub
commit d64154bf40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -1,5 +1,6 @@
# 1.7.1 (future) # 1.7.1 (future)
- COMMON: Fix menu toggle with keymapper active. - DINPUT: don't reinitialize input driver on network events / media insertion / network drive connection
- KEYMAPPER: prevent a condition that caused input_menu_toggle to stop working when a RETRO_DEVICE_KEYBOARD type device is enabled
- PS3: Enable Cheevos. - PS3: Enable Cheevos.
- PSP: Enable threading support through pthreads. - PSP: Enable threading support through pthreads.

View File

@ -21,6 +21,8 @@
#undef DIRECTINPUT_VERSION #undef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0800 #define DIRECTINPUT_VERSION 0x0800
#define DBT_DEVNODES_CHANGED 0x0007
#ifndef WM_MOUSEHWHEEL #ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x20e #define WM_MOUSEHWHEEL 0x20e
#endif #endif
@ -802,9 +804,12 @@ bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lPa
return true; return true;
} }
case WM_DEVICECHANGE: case WM_DEVICECHANGE:
if (di->joypad) if (wParam == DBT_DEVNODES_CHANGED)
di->joypad->destroy(); {
di->joypad = input_joypad_init_driver(di->joypad_driver_name, di); if (di->joypad)
di->joypad->destroy();
di->joypad = input_joypad_init_driver(di->joypad_driver_name, di);
}
break; break;
case WM_MOUSEWHEEL: case WM_MOUSEWHEEL:
if (((short) HIWORD(wParam))/120 > 0) if (((short) HIWORD(wParam))/120 > 0)