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
a6947bde
Commit
a6947bde
authored
Jan 17, 2007
by
Christoph Frick
Committed by
Alexandre Julliard
Jan 18, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Calc more caps infos ahead and store it in JoystickImpl.
parent
955fb95e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
34 deletions
+13
-34
joystick_linuxinput.c
dlls/dinput/joystick_linuxinput.c
+13
-34
No files found.
dlls/dinput/joystick_linuxinput.c
View file @
a6947bde
...
@@ -145,6 +145,10 @@ struct JoystickImpl
...
@@ -145,6 +145,10 @@ struct JoystickImpl
/* LUT for KEY_ to offset in rgbButtons */
/* LUT for KEY_ to offset in rgbButtons */
BYTE
buttons
[
KEY_MAX
];
BYTE
buttons
[
KEY_MAX
];
DWORD
numAxes
;
DWORD
numPOVs
;
DWORD
numButtons
;
/* Force feedback variables */
/* Force feedback variables */
EffectListItem
*
top_effect
;
EffectListItem
*
top_effect
;
int
ff_state
;
int
ff_state
;
...
@@ -354,7 +358,6 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
...
@@ -354,7 +358,6 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
JoystickImpl
*
newDevice
;
JoystickImpl
*
newDevice
;
LPDIDATAFORMAT
df
=
NULL
;
LPDIDATAFORMAT
df
=
NULL
;
int
i
,
idx
=
0
;
int
i
,
idx
=
0
;
int
axis
=
0
,
btn
=
0
;
newDevice
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
JoystickImpl
));
newDevice
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
JoystickImpl
));
if
(
!
newDevice
)
return
NULL
;
if
(
!
newDevice
)
return
NULL
;
...
@@ -388,7 +391,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
...
@@ -388,7 +391,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
newDevice
->
props
[
idx
].
wantmin
=
newDevice
->
props
[
idx
].
havemin
=
newDevice
->
joydev
->
axes
[
i
][
AXIS_ABSMIN
];
newDevice
->
props
[
idx
].
wantmin
=
newDevice
->
props
[
idx
].
havemin
=
newDevice
->
joydev
->
axes
[
i
][
AXIS_ABSMIN
];
newDevice
->
props
[
idx
].
wantmax
=
newDevice
->
props
[
idx
].
havemax
=
newDevice
->
joydev
->
axes
[
i
][
AXIS_ABSMAX
];
newDevice
->
props
[
idx
].
wantmax
=
newDevice
->
props
[
idx
].
havemax
=
newDevice
->
joydev
->
axes
[
i
][
AXIS_ABSMAX
];
newDevice
->
props
[
idx
].
deadzone
=
0
;
newDevice
->
props
[
idx
].
deadzone
=
0
;
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
axi
s
++
)
|
DIDFT_ABSAXIS
;
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
newDevice
->
numAxe
s
++
)
|
DIDFT_ABSAXIS
;
}
}
for
(
i
=
0
;
i
<
WINE_JOYSTICK_MAX_POVS
;
i
++
)
for
(
i
=
0
;
i
<
WINE_JOYSTICK_MAX_POVS
;
i
++
)
...
@@ -401,17 +404,17 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
...
@@ -401,17 +404,17 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
memcpy
(
&
df
->
rgodf
[
idx
],
&
c_dfDIJoystick2
.
rgodf
[
i
+
WINE_JOYSTICK_MAX_AXES
],
df
->
dwObjSize
);
memcpy
(
&
df
->
rgodf
[
idx
],
&
c_dfDIJoystick2
.
rgodf
[
i
+
WINE_JOYSTICK_MAX_AXES
],
df
->
dwObjSize
);
newDevice
->
axes
[
ABS_HAT0X
+
i
*
2
]
=
newDevice
->
axes
[
ABS_HAT0Y
+
i
*
2
]
=
i
;
newDevice
->
axes
[
ABS_HAT0X
+
i
*
2
]
=
newDevice
->
axes
[
ABS_HAT0Y
+
i
*
2
]
=
i
;
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
i
)
|
DIDFT_POV
;
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
newDevice
->
numPOVs
++
)
|
DIDFT_POV
;
}
}
/* Buttons can be anywhere, so check all */
/* Buttons can be anywhere, so check all */
for
(
i
=
0
;
i
<
KEY_MAX
&&
btn
<
WINE_JOYSTICK_MAX_BUTTONS
;
i
++
)
for
(
i
=
0
;
i
<
KEY_MAX
&&
newDevice
->
numButtons
<
WINE_JOYSTICK_MAX_BUTTONS
;
i
++
)
{
{
if
(
!
test_bit
(
newDevice
->
joydev
->
keybits
,
i
))
continue
;
if
(
!
test_bit
(
newDevice
->
joydev
->
keybits
,
i
))
continue
;
memcpy
(
&
df
->
rgodf
[
idx
],
&
c_dfDIJoystick2
.
rgodf
[
btn
+
WINE_JOYSTICK_MAX_AXES
+
WINE_JOYSTICK_MAX_POVS
],
df
->
dwObjSize
);
memcpy
(
&
df
->
rgodf
[
idx
],
&
c_dfDIJoystick2
.
rgodf
[
newDevice
->
numButtons
+
WINE_JOYSTICK_MAX_AXES
+
WINE_JOYSTICK_MAX_POVS
],
df
->
dwObjSize
);
newDevice
->
buttons
[
i
]
=
0x80
|
btn
;
newDevice
->
buttons
[
i
]
=
0x80
|
newDevice
->
numButtons
;
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
btn
++
)
|
DIDFT_PSHBUTTON
;
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
newDevice
->
numButtons
++
)
|
DIDFT_PSHBUTTON
;
}
}
df
->
dwNumObjs
=
idx
;
df
->
dwNumObjs
=
idx
;
...
@@ -851,7 +854,6 @@ static HRESULT WINAPI JoystickAImpl_GetCapabilities(
...
@@ -851,7 +854,6 @@ static HRESULT WINAPI JoystickAImpl_GetCapabilities(
LPDIDEVCAPS
lpDIDevCaps
)
LPDIDEVCAPS
lpDIDevCaps
)
{
{
JoystickImpl
*
This
=
(
JoystickImpl
*
)
iface
;
JoystickImpl
*
This
=
(
JoystickImpl
*
)
iface
;
int
i
,
axes
,
buttons
,
povs
;
TRACE
(
"%p->(%p)
\n
"
,
iface
,
lpDIDevCaps
);
TRACE
(
"%p->(%p)
\n
"
,
iface
,
lpDIDevCaps
);
...
@@ -871,35 +873,12 @@ static HRESULT WINAPI JoystickAImpl_GetCapabilities(
...
@@ -871,35 +873,12 @@ static HRESULT WINAPI JoystickAImpl_GetCapabilities(
else
else
lpDIDevCaps
->
dwDevType
=
DIDEVTYPE_JOYSTICK
|
(
DIDEVTYPEJOYSTICK_TRADITIONAL
<<
8
);
lpDIDevCaps
->
dwDevType
=
DIDEVTYPE_JOYSTICK
|
(
DIDEVTYPEJOYSTICK_TRADITIONAL
<<
8
);
axes
=
0
;
for
(
i
=
0
;
i
<
ABS_MAX
;
i
++
)
{
if
(
!
test_bit
(
This
->
joydev
->
absbits
,
i
))
continue
;
switch
(
i
)
{
case
ABS_HAT0X
:
case
ABS_HAT0Y
:
case
ABS_HAT1X
:
case
ABS_HAT1Y
:
case
ABS_HAT2X
:
case
ABS_HAT2Y
:
case
ABS_HAT3X
:
case
ABS_HAT3Y
:
/* will be handled as POV - see below */
break
;
default:
axes
++
;
}
}
buttons
=
0
;
for
(
i
=
0
;
i
<
KEY_MAX
;
i
++
)
if
(
test_bit
(
This
->
joydev
->
keybits
,
i
))
buttons
++
;
povs
=
0
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
if
(
test_bit
(
This
->
joydev
->
absbits
,
ABS_HAT0X
+
(
i
<<
1
))
&&
test_bit
(
This
->
joydev
->
absbits
,
ABS_HAT0Y
+
(
i
<<
1
)))
{
povs
++
;
}
}
if
(
This
->
joydev
->
has_ff
)
if
(
This
->
joydev
->
has_ff
)
lpDIDevCaps
->
dwFlags
|=
DIDC_FORCEFEEDBACK
;
lpDIDevCaps
->
dwFlags
|=
DIDC_FORCEFEEDBACK
;
lpDIDevCaps
->
dwAxes
=
a
xes
;
lpDIDevCaps
->
dwAxes
=
This
->
numA
xes
;
lpDIDevCaps
->
dwButtons
=
b
uttons
;
lpDIDevCaps
->
dwButtons
=
This
->
numB
uttons
;
lpDIDevCaps
->
dwPOVs
=
pov
s
;
lpDIDevCaps
->
dwPOVs
=
This
->
numPOV
s
;
return
DI_OK
;
return
DI_OK
;
}
}
...
...
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