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
This commit is contained in:
Jordan Woyak 2010-10-11 22:19:47 +00:00
parent 7733b84bc1
commit de3ad37299
4 changed files with 8 additions and 5 deletions

View File

@ -71,7 +71,7 @@ void Init(std::vector<ControllerInterface::Device*>& devices, HWND hwnd)
InitKeyboardMouse(idi8, devices, hwnd);
#endif
#ifdef CIFACE_USE_DINPUT_JOYSTICK
InitJoystick(idi8, devices/*, hwnd*/);
InitJoystick(idi8, devices, hwnd);
#endif
idi8->Release();

View File

@ -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

View File

@ -21,7 +21,7 @@ namespace ciface
namespace DInput
{
void InitJoystick( IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices/*, HWND hwnd*/ );
void InitJoystick(IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices, HWND hwnd);
class Joystick : public ControllerInterface::Device
{

View File

@ -434,6 +434,10 @@ void Wiimote::ReadData(const wm_read_data* const rd)
// motion plus
case 0xa6 :
{
// emulated motion plus is not yet supported
// return read error
size = 0;
// motion plus crap copied from old wiimote plugin
//block[0xFC] = 0xA6;
//block[0xFD] = 0x20;