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
f3391311
Commit
f3391311
authored
Feb 14, 2018
by
Aric Stewart
Committed by
Alexandre Julliard
Feb 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xinput: Implement XInputSetState.
Signed-off-by:
Aric Stewart
<
aric@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9e321a6f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
2 deletions
+49
-2
hid.c
dlls/xinput1_3/hid.c
+42
-0
xinput_main.c
dlls/xinput1_3/xinput_main.c
+4
-2
xinput_private.h
dlls/xinput1_3/xinput_private.h
+1
-0
xinput.h
include/xinput.h
+2
-0
No files found.
dlls/xinput1_3/hid.c
View file @
f3391311
...
...
@@ -192,6 +192,11 @@ static BOOL VerifyGamepad(PHIDP_PREPARSED_DATA ppd, XINPUT_CAPABILITIES *xinput_
xinput_caps
->
Type
=
XINPUT_DEVTYPE_GAMEPAD
;
xinput_caps
->
SubType
=
XINPUT_DEVSUBTYPE_GAMEPAD
;
value_caps_count
=
caps
->
NumberOutputValueCaps
;
if
(
value_caps_count
>
0
)
xinput_caps
->
Flags
|=
XINPUT_CAPS_FFB_SUPPORTED
;
return
TRUE
;
}
...
...
@@ -411,3 +416,40 @@ void HID_update_state(xinput_controller* device)
device
->
state
.
Gamepad
.
bLeftTrigger
=
SCALE_BYTE
(
value
,
private
->
LeftTriggerRange
);
LeaveCriticalSection
(
&
private
->
crit
);
}
DWORD
HID_set_state
(
xinput_controller
*
device
,
XINPUT_VIBRATION
*
state
)
{
struct
hid_platform_private
*
private
=
device
->
platform_private
;
struct
{
BYTE
report
;
BYTE
pad1
[
2
];
BYTE
left
;
BYTE
right
;
BYTE
pad2
[
3
];
}
report
;
if
(
device
->
caps
.
Flags
&
XINPUT_CAPS_FFB_SUPPORTED
)
{
BOOLEAN
rc
;
device
->
caps
.
Vibration
.
wLeftMotorSpeed
=
state
->
wLeftMotorSpeed
;
device
->
caps
.
Vibration
.
wRightMotorSpeed
=
state
->
wRightMotorSpeed
;
report
.
report
=
0
;
report
.
pad1
[
0
]
=
0x8
;
report
.
pad1
[
1
]
=
0x0
;
report
.
left
=
(
BYTE
)(
state
->
wLeftMotorSpeed
/
255
);
report
.
right
=
(
BYTE
)(
state
->
wRightMotorSpeed
/
255
);
memset
(
&
report
.
pad2
,
0
,
sizeof
(
report
.
pad2
));
EnterCriticalSection
(
&
private
->
crit
);
rc
=
HidD_SetOutputReport
(
private
->
device
,
&
report
,
sizeof
(
report
));
LeaveCriticalSection
(
&
private
->
crit
);
if
(
rc
)
return
ERROR_SUCCESS
;
return
GetLastError
();
}
return
ERROR_NOT_SUPPORTED
;
}
dlls/xinput1_3/xinput_main.c
View file @
f3391311
...
...
@@ -63,14 +63,16 @@ void WINAPI DECLSPEC_HOTPATCH XInputEnable(BOOL enable)
DWORD
WINAPI
XInputSetState
(
DWORD
index
,
XINPUT_VIBRATION
*
vibration
)
{
FIXME
(
"(index %u, vibration %p) Stub!
\n
"
,
index
,
vibration
);
TRACE
(
"(index %u, vibration %p)
\n
"
,
index
,
vibration
);
HID_find_gamepads
(
controllers
);
if
(
index
>=
XUSER_MAX_COUNT
)
return
ERROR_BAD_ARGUMENTS
;
if
(
!
controllers
[
index
].
connected
)
return
ERROR_DEVICE_NOT_CONNECTED
;
return
ERROR_NOT_SUPPORTED
;
return
HID_set_state
(
&
controllers
[
index
],
vibration
)
;
}
DWORD
WINAPI
DECLSPEC_HOTPATCH
XInputGetState
(
DWORD
index
,
XINPUT_STATE
*
state
)
...
...
dlls/xinput1_3/xinput_private.h
View file @
f3391311
...
...
@@ -29,3 +29,4 @@ typedef struct _xinput_controller
void
HID_find_gamepads
(
xinput_controller
*
devices
)
DECLSPEC_HIDDEN
;
void
HID_destroy_gamepads
(
xinput_controller
*
devices
)
DECLSPEC_HIDDEN
;
void
HID_update_state
(
xinput_controller
*
device
)
DECLSPEC_HIDDEN
;
DWORD
HID_set_state
(
xinput_controller
*
device
,
XINPUT_VIBRATION
*
state
)
DECLSPEC_HIDDEN
;
include/xinput.h
View file @
f3391311
...
...
@@ -156,6 +156,8 @@
#define XUSER_MAX_COUNT 4
#define XUSER_INDEX_ANY 0x000000FF
#define XINPUT_CAPS_FFB_SUPPORTED 0x0001
/*
* Defines the structure of an xbox 360 joystick.
*/
...
...
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