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
9d06d700
Commit
9d06d700
authored
Jan 02, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Jan 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windows.gaming.input: Introduce new effect_reorient_direction helper.
parent
d79075eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
14 deletions
+49
-14
force_feedback.c
dlls/windows.gaming.input/force_feedback.c
+49
-14
No files found.
dlls/windows.gaming.input/force_feedback.c
View file @
9d06d700
...
...
@@ -109,37 +109,74 @@ static ULONG WINAPI effect_impl_Release( IWineForceFeedbackEffectImpl *iface )
return
ref
;
}
static
int
effect_reorient_direction
(
const
WineForceFeedbackEffectParameters
*
params
,
Vector3
*
direction
)
{
int
sign
=
+
1
;
switch
(
params
->
type
)
{
case
WineForceFeedbackEffectType_Constant
:
*
direction
=
params
->
constant
.
direction
;
break
;
case
WineForceFeedbackEffectType_Ramp
:
*
direction
=
params
->
ramp
.
start_vector
;
break
;
case
WineForceFeedbackEffectType_Periodic_SineWave
:
case
WineForceFeedbackEffectType_Periodic_TriangleWave
:
case
WineForceFeedbackEffectType_Periodic_SquareWave
:
case
WineForceFeedbackEffectType_Periodic_SawtoothWaveDown
:
case
WineForceFeedbackEffectType_Periodic_SawtoothWaveUp
:
*
direction
=
params
->
periodic
.
direction
;
break
;
case
WineForceFeedbackEffectType_Condition_Spring
:
case
WineForceFeedbackEffectType_Condition_Damper
:
case
WineForceFeedbackEffectType_Condition_Inertia
:
case
WineForceFeedbackEffectType_Condition_Friction
:
*
direction
=
params
->
condition
.
direction
;
sign
=
-
1
;
break
;
}
direction
->
X
*=
-
sign
;
direction
->
Y
*=
-
sign
;
direction
->
Z
*=
-
sign
;
return
sign
;
}
static
HRESULT
WINAPI
effect_impl_put_Parameters
(
IWineForceFeedbackEffectImpl
*
iface
,
WineForceFeedbackEffectParameters
params
,
WineForceFeedbackEffectEnvelope
*
envelope
)
{
struct
effect
*
impl
=
impl_from_IWineForceFeedbackEffectImpl
(
iface
);
Vector3
direction
=
{
0
};
DWORD
count
=
0
;
HRESULT
hr
;
int
sign
;
TRACE
(
"iface %p, params %p, envelope %p.
\n
"
,
iface
,
&
params
,
envelope
);
EnterCriticalSection
(
&
impl
->
cs
);
sign
=
effect_reorient_direction
(
&
params
,
&
direction
);
switch
(
params
.
type
)
{
case
WineForceFeedbackEffectType_Constant
:
impl
->
repeat_count
=
params
.
constant
.
repeat_count
;
impl
->
constant_force
.
lMagnitude
=
round
(
params
.
constant
.
gain
*
params
.
constant
.
direction
.
X
*
10000
);
impl
->
constant_force
.
lMagnitude
=
-
sign
*
round
(
params
.
constant
.
gain
*
direction
.
X
*
10000
);
impl
->
params
.
dwDuration
=
min
(
max
(
params
.
constant
.
duration
.
Duration
/
10
,
0
),
INFINITE
);
impl
->
params
.
dwStartDelay
=
min
(
max
(
params
.
constant
.
start_delay
.
Duration
/
10
,
0
),
INFINITE
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_X
)
impl
->
directions
[
count
++
]
=
round
(
-
params
.
constant
.
direction
.
X
*
10000
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_Y
)
impl
->
directions
[
count
++
]
=
round
(
-
params
.
constant
.
direction
.
Y
*
10000
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_Z
)
impl
->
directions
[
count
++
]
=
round
(
-
params
.
constant
.
direction
.
Z
*
10000
);
break
;
case
WineForceFeedbackEffectType_Ramp
:
impl
->
repeat_count
=
params
.
ramp
.
repeat_count
;
impl
->
ramp_force
.
lStart
=
round
(
params
.
ramp
.
gain
*
params
.
ramp
.
start_vector
.
X
*
10000
);
impl
->
ramp_force
.
lStart
=
-
sign
*
round
(
params
.
ramp
.
gain
*
direction
.
X
*
10000
);
impl
->
ramp_force
.
lEnd
=
round
(
params
.
ramp
.
gain
*
params
.
ramp
.
end_vector
.
X
*
10000
);
impl
->
params
.
dwDuration
=
min
(
max
(
params
.
ramp
.
duration
.
Duration
/
10
,
0
),
INFINITE
);
impl
->
params
.
dwStartDelay
=
min
(
max
(
params
.
ramp
.
start_delay
.
Duration
/
10
,
0
),
INFINITE
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_X
)
impl
->
directions
[
count
++
]
=
round
(
-
params
.
ramp
.
start_vector
.
X
*
10000
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_Y
)
impl
->
directions
[
count
++
]
=
round
(
-
params
.
ramp
.
start_vector
.
Y
*
10000
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_Z
)
impl
->
directions
[
count
++
]
=
round
(
-
params
.
ramp
.
start_vector
.
Z
*
10000
);
break
;
case
WineForceFeedbackEffectType_Periodic_SineWave
:
...
...
@@ -154,9 +191,6 @@ static HRESULT WINAPI effect_impl_put_Parameters( IWineForceFeedbackEffectImpl *
impl
->
periodic
.
lOffset
=
round
(
params
.
periodic
.
bias
*
10000
);
impl
->
params
.
dwDuration
=
min
(
max
(
params
.
periodic
.
duration
.
Duration
/
10
,
0
),
INFINITE
);
impl
->
params
.
dwStartDelay
=
min
(
max
(
params
.
periodic
.
start_delay
.
Duration
/
10
,
0
),
INFINITE
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_X
)
impl
->
directions
[
count
++
]
=
round
(
-
params
.
periodic
.
direction
.
X
*
10000
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_Y
)
impl
->
directions
[
count
++
]
=
round
(
-
params
.
periodic
.
direction
.
Y
*
10000
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_Z
)
impl
->
directions
[
count
++
]
=
round
(
-
params
.
periodic
.
direction
.
Z
*
10000
);
break
;
case
WineForceFeedbackEffectType_Condition_Spring
:
...
...
@@ -172,12 +206,13 @@ static HRESULT WINAPI effect_impl_put_Parameters( IWineForceFeedbackEffectImpl *
impl
->
condition
.
lOffset
=
round
(
params
.
condition
.
bias
*
10000
);
impl
->
params
.
dwDuration
=
-
1
;
impl
->
params
.
dwStartDelay
=
0
;
if
(
impl
->
axes
[
count
]
==
DIJOFS_X
)
impl
->
directions
[
count
++
]
=
round
(
params
.
condition
.
direction
.
X
*
10000
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_Y
)
impl
->
directions
[
count
++
]
=
round
(
params
.
condition
.
direction
.
Y
*
10000
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_Z
)
impl
->
directions
[
count
++
]
=
round
(
params
.
condition
.
direction
.
Z
*
10000
);
break
;
}
if
(
impl
->
axes
[
count
]
==
DIJOFS_X
)
impl
->
directions
[
count
++
]
=
round
(
direction
.
X
*
10000
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_Y
)
impl
->
directions
[
count
++
]
=
round
(
direction
.
Y
*
10000
);
if
(
impl
->
axes
[
count
]
==
DIJOFS_Z
)
impl
->
directions
[
count
++
]
=
round
(
direction
.
Z
*
10000
);
if
(
!
envelope
)
impl
->
params
.
lpEnvelope
=
NULL
;
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