From de3ad372998f3c0c7fb4fb47fde8d3b2edd79759 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 11 Oct 2010 22:19:47 +0000 Subject: WiimoteNew: Made emulated wiimote return read error when motion plus register area is read.(Fixes "Sonic the Hedgehog 4" input, perhaps others) GCPad/WiimoteNew: Made DirectInput use the Dolphin window hwnd for SetCoopLevel instead of GetForegroundWindow.(attempt to fix issue where gamepads sometimes don't work until "Refresh" is pressed) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6269 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp') diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp index 337936f3a4..40823d617d 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp @@ -142,7 +142,7 @@ LCleanup: } #endif -void InitJoystick( IDirectInput8* const idi8, std::vector& devices/*, HWND hwnd*/ ) +void InitJoystick(IDirectInput8* const idi8, std::vector& devices, HWND hwnd) { std::list joysticks; idi8->EnumDevices( DI8DEVCLASS_GAMECTRL, DIEnumDevicesCallback, (LPVOID)&joysticks, DIEDFL_ATTACHEDONLY ); @@ -171,8 +171,7 @@ void InitJoystick( IDirectInput8* const idi8, std::vectorSetDataFormat(&c_dfDIJoystick))) { - // using foregroundwindow seems like a hack - if (FAILED(js_device->SetCooperativeLevel(GetForegroundWindow(), DISCL_BACKGROUND | DISCL_EXCLUSIVE))) + if (FAILED(js_device->SetCooperativeLevel(GetAncestor(hwnd, GA_ROOT), DISCL_BACKGROUND | DISCL_EXCLUSIVE))) { //PanicAlert("SetCooperativeLevel(DISCL_EXCLUSIVE) failed!"); // fall back to non-exclusive mode, with no rumble -- cgit v1.2.3