Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
57aaa274
Commit
57aaa274
authored
Feb 16, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Feb 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xinput1_3: Only write haptics waveform reports when needed.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
59584b99
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
main.c
dlls/xinput1_3/main.c
+12
-0
No files found.
dlls/xinput1_3/main.c
View file @
57aaa274
...
...
@@ -286,11 +286,14 @@ static DWORD HID_set_state(struct xinput_controller *controller, XINPUT_VIBRATIO
PHIDP_PREPARSED_DATA
preparsed
=
controller
->
hid
.
preparsed
;
char
*
report_buf
=
controller
->
hid
.
output_report_buf
;
BYTE
report_id
=
controller
->
hid
.
haptics_report
;
BOOL
update_rumble
,
update_buzz
;
NTSTATUS
status
;
if
(
!
(
controller
->
caps
.
Flags
&
XINPUT_CAPS_FFB_SUPPORTED
))
return
ERROR_SUCCESS
;
update_rumble
=
(
controller
->
vibration
.
wLeftMotorSpeed
!=
state
->
wLeftMotorSpeed
);
controller
->
vibration
.
wLeftMotorSpeed
=
state
->
wLeftMotorSpeed
;
update_buzz
=
(
controller
->
vibration
.
wRightMotorSpeed
!=
state
->
wRightMotorSpeed
);
controller
->
vibration
.
wRightMotorSpeed
=
state
->
wRightMotorSpeed
;
if
(
!
controller
->
enabled
)
return
ERROR_SUCCESS
;
...
...
@@ -311,6 +314,8 @@ static DWORD HID_set_state(struct xinput_controller *controller, XINPUT_VIBRATIO
return
0
;
}
if
(
update_rumble
)
{
/* send haptics rumble report (left motor) */
status
=
HidP_InitializeReportForID
(
HidP_Output
,
report_id
,
preparsed
,
report_buf
,
report_len
);
if
(
status
!=
HIDP_STATUS_SUCCESS
)
WARN
(
"HidP_InitializeReportForID returned %#lx
\n
"
,
status
);
...
...
@@ -328,7 +333,10 @@ static DWORD HID_set_state(struct xinput_controller *controller, XINPUT_VIBRATIO
WARN
(
"HidD_SetOutputReport failed with error %lu
\n
"
,
GetLastError
());
return
GetLastError
();
}
}
if
(
update_buzz
)
{
/* send haptics buzz report (right motor) */
status
=
HidP_InitializeReportForID
(
HidP_Output
,
report_id
,
preparsed
,
report_buf
,
report_len
);
if
(
status
!=
HIDP_STATUS_SUCCESS
)
WARN
(
"HidP_InitializeReportForID returned %#lx
\n
"
,
status
);
...
...
@@ -346,7 +354,10 @@ static DWORD HID_set_state(struct xinput_controller *controller, XINPUT_VIBRATIO
WARN
(
"HidD_SetOutputReport failed with error %lu
\n
"
,
GetLastError
());
return
GetLastError
();
}
}
if
(
update_rumble
||
update_buzz
)
{
/* trigger haptics waveforms */
status
=
HidP_InitializeReportForID
(
HidP_Output
,
report_id
,
preparsed
,
report_buf
,
report_len
);
if
(
status
!=
HIDP_STATUS_SUCCESS
)
WARN
(
"HidP_InitializeReportForID returned %#lx
\n
"
,
status
);
...
...
@@ -361,6 +372,7 @@ static DWORD HID_set_state(struct xinput_controller *controller, XINPUT_VIBRATIO
WARN
(
"HidD_SetOutputReport failed with error %lu
\n
"
,
GetLastError
());
return
GetLastError
();
}
}
return
ERROR_SUCCESS
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment