From 10a2ae14715eeabe96af8d0c4a6f300d455b329c Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 21 Sep 2016 21:23:57 -0400 Subject: [PATCH] Detect when a joypad is added or removed while bizhawk is open fixes #698 --- BizHawk.Client.EmuHawk/MainForm.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index e88133dedc..db7a1010c1 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -2595,9 +2595,19 @@ namespace BizHawk.Client.EmuHawk }); } + private const int WM_DEVICECHANGE = 0x0219; + // Alt key hacks protected override void WndProc(ref Message m) { + switch (m.Msg) + { + case WM_DEVICECHANGE: + GamePad.Initialize(); + GamePad360.Initialize(); + break; + } + // this is necessary to trap plain alt keypresses so that only our hotkey system gets them if (m.Msg == 0x0112) // WM_SYSCOMMAND {