From 56a4ce5ef8ce3d5c96c6d0ac4f15492515156e44 Mon Sep 17 00:00:00 2001 From: OV2 Date: Mon, 20 Apr 2015 17:55:19 +0200 Subject: [PATCH] Win32: another attempt on hotplugging crashes --- win32/wsnes9x.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index 0640b8c1..a48814b4 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -291,6 +291,7 @@ void S9xDetectJoypads(); #define WM_CUSTKEYDOWN (WM_USER+50) #define WM_CUSTKEYUP (WM_USER+51) +#define WM_SCANJOYPADS (WM_APP+10) #ifdef UNICODE #define S9XW_SHARD_PATH SHARD_PATHW @@ -2673,7 +2674,10 @@ LRESULT CALLBACK WinProc( #endif case WM_DEVICECHANGE: if(wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE || wParam == DBT_DEVNODES_CHANGED) - S9xDetectJoypads(); + PostMessage(hWnd, WM_SCANJOYPADS, 0, 0); + break; + case WM_SCANJOYPADS: + S9xDetectJoypads(); break; } return DefWindowProc (hWnd, uMsg, wParam, lParam);