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
504798ce
Commit
504798ce
authored
Jan 04, 2007
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Jan 05, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Change EnumObjects to use GetObjectInfo.
Also small debug trace correction to make it more readable.
parent
d8c67c34
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
47 deletions
+34
-47
device.c
dlls/dinput/device.c
+32
-45
device.c
dlls/dinput/tests/device.c
+2
-2
No files found.
dlls/dinput/device.c
View file @
504798ce
...
...
@@ -800,15 +800,12 @@ ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
return
InterlockedIncrement
(
&
(
This
->
ref
));
}
HRESULT
WINAPI
IDirectInputDevice2AImpl_EnumObjects
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIENUMDEVICEOBJECTSCALLBACKA
lpCallback
,
LPVOID
lpvRef
,
DWORD
dwFlags
)
HRESULT
WINAPI
IDirectInputDevice2AImpl_EnumObjects
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIENUMDEVICEOBJECTSCALLBACKA
lpCallback
,
LPVOID
lpvRef
,
DWORD
dwFlags
)
{
IDirectInputDevice2AImpl
*
This
=
(
IDirectInputDevice2AImpl
*
)
iface
;
DIDEVICEOBJECTINSTANCEA
ddoi
;
int
i
,
axis
=
0
,
button
=
0
;
int
i
;
TRACE
(
"(%p) %p,%p flags:%08x)
\n
"
,
iface
,
lpCallback
,
lpvRef
,
dwFlags
);
TRACE
(
" - flags = "
);
...
...
@@ -821,56 +818,46 @@ HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
for
(
i
=
0
;
i
<
This
->
data_format
.
wine_df
->
dwNumObjs
;
i
++
)
{
LPDIOBJECTDATAFORMAT
odf
;
DWORD
type
;
LPDIOBJECTDATAFORMAT
odf
=
dataformat_to_odf
(
This
->
data_format
.
wine_df
,
i
);
odf
=
(
LPDIOBJECTDATAFORMAT
)((
LPBYTE
)
This
->
data_format
.
wine_df
->
rgodf
+
i
*
This
->
data_format
.
wine_df
->
dwObjSize
);
type
=
DIEFT_GETTYPE
(
odf
->
dwType
);
if
(
type
&
DIDFT_AXIS
)
axis
++
;
else
if
(
type
&
DIDFT_BUTTON
)
button
++
;
if
(
dwFlags
!=
DIDFT_ALL
&&
!
(
dwFlags
&
DIEFT_GETTYPE
(
odf
->
dwType
)))
continue
;
if
(
IDirectInputDevice_GetObjectInfo
(
iface
,
&
ddoi
,
odf
->
dwType
,
DIPH_BYID
)
!=
DI_OK
)
continue
;
if
(
dwFlags
!=
DIDFT_ALL
&&
!
(
dwFlags
&
type
))
continue
;
ddoi
.
guidType
=
*
odf
->
pguid
;
ddoi
.
dwType
=
odf
->
dwType
;
ddoi
.
dwFlags
=
odf
->
dwFlags
;
ddoi
.
dwOfs
=
!
This
->
data_format
.
offsets
?
odf
->
dwOfs
:
This
->
data_format
.
offsets
[
i
];
if
(
IsEqualGUID
(
&
ddoi
.
guidType
,
&
GUID_XAxis
))
strcpy
(
ddoi
.
tszName
,
"X-Axis"
);
else
if
(
IsEqualGUID
(
&
ddoi
.
guidType
,
&
GUID_YAxis
))
strcpy
(
ddoi
.
tszName
,
"Y-Axis"
);
else
if
(
IsEqualGUID
(
&
ddoi
.
guidType
,
&
GUID_ZAxis
))
strcpy
(
ddoi
.
tszName
,
"Z-Axis"
);
else
if
(
IsEqualGUID
(
&
ddoi
.
guidType
,
&
GUID_Key
))
GetKeyNameTextA
((
DIDFT_GETINSTANCE
(
odf
->
dwType
)
&
0x80
)
<<
17
|
(
DIDFT_GETINSTANCE
(
odf
->
dwType
)
&
0x7f
)
<<
16
,
ddoi
.
tszName
,
sizeof
(
ddoi
.
tszName
));
else
if
(
type
&
DIDFT_AXIS
)
wsprintfA
(
ddoi
.
tszName
,
"%d-Axis"
,
axis
-
1
);
else
if
(
type
&
DIDFT_BUTTON
)
wsprintfA
(
ddoi
.
tszName
,
"Button %d"
,
button
-
1
);
else
FIXME
(
"no name
\n
"
);
_dump_OBJECTINSTANCEA
(
&
ddoi
);
if
(
lpCallback
(
&
ddoi
,
lpvRef
)
!=
DIENUM_CONTINUE
)
break
;
}
return
DI_OK
;
}
HRESULT
WINAPI
IDirectInputDevice2WImpl_EnumObjects
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIENUMDEVICEOBJECTSCALLBACKW
lpCallback
,
LPVOID
lpvRef
,
DWORD
dwFlags
)
HRESULT
WINAPI
IDirectInputDevice2WImpl_EnumObjects
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIENUMDEVICEOBJECTSCALLBACKW
lpCallback
,
LPVOID
lpvRef
,
DWORD
dwFlags
)
{
device_enumobjects_AtoWcb_data
data
;
IDirectInputDevice2AImpl
*
This
=
(
IDirectInputDevice2AImpl
*
)
iface
;
DIDEVICEOBJECTINSTANCEW
ddoi
;
int
i
;
data
.
lpCallBack
=
lpCallback
;
data
.
lpvRef
=
lpvRef
;
TRACE
(
"(%p) %p,%p flags:%08x)
\n
"
,
iface
,
lpCallback
,
lpvRef
,
dwFlags
);
TRACE
(
" - flags = "
);
_dump_EnumObjects_flags
(
dwFlags
);
TRACE
(
"
\n
"
);
return
IDirectInputDevice2AImpl_EnumObjects
(
(
LPDIRECTINPUTDEVICE8A
)
iface
,
(
LPDIENUMDEVICEOBJECTSCALLBACKA
)
DIEnumDevicesCallbackAtoW
,
(
LPVOID
)
&
data
,
dwFlags
);
/* Only the fields till dwFFMaxForce are relevant */
memset
(
&
ddoi
,
0
,
sizeof
(
ddoi
));
ddoi
.
dwSize
=
FIELD_OFFSET
(
DIDEVICEOBJECTINSTANCEW
,
dwFFMaxForce
);
for
(
i
=
0
;
i
<
This
->
data_format
.
wine_df
->
dwNumObjs
;
i
++
)
{
LPDIOBJECTDATAFORMAT
odf
=
dataformat_to_odf
(
This
->
data_format
.
wine_df
,
i
);
if
(
dwFlags
!=
DIDFT_ALL
&&
!
(
dwFlags
&
DIEFT_GETTYPE
(
odf
->
dwType
)))
continue
;
if
(
IDirectInputDevice_GetObjectInfo
(
iface
,
&
ddoi
,
odf
->
dwType
,
DIPH_BYID
)
!=
DI_OK
)
continue
;
if
(
lpCallback
(
&
ddoi
,
lpvRef
)
!=
DIENUM_CONTINUE
)
break
;
}
return
DI_OK
;
}
/******************************************************************************
...
...
dlls/dinput/tests/device.c
View file @
504798ce
...
...
@@ -59,8 +59,8 @@ static const DIDATAFORMAT data_format = {
static
BOOL
CALLBACK
enum_callback
(
LPCDIDEVICEOBJECTINSTANCE
oi
,
LPVOID
info
)
{
if
(
winetest_debug
>
1
)
trace
(
" Type:%4x Ofs:%
2x Name:%s Flags:%08x
\n
"
,
oi
->
dwType
,
oi
->
dwOfs
,
oi
->
tszName
,
oi
->
dwFlags
);
trace
(
" Type:%4x Ofs:%
3d Flags:%08x Name:%s
\n
"
,
oi
->
dwType
,
oi
->
dwOfs
,
oi
->
dwFlags
,
oi
->
tszName
);
(
*
(
int
*
)
info
)
++
;
return
DIENUM_CONTINUE
;
}
...
...
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