Skip to content

Commit

Permalink
Limit DIPROP_VIDPID to only those versions of DirectInput that actual…
Browse files Browse the repository at this point in the history
…ly support it.
  • Loading branch information
samuelgr committed Dec 1, 2022
1 parent 293a5cd commit 218a92b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/VirtualDirectInputDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ namespace Xidi
case ((size_t)&DIPROP_DEADZONE):
case ((size_t)&DIPROP_GRANULARITY):
case ((size_t)&DIPROP_SATURATION):
#if DIRECTINPUT_VERSION >= 0x0800
case ((size_t)&DIPROP_VIDPID):
#endif
// Axis mode, deadzone, granularity, saturation, and vendor/product ID all use DIPROPDWORD.
if (sizeof(DIPROPDWORD) != pdiph->dwSize)
{
Expand Down Expand Up @@ -1585,11 +1587,13 @@ namespace Xidi
((LPDIPROPDWORD)pdiph)->dwData = controller->GetAxisSaturation(element.axis);
LOG_PROPERTY_INVOCATION_DIPROPDWORD_AND_RETURN(DI_OK, kMethodSeverity, rguidProp, pdiph);

#if DIRECTINPUT_VERSION >= 0x0800
case ((size_t)&DIPROP_VIDPID):
if (Controller::EElementType::WholeController != element.type)
LOG_PROPERTY_INVOCATION_NO_VALUE_AND_RETURN(DIERR_INVALIDPARAM, kMethodSeverity, rguidProp);
((LPDIPROPDWORD)pdiph)->dwData = ((DWORD)VirtualControllerProductId() << 16) | ((DWORD)VirtualControllerVendorId());
LOG_PROPERTY_INVOCATION_DIPROPDWORD_AND_RETURN(DI_OK, kMethodSeverity, rguidProp, pdiph);
#endif

default:
LOG_PROPERTY_INVOCATION_NO_VALUE_AND_RETURN(DIERR_UNSUPPORTED, kMethodSeverity, rguidProp);
Expand Down

0 comments on commit 218a92b

Please sign in to comment.