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
aa482426
Commit
aa482426
authored
Oct 22, 2019
by
Andrew Eikum
Committed by
Alexandre Julliard
Oct 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xinput: Get rid of redundant connected boolean.
Signed-off-by:
Andrew Eikum
<
aeikum@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b3cc2542
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
13 deletions
+10
-13
hid.c
dlls/xinput1_3/hid.c
+3
-5
xinput_main.c
dlls/xinput1_3/xinput_main.c
+6
-6
xinput_private.h
dlls/xinput1_3/xinput_private.h
+1
-2
No files found.
dlls/xinput1_3/hid.c
View file @
aa482426
...
...
@@ -199,7 +199,6 @@ static BOOL init_controller(xinput_controller *controller, PHIDP_PREPARSED_DATA
memset
(
&
controller
->
vibration
,
0
,
sizeof
(
controller
->
vibration
));
controller
->
platform_private
=
private
;
controller
->
connected
=
TRUE
;
return
TRUE
;
}
...
...
@@ -256,7 +255,7 @@ void HID_find_gamepads(xinput_controller *devices)
for
(
i
=
0
;
i
<
XUSER_MAX_COUNT
;
i
++
)
{
struct
hid_platform_private
*
private
=
devices
[
i
].
platform_private
;
if
(
devices
[
i
].
connected
)
if
(
devices
[
i
].
platform_private
)
{
if
(
!
wcscmp
(
data
->
DevicePath
,
private
->
device_path
))
break
;
...
...
@@ -302,18 +301,17 @@ static void remove_gamepad(xinput_controller *device)
{
EnterCriticalSection
(
&
device
->
crit
);
if
(
device
->
connected
)
if
(
device
->
platform_private
)
{
struct
hid_platform_private
*
private
=
device
->
platform_private
;
device
->
connected
=
FALSE
;
device
->
platform_private
=
NULL
;
CloseHandle
(
private
->
device
);
HeapFree
(
GetProcessHeap
(),
0
,
private
->
reports
[
0
]);
HeapFree
(
GetProcessHeap
(),
0
,
private
->
reports
[
1
]);
HeapFree
(
GetProcessHeap
(),
0
,
private
->
device_path
);
HidD_FreePreparsedData
(
private
->
ppd
);
device
->
platform_private
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
private
);
}
...
...
dlls/xinput1_3/xinput_main.c
View file @
aa482426
...
...
@@ -76,12 +76,12 @@ xinput_controller controllers[XUSER_MAX_COUNT] = {
static
BOOL
verify_and_lock_device
(
xinput_controller
*
device
)
{
if
(
!
device
->
connected
)
if
(
!
device
->
platform_private
)
return
FALSE
;
EnterCriticalSection
(
&
device
->
crit
);
if
(
!
device
->
connected
)
if
(
!
device
->
platform_private
)
{
LeaveCriticalSection
(
&
device
->
crit
);
return
FALSE
;
...
...
@@ -166,7 +166,7 @@ static DWORD xinput_get_state(DWORD index, XINPUT_STATE *state)
HID_update_state
(
&
controllers
[
index
],
state
);
if
(
!
controllers
[
index
].
connected
)
if
(
!
controllers
[
index
].
platform_private
)
{
/* update_state may have disconnected the controller */
unlock_device
(
&
controllers
[
index
]);
...
...
@@ -211,7 +211,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputGetKeystroke(DWORD index, DWORD reserved, P
if
(
index
>=
XUSER_MAX_COUNT
)
return
ERROR_BAD_ARGUMENTS
;
if
(
!
controllers
[
index
].
connected
)
if
(
!
controllers
[
index
].
platform_private
)
return
ERROR_DEVICE_NOT_CONNECTED
;
return
ERROR_NOT_SUPPORTED
;
...
...
@@ -248,7 +248,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputGetDSoundAudioDeviceGuids(DWORD index, GUID
if
(
index
>=
XUSER_MAX_COUNT
)
return
ERROR_BAD_ARGUMENTS
;
if
(
!
controllers
[
index
].
connected
)
if
(
!
controllers
[
index
].
platform_private
)
return
ERROR_DEVICE_NOT_CONNECTED
;
return
ERROR_NOT_SUPPORTED
;
...
...
@@ -263,7 +263,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputGetBatteryInformation(DWORD index, BYTE typ
if
(
index
>=
XUSER_MAX_COUNT
)
return
ERROR_BAD_ARGUMENTS
;
if
(
!
controllers
[
index
].
connected
)
if
(
!
controllers
[
index
].
platform_private
)
return
ERROR_DEVICE_NOT_CONNECTED
;
return
ERROR_NOT_SUPPORTED
;
...
...
dlls/xinput1_3/xinput_private.h
View file @
aa482426
...
...
@@ -20,9 +20,8 @@
typedef
struct
_xinput_controller
{
CRITICAL_SECTION
crit
;
BOOL
connected
;
/* only TRUE when device is valid; may be used without holding crit */
XINPUT_CAPABILITIES
caps
;
void
*
platform_private
;
void
*
platform_private
;
/* non-NULL when device is valid; validity may be read without holding crit */
XINPUT_STATE
state
;
XINPUT_VIBRATION
vibration
;
}
xinput_controller
;
...
...
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