From: Tomasz Pakuła tomasz.pakula.oficjalny@gmail.com
--- dlls/dinput/joystick_hid.c | 18 +++++++++--------- dlls/winebus.sys/hid.c | 2 +- dlls/winebus.sys/unix_private.h | 7 ++++--- include/wine/hid.h | 2 ++ 4 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index f7f87596c82..27d08fd2af2 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -69,8 +69,8 @@ struct pid_effect_update UINT axis_count; UINT direction_coll; UINT direction_count; - struct hid_value_caps *axis_caps[6]; - struct hid_value_caps *direction_caps[6]; + struct hid_value_caps *axis_caps[MAX_PID_AXES]; + struct hid_value_caps *direction_caps[MAX_PID_AXES]; struct hid_value_caps *duration_caps; struct hid_value_caps *gain_caps; struct hid_value_caps *sample_period_caps; @@ -221,11 +221,11 @@ struct hid_joystick_effect struct list entry; struct hid_joystick *joystick;
- DWORD axes[6]; - LONG directions[6]; + DWORD axes[MAX_PID_AXES]; + LONG directions[MAX_PID_AXES]; DICONSTANTFORCE constant_force; DIRAMPFORCE ramp_force; - DICONDITION condition[6]; + DICONDITION condition[MAX_PID_AXES]; DIENVELOPE envelope; DIPERIODIC periodic; DIEFFECT params; @@ -1852,7 +1852,7 @@ static BOOL init_pid_caps( struct dinput_device *device, UINT index, struct hid_ if (instance->wCollectionNumber == effect_update->axes_coll) { SET_REPORT_ID( effect_update ); - if (effect_update->axis_count >= 6) FIXME( "more than 6 PID axes detected\n" ); + if (effect_update->axis_count >= MAX_PID_AXES) FIXME( "more than %d PID axes detected\n", MAX_PID_AXES ); else effect_update->axis_caps[effect_update->axis_count] = caps; effect_update->axis_count++; } @@ -1861,7 +1861,7 @@ static BOOL init_pid_caps( struct dinput_device *device, UINT index, struct hid_ SET_REPORT_ID( effect_update ); caps->physical_min = 0; caps->physical_max = 35900; - if (effect_update->direction_count >= 6) FIXME( "more than 6 PID directions detected\n" ); + if (effect_update->direction_count >= MAX_PID_AXES) FIXME( "more than %d PID directions detected\n", MAX_PID_AXES ); else effect_update->direction_caps[effect_update->direction_count] = caps; effect_update->direction_count++; } @@ -2374,7 +2374,7 @@ static void convert_directions_from_spherical( const DIEFFECT *in, DIEFFECT *out static void convert_directions( const DIEFFECT *in, DIEFFECT *out ) { DWORD direction_flags = DIEFF_CARTESIAN | DIEFF_POLAR | DIEFF_SPHERICAL; - LONG directions[6] = {0}; + LONG directions[MAX_PID_AXES] = {0}; DIEFFECT spherical = {.rglDirection = directions};
switch (in->dwFlags & direction_flags) @@ -2894,7 +2894,7 @@ static HRESULT WINAPI hid_joystick_effect_Download( IDirectInputEffect *iface ) ULONG report_len = impl->joystick->caps.OutputReportByteLength; HANDLE device = impl->joystick->device; struct hid_value_caps *caps; - LONG directions[4] = {0}; + LONG directions[MAX_PID_AXES] = {0}; DWORD i, tmp, count; DIEFFECT spherical; NTSTATUS status; diff --git a/dlls/winebus.sys/hid.c b/dlls/winebus.sys/hid.c index 78efe6116ce..0e101c2f70a 100644 --- a/dlls/winebus.sys/hid.c +++ b/dlls/winebus.sys/hid.c @@ -503,7 +503,7 @@ struct pid_effect_update BYTE gain_percent; BYTE trigger_button; BYTE enable_bits; - UINT16 direction[2]; + UINT16 direction[MAX_PID_AXES]; };
struct pid_set_periodic diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index f2f4e71f014..bc76fad33dc 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -29,6 +29,7 @@ #include "unixlib.h"
#include "wine/list.h" +#include "wine/hid.h"
struct effect_periodic { @@ -75,9 +76,9 @@ struct effect_params UINT16 sample_period; UINT16 start_delay; BYTE trigger_button; - BOOL axis_enabled[2]; + BOOL axis_enabled[MAX_PID_AXES]; BOOL direction_enabled; - UINT16 direction[2]; + UINT16 direction[MAX_PID_AXES]; BYTE gain_percent; BYTE condition_count; /* only for periodic, constant or ramp forces */ @@ -85,7 +86,7 @@ struct effect_params union { struct effect_periodic periodic; - struct effect_condition condition[2]; + struct effect_condition condition[MAX_PID_AXES]; struct effect_constant_force constant_force; struct effect_ramp_force ramp_force; }; diff --git a/include/wine/hid.h b/include/wine/hid.h index 8200ca9beec..cb31bd6e5a5 100644 --- a/include/wine/hid.h +++ b/include/wine/hid.h @@ -239,6 +239,8 @@ struct hid_preparsed_data #define PID_USAGE_CREATE_NEW_EFFECT_REPORT ((USAGE) 0xab) #define PID_USAGE_RAM_POOL_AVAILABLE ((USAGE) 0xac)
+#define MAX_PID_AXES 6 + #define IOCTL_HID_GET_WINE_RAWINPUT_HANDLE HID_BUFFER_CTL_CODE(300)
#endif /* __WINE_PARSE_H */