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
d175c152
Commit
d175c152
authored
Aug 23, 2011
by
Lucas Fialho Zawacki
Committed by
Alexandre Julliard
Aug 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Common implementation for joystick, keyboard and mouse SetActionMap.
parent
c0fd2223
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
175 deletions
+90
-175
device.c
dlls/dinput/device.c
+84
-22
device_private.h
dlls/dinput/device_private.h
+1
-0
joystick.c
dlls/dinput/joystick.c
+1
-57
keyboard.c
dlls/dinput/keyboard.c
+2
-46
mouse.c
dlls/dinput/mouse.c
+2
-50
No files found.
dlls/dinput/device.c
View file @
d175c152
...
...
@@ -640,6 +640,87 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf,
return
IDirectInputDevice8WImpl_BuildActionMap
(
iface
,
lpdiaf
,
lpszUserName
,
dwFlags
);
}
HRESULT
_set_action_map
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
,
LPCDIDATAFORMAT
df
)
{
IDirectInputDeviceImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
DIDATAFORMAT
data_format
;
DIOBJECTDATAFORMAT
*
obj_df
=
NULL
;
DIPROPDWORD
dp
;
DIPROPRANGE
dpr
;
int
i
,
action
=
0
,
num_actions
=
0
;
unsigned
int
offset
=
0
;
if
(
This
->
acquired
)
return
DIERR_ACQUIRED
;
data_format
.
dwSize
=
sizeof
(
data_format
);
data_format
.
dwObjSize
=
sizeof
(
DIOBJECTDATAFORMAT
);
data_format
.
dwFlags
=
DIDF_RELAXIS
;
data_format
.
dwDataSize
=
lpdiaf
->
dwDataSize
;
/* Count the actions */
for
(
i
=
0
;
i
<
lpdiaf
->
dwNumActions
;
i
++
)
if
(
IsEqualGUID
(
&
This
->
guid
,
&
lpdiaf
->
rgoAction
[
i
].
guidInstance
))
num_actions
++
;
if
(
num_actions
==
0
)
return
DI_NOEFFECT
;
This
->
num_actions
=
num_actions
;
/* Construct the dataformat and actionmap */
obj_df
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DIOBJECTDATAFORMAT
)
*
num_actions
);
data_format
.
rgodf
=
(
LPDIOBJECTDATAFORMAT
)
obj_df
;
data_format
.
dwNumObjs
=
num_actions
;
This
->
action_map
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ActionMap
)
*
num_actions
);
for
(
i
=
0
;
i
<
lpdiaf
->
dwNumActions
;
i
++
)
{
if
(
IsEqualGUID
(
&
This
->
guid
,
&
lpdiaf
->
rgoAction
[
i
].
guidInstance
))
{
DWORD
inst
=
DIDFT_GETINSTANCE
(
lpdiaf
->
rgoAction
[
i
].
dwObjID
);
DWORD
type
=
DIDFT_GETTYPE
(
lpdiaf
->
rgoAction
[
i
].
dwObjID
);
LPDIOBJECTDATAFORMAT
obj
;
if
(
type
==
DIDFT_PSHBUTTON
)
type
=
DIDFT_BUTTON
;
if
(
type
==
DIDFT_RELAXIS
)
type
=
DIDFT_AXIS
;
obj
=
dataformat_to_odf_by_type
(
df
,
inst
,
type
);
memcpy
(
&
obj_df
[
action
],
obj
,
df
->
dwObjSize
);
This
->
action_map
[
action
].
uAppData
=
lpdiaf
->
rgoAction
[
i
].
uAppData
;
This
->
action_map
[
action
].
offset
=
offset
;
obj_df
[
action
].
dwOfs
=
offset
;
offset
+=
(
type
&
DIDFT_BUTTON
)
?
1
:
4
;
action
++
;
}
}
IDirectInputDevice8_SetDataFormat
(
iface
,
&
data_format
);
HeapFree
(
GetProcessHeap
(),
0
,
obj_df
);
/* Set the device properties according to the action format */
dpr
.
diph
.
dwSize
=
sizeof
(
DIPROPRANGE
);
dpr
.
lMin
=
lpdiaf
->
lAxisMin
;
dpr
.
lMax
=
lpdiaf
->
lAxisMax
;
dpr
.
diph
.
dwHeaderSize
=
sizeof
(
DIPROPHEADER
);
dpr
.
diph
.
dwHow
=
DIPH_DEVICE
;
IDirectInputDevice8_SetProperty
(
iface
,
DIPROP_RANGE
,
&
dpr
.
diph
);
if
(
lpdiaf
->
dwBufferSize
>
0
)
{
dp
.
diph
.
dwSize
=
sizeof
(
DIPROPDWORD
);
dp
.
dwData
=
lpdiaf
->
dwBufferSize
;
dp
.
diph
.
dwHeaderSize
=
sizeof
(
DIPROPHEADER
);
dp
.
diph
.
dwHow
=
DIPH_DEVICE
;
IDirectInputDevice8_SetProperty
(
iface
,
DIPROP_BUFFERSIZE
,
&
dp
.
diph
);
}
return
IDirectInputDevice8WImpl_SetActionMap
(
iface
,
lpdiaf
,
lpszUserName
,
dwFlags
);
}
/******************************************************************************
* queue_event - add new event to the ring queue
*/
...
...
@@ -1483,31 +1564,12 @@ HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W ifa
}
HRESULT
WINAPI
IDirectInputDevice8WImpl_SetActionMap
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
)
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
)
{
DIPROPDWORD
dp
;
DIPROPRANGE
dpr
;
FIXME
(
"(%p)->(%p,%s,%08x): semi-stub !
\n
"
,
iface
,
lpdiaf
,
debugstr_w
(
lpszUserName
),
dwFlags
);
dpr
.
diph
.
dwSize
=
sizeof
(
DIPROPRANGE
);
dpr
.
lMin
=
lpdiaf
->
lAxisMin
;
dpr
.
lMax
=
lpdiaf
->
lAxisMax
;
dpr
.
diph
.
dwHeaderSize
=
sizeof
(
DIPROPHEADER
);
dpr
.
diph
.
dwHow
=
DIPH_DEVICE
;
IDirectInputDevice8_SetProperty
(
iface
,
DIPROP_RANGE
,
&
dpr
.
diph
);
if
(
lpdiaf
->
dwBufferSize
>
0
)
{
dp
.
diph
.
dwSize
=
sizeof
(
DIPROPDWORD
);
dp
.
dwData
=
lpdiaf
->
dwBufferSize
;
dp
.
diph
.
dwHeaderSize
=
sizeof
(
DIPROPHEADER
);
dp
.
diph
.
dwHow
=
DIPH_DEVICE
;
IDirectInputDevice8_SetProperty
(
iface
,
DIPROP_BUFFERSIZE
,
&
dp
.
diph
);
}
return
DI_OK
;
}
...
...
dlls/dinput/device_private.h
View file @
d175c152
...
...
@@ -128,6 +128,7 @@ extern DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic)
extern
LPDIOBJECTDATAFORMAT
dataformat_to_odf_by_type
(
LPCDIDATAFORMAT
df
,
int
n
,
DWORD
type
)
DECLSPEC_HIDDEN
;
extern
HRESULT
_build_action_map
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
,
DWORD
devMask
,
LPCDIDATAFORMAT
df
)
DECLSPEC_HIDDEN
;
extern
HRESULT
_set_action_map
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
,
LPCDIDATAFORMAT
df
)
DECLSPEC_HIDDEN
;
/* And the stubs */
extern
HRESULT
WINAPI
IDirectInputDevice2AImpl_Acquire
(
LPDIRECTINPUTDEVICE8A
iface
)
DECLSPEC_HIDDEN
;
...
...
dlls/dinput/joystick.c
View file @
d175c152
...
...
@@ -501,66 +501,10 @@ HRESULT WINAPI JoystickWGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
DWORD
dwFlags
)
{
JoystickGenericImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
DIDATAFORMAT
data_format
;
DIOBJECTDATAFORMAT
*
obj_df
=
NULL
;
int
i
,
action
=
0
,
num_actions
=
0
;
unsigned
int
offset
=
0
;
FIXME
(
"(%p)->(%p,%s,%08x): semi-stub !
\n
"
,
iface
,
lpdiaf
,
debugstr_w
(
lpszUserName
),
dwFlags
);
if
(
This
->
base
.
acquired
)
return
DIERR_ACQUIRED
;
data_format
.
dwSize
=
sizeof
(
data_format
);
data_format
.
dwObjSize
=
sizeof
(
DIOBJECTDATAFORMAT
);
data_format
.
dwFlags
=
DIDF_RELAXIS
;
data_format
.
dwDataSize
=
lpdiaf
->
dwDataSize
;
/* count the actions */
for
(
i
=
0
;
i
<
lpdiaf
->
dwNumActions
;
i
++
)
if
(
IsEqualGUID
(
&
This
->
base
.
guid
,
&
lpdiaf
->
rgoAction
[
i
].
guidInstance
))
num_actions
++
;
if
(
num_actions
==
0
)
return
DI_NOEFFECT
;
This
->
base
.
num_actions
=
num_actions
;
/* Construct the dataformat and actionmap */
obj_df
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DIOBJECTDATAFORMAT
)
*
num_actions
);
data_format
.
rgodf
=
(
LPDIOBJECTDATAFORMAT
)
obj_df
;
data_format
.
dwNumObjs
=
num_actions
;
This
->
base
.
action_map
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ActionMap
)
*
num_actions
);
for
(
i
=
0
;
i
<
lpdiaf
->
dwNumActions
;
i
++
)
{
if
(
IsEqualGUID
(
&
This
->
base
.
guid
,
&
lpdiaf
->
rgoAction
[
i
].
guidInstance
))
{
LPDIDATAFORMAT
df
=
This
->
base
.
data_format
.
wine_df
;
DWORD
inst
=
DIDFT_GETINSTANCE
(
lpdiaf
->
rgoAction
[
i
].
dwObjID
);
DWORD
type
=
DIDFT_GETTYPE
(
lpdiaf
->
rgoAction
[
i
].
dwObjID
);
LPDIOBJECTDATAFORMAT
obj
;
if
(
type
==
DIDFT_PSHBUTTON
)
type
=
DIDFT_BUTTON
;
if
(
type
==
DIDFT_RELAXIS
)
type
=
DIDFT_AXIS
;
obj
=
dataformat_to_odf_by_type
(
df
,
inst
,
type
);
memcpy
(
&
obj_df
[
action
],
obj
,
df
->
dwObjSize
);
This
->
base
.
action_map
[
action
].
uAppData
=
lpdiaf
->
rgoAction
[
i
].
uAppData
;
This
->
base
.
action_map
[
action
].
offset
=
offset
;
obj_df
[
action
].
dwOfs
=
offset
;
offset
+=
(
type
&
DIDFT_BUTTON
)
?
1
:
4
;
action
++
;
}
}
IDirectInputDevice8_SetDataFormat
(
iface
,
&
data_format
);
HeapFree
(
GetProcessHeap
(),
0
,
obj_df
);
return
IDirectInputDevice8WImpl_SetActionMap
(
iface
,
lpdiaf
,
lpszUserName
,
dwFlags
);
return
_set_action_map
(
iface
,
lpdiaf
,
lpszUserName
,
dwFlags
,
This
->
base
.
data_format
.
wine_df
);
}
HRESULT
WINAPI
JoystickAGenericImpl_SetActionMap
(
LPDIRECTINPUTDEVICE8A
iface
,
...
...
dlls/dinput/keyboard.c
View file @
d175c152
...
...
@@ -559,53 +559,9 @@ static HRESULT WINAPI SysKeyboardWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
)
{
SysKeyboardImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
DIDATAFORMAT
data_format
;
DIOBJECTDATAFORMAT
*
obj_df
=
NULL
;
int
i
,
action
=
0
,
num_actions
=
0
;
if
(
This
->
base
.
acquired
)
return
DIERR_ACQUIRED
;
data_format
.
dwSize
=
sizeof
(
data_format
);
data_format
.
dwObjSize
=
sizeof
(
DIOBJECTDATAFORMAT
);
data_format
.
dwFlags
=
DIDF_ABSAXIS
;
data_format
.
dwDataSize
=
lpdiaf
->
dwDataSize
;
/* count the actions */
for
(
i
=
0
;
i
<
lpdiaf
->
dwNumActions
;
i
++
)
if
(
IsEqualGUID
(
&
This
->
base
.
guid
,
&
lpdiaf
->
rgoAction
[
i
].
guidInstance
))
num_actions
++
;
if
(
num_actions
==
0
)
return
DI_NOEFFECT
;
This
->
base
.
num_actions
=
num_actions
;
/* Construct the dataformat and actionmap */
obj_df
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DIOBJECTDATAFORMAT
)
*
num_actions
);
data_format
.
rgodf
=
(
LPDIOBJECTDATAFORMAT
)
obj_df
;
data_format
.
dwNumObjs
=
num_actions
;
This
->
base
.
action_map
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ActionMap
)
*
num_actions
);
for
(
i
=
0
;
i
<
lpdiaf
->
dwNumActions
;
i
++
)
{
if
(
IsEqualGUID
(
&
This
->
base
.
guid
,
&
lpdiaf
->
rgoAction
[
i
].
guidInstance
))
{
int
instance
=
DIDFT_GETINSTANCE
(
lpdiaf
->
rgoAction
[
i
].
dwObjID
);
memcpy
(
&
obj_df
[
action
],
&
c_dfDIKeyboard
.
rgodf
[
instance
],
c_dfDIKeyboard
.
dwObjSize
);
This
->
base
.
action_map
[
action
].
uAppData
=
lpdiaf
->
rgoAction
[
i
].
uAppData
;
This
->
base
.
action_map
[
action
].
offset
=
action
;
obj_df
[
action
].
dwOfs
=
action
;
action
++
;
}
}
IDirectInputDevice8_SetDataFormat
(
iface
,
&
data_format
);
HeapFree
(
GetProcessHeap
(),
0
,
obj_df
);
FIXME
(
"(%p)->(%p,%s,%08x): semi-stub !
\n
"
,
iface
,
lpdiaf
,
debugstr_w
(
lpszUserName
),
dwFlags
);
return
IDirectInputDevice8WImpl_SetActionMap
(
iface
,
lpdiaf
,
lpszUserName
,
dwFlags
);
return
_set_action_map
(
iface
,
lpdiaf
,
lpszUserName
,
dwFlags
,
&
c_dfDIKeyboard
);
}
static
HRESULT
WINAPI
SysKeyboardAImpl_SetActionMap
(
LPDIRECTINPUTDEVICE8A
iface
,
...
...
dlls/dinput/mouse.c
View file @
d175c152
...
...
@@ -808,57 +808,9 @@ static HRESULT WINAPI SysMouseWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
)
{
SysMouseImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
DIDATAFORMAT
data_format
;
DIOBJECTDATAFORMAT
*
obj_df
=
NULL
;
int
i
,
action
=
0
,
num_actions
=
0
;
unsigned
int
offset
=
0
;
if
(
This
->
base
.
acquired
)
return
DIERR_ACQUIRED
;
/* count the actions */
for
(
i
=
0
;
i
<
lpdiaf
->
dwNumActions
;
i
++
)
if
(
IsEqualGUID
(
&
This
->
base
.
guid
,
&
lpdiaf
->
rgoAction
[
i
].
guidInstance
))
num_actions
++
;
if
(
num_actions
==
0
)
return
DI_NOEFFECT
;
data_format
.
dwSize
=
sizeof
(
data_format
);
data_format
.
dwObjSize
=
sizeof
(
DIOBJECTDATAFORMAT
);
data_format
.
dwFlags
=
DIDF_ABSAXIS
;
data_format
.
dwDataSize
=
lpdiaf
->
dwDataSize
;
This
->
base
.
num_actions
=
num_actions
;
/* Constructing the dataformat and actionmap */
obj_df
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DIOBJECTDATAFORMAT
)
*
num_actions
);
data_format
.
rgodf
=
(
LPDIOBJECTDATAFORMAT
)
obj_df
;
data_format
.
dwNumObjs
=
num_actions
;
This
->
base
.
action_map
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ActionMap
)
*
num_actions
);
for
(
i
=
0
;
i
<
lpdiaf
->
dwNumActions
;
i
++
)
{
if
(
IsEqualGUID
(
&
This
->
base
.
guid
,
&
lpdiaf
->
rgoAction
[
i
].
guidInstance
))
{
int
instance
=
DIDFT_GETINSTANCE
(
lpdiaf
->
rgoAction
[
i
].
dwObjID
);
memcpy
(
&
obj_df
[
action
],
&
c_dfDIMouse
.
rgodf
[
instance
],
c_dfDIMouse
.
dwObjSize
);
This
->
base
.
action_map
[
action
].
uAppData
=
lpdiaf
->
rgoAction
[
i
].
uAppData
;
This
->
base
.
action_map
[
action
].
offset
=
offset
;
obj_df
[
action
].
dwOfs
=
offset
;
offset
+=
(
obj_df
[
action
].
dwType
&
DIDFT_BUTTON
)
?
1
:
4
;
action
++
;
}
}
IDirectInputDevice8_SetDataFormat
(
iface
,
&
data_format
);
HeapFree
(
GetProcessHeap
(),
0
,
obj_df
);
FIXME
(
"(%p)->(%p,%s,%08x): semi-stub !
\n
"
,
iface
,
lpdiaf
,
debugstr_w
(
lpszUserName
),
dwFlags
);
return
IDirectInputDevice8WImpl_SetActionMap
(
iface
,
lpdiaf
,
lpszUserName
,
dwFlags
);
return
_set_action_map
(
iface
,
lpdiaf
,
lpszUserName
,
dwFlags
,
&
c_dfDIMouse2
);
}
static
HRESULT
WINAPI
SysMouseAImpl_SetActionMap
(
LPDIRECTINPUTDEVICE8A
iface
,
...
...
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