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
bc5d32be
Commit
bc5d32be
authored
Jul 11, 2011
by
Lucas Fialho Zawacki
Committed by
Alexandre Julliard
Jul 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: EnumDevicesBySemantics enumerating all kinds of joysticks.
parent
dc044e15
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
2 deletions
+55
-2
dinput_main.c
dlls/dinput/dinput_main.c
+52
-2
device.c
dlls/dinput8/tests/device.c
+3
-0
No files found.
dlls/dinput/dinput_main.c
View file @
bc5d32be
...
...
@@ -847,6 +847,7 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
IDirectInputImpl
*
This
=
impl_from_IDirectInput8A
(
iface
);
DIDEVICEINSTANCEA
didevi
;
LPDIRECTINPUTDEVICE8A
lpdid
;
DWORD
callbackFlags
;
int
i
,
j
;
...
...
@@ -865,12 +866,36 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
didevi
.
dwSize
=
sizeof
(
didevi
);
/* Enumerate all the joysticks */
for
(
i
=
0
;
i
<
NB_DINPUT_DEVICES
;
i
++
)
{
BOOL
enumSuccess
;
if
(
!
dinput_devices
[
i
]
->
enum_deviceA
)
continue
;
for
(
j
=
0
,
enumSuccess
=
-
1
;
enumSuccess
!=
0
;
j
++
)
{
TRACE
(
" - checking device %u ('%s')
\n
"
,
i
,
dinput_devices
[
i
]
->
name
);
callbackFlags
=
0
;
/* 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
)
{
IDirectInput_CreateDevice
(
iface
,
&
didevi
.
guidInstance
,
&
lpdid
,
NULL
);
if
(
lpCallback
(
&
didevi
,
lpdid
,
callbackFlags
,
0
,
pvRef
)
==
DIENUM_STOP
)
return
DI_OK
;
}
}
}
if
(
dwFlags
&
DIEDBSFL_FORCEFEEDBACK
)
return
DI_OK
;
/* Enumerate keyboard and mouse */
for
(
i
=
0
;
i
<
sizeof
(
guids
)
/
sizeof
(
guids
[
0
]);
i
++
)
{
DWORD
callbackFlags
=
0
;
callbackFlags
=
0
;
IDirectInput_CreateDevice
(
iface
,
guids
[
i
],
&
lpdid
,
NULL
);
IDirectInputDevice_GetDeviceInfo
(
lpdid
,
&
didevi
);
...
...
@@ -898,6 +923,7 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
IDirectInputImpl
*
This
=
impl_from_IDirectInput8W
(
iface
);
DIDEVICEINSTANCEW
didevi
;
LPDIRECTINPUTDEVICE8W
lpdid
;
DWORD
callbackFlags
;
int
i
,
j
;
FIXME
(
"(this=%p,%s,%p,%p,%p,%04x): semi-stub
\n
"
,
This
,
debugstr_w
(
ptszUserName
),
lpdiActionFormat
,
...
...
@@ -905,12 +931,36 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
didevi
.
dwSize
=
sizeof
(
didevi
);
/* Enumerate all the joysticks */
for
(
i
=
0
;
i
<
NB_DINPUT_DEVICES
;
i
++
)
{
BOOL
enumSuccess
;
if
(
!
dinput_devices
[
i
]
->
enum_deviceW
)
continue
;
for
(
j
=
0
,
enumSuccess
=
-
1
;
enumSuccess
!=
0
;
j
++
)
{
TRACE
(
" - checking device %u ('%s')
\n
"
,
i
,
dinput_devices
[
i
]
->
name
);
callbackFlags
=
0
;
/* 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
)
{
IDirectInput_CreateDevice
(
iface
,
&
didevi
.
guidInstance
,
&
lpdid
,
NULL
);
if
(
lpCallback
(
&
didevi
,
lpdid
,
callbackFlags
,
0
,
pvRef
)
==
DIENUM_STOP
)
return
DI_OK
;
}
}
}
if
(
dwFlags
&
DIEDBSFL_FORCEFEEDBACK
)
return
DI_OK
;
/* Enumerate keyboard and mouse */
for
(
i
=
0
;
i
<
sizeof
(
guids
)
/
sizeof
(
guids
[
0
]);
i
++
)
{
DWORD
callbackFlags
=
0
;
callbackFlags
=
0
;
IDirectInput_CreateDevice
(
iface
,
guids
[
i
],
&
lpdid
,
NULL
);
IDirectInputDevice_GetDeviceInfo
(
lpdid
,
&
didevi
);
...
...
dlls/dinput8/tests/device.c
View file @
bc5d32be
...
...
@@ -166,6 +166,9 @@ static BOOL CALLBACK enumeration_callback(
hr
=
IDirectInputDevice8_SetActionMap
(
lpdid
,
data
->
lpdiaf
,
NULL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"SetActionMap failed hr=%08x
\n
"
,
hr
);
/* Some joysticks may have no suitable actions and thus should not be tested */
if
(
hr
==
DI_NOEFFECT
)
return
DIENUM_CONTINUE
;
/* Test buffer size */
memset
(
&
dp
,
0
,
sizeof
(
dp
));
dp
.
diph
.
dwSize
=
sizeof
(
dp
);
...
...
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