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
5417c3bf
Commit
5417c3bf
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: Consolidate new device setup.
Signed-off-by:
Andrew Eikum
<
aeikum@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4d3db6d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
hid.c
dlls/xinput1_3/hid.c
+19
-13
No files found.
dlls/xinput1_3/hid.c
View file @
5417c3bf
...
...
@@ -171,19 +171,34 @@ static BOOL VerifyGamepad(PHIDP_PREPARSED_DATA ppd, XINPUT_CAPABILITIES *xinput_
return
TRUE
;
}
static
void
build_private
(
struct
hid_platform_private
*
private
,
PHIDP_PREPARSED_DATA
ppd
,
HIDP_CAPS
*
caps
,
HANDLE
device
,
WCHAR
*
path
)
static
BOOL
init_controller
(
xinput_controller
*
controller
,
PHIDP_PREPARSED_DATA
ppd
,
HIDP_CAPS
*
caps
,
HANDLE
device
,
WCHAR
*
device_
path
)
{
size_t
size
;
struct
hid_platform_private
*
private
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
hid_platform_private
));
if
(
!
VerifyGamepad
(
ppd
,
&
controller
->
caps
,
private
,
caps
))
{
HeapFree
(
GetProcessHeap
(),
0
,
private
);
return
FALSE
;
}
TRACE
(
"Found gamepad %s
\n
"
,
debugstr_w
(
device_path
));
private
->
ppd
=
ppd
;
private
->
device
=
device
;
private
->
report_length
=
caps
->
InputReportByteLength
+
1
;
private
->
current_report
=
0
;
private
->
reports
[
0
]
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
private
->
report_length
);
private
->
reports
[
1
]
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
private
->
report_length
);
size
=
(
lstrlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
);
size
=
(
lstrlenW
(
device_
path
)
+
1
)
*
sizeof
(
WCHAR
);
private
->
device_path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
memcpy
(
private
->
device_path
,
path
,
size
);
memcpy
(
private
->
device_path
,
device_
path
,
size
);
private
->
enabled
=
TRUE
;
controller
->
platform_private
=
private
;
controller
->
connected
=
TRUE
;
return
TRUE
;
}
void
HID_find_gamepads
(
xinput_controller
*
devices
)
...
...
@@ -263,19 +278,10 @@ void HID_find_gamepads(xinput_controller *devices)
Caps
.
Usage
==
HID_USAGE_GENERIC_JOYSTICK
||
Caps
.
Usage
==
0x8
/* Multi-axis Controller */
))
{
struct
hid_platform_private
*
private
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
hid_platform_private
));
if
(
VerifyGamepad
(
ppd
,
&
devices
[
open_device_idx
].
caps
,
private
,
&
Caps
))
{
TRACE
(
"Found gamepad %i %s
\n
"
,
open_device_idx
,
debugstr_w
(
data
->
DevicePath
));
build_private
(
private
,
ppd
,
&
Caps
,
device
,
data
->
DevicePath
);
devices
[
open_device_idx
].
platform_private
=
private
;
devices
[
open_device_idx
].
connected
=
TRUE
;
}
else
if
(
!
init_controller
(
&
devices
[
open_device_idx
],
ppd
,
&
Caps
,
device
,
data
->
DevicePath
))
{
CloseHandle
(
device
);
HidD_FreePreparsedData
(
ppd
);
HeapFree
(
GetProcessHeap
(),
0
,
private
);
}
}
else
...
...
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