summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2010-10-11 22:19:47 +0000
committerJordan Woyak <jordan.woyak@gmail.com>2010-10-11 22:19:47 +0000
commitde3ad372998f3c0c7fb4fb47fde8d3b2edd79759 (patch)
tree14f161574e72f0858ae9c76b218326dff66e85eb /Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp
parent7733b84bc134e3aeeeb47a89521dd00e8b122754 (diff)
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
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp5
1 files changed, 2 insertions, 3 deletions
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<ControllerInterface::Device*>& devices/*, HWND hwnd*/ )
+void InitJoystick(IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices, HWND hwnd)
{
std::list<DIDEVICEINSTANCE> joysticks;
idi8->EnumDevices( DI8DEVCLASS_GAMECTRL, DIEnumDevicesCallback, (LPVOID)&joysticks, DIEDFL_ATTACHEDONLY );
@@ -171,8 +171,7 @@ void InitJoystick( IDirectInput8* const idi8, std::vector<ControllerInterface::D
{
if (SUCCEEDED(js_device->SetDataFormat(&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