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
34f66a0c
Commit
34f66a0c
authored
Oct 18, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Oct 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Implement EnumObjects through the internal vtable.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
be9a36c4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
81 deletions
+84
-81
device.c
dlls/dinput/device.c
+54
-17
device_private.h
dlls/dinput/device_private.h
+5
-3
joystick_hid.c
dlls/dinput/joystick_hid.c
+23
-61
keyboard.c
dlls/dinput/keyboard.c
+1
-0
mouse.c
dlls/dinput/mouse.c
+1
-0
No files found.
dlls/dinput/device.c
View file @
34f66a0c
...
...
@@ -1140,33 +1140,70 @@ ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface)
return
ref
;
}
HRESULT
WINAPI
IDirectInputDevice2WImpl_EnumObjects
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIENUMDEVICEOBJECTSCALLBACKW
lpCallback
,
LPVOID
lpvRef
,
DWORD
dwFlags
)
HRESULT
WINAPI
IDirectInputDevice2WImpl_EnumObjects
(
IDirectInputDevice8W
*
iface
,
LPDIENUMDEVICEOBJECTSCALLBACKW
callback
,
void
*
context
,
DWORD
flags
)
{
IDirectInputDeviceImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
DIDEVICEOBJECTINSTANCEW
ddoi
;
int
i
;
static
const
DIPROPHEADER
filter
=
{
.
dwSize
=
sizeof
(
filter
),
.
dwHeaderSize
=
sizeof
(
filter
),
.
dwHow
=
DIPH_DEVICE
,
};
struct
IDirectInputDeviceImpl
*
impl
=
impl_from_IDirectInputDevice8W
(
iface
);
HRESULT
hr
;
TRACE
(
"(%p)->(%p,%p flags:%08x)
\n
"
,
This
,
lpCallback
,
lpvRef
,
dwFlags
);
TRACE
(
" - flags = "
);
_dump_EnumObjects_flags
(
dwFlags
);
TRACE
(
"
\n
"
);
TRACE
(
"iface %p, callback %p, context %p, flags %#x.
\n
"
,
iface
,
callback
,
context
,
flags
);
if
(
!
callback
)
return
DIERR_INVALIDPARAM
;
if
(
flags
&
~
(
DIDFT_AXIS
|
DIDFT_POV
|
DIDFT_BUTTON
|
DIDFT_NODATA
|
DIDFT_COLLECTION
))
return
DIERR_INVALIDPARAM
;
if
(
!
lpCallback
)
return
DIERR_INVALIDPARAM
;
if
(
!
impl
->
vtbl
->
enum_objects
)
{
DIDEVICEOBJECTINSTANCEW
ddoi
;
DWORD
i
;
/* Only the fields till dwFFMaxForce are relevant */
memset
(
&
ddoi
,
0
,
sizeof
(
ddoi
)
);
ddoi
.
dwSize
=
FIELD_OFFSET
(
DIDEVICEOBJECTINSTANCEW
,
dwFFMaxForce
);
memset
(
&
ddoi
,
0
,
sizeof
(
ddoi
)
);
ddoi
.
dwSize
=
FIELD_OFFSET
(
DIDEVICEOBJECTINSTANCEW
,
dwFFMaxForce
);
for
(
i
=
0
;
i
<
This
->
data_format
.
wine_df
->
dwNumObjs
;
i
++
)
for
(
i
=
0
;
i
<
impl
->
data_format
.
wine_df
->
dwNumObjs
;
i
++
)
{
LPDIOBJECTDATAFORMAT
odf
=
dataformat_to_odf
(
This
->
data_format
.
wine_df
,
i
);
LPDIOBJECTDATAFORMAT
odf
=
dataformat_to_odf
(
impl
->
data_format
.
wine_df
,
i
);
if
(
dwFlags
!=
DIDFT_ALL
&&
!
(
dwFlags
&
DIDFT_GETTYPE
(
odf
->
dwType
)))
continue
;
if
(
IDirectInputDevice_GetObjectInfo
(
iface
,
&
ddoi
,
odf
->
dwType
,
DIPH_BYID
)
!=
DI_OK
)
if
(
flags
!=
DIDFT_ALL
&&
!
(
flags
&
DIDFT_GETTYPE
(
odf
->
dwType
)))
continue
;
if
(
IDirectInputDevice_GetObjectInfo
(
iface
,
&
ddoi
,
odf
->
dwType
,
DIPH_BYID
)
!=
DI_OK
)
continue
;
if
(
lpCallback
(
&
ddoi
,
lpvRef
)
!=
DIENUM_CONTINUE
)
break
;
if
(
callback
(
&
ddoi
,
context
)
!=
DIENUM_CONTINUE
)
break
;
}
return
DI_OK
;
}
if
(
flags
==
DIDFT_ALL
||
(
flags
&
DIDFT_AXIS
))
{
hr
=
impl
->
vtbl
->
enum_objects
(
iface
,
&
filter
,
DIDFT_AXIS
,
callback
,
context
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
hr
!=
DIENUM_CONTINUE
)
return
DI_OK
;
}
if
(
flags
==
DIDFT_ALL
||
(
flags
&
DIDFT_POV
))
{
hr
=
impl
->
vtbl
->
enum_objects
(
iface
,
&
filter
,
DIDFT_POV
,
callback
,
context
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
hr
!=
DIENUM_CONTINUE
)
return
DI_OK
;
}
if
(
flags
==
DIDFT_ALL
||
(
flags
&
DIDFT_BUTTON
))
{
hr
=
impl
->
vtbl
->
enum_objects
(
iface
,
&
filter
,
DIDFT_BUTTON
,
callback
,
context
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
hr
!=
DIENUM_CONTINUE
)
return
DI_OK
;
}
if
(
flags
==
DIDFT_ALL
||
(
flags
&
(
DIDFT_NODATA
|
DIDFT_COLLECTION
)))
{
hr
=
impl
->
vtbl
->
enum_objects
(
iface
,
&
filter
,
DIDFT_NODATA
,
callback
,
context
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
hr
!=
DIENUM_CONTINUE
)
return
DI_OK
;
}
return
DI_OK
;
...
...
dlls/dinput/device_private.h
View file @
34f66a0c
...
...
@@ -57,9 +57,11 @@ typedef HRESULT dinput_device_read_state( IDirectInputDevice8W *iface );
struct
dinput_device_vtbl
{
HRESULT
(
*
read
)(
IDirectInputDevice8W
*
);
HRESULT
(
*
acquire
)(
IDirectInputDevice8W
*
);
HRESULT
(
*
unacquire
)(
IDirectInputDevice8W
*
);
HRESULT
(
*
read
)(
IDirectInputDevice8W
*
iface
);
HRESULT
(
*
acquire
)(
IDirectInputDevice8W
*
iface
);
HRESULT
(
*
unacquire
)(
IDirectInputDevice8W
*
iface
);
HRESULT
(
*
enum_objects
)(
IDirectInputDevice8W
*
iface
,
const
DIPROPHEADER
*
filter
,
DWORD
flags
,
LPDIENUMDEVICEOBJECTSCALLBACKW
callback
,
void
*
context
);
};
#define DEVICE_STATE_MAX_SIZE 1024
...
...
dlls/dinput/joystick_hid.c
View file @
34f66a0c
...
...
@@ -656,66 +656,6 @@ static ULONG WINAPI hid_joystick_Release( IDirectInputDevice8W *iface )
return
ref
;
}
struct
enum_objects_params
{
LPDIENUMDEVICEOBJECTSCALLBACKW
callback
;
void
*
context
;
};
static
BOOL
enum_objects_callback
(
struct
hid_joystick
*
impl
,
struct
hid_value_caps
*
caps
,
DIDEVICEOBJECTINSTANCEW
*
instance
,
void
*
data
)
{
struct
enum_objects_params
*
params
=
data
;
return
params
->
callback
(
instance
,
params
->
context
);
}
static
HRESULT
WINAPI
hid_joystick_EnumObjects
(
IDirectInputDevice8W
*
iface
,
LPDIENUMDEVICEOBJECTSCALLBACKW
callback
,
void
*
context
,
DWORD
flags
)
{
static
const
DIPROPHEADER
filter
=
{
.
dwSize
=
sizeof
(
filter
),
.
dwHeaderSize
=
sizeof
(
filter
),
.
dwHow
=
DIPH_DEVICE
,
};
struct
hid_joystick
*
impl
=
impl_from_IDirectInputDevice8W
(
iface
);
struct
enum_objects_params
params
=
{
.
callback
=
callback
,
.
context
=
context
,
};
BOOL
ret
;
TRACE
(
"iface %p, callback %p, context %p, flags %#x.
\n
"
,
iface
,
callback
,
context
,
flags
);
if
(
!
callback
)
return
DIERR_INVALIDPARAM
;
if
(
flags
&
~
(
DIDFT_AXIS
|
DIDFT_POV
|
DIDFT_BUTTON
|
DIDFT_NODATA
|
DIDFT_COLLECTION
))
return
DIERR_INVALIDPARAM
;
if
(
flags
==
DIDFT_ALL
||
(
flags
&
DIDFT_AXIS
))
{
ret
=
enum_objects
(
impl
,
&
filter
,
DIDFT_AXIS
,
enum_objects_callback
,
&
params
);
if
(
ret
!=
DIENUM_CONTINUE
)
return
DI_OK
;
}
if
(
flags
==
DIDFT_ALL
||
(
flags
&
DIDFT_POV
))
{
ret
=
enum_objects
(
impl
,
&
filter
,
DIDFT_POV
,
enum_objects_callback
,
&
params
);
if
(
ret
!=
DIENUM_CONTINUE
)
return
DI_OK
;
}
if
(
flags
==
DIDFT_ALL
||
(
flags
&
DIDFT_BUTTON
))
{
ret
=
enum_objects
(
impl
,
&
filter
,
DIDFT_BUTTON
,
enum_objects_callback
,
&
params
);
if
(
ret
!=
DIENUM_CONTINUE
)
return
DI_OK
;
}
if
(
flags
==
DIDFT_ALL
||
(
flags
&
(
DIDFT_NODATA
|
DIDFT_COLLECTION
)))
{
ret
=
enum_objects
(
impl
,
&
filter
,
DIDFT_NODATA
,
enum_objects_callback
,
&
params
);
if
(
ret
!=
DIENUM_CONTINUE
)
return
DI_OK
;
}
return
DI_OK
;
}
static
BOOL
get_property_prop_range
(
struct
hid_joystick
*
impl
,
struct
hid_value_caps
*
caps
,
DIDEVICEOBJECTINSTANCEW
*
instance
,
void
*
data
)
{
...
...
@@ -1392,7 +1332,7 @@ static const IDirectInputDevice8WVtbl hid_joystick_vtbl =
hid_joystick_Release
,
/*** IDirectInputDevice methods ***/
IDirectInputDevice2WImpl_GetCapabilities
,
hid_joystick
_EnumObjects
,
IDirectInputDevice2WImpl
_EnumObjects
,
hid_joystick_GetProperty
,
hid_joystick_SetProperty
,
IDirectInputDevice2WImpl_Acquire
,
...
...
@@ -1616,11 +1556,33 @@ static HRESULT hid_joystick_internal_read( IDirectInputDevice8W *iface )
return
hr
;
}
struct
enum_objects_params
{
LPDIENUMDEVICEOBJECTSCALLBACKW
callback
;
void
*
context
;
};
static
BOOL
enum_objects_callback
(
struct
hid_joystick
*
impl
,
struct
hid_value_caps
*
caps
,
DIDEVICEOBJECTINSTANCEW
*
instance
,
void
*
data
)
{
struct
enum_objects_params
*
params
=
data
;
return
params
->
callback
(
instance
,
params
->
context
);
}
static
HRESULT
hid_joystick_internal_enum_objects
(
IDirectInputDevice8W
*
iface
,
const
DIPROPHEADER
*
filter
,
DWORD
flags
,
LPDIENUMDEVICEOBJECTSCALLBACKW
callback
,
void
*
context
)
{
struct
enum_objects_params
params
=
{.
callback
=
callback
,
.
context
=
context
};
struct
hid_joystick
*
impl
=
impl_from_IDirectInputDevice8W
(
iface
);
return
enum_objects
(
impl
,
filter
,
flags
,
enum_objects_callback
,
&
params
);
}
static
const
struct
dinput_device_vtbl
hid_joystick_internal_vtbl
=
{
hid_joystick_internal_read
,
hid_joystick_internal_acquire
,
hid_joystick_internal_unacquire
,
hid_joystick_internal_enum_objects
,
};
static
DWORD
device_type_for_version
(
DWORD
type
,
DWORD
version
)
...
...
dlls/dinput/keyboard.c
View file @
34f66a0c
...
...
@@ -412,6 +412,7 @@ static const struct dinput_device_vtbl keyboard_internal_vtbl =
NULL
,
keyboard_internal_acquire
,
keyboard_internal_unacquire
,
NULL
,
};
static
const
IDirectInputDevice8WVtbl
SysKeyboardWvt
=
...
...
dlls/dinput/mouse.c
View file @
34f66a0c
...
...
@@ -668,6 +668,7 @@ static const struct dinput_device_vtbl mouse_internal_vtbl =
NULL
,
mouse_internal_acquire
,
mouse_internal_unacquire
,
NULL
,
};
static
const
IDirectInputDevice8WVtbl
SysMouseWvt
=
...
...
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