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
e2936702
Commit
e2936702
authored
May 20, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Implement SOCD neutral cleaning for hatswitches.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=52841
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
parent
4ca954ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
12 deletions
+27
-12
bus_sdl.c
dlls/winebus.sys/bus_sdl.c
+15
-12
hid.c
dlls/winebus.sys/hid.c
+11
-0
unix_private.h
dlls/winebus.sys/unix_private.h
+1
-0
No files found.
dlls/winebus.sys/bus_sdl.c
View file @
e2936702
...
@@ -382,6 +382,8 @@ static NTSTATUS build_controller_report_descriptor(struct unix_device *iface)
...
@@ -382,6 +382,8 @@ static NTSTATUS build_controller_report_descriptor(struct unix_device *iface)
static
const
USAGE
trigger_axis_usages
[]
=
{
HID_USAGE_GENERIC_Z
,
HID_USAGE_GENERIC_RZ
};
static
const
USAGE
trigger_axis_usages
[]
=
{
HID_USAGE_GENERIC_Z
,
HID_USAGE_GENERIC_RZ
};
struct
sdl_device
*
impl
=
impl_from_unix_device
(
iface
);
struct
sdl_device
*
impl
=
impl_from_unix_device
(
iface
);
ULONG
i
,
button_count
=
SDL_CONTROLLER_BUTTON_MAX
-
1
;
ULONG
i
,
button_count
=
SDL_CONTROLLER_BUTTON_MAX
-
1
;
BOOL
state
;
C_ASSERT
(
SDL_CONTROLLER_AXIS_MAX
==
6
);
C_ASSERT
(
SDL_CONTROLLER_AXIS_MAX
==
6
);
if
(
!
hid_device_begin_report_descriptor
(
iface
,
&
device_usage
))
if
(
!
hid_device_begin_report_descriptor
(
iface
,
&
device_usage
))
...
@@ -420,14 +422,15 @@ static NTSTATUS build_controller_report_descriptor(struct unix_device *iface)
...
@@ -420,14 +422,15 @@ static NTSTATUS build_controller_report_descriptor(struct unix_device *iface)
/* Initialize axis in the report */
/* Initialize axis in the report */
for
(
i
=
SDL_CONTROLLER_AXIS_LEFTX
;
i
<
SDL_CONTROLLER_AXIS_MAX
;
i
++
)
for
(
i
=
SDL_CONTROLLER_AXIS_LEFTX
;
i
<
SDL_CONTROLLER_AXIS_MAX
;
i
++
)
hid_device_set_abs_axis
(
iface
,
i
,
pSDL_GameControllerGetAxis
(
impl
->
sdl_controller
,
i
));
hid_device_set_abs_axis
(
iface
,
i
,
pSDL_GameControllerGetAxis
(
impl
->
sdl_controller
,
i
));
if
(
pSDL_GameControllerGetButton
(
impl
->
sdl_controller
,
SDL_CONTROLLER_BUTTON_DPAD_UP
))
hid_device_set_hatswitch_y
(
iface
,
0
,
-
1
);
state
=
pSDL_GameControllerGetButton
(
impl
->
sdl_controller
,
SDL_CONTROLLER_BUTTON_DPAD_UP
);
if
(
pSDL_GameControllerGetButton
(
impl
->
sdl_controller
,
SDL_CONTROLLER_BUTTON_DPAD_DOWN
))
hid_device_move_hatswitch
(
iface
,
0
,
0
,
state
?
-
1
:
+
1
);
hid_device_set_hatswitch_y
(
iface
,
0
,
+
1
);
state
=
pSDL_GameControllerGetButton
(
impl
->
sdl_controller
,
SDL_CONTROLLER_BUTTON_DPAD_DOWN
);
if
(
pSDL_GameControllerGetButton
(
impl
->
sdl_controller
,
SDL_CONTROLLER_BUTTON_DPAD_LEFT
))
hid_device_move_hatswitch
(
iface
,
0
,
0
,
state
?
+
1
:
-
1
);
hid_device_set_hatswitch_x
(
iface
,
0
,
-
1
);
state
=
pSDL_GameControllerGetButton
(
impl
->
sdl_controller
,
SDL_CONTROLLER_BUTTON_DPAD_LEFT
);
if
(
pSDL_GameControllerGetButton
(
impl
->
sdl_controller
,
SDL_CONTROLLER_BUTTON_DPAD_RIGHT
))
hid_device_move_hatswitch
(
iface
,
0
,
state
?
-
1
:
+
1
,
0
);
hid_device_set_hatswitch_x
(
iface
,
0
,
+
1
);
state
=
pSDL_GameControllerGetButton
(
impl
->
sdl_controller
,
SDL_CONTROLLER_BUTTON_DPAD_RIGHT
);
hid_device_move_hatswitch
(
iface
,
0
,
state
?
+
1
:
-
1
,
0
);
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
...
@@ -873,16 +876,16 @@ static BOOL set_report_from_controller_event(struct sdl_device *impl, SDL_Event
...
@@ -873,16 +876,16 @@ static BOOL set_report_from_controller_event(struct sdl_device *impl, SDL_Event
switch
((
button
=
ie
->
button
))
switch
((
button
=
ie
->
button
))
{
{
case
SDL_CONTROLLER_BUTTON_DPAD_UP
:
case
SDL_CONTROLLER_BUTTON_DPAD_UP
:
hid_device_
set_hatswitch_y
(
iface
,
0
,
ie
->
state
?
-
1
:
0
);
hid_device_
move_hatswitch
(
iface
,
0
,
0
,
ie
->
state
?
-
1
:
+
1
);
break
;
break
;
case
SDL_CONTROLLER_BUTTON_DPAD_DOWN
:
case
SDL_CONTROLLER_BUTTON_DPAD_DOWN
:
hid_device_
set_hatswitch_y
(
iface
,
0
,
ie
->
state
?
+
1
:
0
);
hid_device_
move_hatswitch
(
iface
,
0
,
0
,
ie
->
state
?
+
1
:
-
1
);
break
;
break
;
case
SDL_CONTROLLER_BUTTON_DPAD_LEFT
:
case
SDL_CONTROLLER_BUTTON_DPAD_LEFT
:
hid_device_
set_hatswitch_x
(
iface
,
0
,
ie
->
state
?
-
1
:
0
);
hid_device_
move_hatswitch
(
iface
,
0
,
ie
->
state
?
-
1
:
+
1
,
0
);
break
;
break
;
case
SDL_CONTROLLER_BUTTON_DPAD_RIGHT
:
case
SDL_CONTROLLER_BUTTON_DPAD_RIGHT
:
hid_device_
set_hatswitch_x
(
iface
,
0
,
ie
->
state
?
+
1
:
0
);
hid_device_
move_hatswitch
(
iface
,
0
,
ie
->
state
?
+
1
:
-
1
,
0
);
break
;
break
;
case
SDL_CONTROLLER_BUTTON_LEFTSHOULDER
:
button
=
4
;
break
;
case
SDL_CONTROLLER_BUTTON_LEFTSHOULDER
:
button
=
4
;
break
;
case
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER
:
button
=
5
;
break
;
case
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER
:
button
=
5
;
break
;
...
...
dlls/winebus.sys/hid.c
View file @
e2936702
...
@@ -1453,6 +1453,17 @@ BOOL hid_device_set_hatswitch_y(struct unix_device *iface, ULONG index, LONG new
...
@@ -1453,6 +1453,17 @@ BOOL hid_device_set_hatswitch_y(struct unix_device *iface, ULONG index, LONG new
return
TRUE
;
return
TRUE
;
}
}
BOOL
hid_device_move_hatswitch
(
struct
unix_device
*
iface
,
ULONG
index
,
LONG
x
,
LONG
y
)
{
struct
hid_device_state
*
state
=
&
iface
->
hid_device_state
;
ULONG
offset
=
state
->
hatswitch_start
+
index
;
LONG
old_x
,
old_y
;
if
(
index
>
state
->
hatswitch_count
)
return
FALSE
;
hatswitch_decompose
(
state
->
report_buf
[
offset
],
&
old_x
,
&
old_y
);
hatswitch_compose
(
old_x
+
x
,
old_y
+
y
,
&
state
->
report_buf
[
offset
]);
return
TRUE
;
}
BOOL
hid_device_sync_report
(
struct
unix_device
*
iface
)
BOOL
hid_device_sync_report
(
struct
unix_device
*
iface
)
{
{
BOOL
dropped
;
BOOL
dropped
;
...
...
dlls/winebus.sys/unix_private.h
View file @
e2936702
...
@@ -257,6 +257,7 @@ extern BOOL hid_device_set_rel_axis(struct unix_device *iface, ULONG index, LONG
...
@@ -257,6 +257,7 @@ extern BOOL hid_device_set_rel_axis(struct unix_device *iface, ULONG index, LONG
extern
BOOL
hid_device_set_button
(
struct
unix_device
*
iface
,
ULONG
index
,
BOOL
is_set
)
DECLSPEC_HIDDEN
;
extern
BOOL
hid_device_set_button
(
struct
unix_device
*
iface
,
ULONG
index
,
BOOL
is_set
)
DECLSPEC_HIDDEN
;
extern
BOOL
hid_device_set_hatswitch_x
(
struct
unix_device
*
iface
,
ULONG
index
,
LONG
new_x
)
DECLSPEC_HIDDEN
;
extern
BOOL
hid_device_set_hatswitch_x
(
struct
unix_device
*
iface
,
ULONG
index
,
LONG
new_x
)
DECLSPEC_HIDDEN
;
extern
BOOL
hid_device_set_hatswitch_y
(
struct
unix_device
*
iface
,
ULONG
index
,
LONG
new_y
)
DECLSPEC_HIDDEN
;
extern
BOOL
hid_device_set_hatswitch_y
(
struct
unix_device
*
iface
,
ULONG
index
,
LONG
new_y
)
DECLSPEC_HIDDEN
;
extern
BOOL
hid_device_move_hatswitch
(
struct
unix_device
*
iface
,
ULONG
index
,
LONG
x
,
LONG
y
)
DECLSPEC_HIDDEN
;
extern
BOOL
hid_device_sync_report
(
struct
unix_device
*
iface
)
DECLSPEC_HIDDEN
;
extern
BOOL
hid_device_sync_report
(
struct
unix_device
*
iface
)
DECLSPEC_HIDDEN
;
extern
void
hid_device_drop_report
(
struct
unix_device
*
iface
)
DECLSPEC_HIDDEN
;
extern
void
hid_device_drop_report
(
struct
unix_device
*
iface
)
DECLSPEC_HIDDEN
;
...
...
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