mirror of https://github.com/snes9xgit/snes9x.git
win32: do hotplugging detection 500ms after arrival/removal
This commit is contained in:
parent
47144176ff
commit
f7c3117f5f
|
@ -297,7 +297,8 @@ 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)
|
|
||||||
|
#define TIMER_SCANJOYPADS (99999)
|
||||||
|
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
#define S9XW_SHARD_PATH SHARD_PATHW
|
#define S9XW_SHARD_PATH SHARD_PATHW
|
||||||
|
@ -2682,13 +2683,20 @@ LRESULT CALLBACK WinProc(
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case WM_DEVICECHANGE:
|
case WM_DEVICECHANGE:
|
||||||
if(wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE)
|
if (wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE) {
|
||||||
PostMessage(hWnd, WM_SCANJOYPADS, 0, 0);
|
// trigger a joypad detect after 500ms - the multimedia functions do not like it if we trigger this right after arrival/removal
|
||||||
|
SetTimer(hWnd, TIMER_SCANJOYPADS, 500, NULL);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WM_SCANJOYPADS:
|
case WM_TIMER:
|
||||||
S9xDetectJoypads();
|
{
|
||||||
break;
|
if (wParam == TIMER_SCANJOYPADS) {
|
||||||
}
|
S9xDetectJoypads();
|
||||||
|
KillTimer(hWnd, TIMER_SCANJOYPADS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue