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
99341249
Commit
99341249
authored
Mar 14, 2016
by
Andrew Eikum
Committed by
Alexandre Julliard
Mar 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Fix condition effect joystick offset calculation.
Signed-off-by:
Andrew Eikum
<
aeikum@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2efaddc7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
effect_linuxinput.c
dlls/dinput/effect_linuxinput.c
+14
-5
No files found.
dlls/dinput/effect_linuxinput.c
View file @
99341249
...
...
@@ -67,6 +67,11 @@ static inline LinuxInputEffectImpl *impl_from_IDirectInputEffect(IDirectInputEff
return
CONTAINING_RECORD
(
iface
,
LinuxInputEffectImpl
,
IDirectInputEffect_iface
);
}
double
ff_effect_direction_to_rad
(
unsigned
int
dir
)
{
return
(
dir
&
0xffff
)
*
M_PI
/
0x8000
;
}
/******************************************************************************
* LinuxInputEffectImpl
*/
...
...
@@ -172,8 +177,10 @@ static HRESULT WINAPI LinuxInputEffectImpl_GetParameters(
return
diErr
;
else
{
if
(
peff
->
dwFlags
&
DIEFF_CARTESIAN
)
{
peff
->
rglDirection
[
0
]
=
sin
(
M_PI
*
3
*
This
->
effect
.
direction
/
0x7FFF
)
*
1000
;
peff
->
rglDirection
[
1
]
=
cos
(
M_PI
*
3
*
This
->
effect
.
direction
/
0x7FFF
)
*
1000
;
/* rotate so 0 points right */
double
angle
=
ff_effect_direction_to_rad
(
This
->
effect
.
direction
+
0xc000
);
peff
->
rglDirection
[
0
]
=
sin
(
angle
)
*
1000
;
peff
->
rglDirection
[
1
]
=
-
cos
(
angle
)
*
1000
;
}
else
{
/* Polar and spherical coordinates are the same for two or less
* axes.
...
...
@@ -505,9 +512,11 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
/* One condition block. This needs to be rotated to direction,
* and expanded to separate x and y conditions. */
int
i
;
double
factor
[
2
];
factor
[
0
]
=
asin
((
This
->
effect
.
direction
*
3
.
0
*
M_PI
)
/
0x7FFF
);
factor
[
1
]
=
acos
((
This
->
effect
.
direction
*
3
.
0
*
M_PI
)
/
0x7FFF
);
double
factor
[
2
],
angle
;
/* rotate so 0 points right */
angle
=
ff_effect_direction_to_rad
(
This
->
effect
.
direction
+
0xc000
);
factor
[
0
]
=
sin
(
angle
);
factor
[
1
]
=
-
cos
(
angle
);
for
(
i
=
0
;
i
<
2
;
++
i
)
{
This
->
effect
.
u
.
condition
[
i
].
center
=
(
int
)(
factor
[
i
]
*
(
tsp
->
lOffset
/
10
)
*
32
);
This
->
effect
.
u
.
condition
[
i
].
right_coeff
=
(
int
)(
factor
[
i
]
*
(
tsp
->
lPositiveCoefficient
/
10
)
*
32
);
...
...
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