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
30ea1876
Commit
30ea1876
authored
Oct 13, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Oct 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Factor all BuildActionMap wrappers together.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
daed18a8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
111 deletions
+87
-111
device.c
dlls/dinput/device.c
+84
-76
device_private.h
dlls/dinput/device_private.h
+0
-1
joystick_hid.c
dlls/dinput/joystick_hid.c
+1
-11
keyboard.c
dlls/dinput/keyboard.c
+1
-12
mouse.c
dlls/dinput/mouse.c
+1
-11
No files found.
dlls/dinput/device.c
View file @
30ea1876
...
...
@@ -827,68 +827,6 @@ static BOOL set_app_data(IDirectInputDeviceImpl *dev, int offset, UINT_PTR app_d
return
TRUE
;
}
HRESULT
_build_action_map
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
,
DWORD
devMask
,
LPCDIDATAFORMAT
df
)
{
IDirectInputDeviceImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
WCHAR
username
[
MAX_PATH
];
DWORD
username_size
=
MAX_PATH
;
int
i
;
BOOL
load_success
=
FALSE
,
has_actions
=
FALSE
;
/* Unless asked the contrary by these flags, try to load a previous mapping */
if
(
!
(
dwFlags
&
DIDBAM_HWDEFAULTS
))
{
/* Retrieve logged user name if necessary */
if
(
lpszUserName
==
NULL
)
GetUserNameW
(
username
,
&
username_size
);
else
lstrcpynW
(
username
,
lpszUserName
,
MAX_PATH
);
load_success
=
load_mapping_settings
(
This
,
lpdiaf
,
username
);
}
if
(
load_success
)
return
DI_OK
;
for
(
i
=
0
;
i
<
lpdiaf
->
dwNumActions
;
i
++
)
{
/* Don't touch a user configured action */
if
(
lpdiaf
->
rgoAction
[
i
].
dwHow
==
DIAH_USERCONFIG
)
continue
;
if
((
lpdiaf
->
rgoAction
[
i
].
dwSemantic
&
devMask
)
==
devMask
)
{
DWORD
obj_id
=
semantic_to_obj_id
(
This
,
lpdiaf
->
rgoAction
[
i
].
dwSemantic
);
DWORD
type
=
DIDFT_GETTYPE
(
obj_id
);
DWORD
inst
=
DIDFT_GETINSTANCE
(
obj_id
);
LPDIOBJECTDATAFORMAT
odf
;
if
(
type
==
DIDFT_PSHBUTTON
)
type
=
DIDFT_BUTTON
;
if
(
type
==
DIDFT_RELAXIS
)
type
=
DIDFT_AXIS
;
/* Make sure the object exists */
odf
=
dataformat_to_odf_by_type
(
df
,
inst
,
type
);
if
(
odf
!=
NULL
)
{
lpdiaf
->
rgoAction
[
i
].
dwObjID
=
obj_id
;
lpdiaf
->
rgoAction
[
i
].
guidInstance
=
This
->
guid
;
lpdiaf
->
rgoAction
[
i
].
dwHow
=
DIAH_DEFAULT
;
has_actions
=
TRUE
;
}
}
else
if
(
!
(
dwFlags
&
DIDBAM_PRESERVE
))
{
/* We must clear action data belonging to other devices */
memset
(
&
lpdiaf
->
rgoAction
[
i
].
guidInstance
,
0
,
sizeof
(
GUID
));
lpdiaf
->
rgoAction
[
i
].
dwHow
=
DIAH_UNMAPPED
;
}
}
if
(
!
has_actions
)
return
DI_NOEFFECT
;
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
);
...
...
@@ -986,7 +924,7 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
dps
.
wsz
[
0
]
=
'\0'
;
else
lstrcpynW
(
dps
.
wsz
,
username
,
ARRAY_SIZE
(
dps
.
wsz
));
IDirectInputDevice
8
_SetProperty
(
iface
,
DIPROP_USERNAME
,
&
dps
.
diph
);
IDirectInputDevice
2WImpl
_SetProperty
(
iface
,
DIPROP_USERNAME
,
&
dps
.
diph
);
/* Save the settings to disk */
save_mapping_settings
(
iface
,
lpdiaf
,
username
);
...
...
@@ -1735,20 +1673,90 @@ HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W
return
DI_OK
;
}
HRESULT
WINAPI
IDirectInputDevice8WImpl_BuildActionMap
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
)
HRESULT
WINAPI
IDirectInputDevice8WImpl_BuildActionMap
(
IDirectInputDevice8W
*
iface
,
DIACTIONFORMATW
*
format
,
const
WCHAR
*
username
,
DWORD
flags
)
{
IDirectInputDeviceImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
FIXME
(
"(%p)->(%p,%s,%08x): semi-stub !
\n
"
,
This
,
lpdiaf
,
debugstr_w
(
lpszUserName
),
dwFlags
);
#define X(x) if (dwFlags & x) FIXME("\tdwFlags =|"#x"\n");
X
(
DIDBAM_DEFAULT
)
X
(
DIDBAM_PRESERVE
)
X
(
DIDBAM_INITIALIZE
)
X
(
DIDBAM_HWDEFAULTS
)
#undef X
IDirectInputDeviceImpl
*
impl
=
impl_from_IDirectInputDevice8W
(
iface
);
BOOL
load_success
=
FALSE
,
has_actions
=
FALSE
;
DWORD
genre
,
username_len
=
MAX_PATH
;
WCHAR
username_buf
[
MAX_PATH
];
const
DIDATAFORMAT
*
df
;
DWORD
devMask
;
int
i
;
FIXME
(
"iface %p, format %p, username %s, flags %#x semi-stub!
\n
"
,
iface
,
format
,
debugstr_w
(
username
),
flags
);
if
(
!
format
)
return
DIERR_INVALIDPARAM
;
switch
(
GET_DIDEVICE_TYPE
(
impl
->
instance
.
dwDevType
))
{
case
DIDEVTYPE_KEYBOARD
:
case
DI8DEVTYPE_KEYBOARD
:
devMask
=
DIKEYBOARD_MASK
;
df
=
&
c_dfDIKeyboard
;
break
;
case
DIDEVTYPE_MOUSE
:
case
DI8DEVTYPE_MOUSE
:
devMask
=
DIMOUSE_MASK
;
df
=
&
c_dfDIMouse2
;
break
;
default:
devMask
=
DIGENRE_ANY
;
df
=
impl
->
data_format
.
wine_df
;
break
;
}
/* Unless asked the contrary by these flags, try to load a previous mapping */
if
(
!
(
flags
&
DIDBAM_HWDEFAULTS
))
{
/* Retrieve logged user name if necessary */
if
(
username
==
NULL
)
GetUserNameW
(
username_buf
,
&
username_len
);
else
lstrcpynW
(
username_buf
,
username
,
MAX_PATH
);
load_success
=
load_mapping_settings
(
impl
,
format
,
username_buf
);
}
if
(
load_success
)
return
DI_OK
;
for
(
i
=
0
;
i
<
format
->
dwNumActions
;
i
++
)
{
/* Don't touch a user configured action */
if
(
format
->
rgoAction
[
i
].
dwHow
==
DIAH_USERCONFIG
)
continue
;
genre
=
format
->
rgoAction
[
i
].
dwSemantic
&
DIGENRE_ANY
;
if
(
devMask
==
genre
||
(
devMask
==
DIGENRE_ANY
&&
genre
!=
DIMOUSE_MASK
&&
genre
!=
DIKEYBOARD_MASK
))
{
DWORD
obj_id
=
semantic_to_obj_id
(
impl
,
format
->
rgoAction
[
i
].
dwSemantic
);
DWORD
type
=
DIDFT_GETTYPE
(
obj_id
);
DWORD
inst
=
DIDFT_GETINSTANCE
(
obj_id
);
LPDIOBJECTDATAFORMAT
odf
;
if
(
type
==
DIDFT_PSHBUTTON
)
type
=
DIDFT_BUTTON
;
if
(
type
==
DIDFT_RELAXIS
)
type
=
DIDFT_AXIS
;
/* Make sure the object exists */
odf
=
dataformat_to_odf_by_type
(
df
,
inst
,
type
);
if
(
odf
!=
NULL
)
{
format
->
rgoAction
[
i
].
dwObjID
=
obj_id
;
format
->
rgoAction
[
i
].
guidInstance
=
impl
->
guid
;
format
->
rgoAction
[
i
].
dwHow
=
DIAH_DEFAULT
;
has_actions
=
TRUE
;
}
}
else
if
(
!
(
flags
&
DIDBAM_PRESERVE
))
{
/* We must clear action data belonging to other devices */
memset
(
&
format
->
rgoAction
[
i
].
guidInstance
,
0
,
sizeof
(
GUID
)
);
format
->
rgoAction
[
i
].
dwHow
=
DIAH_UNMAPPED
;
}
}
if
(
!
has_actions
)
return
DI_NOEFFECT
;
if
(
flags
&
(
DIDBAM_DEFAULT
|
DIDBAM_PRESERVE
|
DIDBAM_INITIALIZE
|
DIDBAM_HWDEFAULTS
))
FIXME
(
"Unimplemented flags %#x
\n
"
,
flags
);
return
DI_OK
;
}
...
...
dlls/dinput/device_private.h
View file @
30ea1876
...
...
@@ -114,7 +114,6 @@ extern void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi) DECLSPEC
extern
void
_dump_DIDATAFORMAT
(
const
DIDATAFORMAT
*
df
)
DECLSPEC_HIDDEN
;
extern
const
char
*
_dump_dinput_GUID
(
const
GUID
*
guid
)
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 */
...
...
dlls/dinput/joystick_hid.c
View file @
30ea1876
...
...
@@ -1385,16 +1385,6 @@ static HRESULT WINAPI hid_joystick_Poll( IDirectInputDevice8W *iface )
return
hr
;
}
static
HRESULT
WINAPI
hid_joystick_BuildActionMap
(
IDirectInputDevice8W
*
iface
,
DIACTIONFORMATW
*
format
,
const
WCHAR
*
username
,
DWORD
flags
)
{
FIXME
(
"iface %p, format %p, username %s, flags %#x stub!
\n
"
,
iface
,
format
,
debugstr_w
(
username
),
flags
);
if
(
!
format
)
return
DIERR_INVALIDPARAM
;
return
DIERR_UNSUPPORTED
;
}
static
HRESULT
WINAPI
hid_joystick_SetActionMap
(
IDirectInputDevice8W
*
iface
,
DIACTIONFORMATW
*
format
,
const
WCHAR
*
username
,
DWORD
flags
)
{
...
...
@@ -1443,7 +1433,7 @@ static const IDirectInputDevice8WVtbl hid_joystick_vtbl =
IDirectInputDevice7WImpl_EnumEffectsInFile
,
IDirectInputDevice7WImpl_WriteEffectToFile
,
/*** IDirectInputDevice8 methods ***/
hid_joystick
_BuildActionMap
,
IDirectInputDevice8WImpl
_BuildActionMap
,
hid_joystick_SetActionMap
,
IDirectInputDevice8WImpl_GetImageInfo
,
};
...
...
dlls/dinput/keyboard.c
View file @
30ea1876
...
...
@@ -410,17 +410,6 @@ static HRESULT WINAPI SysKeyboardWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
return
res
;
}
static
HRESULT
WINAPI
SysKeyboardWImpl_BuildActionMap
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
)
{
SysKeyboardImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
FIXME
(
"(%p)->(%p,%s,%08x): semi-stub !
\n
"
,
This
,
lpdiaf
,
debugstr_w
(
lpszUserName
),
dwFlags
);
return
_build_action_map
(
iface
,
lpdiaf
,
lpszUserName
,
dwFlags
,
DIKEYBOARD_MASK
,
&
c_dfDIKeyboard
);
}
static
HRESULT
WINAPI
SysKeyboardWImpl_SetActionMap
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
...
...
@@ -463,7 +452,7 @@ static const IDirectInputDevice8WVtbl SysKeyboardWvt =
IDirectInputDevice2WImpl_SendDeviceData
,
IDirectInputDevice7WImpl_EnumEffectsInFile
,
IDirectInputDevice7WImpl_WriteEffectToFile
,
SysKeyboard
WImpl_BuildActionMap
,
IDirectInputDevice8
WImpl_BuildActionMap
,
SysKeyboardWImpl_SetActionMap
,
IDirectInputDevice8WImpl_GetImageInfo
};
dlls/dinput/mouse.c
View file @
30ea1876
...
...
@@ -676,16 +676,6 @@ static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
return
res
;
}
static
HRESULT
WINAPI
SysMouseWImpl_BuildActionMap
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
)
{
FIXME
(
"(%p)->(%p,%s,%08x): semi-stub !
\n
"
,
iface
,
lpdiaf
,
debugstr_w
(
lpszUserName
),
dwFlags
);
return
_build_action_map
(
iface
,
lpdiaf
,
lpszUserName
,
dwFlags
,
DIMOUSE_MASK
,
&
c_dfDIMouse2
);
}
static
HRESULT
WINAPI
SysMouseWImpl_SetActionMap
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
...
...
@@ -728,7 +718,7 @@ static const IDirectInputDevice8WVtbl SysMouseWvt =
IDirectInputDevice2WImpl_SendDeviceData
,
IDirectInputDevice7WImpl_EnumEffectsInFile
,
IDirectInputDevice7WImpl_WriteEffectToFile
,
SysMouse
WImpl_BuildActionMap
,
IDirectInputDevice8
WImpl_BuildActionMap
,
SysMouseWImpl_SetActionMap
,
IDirectInputDevice8WImpl_GetImageInfo
};
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