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
8ff74b15
Commit
8ff74b15
authored
Mar 22, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Initialize object formats from device objects in SetActionMap.
parent
df90c379
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
47 deletions
+14
-47
device.c
dlls/dinput/device.c
+10
-40
joystick8.c
dlls/dinput/tests/joystick8.c
+4
-7
No files found.
dlls/dinput/device.c
View file @
8ff74b15
...
...
@@ -1975,7 +1975,6 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
const
WCHAR
*
username
,
DWORD
flags
)
{
struct
dinput_device
*
impl
=
impl_from_IDirectInputDevice8W
(
iface
);
DIOBJECTDATAFORMAT
*
obj_df
=
NULL
;
DIDATAFORMAT
data_format
=
{
.
dwSize
=
sizeof
(
DIDATAFORMAT
),
...
...
@@ -2011,9 +2010,8 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
};
WCHAR
username_buf
[
MAX_PATH
];
DWORD
username_len
=
MAX_PATH
;
int
i
,
action
=
0
,
num_actions
=
0
;
int
i
,
index
,
action
=
0
,
num_actions
=
0
;
unsigned
int
offset
=
0
;
const
DIDATAFORMAT
*
df
;
ActionMap
*
action_map
;
FIXME
(
"iface %p, format %p, username %s, flags %#lx stub!
\n
"
,
iface
,
format
,
...
...
@@ -2021,21 +2019,6 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
if
(
!
format
)
return
DIERR_INVALIDPARAM
;
switch
(
GET_DIDEVICE_TYPE
(
impl
->
instance
.
dwDevType
))
{
case
DIDEVTYPE_KEYBOARD
:
case
DI8DEVTYPE_KEYBOARD
:
df
=
&
c_dfDIKeyboard
;
break
;
case
DIDEVTYPE_MOUSE
:
case
DI8DEVTYPE_MOUSE
:
df
=
&
c_dfDIMouse2
;
break
;
default:
df
=
&
impl
->
device_format
;
break
;
}
if
(
impl
->
status
==
STATUS_ACQUIRED
)
return
DIERR_ACQUIRED
;
/* Count the actions */
...
...
@@ -2045,34 +2028,21 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
if
(
num_actions
==
0
)
return
DI_NOEFFECT
;
/* Construct the dataformat and actionmap */
obj_df
=
malloc
(
sizeof
(
DIOBJECTDATAFORMAT
)
*
num_actions
);
data_format
.
rgodf
=
(
LPDIOBJECTDATAFORMAT
)
obj_df
;
data_format
.
rgodf
=
malloc
(
sizeof
(
DIOBJECTDATAFORMAT
)
*
num_actions
);
data_format
.
dwDataSize
=
format
->
dwDataSize
;
action_map
=
malloc
(
sizeof
(
ActionMap
)
*
num_actions
);
for
(
i
=
0
;
i
<
format
->
dwNumActions
;
i
++
,
offset
+=
sizeof
(
ULONG
))
{
if
(
IsEqualGUID
(
&
impl
->
guid
,
&
format
->
rgoAction
[
i
].
guidInstance
))
{
DWORD
inst
=
DIDFT_GETINSTANCE
(
format
->
rgoAction
[
i
].
dwObjID
);
DWORD
type
=
DIDFT_GETTYPE
(
format
->
rgoAction
[
i
].
dwObjID
);
LPDIOBJECTDATAFORMAT
obj
;
if
(
type
==
DIDFT_PSHBUTTON
)
type
=
DIDFT_BUTTON
;
if
(
type
==
DIDFT_RELAXIS
)
type
=
DIDFT_AXIS
;
if
(
!
IsEqualGUID
(
&
impl
->
guid
,
&
format
->
rgoAction
[
i
].
guidInstance
))
continue
;
if
((
index
=
dinput_device_object_index_from_id
(
iface
,
format
->
rgoAction
[
i
].
dwObjID
))
<
0
)
continue
;
if
(
!
(
obj
=
dataformat_to_odf_by_type
(
df
,
inst
,
type
)))
continue
;
memcpy
(
&
obj_df
[
action
],
obj
,
df
->
dwObjSize
);
action_map
[
action
].
uAppData
=
format
->
rgoAction
[
i
].
uAppData
;
action_map
[
action
].
offset
=
offset
;
obj_df
[
action
].
dwOfs
=
offset
;
data_format
.
dwNumObjs
++
;
action
++
;
}
action_map
[
action
].
uAppData
=
format
->
rgoAction
[
i
].
uAppData
;
action_map
[
action
].
offset
=
offset
;
data_format
.
rgodf
[
data_format
.
dwNumObjs
]
=
impl
->
device_format
.
rgodf
[
index
];
data_format
.
rgodf
[
data_format
.
dwNumObjs
].
dwOfs
=
offset
;
data_format
.
dwNumObjs
++
;
}
IDirectInputDevice8_SetDataFormat
(
iface
,
&
data_format
);
...
...
@@ -2080,7 +2050,7 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
impl
->
action_map
=
action_map
;
impl
->
num_actions
=
num_actions
;
free
(
obj_
df
);
free
(
data_format
.
rgo
df
);
if
(
format
->
lAxisMin
!=
format
->
lAxisMax
)
{
...
...
dlls/dinput/tests/joystick8.c
View file @
8ff74b15
...
...
@@ -1046,13 +1046,11 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e
hr
=
IDirectInputDevice8_GetDeviceState
(
device
,
sizeof
(
state
),
state
);
ok
(
hr
==
DI_OK
,
"GetDeviceState returned: %#lx
\n
"
,
hr
);
todo_wine_if
(
i
>
5
)
ok
(
state
[
0
]
==
expect_state
[
i
][
0
],
"got state[0] %+ld
\n
"
,
state
[
0
]
);
todo_wine_if
(
i
==
2
||
i
>
4
)
todo_wine_if
(
i
==
2
||
i
==
5
)
ok
(
state
[
1
]
==
expect_state
[
i
][
1
],
"got state[1] %+ld
\n
"
,
state
[
1
]
);
todo_wine_if
(
expect_state
[
i
][
2
]
)
ok
(
state
[
2
]
==
expect_state
[
i
][
2
],
"got state[2] %+ld
\n
"
,
state
[
2
]
);
todo_wine_if
(
i
>
5
)
ok
(
state
[
3
]
==
expect_state
[
i
][
3
],
"got state[3] %+ld
\n
"
,
state
[
3
]
);
todo_wine_if
(
expect_state
[
i
][
4
]
)
ok
(
state
[
4
]
==
expect_state
[
i
][
4
],
"got state[4] %+ld
\n
"
,
state
[
4
]
);
...
...
@@ -1060,7 +1058,6 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e
ok
(
state
[
5
]
==
expect_state
[
i
][
5
],
"got state[5] %+ld
\n
"
,
state
[
5
]
);
todo_wine_if
(
expect_state
[
i
][
6
]
)
ok
(
state
[
6
]
==
expect_state
[
i
][
6
],
"got state[6] %+ld
\n
"
,
state
[
6
]
);
todo_wine_if
(
expect_state
[
i
][
7
]
)
ok
(
state
[
7
]
==
expect_state
[
i
][
7
]
||
broken
(
state
[
7
]
==
-
45
&&
expect_state
[
i
][
7
]
==
-
43
)
/* 32-bit rounding */
,
"got state[7] %+ld
\n
"
,
state
[
7
]
);
...
...
@@ -1082,13 +1079,13 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e
while
(
res
--
)
{
winetest_push_context
(
"%lu"
,
res
);
todo_wine
_if
(
res
!=
1
&&
res
!=
4
)
todo_wine
check_member
(
objdata
[
res
],
expect_objdata
[
res
],
"%#lx"
,
dwOfs
);
todo_wine
_if
(
res
==
0
||
res
==
3
||
res
==
6
)
todo_wine
ok
(
objdata
[
res
].
dwData
==
expect_objdata
[
res
].
dwData
||
broken
(
objdata
[
res
].
dwData
==
-
45
&&
expect_objdata
[
res
].
dwData
==
-
43
)
/* 32-bit rounding */
,
"got dwData %+ld
\n
"
,
objdata
[
res
].
dwData
);
todo_wine
_if
(
res
!=
1
&&
res
!=
4
)
todo_wine
check_member
(
objdata
[
res
],
expect_objdata
[
res
],
"%#Ix"
,
uAppData
);
winetest_pop_context
();
}
...
...
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