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
0f60464b
Commit
0f60464b
authored
May 13, 2005
by
Robert Reif
Committed by
Alexandre Julliard
May 13, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SetProperty error returned.
Add EnumDevice joystick version check. Test multiple versions.
parent
50372025
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
18 deletions
+53
-18
dinput_main.c
dlls/dinput/dinput_main.c
+14
-0
dinput_private.h
dlls/dinput/dinput_private.h
+1
-0
joystick_linux.c
dlls/dinput/joystick_linux.c
+1
-1
joystick.c
dlls/dinput/tests/joystick.c
+37
-17
No files found.
dlls/dinput/dinput_main.c
View file @
0f60464b
...
...
@@ -95,6 +95,7 @@ HRESULT WINAPI DirectInputCreateEx(
This
->
lpVtbl
=
&
ddi7avt
;
This
->
ref
=
1
;
This
->
version
=
1
;
This
->
dwVersion
=
dwVersion
;
*
ppDI
=
This
;
return
DI_OK
;
...
...
@@ -107,6 +108,7 @@ HRESULT WINAPI DirectInputCreateEx(
This
->
lpVtbl
=
&
ddi7wvt
;
This
->
ref
=
1
;
This
->
version
=
1
;
This
->
dwVersion
=
dwVersion
;
*
ppDI
=
This
;
return
DI_OK
;
...
...
@@ -117,6 +119,7 @@ HRESULT WINAPI DirectInputCreateEx(
This
->
lpVtbl
=
&
ddi8avt
;
This
->
ref
=
1
;
This
->
version
=
8
;
This
->
dwVersion
=
dwVersion
;
*
ppDI
=
This
;
return
DI_OK
;
...
...
@@ -127,6 +130,7 @@ HRESULT WINAPI DirectInputCreateEx(
This
->
lpVtbl
=
&
ddi8wvt
;
This
->
ref
=
1
;
This
->
version
=
8
;
This
->
dwVersion
=
dwVersion
;
*
ppDI
=
This
;
return
DI_OK
;
...
...
@@ -145,6 +149,7 @@ HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPU
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IDirectInputImpl
));
This
->
lpVtbl
=
&
ddi7avt
;
This
->
ref
=
1
;
This
->
dwVersion
=
dwVersion
;
if
(
dwVersion
>=
0x0800
)
{
This
->
version
=
8
;
}
else
{
...
...
@@ -166,6 +171,7 @@ HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPU
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IDirectInputImpl
));
This
->
lpVtbl
=
&
ddi7wvt
;
This
->
ref
=
1
;
This
->
dwVersion
=
dwVersion
;
if
(
dwVersion
>=
0x0800
)
{
This
->
version
=
8
;
}
else
{
...
...
@@ -228,6 +234,10 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices(
lpCallback
,
pvRef
,
dwFlags
);
TRACE
(
" flags: "
);
_dump_EnumDevices_dwFlags
(
dwFlags
);
TRACE
(
"
\n
"
);
/* joysticks are not supported in version 0x0300 */
if
((
dwDevType
==
DIDEVTYPE_JOYSTICK
)
&&
(
This
->
dwVersion
<=
0x0300
))
return
E_INVALIDARG
;
for
(
i
=
0
;
i
<
NB_DINPUT_DEVICES
;
i
++
)
{
if
(
!
dinput_devices
[
i
]
->
enum_deviceA
)
continue
;
for
(
j
=
0
,
r
=
-
1
;
r
!=
0
;
j
++
)
{
...
...
@@ -258,6 +268,10 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
lpCallback
,
pvRef
,
dwFlags
);
TRACE
(
" flags: "
);
_dump_EnumDevices_dwFlags
(
dwFlags
);
TRACE
(
"
\n
"
);
/* joysticks are not supported in version 0x0300 */
if
((
dwDevType
==
DIDEVTYPE_JOYSTICK
)
&&
(
This
->
dwVersion
<=
0x0300
))
return
E_INVALIDARG
;
for
(
i
=
0
;
i
<
NB_DINPUT_DEVICES
;
i
++
)
{
if
(
!
dinput_devices
[
i
]
->
enum_deviceW
)
continue
;
for
(
j
=
0
,
r
=
-
1
;
r
!=
0
;
j
++
)
{
...
...
dlls/dinput/dinput_private.h
View file @
0f60464b
...
...
@@ -36,6 +36,7 @@ struct IDirectInputImpl
DWORD
evsequence
;
int
version
;
DWORD
dwVersion
;
};
/* Function called by all devices that Wine supports */
...
...
dlls/dinput/joystick_linux.c
View file @
0f60464b
...
...
@@ -1125,7 +1125,7 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(
if
(
ph
==
NULL
)
{
WARN
(
"invalid pointer
\n
"
);
return
E_
POINTER
;
return
E_
INVALIDARG
;
}
if
(
TRACE_ON
(
dinput
))
...
...
dlls/dinput/tests/joystick.c
View file @
0f60464b
...
...
@@ -35,6 +35,11 @@
#define numObjects(x) (sizeof(x) / sizeof(x[0]))
typedef
struct
tagUserData
{
LPDIRECTINPUT
pDI
;
DWORD
version
;
}
UserData
;
static
const
DIOBJECTDATAFORMAT
dfDIJoystickTest
[]
=
{
{
&
GUID_XAxis
,
DIJOFS_X
,
DIDFT_OPTIONAL
|
DIDFT_AXIS
|
DIDFT_ANYINSTANCE
,
0
},
{
&
GUID_YAxis
,
DIJOFS_Y
,
DIDFT_OPTIONAL
|
DIDFT_AXIS
|
DIDFT_ANYINSTANCE
,
0
},
...
...
@@ -103,8 +108,8 @@ static BOOL CALLBACK EnumAxes(
diprg
.
lMax
=
+
1000
;
hr
=
IDirectInputDevice_SetProperty
(
info
->
pJoystick
,
DIPROP_RANGE
,
NULL
);
ok
(
hr
==
E_
POINTER
,
"IDirectInputDevice_SetProperty() should have returned "
"E_
POINTER
, returned: %s
\n
"
,
DXGetErrorString8
(
hr
));
ok
(
hr
==
E_
INVALIDARG
,
"IDirectInputDevice_SetProperty() should have returned "
"E_
INVALIDARG
, returned: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInputDevice_SetProperty
(
info
->
pJoystick
,
DIPROP_RANGE
,
&
diprg
.
diph
);
ok
(
hr
==
DI_OK
,
"IDirectInputDevice_SetProperty() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
...
...
@@ -123,7 +128,7 @@ static BOOL CALLBACK EnumJoysticks(
LPVOID
pvRef
)
{
HRESULT
hr
;
LPDIRECTINPUT
pDI
=
(
LPDIRECTINPUT
)
pvRef
;
UserData
*
data
=
(
UserData
*
)
pvRef
;
LPDIRECTINPUTDEVICE
pJoystick
;
DIDATAFORMAT
format
;
DIDEVCAPS
caps
;
...
...
@@ -132,19 +137,20 @@ static BOOL CALLBACK EnumJoysticks(
int
i
,
count
;
ULONG
ref
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
lpddi
->
guidInstance
,
NULL
,
NULL
);
hr
=
IDirectInput_CreateDevice
(
data
->
pDI
,
&
lpddi
->
guidInstance
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"IDirectInput_CreateDevice() should have returned "
"E_POINTER, returned: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInput_CreateDevice
(
pDI
,
NULL
,
&
pJoystick
,
NULL
);
hr
=
IDirectInput_CreateDevice
(
data
->
pDI
,
NULL
,
&
pJoystick
,
NULL
);
ok
(
hr
==
E_POINTER
,
"IDirectInput_CreateDevice() should have returned "
"E_POINTER, returned: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInput_CreateDevice
(
pDI
,
NULL
,
NULL
,
NULL
);
hr
=
IDirectInput_CreateDevice
(
data
->
pDI
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"IDirectInput_CreateDevice() should have returned "
"E_POINTER, returned: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
lpddi
->
guidInstance
,
&
pJoystick
,
NULL
);
hr
=
IDirectInput_CreateDevice
(
data
->
pDI
,
&
lpddi
->
guidInstance
,
&
pJoystick
,
NULL
);
ok
(
hr
==
DI_OK
,
"IDirectInput_CreateDevice() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
hr
!=
DI_OK
)
...
...
@@ -260,22 +266,34 @@ DONE:
return
DIENUM_CONTINUE
;
}
static
void
joystick_tests
()
static
void
joystick_tests
(
DWORD
version
)
{
HRESULT
hr
;
LPDIRECTINPUT
pDI
;
ULONG
ref
;
hr
=
DirectInputCreate
(
GetModuleHandle
(
NULL
),
DIRECTINPUT_VERSION
,
&
pDI
,
NULL
);
ok
(
hr
==
DI_OK
,
"DirectInputCreate() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
hr
!=
DI_OK
)
return
;
hr
=
IDirectInput_EnumDevices
(
pDI
,
DIDEVTYPE_JOYSTICK
,
EnumJoysticks
,
pDI
,
DIEDFL_ALLDEVICES
);
ok
(
hr
==
DI_OK
,
"IDirectInput_EnumDevices() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
trace
(
"-- Testing Direct Input Version 0x%04lx --
\n
"
,
version
);
hr
=
DirectInputCreate
(
GetModuleHandle
(
NULL
),
version
,
&
pDI
,
NULL
);
ok
(
hr
==
DI_OK
||
hr
==
DIERR_OLDDIRECTINPUTVERSION
,
"DirectInputCreate() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
hr
==
DI_OK
&&
pDI
!=
0
)
{
UserData
data
;
data
.
pDI
=
pDI
;
data
.
version
=
version
;
hr
=
IDirectInput_EnumDevices
(
pDI
,
DIDEVTYPE_JOYSTICK
,
EnumJoysticks
,
&
data
,
DIEDFL_ALLDEVICES
);
if
(
version
==
0x0300
)
{
trace
(
" Joysticks Not Supported
\n
"
);
ok
(
hr
==
E_INVALIDARG
,
"IDirectInput_EnumDevices() should have "
"returned E_INVALIDARG, returned: %s
\n
"
,
DXGetErrorString8
(
hr
));
}
else
{
ok
(
hr
==
DI_OK
,
"IDirectInput_EnumDevices() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
}
ref
=
IDirectInput_Release
(
pDI
);
ok
(
ref
==
0
,
"IDirectInput_Release() reference count = %ld
\n
"
,
ref
);
}
else
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
)
trace
(
" Version Not Supported
\n
"
);
}
START_TEST
(
joystick
)
...
...
@@ -284,7 +302,9 @@ START_TEST(joystick)
trace
(
"DLL Version: %s
\n
"
,
get_file_version
(
"dinput.dll"
));
joystick_tests
();
joystick_tests
(
0x0700
);
joystick_tests
(
0x0500
);
joystick_tests
(
0x0300
);
CoUninitialize
();
}
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