Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
419909f4
Commit
419909f4
authored
Aug 06, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Aug 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xinput1_3: Move enabled flag to struct xinput_controller.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
927ae12a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
main.c
dlls/xinput1_3/main.c
+8
-10
No files found.
dlls/xinput1_3/main.c
View file @
419909f4
...
@@ -56,6 +56,7 @@ struct xinput_controller
...
@@ -56,6 +56,7 @@ struct xinput_controller
XINPUT_STATE
state
;
XINPUT_STATE
state
;
XINPUT_GAMEPAD
last_keystroke
;
XINPUT_GAMEPAD
last_keystroke
;
XINPUT_VIBRATION
vibration
;
XINPUT_VIBRATION
vibration
;
BOOL
enabled
;
};
};
/* xinput_crit guards controllers array */
/* xinput_crit guards controllers array */
...
@@ -115,7 +116,6 @@ struct hid_platform_private
...
@@ -115,7 +116,6 @@ struct hid_platform_private
HANDLE
device
;
HANDLE
device
;
WCHAR
device_path
[
MAX_PATH
];
WCHAR
device_path
[
MAX_PATH
];
BOOL
enabled
;
char
*
input_report_buf
[
2
];
char
*
input_report_buf
[
2
];
char
*
output_report_buf
;
char
*
output_report_buf
;
...
@@ -251,7 +251,7 @@ static DWORD HID_set_state(struct xinput_controller *device, XINPUT_VIBRATION *s
...
@@ -251,7 +251,7 @@ static DWORD HID_set_state(struct xinput_controller *device, XINPUT_VIBRATION *s
device
->
vibration
.
wLeftMotorSpeed
=
state
->
wLeftMotorSpeed
;
device
->
vibration
.
wLeftMotorSpeed
=
state
->
wLeftMotorSpeed
;
device
->
vibration
.
wRightMotorSpeed
=
state
->
wRightMotorSpeed
;
device
->
vibration
.
wRightMotorSpeed
=
state
->
wRightMotorSpeed
;
if
(
privat
e
->
enabled
)
if
(
devic
e
->
enabled
)
{
{
memset
(
output_report_buf
,
0
,
output_report_len
);
memset
(
output_report_buf
,
0
,
output_report_len
);
output_report_buf
[
0
]
=
/* report id */
0
;
output_report_buf
[
0
]
=
/* report id */
0
;
...
@@ -274,22 +274,20 @@ static DWORD HID_set_state(struct xinput_controller *device, XINPUT_VIBRATION *s
...
@@ -274,22 +274,20 @@ static DWORD HID_set_state(struct xinput_controller *device, XINPUT_VIBRATION *s
static
void
controller_enable
(
struct
xinput_controller
*
controller
)
static
void
controller_enable
(
struct
xinput_controller
*
controller
)
{
{
struct
hid_platform_private
*
private
=
controller
->
platform_private
;
XINPUT_VIBRATION
state
=
controller
->
vibration
;
XINPUT_VIBRATION
state
=
controller
->
vibration
;
if
(
private
->
enabled
)
return
;
if
(
controller
->
enabled
)
return
;
if
(
controller
->
caps
.
Flags
&
XINPUT_CAPS_FFB_SUPPORTED
)
HID_set_state
(
controller
,
&
state
);
if
(
controller
->
caps
.
Flags
&
XINPUT_CAPS_FFB_SUPPORTED
)
HID_set_state
(
controller
,
&
state
);
private
->
enabled
=
TRUE
;
controller
->
enabled
=
TRUE
;
}
}
static
void
controller_disable
(
struct
xinput_controller
*
controller
)
static
void
controller_disable
(
struct
xinput_controller
*
controller
)
{
{
struct
hid_platform_private
*
private
=
controller
->
platform_private
;
XINPUT_VIBRATION
state
=
{
0
};
XINPUT_VIBRATION
state
=
{
0
};
if
(
!
private
->
enabled
)
return
;
if
(
!
controller
->
enabled
)
return
;
if
(
controller
->
caps
.
Flags
&
XINPUT_CAPS_FFB_SUPPORTED
)
HID_set_state
(
controller
,
&
state
);
if
(
controller
->
caps
.
Flags
&
XINPUT_CAPS_FFB_SUPPORTED
)
HID_set_state
(
controller
,
&
state
);
private
->
enabled
=
FALSE
;
controller
->
enabled
=
FALSE
;
}
}
static
BOOL
init_controller
(
struct
xinput_controller
*
controller
,
PHIDP_PREPARSED_DATA
preparsed
,
static
BOOL
init_controller
(
struct
xinput_controller
*
controller
,
PHIDP_PREPARSED_DATA
preparsed
,
...
@@ -309,10 +307,10 @@ static BOOL init_controller(struct xinput_controller *controller, PHIDP_PREPARSE
...
@@ -309,10 +307,10 @@ static BOOL init_controller(struct xinput_controller *controller, PHIDP_PREPARSE
if
(
!
(
private
->
input_report_buf
[
1
]
=
calloc
(
1
,
private
->
caps
.
InputReportByteLength
)))
goto
failed
;
if
(
!
(
private
->
input_report_buf
[
1
]
=
calloc
(
1
,
private
->
caps
.
InputReportByteLength
)))
goto
failed
;
if
(
!
(
private
->
output_report_buf
=
calloc
(
1
,
private
->
caps
.
OutputReportByteLength
)))
goto
failed
;
if
(
!
(
private
->
output_report_buf
=
calloc
(
1
,
private
->
caps
.
OutputReportByteLength
)))
goto
failed
;
lstrcpynW
(
private
->
device_path
,
device_path
,
MAX_PATH
);
lstrcpynW
(
private
->
device_path
,
device_path
,
MAX_PATH
);
private
->
enabled
=
FALSE
;
memset
(
&
controller
->
state
,
0
,
sizeof
(
controller
->
state
));
memset
(
&
controller
->
state
,
0
,
sizeof
(
controller
->
state
));
memset
(
&
controller
->
vibration
,
0
,
sizeof
(
controller
->
vibration
));
memset
(
&
controller
->
vibration
,
0
,
sizeof
(
controller
->
vibration
));
controller
->
enabled
=
FALSE
;
EnterCriticalSection
(
&
controller
->
crit
);
EnterCriticalSection
(
&
controller
->
crit
);
controller
->
platform_private
=
private
;
controller
->
platform_private
=
private
;
...
@@ -447,7 +445,7 @@ static void HID_update_state(struct xinput_controller *device, XINPUT_STATE *sta
...
@@ -447,7 +445,7 @@ static void HID_update_state(struct xinput_controller *device, XINPUT_STATE *sta
ULONG
button_length
,
hat_value
;
ULONG
button_length
,
hat_value
;
LONG
value
;
LONG
value
;
if
(
!
privat
e
->
enabled
)
return
;
if
(
!
devic
e
->
enabled
)
return
;
if
(
!
HidD_GetInputReport
(
private
->
device
,
report_buf
[
0
],
report_len
))
if
(
!
HidD_GetInputReport
(
private
->
device
,
report_buf
[
0
],
report_len
))
{
{
...
...
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