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
fd46a5aa
Commit
fd46a5aa
authored
Jan 24, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Jan 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Introduce new is_exclusively_acquired helper.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c232fce6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
device.c
dlls/dinput/device.c
+11
-8
joystick_hid.c
dlls/dinput/joystick_hid.c
+11
-6
No files found.
dlls/dinput/device.c
View file @
fd46a5aa
...
...
@@ -82,6 +82,11 @@ static inline const char *debugstr_diobjectdataformat( const DIOBJECTDATAFORMAT
debugstr_guid
(
data
->
pguid
),
data
->
dwOfs
,
data
->
dwType
,
data
->
dwFlags
);
}
static
inline
BOOL
is_exclusively_acquired
(
struct
dinput_device
*
device
)
{
return
device
->
acquired
&&
(
device
->
dwCoopLevel
&
DISCL_EXCLUSIVE
);
}
/******************************************************************************
* Various debugging tools
*/
...
...
@@ -1073,7 +1078,7 @@ static HRESULT check_property( struct dinput_device *impl, const GUID *guid, con
case
(
DWORD_PTR
)
DIPROP_FFLOAD
:
if
(
!
(
impl
->
caps
.
dwFlags
&
DIDC_FORCEFEEDBACK
))
return
DIERR_UNSUPPORTED
;
if
(
!
i
mpl
->
acquired
||
!
(
impl
->
dwCoopLevel
&
DISCL_EXCLUSIVE
))
return
DIERR_NOTEXCLUSIVEACQUIRED
;
if
(
!
i
s_exclusively_acquired
(
impl
))
return
DIERR_NOTEXCLUSIVEACQUIRED
;
/* fallthrough */
case
(
DWORD_PTR
)
DIPROP_PRODUCTNAME
:
case
(
DWORD_PTR
)
DIPROP_INSTANCENAME
:
...
...
@@ -1399,7 +1404,7 @@ static HRESULT WINAPI dinput_device_set_property( IDirectInputDevice8W *iface, c
const
DIPROPDWORD
*
value
=
(
const
DIPROPDWORD
*
)
header
;
if
(
!
impl
->
vtbl
->
send_device_gain
)
return
DIERR_UNSUPPORTED
;
impl
->
device_gain
=
value
->
dwData
;
if
(
!
i
mpl
->
acquired
||
!
(
impl
->
dwCoopLevel
&
DISCL_EXCLUSIVE
))
return
DI_OK
;
if
(
!
i
s_exclusively_acquired
(
impl
))
return
DI_OK
;
return
impl
->
vtbl
->
send_device_gain
(
iface
,
impl
->
device_gain
);
}
case
(
DWORD_PTR
)
DIPROP_AXISMODE
:
...
...
@@ -1679,7 +1684,7 @@ static HRESULT WINAPI dinput_device_CreateEffect( IDirectInputDevice8W *iface, c
if
(
!
params
)
return
DI_OK
;
flags
=
params
->
dwSize
==
sizeof
(
DIEFFECT_DX6
)
?
DIEP_ALLPARAMS
:
DIEP_ALLPARAMS_DX5
;
if
(
!
i
mpl
->
acquired
||
!
(
impl
->
dwCoopLevel
&
DISCL_EXCLUSIVE
))
flags
|=
DIEP_NODOWNLOAD
;
if
(
!
i
s_exclusively_acquired
(
impl
))
flags
|=
DIEP_NODOWNLOAD
;
hr
=
IDirectInputEffect_SetParameters
(
*
out
,
params
,
flags
);
if
(
FAILED
(
hr
))
goto
failed
;
return
DI_OK
;
...
...
@@ -1788,10 +1793,8 @@ static HRESULT WINAPI dinput_device_GetForceFeedbackState( IDirectInputDevice8W
if
(
!
(
impl
->
caps
.
dwFlags
&
DIDC_FORCEFEEDBACK
))
return
DIERR_UNSUPPORTED
;
EnterCriticalSection
(
&
impl
->
crit
);
if
(
!
impl
->
acquired
||
!
(
impl
->
dwCoopLevel
&
DISCL_EXCLUSIVE
))
hr
=
DIERR_NOTEXCLUSIVEACQUIRED
;
else
*
out
=
impl
->
force_feedback_state
;
if
(
!
is_exclusively_acquired
(
impl
))
hr
=
DIERR_NOTEXCLUSIVEACQUIRED
;
else
*
out
=
impl
->
force_feedback_state
;
LeaveCriticalSection
(
&
impl
->
crit
);
return
hr
;
...
...
@@ -1819,7 +1822,7 @@ static HRESULT WINAPI dinput_device_SendForceFeedbackCommand( IDirectInputDevice
if
(
!
impl
->
vtbl
->
send_force_feedback_command
)
return
DIERR_UNSUPPORTED
;
EnterCriticalSection
(
&
impl
->
crit
);
if
(
!
i
mpl
->
acquired
||
!
(
impl
->
dwCoopLevel
&
DISCL_EXCLUSIVE
))
hr
=
DIERR_NOTEXCLUSIVEACQUIRED
;
if
(
!
i
s_exclusively_acquired
(
impl
))
hr
=
DIERR_NOTEXCLUSIVEACQUIRED
;
else
hr
=
impl
->
vtbl
->
send_force_feedback_command
(
iface
,
command
,
FALSE
);
LeaveCriticalSection
(
&
impl
->
crit
);
...
...
dlls/dinput/joystick_hid.c
View file @
fd46a5aa
...
...
@@ -241,6 +241,11 @@ static inline struct hid_joystick_effect *impl_from_IDirectInputEffect( IDirectI
return
CONTAINING_RECORD
(
iface
,
struct
hid_joystick_effect
,
IDirectInputEffect_iface
);
}
static
inline
BOOL
is_exclusively_acquired
(
struct
hid_joystick
*
joystick
)
{
return
joystick
->
base
.
acquired
&&
(
joystick
->
base
.
dwCoopLevel
&
DISCL_EXCLUSIVE
);
}
static
const
GUID
*
object_usage_to_guid
(
USAGE
usage_page
,
USAGE
usage
)
{
switch
(
usage_page
)
...
...
@@ -827,7 +832,7 @@ static HRESULT hid_joystick_get_property( IDirectInputDevice8W *iface, DWORD pro
{
DIPROPDWORD
*
value
=
(
DIPROPDWORD
*
)
header
;
if
(
!
(
impl
->
base
.
caps
.
dwFlags
&
DIDC_FORCEFEEDBACK
))
return
DIERR_UNSUPPORTED
;
if
(
!
i
mpl
->
base
.
acquired
||
!
(
impl
->
base
.
dwCoopLevel
&
DISCL_EXCLUSIVE
))
return
DIERR_NOTEXCLUSIVEACQUIRED
;
if
(
!
i
s_exclusively_acquired
(
impl
))
return
DIERR_NOTEXCLUSIVEACQUIRED
;
value
->
dwData
=
0
;
return
DI_OK
;
}
...
...
@@ -898,7 +903,7 @@ static HRESULT hid_joystick_unacquire( IDirectInputDevice8W *iface )
else
WaitForSingleObject
(
impl
->
base
.
read_event
,
INFINITE
);
if
(
!
(
impl
->
base
.
caps
.
dwFlags
&
DIDC_FORCEFEEDBACK
))
return
DI_OK
;
if
(
!
i
mpl
->
base
.
acquired
||
!
(
impl
->
base
.
dwCoopLevel
&
DISCL_EXCLUSIVE
))
return
DI_OK
;
if
(
!
i
s_exclusively_acquired
(
impl
))
return
DI_OK
;
hid_joystick_send_force_feedback_command
(
iface
,
DISFFC_RESET
,
TRUE
);
return
DI_OK
;
}
...
...
@@ -2682,7 +2687,7 @@ static HRESULT WINAPI hid_joystick_effect_Start( IDirectInputEffect *iface, DWOR
else
control
=
PID_USAGE_OP_EFFECT_START
;
EnterCriticalSection
(
&
impl
->
joystick
->
base
.
crit
);
if
(
!
i
mpl
->
joystick
->
base
.
acquired
||
!
(
impl
->
joystick
->
base
.
dwCoopLevel
&
DISCL_EXCLUSIVE
))
if
(
!
i
s_exclusively_acquired
(
impl
->
joystick
))
hr
=
DIERR_NOTEXCLUSIVEACQUIRED
;
else
if
((
flags
&
DIES_NODOWNLOAD
)
&&
!
impl
->
index
)
hr
=
DIERR_NOTDOWNLOADED
;
...
...
@@ -2730,7 +2735,7 @@ static HRESULT WINAPI hid_joystick_effect_Stop( IDirectInputEffect *iface )
TRACE
(
"iface %p.
\n
"
,
iface
);
EnterCriticalSection
(
&
impl
->
joystick
->
base
.
crit
);
if
(
!
i
mpl
->
joystick
->
base
.
acquired
||
!
(
impl
->
joystick
->
base
.
dwCoopLevel
&
DISCL_EXCLUSIVE
))
if
(
!
i
s_exclusively_acquired
(
impl
->
joystick
))
hr
=
DIERR_NOTEXCLUSIVEACQUIRED
;
else
if
(
!
impl
->
index
)
hr
=
DIERR_NOTDOWNLOADED
;
...
...
@@ -2775,7 +2780,7 @@ static HRESULT WINAPI hid_joystick_effect_GetEffectStatus( IDirectInputEffect *i
*
status
=
0
;
EnterCriticalSection
(
&
impl
->
joystick
->
base
.
crit
);
if
(
!
i
mpl
->
joystick
->
base
.
acquired
||
!
(
impl
->
joystick
->
base
.
dwCoopLevel
&
DISCL_EXCLUSIVE
))
if
(
!
i
s_exclusively_acquired
(
impl
->
joystick
))
hr
=
DIERR_NOTEXCLUSIVEACQUIRED
;
else
if
(
!
impl
->
index
)
hr
=
DIERR_NOTDOWNLOADED
;
...
...
@@ -2850,7 +2855,7 @@ static HRESULT WINAPI hid_joystick_effect_Download( IDirectInputEffect *iface )
if
(
impl
->
modified
)
hr
=
DI_OK
;
else
hr
=
DI_NOEFFECT
;
if
(
!
i
mpl
->
joystick
->
base
.
acquired
||
!
(
impl
->
joystick
->
base
.
dwCoopLevel
&
DISCL_EXCLUSIVE
))
if
(
!
i
s_exclusively_acquired
(
impl
->
joystick
))
hr
=
DIERR_NOTEXCLUSIVEACQUIRED
;
else
if
((
impl
->
flags
&
complete_mask
)
!=
complete_mask
)
hr
=
DIERR_INCOMPLETEEFFECT
;
...
...
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