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
a0682176
Commit
a0682176
authored
Feb 06, 2007
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Feb 06, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Don't reset dead zone and saturation when setting data format.
Additional tests indicate that native doesn't touch previously set properties.
parent
aa4f89c8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
31 deletions
+37
-31
joystick_linux.c
dlls/dinput/joystick_linux.c
+3
-29
joystick_linuxinput.c
dlls/dinput/joystick_linuxinput.c
+12
-1
joystick.c
dlls/dinput/tests/joystick.c
+22
-1
No files found.
dlls/dinput/joystick_linux.c
View file @
a0682176
...
...
@@ -474,7 +474,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice
->
base
.
crit
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)
"DINPUT_joystick"
;
/* setup_dinput_options may change these */
newDevice
->
deadzone
=
500
0
;
newDevice
->
deadzone
=
0
;
newDevice
->
devcaps
.
dwButtons
=
newDevice
->
buttons
;
newDevice
->
devcaps
.
dwAxes
=
newDevice
->
axes
;
newDevice
->
devcaps
.
dwPOVs
=
0
;
...
...
@@ -672,32 +672,6 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
}
/******************************************************************************
* SetDataFormat : the application can choose the format of the data
* the device driver sends back with GetDeviceState.
*/
static
HRESULT
WINAPI
JoystickAImpl_SetDataFormat
(
LPDIRECTINPUTDEVICE8A
iface
,
LPCDIDATAFORMAT
df
)
{
JoystickImpl
*
This
=
(
JoystickImpl
*
)
iface
;
unsigned
int
i
;
HRESULT
hr
;
TRACE
(
"(%p,%p)
\n
"
,
This
,
df
);
hr
=
IDirectInputDevice2AImpl_SetDataFormat
(
iface
,
df
);
if
(
FAILED
(
hr
))
return
hr
;
for
(
i
=
0
;
i
<
This
->
base
.
data_format
.
wine_df
->
dwNumObjs
;
i
++
)
{
This
->
props
[
i
].
lDeadZone
=
1000
;
This
->
props
[
i
].
lSaturation
=
0
;
}
return
DI_OK
;
}
/******************************************************************************
* Acquire : gets exclusive control of the joystick
*/
static
HRESULT
WINAPI
JoystickAImpl_Acquire
(
LPDIRECTINPUTDEVICE8A
iface
)
...
...
@@ -1250,7 +1224,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
JoystickAImpl_Unacquire
,
JoystickAImpl_GetDeviceState
,
IDirectInputDevice2AImpl_GetDeviceData
,
Joystick
AImpl_SetDataFormat
,
IDirectInputDevice2
AImpl_SetDataFormat
,
IDirectInputDevice2AImpl_SetEventNotification
,
IDirectInputDevice2AImpl_SetCooperativeLevel
,
JoystickAImpl_GetObjectInfo
,
...
...
@@ -1292,7 +1266,7 @@ static const IDirectInputDevice8WVtbl SysJoystickWvt =
XCAST
(
Unacquire
)
JoystickAImpl_Unacquire
,
XCAST
(
GetDeviceState
)
JoystickAImpl_GetDeviceState
,
XCAST
(
GetDeviceData
)
IDirectInputDevice2AImpl_GetDeviceData
,
XCAST
(
SetDataFormat
)
Joystick
AImpl_SetDataFormat
,
XCAST
(
SetDataFormat
)
IDirectInputDevice2
AImpl_SetDataFormat
,
XCAST
(
SetEventNotification
)
IDirectInputDevice2AImpl_SetEventNotification
,
XCAST
(
SetCooperativeLevel
)
IDirectInputDevice2AImpl_SetCooperativeLevel
,
IDirectInputDevice2WImpl_GetObjectInfo
,
...
...
dlls/dinput/joystick_linuxinput.c
View file @
a0682176
...
...
@@ -923,9 +923,20 @@ static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
TRACE
(
"range(%d, %d) obj=%d
\n
"
,
pr
->
lMin
,
pr
->
lMax
,
obj
);
break
;
}
case
(
DWORD
)
DIPROP_DEADZONE
:
{
LPDIPROPDWORD
pd
=
(
LPDIPROPDWORD
)
pdiph
;
int
obj
=
find_property
(
&
This
->
base
.
data_format
,
pdiph
);
if
(
obj
<
0
)
return
DIERR_OBJECTNOTFOUND
;
pd
->
dwData
=
This
->
props
[
obj
].
deadzone
;
TRACE
(
"deadzone(%d) obj=%d
\n
"
,
pd
->
dwData
,
obj
);
break
;
}
default:
return
IDirectInputDevice2AImpl_GetProperty
(
iface
,
rguid
,
pdiph
);
return
IDirectInputDevice2AImpl_GetProperty
(
iface
,
rguid
,
pdiph
);
}
return
DI_OK
;
...
...
dlls/dinput/tests/joystick.c
View file @
a0682176
...
...
@@ -82,6 +82,7 @@ typedef struct tagJoystickInfo
DWORD
pov
;
DWORD
button
;
LONG
lMin
,
lMax
;
DWORD
dZone
;
}
JoystickInfo
;
static
BOOL
CALLBACK
EnumAxes
(
...
...
@@ -97,13 +98,21 @@ static BOOL CALLBACK EnumAxes(
IsEqualIID
(
&
pdidoi
->
guidType
,
&
GUID_RxAxis
)
||
IsEqualIID
(
&
pdidoi
->
guidType
,
&
GUID_RyAxis
)
||
IsEqualIID
(
&
pdidoi
->
guidType
,
&
GUID_RzAxis
)
||
IsEqualIID
(
&
pdidoi
->
guidType
,
&
GUID_Slider
))
{
IsEqualIID
(
&
pdidoi
->
guidType
,
&
GUID_Slider
))
{
DIPROPRANGE
diprg
;
DIPROPDWORD
dipdw
;
diprg
.
diph
.
dwSize
=
sizeof
(
DIPROPRANGE
);
diprg
.
diph
.
dwHeaderSize
=
sizeof
(
DIPROPHEADER
);
diprg
.
diph
.
dwHow
=
DIPH_BYID
;
diprg
.
diph
.
dwObj
=
pdidoi
->
dwType
;
dipdw
.
diph
.
dwSize
=
sizeof
(
dipdw
);
dipdw
.
diph
.
dwHeaderSize
=
sizeof
(
DIPROPHEADER
);
dipdw
.
diph
.
dwHow
=
DIPH_BYID
;
dipdw
.
diph
.
dwObj
=
pdidoi
->
dwType
;
hr
=
IDirectInputDevice_GetProperty
(
info
->
pJoystick
,
DIPROP_RANGE
,
&
diprg
.
diph
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetProperty() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
ok
(
info
->
lMin
==
diprg
.
lMin
&&
info
->
lMax
==
diprg
.
lMax
,
"Min/Max range invalid: "
...
...
@@ -119,6 +128,17 @@ static BOOL CALLBACK EnumAxes(
hr
=
IDirectInputDevice_SetProperty
(
info
->
pJoystick
,
DIPROP_RANGE
,
&
diprg
.
diph
);
ok
(
hr
==
DI_OK
,
"IDirectInputDevice_SetProperty() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
/* dead zone */
hr
=
IDirectInputDevice_GetProperty
(
info
->
pJoystick
,
DIPROP_DEADZONE
,
&
dipdw
.
diph
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetProperty() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
ok
(
info
->
dZone
==
dipdw
.
dwData
,
"deadzone invalid: expected %d got %d
\n
"
,
info
->
dZone
,
dipdw
.
dwData
);
dipdw
.
dwData
=
123
;
hr
=
IDirectInputDevice_SetProperty
(
info
->
pJoystick
,
DIPROP_DEADZONE
,
&
dipdw
.
diph
);
ok
(
hr
==
DI_OK
,
"IDirectInputDevice_SetProperty() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
info
->
axis
++
;
}
else
if
(
IsEqualIID
(
&
pdidoi
->
guidType
,
&
GUID_POV
))
info
->
pov
++
;
...
...
@@ -263,6 +283,7 @@ static BOOL CALLBACK EnumJoysticks(
ok
(
hr
==
DI_OK
,
"IDirectInputDevice_SetDataFormat() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
info
.
lMin
=
-
2000
;
info
.
lMax
=
+
2000
;
info
.
dZone
=
123
;
hr
=
IDirectInputDevice_EnumObjects
(
pJoystick
,
EnumAxes
,
(
VOID
*
)
&
info
,
DIDFT_ALL
);
ok
(
hr
==
DI_OK
,
"IDirectInputDevice_EnumObjects() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
...
...
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