GCPad/WiimoteNew: Reordered some stuff in DirectInput device enumeration.(makes certain gamepads work now, hopfully doesn't break other pads) (Thanks to YoD for helping debug) Also fixed something ridiculous in the input config dialog. :p

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6264 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak 2010-10-09 07:24:33 +00:00
parent f3b144d563
commit cf5639af54
2 changed files with 23 additions and 24 deletions

View File

@ -206,6 +206,21 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI
, m_index(index) , m_index(index)
//, m_name(TStringToString(lpddi->tszInstanceName)) //, m_name(TStringToString(lpddi->tszInstanceName))
{ {
// seems this needs to be done before GetCapabilities
// polled or buffered data
DIPROPDWORD dipdw;
dipdw.diph.dwSize = sizeof(DIPROPDWORD);
dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
dipdw.diph.dwObj = 0;
dipdw.diph.dwHow = DIPH_DEVICE;
dipdw.dwData = DATA_BUFFER_SIZE;
// set the buffer size,
// if we can't set the property, we can't use buffered data
m_buffered = SUCCEEDED(m_device->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph));
// seems this needs to be done after SetProperty of buffer size
m_device->Acquire();
// get joystick caps // get joystick caps
DIDEVCAPS js_caps; DIDEVCAPS js_caps;
js_caps.dwSize = sizeof(js_caps); js_caps.dwSize = sizeof(js_caps);
@ -218,17 +233,6 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI
//m_must_poll = (js_caps.dwFlags & DIDC_POLLEDDATAFORMAT) != 0; //m_must_poll = (js_caps.dwFlags & DIDC_POLLEDDATAFORMAT) != 0;
// polled or buffered data
DIPROPDWORD dipdw;
dipdw.diph.dwSize = sizeof(DIPROPDWORD);
dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
dipdw.diph.dwObj = 0;
dipdw.diph.dwHow = DIPH_DEVICE;
dipdw.dwData = DATA_BUFFER_SIZE;
// set the buffer size,
// if we can't set the property, we can't use buffered data
m_buffered = SUCCEEDED(m_device->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph));
// buttons // buttons
for ( unsigned int i = 0; i < js_caps.dwButtons; ++i ) for ( unsigned int i = 0; i < js_caps.dwButtons; ++i )
AddInput( new Button( i ) ); AddInput( new Button( i ) );
@ -267,9 +271,6 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI
} }
} }
// it seems this needs to be done after SetProperty...
m_device->Acquire();
// TODO: check for DIDC_FORCEFEEDBACK in devcaps? // TODO: check for DIDC_FORCEFEEDBACK in devcaps?
// get supported ff effects // get supported ff effects

View File

@ -19,10 +19,15 @@
void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event)) void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
{ {
GamepadPage* const current_page = (GamepadPage*)m_pad_notebook->GetPage( m_pad_notebook->GetSelection() );
wxFont small_font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD); wxFont small_font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
m_plugin.controller_interface.UpdateInput();
// don't want game thread updating input when we are using it here
if (false == m_plugin.controller_interface.update_lock.TryEnter())
return;
GamepadPage* const current_page = (GamepadPage*)m_pad_notebook->GetPage(m_pad_notebook->GetSelection());
std::vector< ControlGroupBox* >::iterator std::vector< ControlGroupBox* >::iterator
g = current_page->control_groups.begin(), g = current_page->control_groups.begin(),
ge = current_page->control_groups.end(); ge = current_page->control_groups.end();
@ -31,12 +36,6 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
// if this control group has a bitmap // if this control group has a bitmap
if ( (*g)->static_bitmap ) if ( (*g)->static_bitmap )
{ {
m_plugin.controller_interface.UpdateInput();
// don't want game thread updating input when we are using it here
if (false == m_plugin.controller_interface.update_lock.TryEnter())
return;
wxMemoryDC dc; wxMemoryDC dc;
wxBitmap bitmap((*g)->static_bitmap->GetBitmap()); wxBitmap bitmap((*g)->static_bitmap->GetBitmap());
dc.SelectObject(bitmap); dc.SelectObject(bitmap);
@ -343,9 +342,8 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
dc.SelectObject(wxNullBitmap); dc.SelectObject(wxNullBitmap);
(*g)->static_bitmap->SetBitmap(bitmap); (*g)->static_bitmap->SetBitmap(bitmap);
m_plugin.controller_interface.update_lock.Leave();
} }
} }
m_plugin.controller_interface.update_lock.Leave();
} }