Win32: another attempt on hotplugging crashes

This commit is contained in:
OV2 2015-04-20 17:55:19 +02:00
parent 951a383ae2
commit 56a4ce5ef8
1 changed files with 5 additions and 1 deletions

View File

@ -291,6 +291,7 @@ void S9xDetectJoypads();
#define WM_CUSTKEYDOWN (WM_USER+50) #define WM_CUSTKEYDOWN (WM_USER+50)
#define WM_CUSTKEYUP (WM_USER+51) #define WM_CUSTKEYUP (WM_USER+51)
#define WM_SCANJOYPADS (WM_APP+10)
#ifdef UNICODE #ifdef UNICODE
#define S9XW_SHARD_PATH SHARD_PATHW #define S9XW_SHARD_PATH SHARD_PATHW
@ -2673,7 +2674,10 @@ LRESULT CALLBACK WinProc(
#endif #endif
case WM_DEVICECHANGE: case WM_DEVICECHANGE:
if(wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE || wParam == DBT_DEVNODES_CHANGED) if(wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE || wParam == DBT_DEVNODES_CHANGED)
S9xDetectJoypads(); PostMessage(hWnd, WM_SCANJOYPADS, 0, 0);
break;
case WM_SCANJOYPADS:
S9xDetectJoypads();
break; break;
} }
return DefWindowProc (hWnd, uMsg, wParam, lParam); return DefWindowProc (hWnd, uMsg, wParam, lParam);