winebus.sys: Add missing padding between hatswitch and constant.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2019-05-20 10:31:06 -05:00 committed by Alexandre Julliard
parent 5904eb8419
commit f8ebb3ac37
1 changed files with 9 additions and 3 deletions

View File

@ -548,19 +548,23 @@ static BOOL build_mapped_report_descriptor(struct platform_private *ext)
BYTE *report_ptr;
INT i, descript_size;
static const int BUTTON_BIT_COUNT = CONTROLLER_NUM_BUTTONS + CONTROLLER_NUM_HATSWITCHES * 4;
descript_size = sizeof(REPORT_HEADER) + sizeof(REPORT_TAIL);
descript_size += sizeof(CONTROLLER_AXIS);
descript_size += sizeof(CONTROLLER_TRIGGERS);
descript_size += sizeof(CONTROLLER_BUTTONS);
descript_size += sizeof(REPORT_HATSWITCH);
descript_size += sizeof(REPORT_PADDING);
if (BUTTON_BIT_COUNT % 8 != 0)
descript_size += sizeof(REPORT_PADDING);
descript_size += test_haptic(ext);
ext->axis_start = 0;
ext->button_start = CONTROLLER_NUM_AXES * sizeof(WORD);
ext->hat_bit_offs = CONTROLLER_NUM_BUTTONS;
ext->buffer_length = (CONTROLLER_NUM_BUTTONS + CONTROLLER_NUM_HATSWITCHES * 4 + 7) / 8
ext->buffer_length = (BUTTON_BIT_COUNT + 7) / 8
+ CONTROLLER_NUM_AXES * sizeof(WORD)
+ 2/* unknown constant*/;
@ -586,6 +590,8 @@ static BOOL build_mapped_report_descriptor(struct platform_private *ext)
memcpy(report_ptr, CONTROLLER_BUTTONS, sizeof(CONTROLLER_BUTTONS));
report_ptr += sizeof(CONTROLLER_BUTTONS);
report_ptr = add_hatswitch(report_ptr, 1);
if (BUTTON_BIT_COUNT % 8 != 0)
report_ptr = add_padding_block(report_ptr, 8 - (BUTTON_BIT_COUNT % 8));/* unused bits between hatswitch and following constant */
report_ptr = add_padding_block(report_ptr, 16);/* unknown constant */
report_ptr += build_haptic(ext, report_ptr);
memcpy(report_ptr, REPORT_TAIL, sizeof(REPORT_TAIL));
@ -606,8 +612,8 @@ static BOOL build_mapped_report_descriptor(struct platform_private *ext)
set_hat_value(ext, 0, compose_dpad_value(ext->sdl_controller));
/* unknown constant */
ext->report_buffer[12] = 0x89;
ext->report_buffer[13] = 0xc5;
ext->report_buffer[14] = 0x89;
ext->report_buffer[15] = 0xc5;
return TRUE;
}