Skip to content

Commit

Permalink
Windows|Joystick|DirectInput|InputSystem|Client: Don't log errors reg…
Browse files Browse the repository at this point in the history
…arding nonexistent joystick controls

In this case the errors are due to our basic DirectInput init not
taking the time to enumerate the available controls before trying
to configure their properties.

The current plan is to switch to using SDL2 for all input in 1.16
so simply ignore these specific errors for now.
  • Loading branch information
danij-deng committed Nov 7, 2014
1 parent ce39812 commit 5eca3db
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions doomsday/client/src/windows/joystick_win32.cpp
@@ -1,8 +1,7 @@
/** @file joystick_win32.cpp Joystick input for Windows.
* @ingroup input
/** @file joystick_win32.cpp Joystick input for Windows.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2005-2014 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand Down Expand Up @@ -152,25 +151,34 @@ dd_bool Joystick_Init()
hr = didJoy->SetProperty(DIPROP_RANGE, DIPropRange(DIPH_BYOFFSET, joyProp[i], IJOY_AXISMIN, IJOY_AXISMAX));
if(FAILED(hr))
{
LOGDEV_INPUT_VERBOSE("Failed to set axis '%s' range (0x%x: %s)")
<< axisName[i] << hr << DirectInput_ErrorMsg(hr);
if(hr != DIERR_NOTFOUND)
{
LOGDEV_INPUT_VERBOSE("Failed to set axis '%s' range (0x%x: %s)")
<< axisName[i] << hr << DirectInput_ErrorMsg(hr);
}
}
}

// Set no dead zone. We'll handle this ourselves thanks...
hr = didJoy->SetProperty(DIPROP_DEADZONE, DIPropDWord(DIPH_DEVICE));
if(FAILED(hr))
{
LOGDEV_INPUT_WARNING("Failed to set dead zone (0x%x: %s)")
<< hr << DirectInput_ErrorMsg(hr);
if(hr != DIERR_NOTFOUND)
{
LOGDEV_INPUT_WARNING("Failed to set dead zone (0x%x: %s)")
<< hr << DirectInput_ErrorMsg(hr);
}
}

// Set absolute mode.
hr = didJoy->SetProperty(DIPROP_AXISMODE, DIPropDWord(DIPH_DEVICE, 0, DIPROPAXISMODE_ABS));
if(FAILED(hr))
{
LOGDEV_INPUT_WARNING("Failed to set absolute axis mode (0x%x: %s)")
<< hr << DirectInput_ErrorMsg(hr);
if(hr != DIERR_NOTFOUND)
{
LOGDEV_INPUT_WARNING("Failed to set absolute axis mode (0x%x: %s)")
<< hr << DirectInput_ErrorMsg(hr);
}
}

// Acquire it.
Expand Down

0 comments on commit 5eca3db

Please sign in to comment.