diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index ee47ff60e4f..2367023175c 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1143,8 +1143,35 @@ static BOOL CALLBACK set_object_property( const DIDEVICEOBJECTINSTANCEW *instanc { struct set_object_property_params *params = context; struct dinput_device *impl = impl_from_IDirectInputDevice8W( params->iface ); - impl->vtbl->set_property( params->iface, params->property, params->header, instance ); - return DIENUM_CONTINUE; + struct object_properties *properties = NULL; + + if (!impl->object_properties) return DIENUM_STOP; + properties = impl->object_properties + instance->dwOfs / sizeof(LONG); + + switch (params->property) + { + case (DWORD_PTR)DIPROP_RANGE: + { + const DIPROPRANGE *value = (const DIPROPRANGE *)params->header; + properties->range_min = value->lMin; + properties->range_max = value->lMax; + return DIENUM_CONTINUE; + } + case (DWORD_PTR)DIPROP_DEADZONE: + { + const DIPROPDWORD *value = (const DIPROPDWORD *)params->header; + properties->deadzone = value->dwData; + return DIENUM_CONTINUE; + } + case (DWORD_PTR)DIPROP_SATURATION: + { + const DIPROPDWORD *value = (const DIPROPDWORD *)params->header; + properties->saturation = value->dwData; + return DIENUM_CONTINUE; + } + } + + return DIENUM_STOP; } static BOOL CALLBACK reset_object_value( const DIDEVICEOBJECTINSTANCEW *instance, void *context ) diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 3e2942f71ef..6d24e66bb54 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -45,8 +45,6 @@ struct dinput_device_vtbl LPDIENUMDEVICEOBJECTSCALLBACKW callback, void *context ); HRESULT (*get_property)( IDirectInputDevice8W *iface, DWORD property, DIPROPHEADER *header, DIDEVICEOBJECTINSTANCEW *instance ); - HRESULT (*set_property)( IDirectInputDevice8W *iface, DWORD property, const DIPROPHEADER *header, - const DIDEVICEOBJECTINSTANCEW *instance ); HRESULT (*get_effect_info)( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, const GUID *guid ); HRESULT (*create_effect)( IDirectInputDevice8W *iface, IDirectInputEffect **out ); HRESULT (*send_force_feedback_command)( IDirectInputDevice8W *iface, DWORD command, BOOL unacquire ); diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index b252b9a13c9..56e4c38c31a 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -780,22 +780,6 @@ static HRESULT hid_joystick_get_property( IDirectInputDevice8W *iface, DWORD pro return DIERR_UNSUPPORTED; } -static void set_extra_caps_range( struct hid_joystick *impl, const DIDEVICEOBJECTINSTANCEW *instance, - LONG min, LONG max ) -{ - struct object_properties *properties = impl->base.object_properties + instance->dwOfs / sizeof(LONG); - LONG tmp; - - properties->range_min = min; - properties->range_max = max; - - if (instance->dwType & DIDFT_POV) - { - tmp = properties->logical_max - properties->logical_min; - if (tmp > 0) properties->range_max -= max / (tmp + 1); - } -} - static HRESULT hid_joystick_send_device_gain( IDirectInputDevice8W *iface, LONG device_gain ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); @@ -817,39 +801,6 @@ static HRESULT hid_joystick_send_device_gain( IDirectInputDevice8W *iface, LONG return DI_OK; } -static HRESULT hid_joystick_set_property( IDirectInputDevice8W *iface, DWORD property, - const DIPROPHEADER *header, const DIDEVICEOBJECTINSTANCEW *instance ) -{ - struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); - struct object_properties *properties = NULL; - - if (instance) properties = impl->base.object_properties + instance->dwOfs / sizeof(LONG); - - switch (property) - { - case (DWORD_PTR)DIPROP_RANGE: - { - const DIPROPRANGE *value = (const DIPROPRANGE *)header; - set_extra_caps_range( impl, instance, value->lMin, value->lMax ); - return DI_OK; - } - case (DWORD_PTR)DIPROP_DEADZONE: - { - const DIPROPDWORD *value = (const DIPROPDWORD *)header; - properties->deadzone = value->dwData; - return DI_OK; - } - case (DWORD_PTR)DIPROP_SATURATION: - { - const DIPROPDWORD *value = (const DIPROPDWORD *)header; - properties->saturation = value->dwData; - return DI_OK; - } - } - - return DIERR_UNSUPPORTED; -} - static HRESULT hid_joystick_acquire( IDirectInputDevice8W *iface ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); @@ -1301,7 +1252,6 @@ static const struct dinput_device_vtbl hid_joystick_vtbl = hid_joystick_unacquire, hid_joystick_enum_objects, hid_joystick_get_property, - hid_joystick_set_property, hid_joystick_get_effect_info, hid_joystick_create_effect, hid_joystick_send_force_feedback_command, @@ -1561,11 +1511,20 @@ static BOOL init_object_properties( struct hid_joystick *impl, struct hid_value_ DIDEVICEOBJECTINSTANCEW *instance, void *data ) { struct object_properties *properties = impl->base.object_properties + instance->dwOfs / sizeof(LONG); - LONG range_max = (instance->dwType & DIDFT_AXIS) ? 65535 : 36000; + LONG tmp; + properties->bit_size = caps->bit_size; properties->logical_min = caps->logical_min; properties->logical_max = caps->logical_max; - set_extra_caps_range( impl, instance, 0, range_max ); + + if (instance->dwType & DIDFT_AXIS) properties->range_max = 65535; + else + { + properties->range_max = 36000; + tmp = caps->logical_max - caps->logical_min; + if (tmp > 0) properties->range_max -= 36000 / (tmp + 1); + } + properties->saturation = 10000; return DIENUM_CONTINUE; } diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index 916a1d43233..2afb744d520 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -274,12 +274,6 @@ static HRESULT keyboard_get_property( IDirectInputDevice8W *iface, DWORD propert return DIERR_UNSUPPORTED; } -static HRESULT keyboard_set_property( IDirectInputDevice8W *iface, DWORD property, - const DIPROPHEADER *header, const DIDEVICEOBJECTINSTANCEW *instance ) -{ - return DIERR_UNSUPPORTED; -} - static const struct dinput_device_vtbl keyboard_vtbl = { NULL, @@ -289,7 +283,6 @@ static const struct dinput_device_vtbl keyboard_vtbl = keyboard_unacquire, keyboard_enum_objects, keyboard_get_property, - keyboard_set_property, NULL, NULL, NULL, diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 313ac070c86..94cca61a0d0 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -576,12 +576,6 @@ static HRESULT mouse_get_property( IDirectInputDevice8W *iface, DWORD property, return DIERR_UNSUPPORTED; } -static HRESULT mouse_set_property( IDirectInputDevice8W *iface, DWORD property, - const DIPROPHEADER *header, const DIDEVICEOBJECTINSTANCEW *instance ) -{ - return DIERR_UNSUPPORTED; -} - static const struct dinput_device_vtbl mouse_vtbl = { NULL, @@ -591,7 +585,6 @@ static const struct dinput_device_vtbl mouse_vtbl = mouse_unacquire, mouse_enum_objects, mouse_get_property, - mouse_set_property, NULL, NULL, NULL,