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
3989e0fe
Commit
3989e0fe
authored
Jan 09, 2007
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Jan 11, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: [joystick_linux] Copy and modify default data format.
Copy only what we have.
parent
101785d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
8 deletions
+32
-8
joystick_linux.c
dlls/dinput/joystick_linux.c
+32
-8
No files found.
dlls/dinput/joystick_linux.c
View file @
3989e0fe
...
...
@@ -396,6 +396,8 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
JoystickImpl
*
newDevice
;
char
name
[
MAX_PATH
];
HRESULT
hr
;
LPDIDATAFORMAT
df
=
NULL
;
int
idx
=
0
;
newDevice
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
JoystickImpl
));
if
(
newDevice
==
0
)
{
...
...
@@ -464,6 +466,31 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice
->
axis_map
[
i
]
=
i
;
}
/* Create copy of default data format */
if
(
!
(
df
=
HeapAlloc
(
GetProcessHeap
(),
0
,
c_dfDIJoystick2
.
dwSize
)))
goto
FAILED
;
memcpy
(
df
,
&
c_dfDIJoystick2
,
c_dfDIJoystick2
.
dwSize
);
/* Axes include POVs */
df
->
dwNumObjs
=
newDevice
->
axes
+
newDevice
->
buttons
;
if
(
!
(
df
->
rgodf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
df
->
dwNumObjs
*
df
->
dwObjSize
)))
goto
FAILED
;
for
(
i
=
0
;
i
<
newDevice
->
axes
;
i
++
)
{
int
wine_obj
=
newDevice
->
axis_map
[
i
];
memcpy
(
&
df
->
rgodf
[
idx
],
&
c_dfDIJoystick2
.
rgodf
[
wine_obj
],
df
->
dwObjSize
);
if
(
wine_obj
<
8
)
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
wine_obj
)
|
DIDFT_ABSAXIS
;
else
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
wine_obj
-
8
)
|
DIDFT_POV
;
}
for
(
i
=
0
;
i
<
newDevice
->
buttons
;
i
++
)
{
memcpy
(
&
df
->
rgodf
[
idx
],
&
c_dfDIJoystick2
.
rgodf
[
i
+
12
],
df
->
dwObjSize
);
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
i
)
|
DIDFT_PSHBUTTON
;
}
newDevice
->
base
.
data_format
.
wine_df
=
df
;
/* create default properties */
newDevice
->
props
=
HeapAlloc
(
GetProcessHeap
(),
0
,
c_dfDIJoystick2
.
dwNumObjs
*
sizeof
(
ObjProps
));
if
(
newDevice
->
props
==
0
)
...
...
@@ -477,13 +504,6 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice
->
props
[
i
].
lSaturation
=
0
;
}
/* wine uses DIJOYSTATE2 as it's internal format */
newDevice
->
base
.
data_format
.
wine_df
=
&
c_dfDIJoystick2
;
/* create the default transform filter */
hr
=
create_DataFormat
(
&
c_dfDIJoystick2
,
&
newDevice
->
base
.
data_format
);
if
(
hr
!=
DI_OK
)
goto
FAILED
;
IDirectInput_AddRef
((
LPDIRECTINPUTDEVICE8A
)
newDevice
->
dinput
);
newDevice
->
devcaps
.
dwSize
=
sizeof
(
newDevice
->
devcaps
);
...
...
@@ -499,7 +519,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice
->
devcaps
.
dwFFDriverVersion
=
0
;
if
(
TRACE_ON
(
dinput
))
{
_dump_DIDATAFORMAT
(
newDevice
->
base
.
data_format
.
user
_df
);
_dump_DIDATAFORMAT
(
newDevice
->
base
.
data_format
.
wine
_df
);
for
(
i
=
0
;
i
<
(
newDevice
->
axes
);
i
++
)
TRACE
(
"axis_map[%d] = %d
\n
"
,
i
,
newDevice
->
axis_map
[
i
]);
_dump_DIDEVCAPS
(
&
newDevice
->
devcaps
);
...
...
@@ -512,6 +532,8 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
FAILED:
hr
=
DIERR_OUTOFMEMORY
;
FAILED1:
if
(
df
)
HeapFree
(
GetProcessHeap
(),
0
,
df
->
rgodf
);
HeapFree
(
GetProcessHeap
(),
0
,
df
);
release_DataFormat
(
&
newDevice
->
base
.
data_format
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
->
axis_map
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
->
name
);
...
...
@@ -610,6 +632,8 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
HeapFree
(
GetProcessHeap
(),
0
,
This
->
props
);
/* release the data transform filter */
HeapFree
(
GetProcessHeap
(),
0
,
(
LPVOID
)
This
->
base
.
data_format
.
wine_df
->
rgodf
);
HeapFree
(
GetProcessHeap
(),
0
,
(
LPVOID
)
This
->
base
.
data_format
.
wine_df
);
release_DataFormat
(
&
This
->
base
.
data_format
);
This
->
base
.
crit
.
DebugInfo
->
Spare
[
0
]
=
0
;
...
...
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