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
89c59e77
Commit
89c59e77
authored
Oct 20, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Oct 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Factor all GetDeviceState implementations together.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
59fad291
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
81 deletions
+45
-81
device.c
dlls/dinput/device.c
+41
-0
device_private.h
dlls/dinput/device_private.h
+1
-0
joystick_hid.c
dlls/dinput/joystick_hid.c
+1
-17
keyboard.c
dlls/dinput/keyboard.c
+1
-30
mouse.c
dlls/dinput/mouse.c
+1
-34
No files found.
dlls/dinput/device.c
View file @
89c59e77
...
...
@@ -1522,6 +1522,47 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo( IDirectInputDevice8W *ifa
return
DI_OK
;
}
static
BOOL
CALLBACK
reset_axis_data
(
const
DIDEVICEOBJECTINSTANCEW
*
instance
,
void
*
data
)
{
*
(
ULONG
*
)((
char
*
)
data
+
instance
->
dwOfs
)
=
0
;
return
DIENUM_CONTINUE
;
}
HRESULT
WINAPI
IDirectInputDevice2WImpl_GetDeviceState
(
IDirectInputDevice8W
*
iface
,
DWORD
size
,
void
*
data
)
{
IDirectInputDeviceImpl
*
impl
=
impl_from_IDirectInputDevice8W
(
iface
);
DIPROPHEADER
filter
=
{
.
dwSize
=
sizeof
(
filter
),
.
dwHeaderSize
=
sizeof
(
filter
),
.
dwHow
=
DIPH_DEVICE
,
.
dwObj
=
0
,
};
HRESULT
hr
;
TRACE
(
"iface %p, size %u, data %p.
\n
"
,
iface
,
size
,
data
);
if
(
!
data
)
return
DIERR_INVALIDPARAM
;
IDirectInputDevice2_Poll
(
iface
);
EnterCriticalSection
(
&
impl
->
crit
);
if
(
!
impl
->
acquired
)
hr
=
DIERR_NOTACQUIRED
;
else
if
(
size
!=
impl
->
data_format
.
user_df
->
dwDataSize
)
hr
=
DIERR_INVALIDPARAM
;
else
{
fill_DataFormat
(
data
,
size
,
impl
->
device_state
,
&
impl
->
data_format
);
if
(
!
(
impl
->
data_format
.
user_df
->
dwFlags
&
DIDF_ABSAXIS
))
impl
->
vtbl
->
enum_objects
(
iface
,
&
filter
,
DIDFT_RELAXIS
,
reset_axis_data
,
impl
->
device_state
);
hr
=
DI_OK
;
}
LeaveCriticalSection
(
&
impl
->
crit
);
return
hr
;
}
HRESULT
WINAPI
IDirectInputDevice2WImpl_GetDeviceData
(
LPDIRECTINPUTDEVICE8W
iface
,
DWORD
dodsize
,
LPDIDEVICEOBJECTDATA
dod
,
LPDWORD
entries
,
DWORD
flags
)
{
...
...
dlls/dinput/device_private.h
View file @
89c59e77
...
...
@@ -157,6 +157,7 @@ extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE
LPDIDEVICEOBJECTINSTANCEW
pdidoi
,
DWORD
dwObj
,
DWORD
dwHow
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirectInputDevice2WImpl_GetDeviceState
(
IDirectInputDevice8W
*
iface
,
DWORD
len
,
void
*
ptr
);
extern
HRESULT
WINAPI
IDirectInputDevice2WImpl_GetDeviceData
(
LPDIRECTINPUTDEVICE8W
iface
,
DWORD
dodsize
,
LPDIDEVICEOBJECTDATA
dod
,
LPDWORD
entries
,
DWORD
flags
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirectInputDevice2WImpl_RunControlPanel
(
LPDIRECTINPUTDEVICE8W
iface
,
HWND
hwndOwner
,
DWORD
dwFlags
)
DECLSPEC_HIDDEN
;
...
...
dlls/dinput/joystick_hid.c
View file @
89c59e77
...
...
@@ -818,22 +818,6 @@ static HRESULT hid_joystick_internal_unacquire( IDirectInputDevice8W *iface )
return
DI_OK
;
}
static
HRESULT
WINAPI
hid_joystick_GetDeviceState
(
IDirectInputDevice8W
*
iface
,
DWORD
len
,
void
*
ptr
)
{
struct
hid_joystick
*
impl
=
impl_from_IDirectInputDevice8W
(
iface
);
HRESULT
hr
=
DI_OK
;
if
(
!
ptr
)
return
DIERR_INVALIDPARAM
;
if
(
len
!=
impl
->
base
.
data_format
.
user_df
->
dwDataSize
)
return
DIERR_INVALIDPARAM
;
EnterCriticalSection
(
&
impl
->
base
.
crit
);
if
(
!
impl
->
base
.
acquired
)
hr
=
DIERR_NOTACQUIRED
;
else
fill_DataFormat
(
ptr
,
len
,
impl
->
base
.
device_state
,
&
impl
->
base
.
data_format
);
LeaveCriticalSection
(
&
impl
->
base
.
crit
);
return
hr
;
}
static
HRESULT
hid_joystick_effect_create
(
struct
hid_joystick
*
joystick
,
IDirectInputEffect
**
out
);
static
HRESULT
WINAPI
hid_joystick_CreateEffect
(
IDirectInputDevice8W
*
iface
,
const
GUID
*
guid
,
...
...
@@ -1175,7 +1159,7 @@ static const IDirectInputDevice8WVtbl hid_joystick_vtbl =
IDirectInputDevice2WImpl_SetProperty
,
IDirectInputDevice2WImpl_Acquire
,
IDirectInputDevice2WImpl_Unacquire
,
hid_joystick
_GetDeviceState
,
IDirectInputDevice2WImpl
_GetDeviceState
,
IDirectInputDevice2WImpl_GetDeviceData
,
IDirectInputDevice2WImpl_SetDataFormat
,
IDirectInputDevice2WImpl_SetEventNotification
,
...
...
dlls/dinput/keyboard.c
View file @
89c59e77
...
...
@@ -241,35 +241,6 @@ const struct dinput_device keyboard_device = {
keyboarddev_create_device
};
static
HRESULT
WINAPI
SysKeyboardWImpl_GetDeviceState
(
LPDIRECTINPUTDEVICE8W
iface
,
DWORD
len
,
LPVOID
ptr
)
{
SysKeyboardImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
DWORD
i
;
TRACE
(
"(%p)->(%d,%p)
\n
"
,
This
,
len
,
ptr
);
if
(
!
This
->
base
.
acquired
)
return
DIERR_NOTACQUIRED
;
if
(
len
!=
This
->
base
.
data_format
.
user_df
->
dwDataSize
)
return
DIERR_INVALIDPARAM
;
check_dinput_events
();
EnterCriticalSection
(
&
This
->
base
.
crit
);
if
(
TRACE_ON
(
dinput
))
{
TRACE
(
"pressed keys:"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
if
(
This
->
base
.
device_state
[
i
])
TRACE
(
" %02x"
,
i
);
TRACE
(
"
\n
"
);
}
fill_DataFormat
(
ptr
,
len
,
This
->
base
.
device_state
,
&
This
->
base
.
data_format
);
LeaveCriticalSection
(
&
This
->
base
.
crit
);
return
DI_OK
;
}
static
HRESULT
keyboard_internal_poll
(
IDirectInputDevice8W
*
iface
)
{
check_dinput_events
();
...
...
@@ -379,7 +350,7 @@ static const IDirectInputDevice8WVtbl SysKeyboardWvt =
IDirectInputDevice2WImpl_SetProperty
,
IDirectInputDevice2WImpl_Acquire
,
IDirectInputDevice2WImpl_Unacquire
,
SysKeyboard
WImpl_GetDeviceState
,
IDirectInputDevice2
WImpl_GetDeviceState
,
IDirectInputDevice2WImpl_GetDeviceData
,
IDirectInputDevice2WImpl_SetDataFormat
,
IDirectInputDevice2WImpl_SetEventNotification
,
...
...
dlls/dinput/mouse.c
View file @
89c59e77
...
...
@@ -442,39 +442,6 @@ static void warp_check( SysMouseImpl* This, BOOL force )
}
}
/******************************************************************************
* GetDeviceState : returns the "state" of the mouse.
*
* For the moment, only the "standard" return structure (DIMOUSESTATE) is
* supported.
*/
static
HRESULT
WINAPI
SysMouseWImpl_GetDeviceState
(
LPDIRECTINPUTDEVICE8W
iface
,
DWORD
len
,
LPVOID
ptr
)
{
SysMouseImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
DIMOUSESTATE2
*
state
=
(
DIMOUSESTATE2
*
)
This
->
base
.
device_state
;
TRACE
(
"(%p)->(%u,%p)
\n
"
,
This
,
len
,
ptr
);
if
(
This
->
base
.
acquired
==
0
)
return
DIERR_NOTACQUIRED
;
check_dinput_events
();
EnterCriticalSection
(
&
This
->
base
.
crit
);
/* Copy the current mouse state */
fill_DataFormat
(
ptr
,
len
,
state
,
&
This
->
base
.
data_format
);
/* Initialize the buffer when in relative mode */
if
(
!
(
This
->
base
.
data_format
.
user_df
->
dwFlags
&
DIDF_ABSAXIS
))
{
state
->
lX
=
0
;
state
->
lY
=
0
;
state
->
lZ
=
0
;
}
LeaveCriticalSection
(
&
This
->
base
.
crit
);
return
DI_OK
;
}
static
HRESULT
mouse_internal_poll
(
IDirectInputDevice8W
*
iface
)
{
SysMouseImpl
*
impl
=
impl_from_IDirectInputDevice8W
(
iface
);
...
...
@@ -696,7 +663,7 @@ static const IDirectInputDevice8WVtbl SysMouseWvt =
IDirectInputDevice2WImpl_SetProperty
,
IDirectInputDevice2WImpl_Acquire
,
IDirectInputDevice2WImpl_Unacquire
,
SysMouse
WImpl_GetDeviceState
,
IDirectInputDevice2
WImpl_GetDeviceState
,
IDirectInputDevice2WImpl_GetDeviceData
,
IDirectInputDevice2WImpl_SetDataFormat
,
IDirectInputDevice2WImpl_SetEventNotification
,
...
...
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