diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp index a433dcaa3d..337936f3a4 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp @@ -206,6 +206,21 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI , m_index(index) //, 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 DIDEVCAPS 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; - // 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 for ( unsigned int i = 0; i < js_caps.dwButtons; ++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? // get supported ff effects diff --git a/Source/Core/InputUICommon/Src/ConfigDiagBitmaps.cpp b/Source/Core/InputUICommon/Src/ConfigDiagBitmaps.cpp index 69de5241f6..4d6a339e47 100644 --- a/Source/Core/InputUICommon/Src/ConfigDiagBitmaps.cpp +++ b/Source/Core/InputUICommon/Src/ConfigDiagBitmaps.cpp @@ -19,10 +19,15 @@ 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); + 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 g = current_page->control_groups.begin(), ge = current_page->control_groups.end(); @@ -31,12 +36,6 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event)) // if this control group has a 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; wxBitmap bitmap((*g)->static_bitmap->GetBitmap()); dc.SelectObject(bitmap); @@ -343,9 +342,8 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event)) dc.SelectObject(wxNullBitmap); (*g)->static_bitmap->SetBitmap(bitmap); - - m_plugin.controller_interface.update_lock.Leave(); } } + m_plugin.controller_interface.update_lock.Leave(); }