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
6e098f90
Commit
6e098f90
authored
Jul 21, 2011
by
Lucas Fialho Zawacki
Committed by
Alexandre Julliard
Jul 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: EnumDevicesBySemantics enumerate joysticks with priority flags.
parent
e98cef49
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
14 deletions
+36
-14
dinput_main.c
dlls/dinput/dinput_main.c
+36
-14
No files found.
dlls/dinput/dinput_main.c
View file @
6e098f90
...
...
@@ -317,6 +317,38 @@ void _copy_diactionformatWtoA(LPDIACTIONFORMATA to, LPDIACTIONFORMATW from)
}
}
/* _diactionformat_priority
*
* Given a DIACTIONFORMAT structure and a DI genre, returns the enumeration
* priority. Joysticks should pass the game genre, and mouse or keyboard their
* respective DI*_MASK
*/
static
DWORD
_diactionformat_priorityA
(
LPDIACTIONFORMATA
lpdiaf
,
DWORD
genre
)
{
int
i
;
DWORD
priorityFlags
=
0
;
/* If there's at least one action for the device it's priority 1 */
for
(
i
=
0
;
i
<
lpdiaf
->
dwActionSize
;
i
++
)
if
((
lpdiaf
->
rgoAction
[
i
].
dwSemantic
&
genre
)
==
genre
)
priorityFlags
|=
DIEDBS_MAPPEDPRI1
;
return
priorityFlags
;
}
static
DWORD
_diactionformat_priorityW
(
LPDIACTIONFORMATW
lpdiaf
,
DWORD
genre
)
{
int
i
;
DWORD
priorityFlags
=
0
;
/* If there's at least one action for the device it's priority 1 */
for
(
i
=
0
;
i
<
lpdiaf
->
dwActionSize
;
i
++
)
if
((
lpdiaf
->
rgoAction
[
i
].
dwSemantic
&
genre
)
==
genre
)
priorityFlags
|=
DIEDBS_MAPPEDPRI1
;
return
priorityFlags
;
}
/******************************************************************************
* IDirectInputA_EnumDevices
*/
...
...
@@ -877,7 +909,7 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
{
TRACE
(
" - checking device %u ('%s')
\n
"
,
i
,
dinput_devices
[
i
]
->
name
);
callbackFlags
=
0
;
callbackFlags
=
_diactionformat_priorityA
(
lpdiActionFormat
,
lpdiActionFormat
->
dwGenre
)
;
/* Default behavior is to enumerate attached game controllers */
enumSuccess
=
dinput_devices
[
i
]
->
enum_deviceA
(
DI8DEVCLASS_GAMECTRL
,
DIEDFL_ATTACHEDONLY
|
dwFlags
,
&
didevi
,
This
->
dwVersion
,
j
);
if
(
enumSuccess
)
...
...
@@ -895,16 +927,11 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
/* Enumerate keyboard and mouse */
for
(
i
=
0
;
i
<
sizeof
(
guids
)
/
sizeof
(
guids
[
0
]);
i
++
)
{
callbackFlags
=
0
;
callbackFlags
=
_diactionformat_priorityA
(
lpdiActionFormat
,
actionMasks
[
i
])
;
IDirectInput_CreateDevice
(
iface
,
guids
[
i
],
&
lpdid
,
NULL
);
IDirectInputDevice_GetDeviceInfo
(
lpdid
,
&
didevi
);
/* If there's at least one action for the device it's priority 1 */
for
(
j
=
0
;
j
<
lpdiActionFormat
->
dwActionSize
;
j
++
)
if
((
lpdiActionFormat
->
rgoAction
[
j
].
dwSemantic
&
actionMasks
[
i
])
==
actionMasks
[
i
])
callbackFlags
|=
DIEDBS_MAPPEDPRI1
;
if
(
lpCallback
(
&
didevi
,
lpdid
,
callbackFlags
,
sizeof
(
guids
)
/
sizeof
(
guids
[
0
])
-
(
i
+
1
),
pvRef
)
==
DIENUM_STOP
)
return
DI_OK
;
}
...
...
@@ -942,7 +969,7 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
{
TRACE
(
" - checking device %u ('%s')
\n
"
,
i
,
dinput_devices
[
i
]
->
name
);
callbackFlags
=
0
;
callbackFlags
=
_diactionformat_priorityW
(
lpdiActionFormat
,
lpdiActionFormat
->
dwGenre
)
;
/* Default behavior is to enumerate attached game controllers */
enumSuccess
=
dinput_devices
[
i
]
->
enum_deviceW
(
DI8DEVCLASS_GAMECTRL
,
DIEDFL_ATTACHEDONLY
|
dwFlags
,
&
didevi
,
This
->
dwVersion
,
j
);
if
(
enumSuccess
)
...
...
@@ -960,16 +987,11 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
/* Enumerate keyboard and mouse */
for
(
i
=
0
;
i
<
sizeof
(
guids
)
/
sizeof
(
guids
[
0
]);
i
++
)
{
callbackFlags
=
0
;
callbackFlags
=
_diactionformat_priorityW
(
lpdiActionFormat
,
actionMasks
[
i
])
;
IDirectInput_CreateDevice
(
iface
,
guids
[
i
],
&
lpdid
,
NULL
);
IDirectInputDevice_GetDeviceInfo
(
lpdid
,
&
didevi
);
/* If there's at least one action for the device it's priority 1 */
for
(
j
=
0
;
j
<
lpdiActionFormat
->
dwActionSize
;
j
++
)
if
((
lpdiActionFormat
->
rgoAction
[
j
].
dwSemantic
&
actionMasks
[
i
])
==
actionMasks
[
i
])
callbackFlags
|=
DIEDBS_MAPPEDPRI1
;
if
(
lpCallback
(
&
didevi
,
lpdid
,
callbackFlags
,
sizeof
(
guids
)
/
sizeof
(
guids
[
0
])
-
(
i
+
1
),
pvRef
)
==
DIENUM_STOP
)
return
DI_OK
;
}
...
...
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