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
a478c4fe
Commit
a478c4fe
authored
Jul 05, 2008
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Jul 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Freed effect should remove itself from the parent's list of effects. Add tests.
parent
aa3694d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
7 deletions
+56
-7
effect_linuxinput.c
dlls/dinput/effect_linuxinput.c
+8
-5
joystick_linuxinput.c
dlls/dinput/joystick_linuxinput.c
+2
-2
joystick.c
dlls/dinput/tests/joystick.c
+46
-0
No files found.
dlls/dinput/effect_linuxinput.c
View file @
a478c4fe
...
@@ -53,11 +53,9 @@ struct LinuxInputEffectImpl
...
@@ -53,11 +53,9 @@ struct LinuxInputEffectImpl
LONG
ref
;
LONG
ref
;
GUID
guid
;
GUID
guid
;
/* Effect data */
struct
ff_effect
effect
;
/* Effect data */
struct
ff_effect
effect
;
int
*
fd
;
/* Parent device */
struct
list
*
entry
;
/* Entry into the parent's list of effects */
/* Parent device */
int
*
fd
;
};
};
...
@@ -766,6 +764,8 @@ static ULONG WINAPI LinuxInputEffectImpl_Release(LPDIRECTINPUTEFFECT iface)
...
@@ -766,6 +764,8 @@ static ULONG WINAPI LinuxInputEffectImpl_Release(LPDIRECTINPUTEFFECT iface)
{
{
LinuxInputEffectImpl_Stop
(
iface
);
LinuxInputEffectImpl_Stop
(
iface
);
LinuxInputEffectImpl_Unload
(
iface
);
LinuxInputEffectImpl_Unload
(
iface
);
list_remove
(
This
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
LIST_ENTRY
(
This
->
entry
,
effect_list_item
,
entry
));
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
}
return
ref
;
return
ref
;
...
@@ -778,6 +778,7 @@ static ULONG WINAPI LinuxInputEffectImpl_Release(LPDIRECTINPUTEFFECT iface)
...
@@ -778,6 +778,7 @@ static ULONG WINAPI LinuxInputEffectImpl_Release(LPDIRECTINPUTEFFECT iface)
HRESULT
linuxinput_create_effect
(
HRESULT
linuxinput_create_effect
(
int
*
fd
,
int
*
fd
,
REFGUID
rguid
,
REFGUID
rguid
,
struct
list
*
parent_list_entry
,
LPDIRECTINPUTEFFECT
*
peff
)
LPDIRECTINPUTEFFECT
*
peff
)
{
{
LinuxInputEffectImpl
*
newEffect
=
HeapAlloc
(
GetProcessHeap
(),
LinuxInputEffectImpl
*
newEffect
=
HeapAlloc
(
GetProcessHeap
(),
...
@@ -835,6 +836,8 @@ HRESULT linuxinput_create_effect(
...
@@ -835,6 +836,8 @@ HRESULT linuxinput_create_effect(
/* mark as non-uploaded */
/* mark as non-uploaded */
newEffect
->
effect
.
id
=
-
1
;
newEffect
->
effect
.
id
=
-
1
;
newEffect
->
entry
=
parent_list_entry
;
*
peff
=
(
LPDIRECTINPUTEFFECT
)
newEffect
;
*
peff
=
(
LPDIRECTINPUTEFFECT
)
newEffect
;
TRACE
(
"Creating linux input system effect (%p) with guid %s
\n
"
,
TRACE
(
"Creating linux input system effect (%p) with guid %s
\n
"
,
...
...
dlls/dinput/joystick_linuxinput.c
View file @
a478c4fe
...
@@ -141,7 +141,7 @@ struct wine_input_absinfo {
...
@@ -141,7 +141,7 @@ struct wine_input_absinfo {
};
};
/* implemented in effect_linuxinput.c */
/* implemented in effect_linuxinput.c */
HRESULT
linuxinput_create_effect
(
int
*
fd
,
REFGUID
rguid
,
LPDIRECTINPUTEFFECT
*
peff
);
HRESULT
linuxinput_create_effect
(
int
*
fd
,
REFGUID
rguid
,
struct
list
*
parent_list_entry
,
LPDIRECTINPUTEFFECT
*
peff
);
HRESULT
linuxinput_get_info_A
(
int
fd
,
REFGUID
rguid
,
LPDIEFFECTINFOA
info
);
HRESULT
linuxinput_get_info_A
(
int
fd
,
REFGUID
rguid
,
LPDIEFFECTINFOA
info
);
HRESULT
linuxinput_get_info_W
(
int
fd
,
REFGUID
rguid
,
LPDIEFFECTINFOW
info
);
HRESULT
linuxinput_get_info_W
(
int
fd
,
REFGUID
rguid
,
LPDIEFFECTINFOW
info
);
...
@@ -1053,7 +1053,7 @@ static HRESULT WINAPI JoystickAImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface,
...
@@ -1053,7 +1053,7 @@ static HRESULT WINAPI JoystickAImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface,
if
(
!
(
new_effect
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
new_effect
))))
if
(
!
(
new_effect
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
new_effect
))))
return
DIERR_OUTOFMEMORY
;
return
DIERR_OUTOFMEMORY
;
retval
=
linuxinput_create_effect
(
&
This
->
joyfd
,
rguid
,
&
new_effect
->
ref
);
retval
=
linuxinput_create_effect
(
&
This
->
joyfd
,
rguid
,
&
new_effect
->
entry
,
&
new_effect
->
ref
);
if
(
retval
!=
DI_OK
)
if
(
retval
!=
DI_OK
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
new_effect
);
HeapFree
(
GetProcessHeap
(),
0
,
new_effect
);
...
...
dlls/dinput/tests/joystick.c
View file @
a478c4fe
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#define DIRECTINPUT_VERSION 0x0700
#define DIRECTINPUT_VERSION 0x0700
#define COBJMACROS
#include <windows.h>
#include <windows.h>
#include <math.h>
#include <math.h>
...
@@ -85,6 +86,12 @@ typedef struct tagJoystickInfo
...
@@ -85,6 +86,12 @@ typedef struct tagJoystickInfo
DWORD
dZone
;
DWORD
dZone
;
}
JoystickInfo
;
}
JoystickInfo
;
static
int
get_refcount
(
IUnknown
*
object
)
{
IUnknown_AddRef
(
object
);
return
IUnknown_Release
(
object
);
}
static
BOOL
CALLBACK
EnumAxes
(
static
BOOL
CALLBACK
EnumAxes
(
const
DIDEVICEOBJECTINSTANCE
*
pdidoi
,
const
DIDEVICEOBJECTINSTANCE
*
pdidoi
,
VOID
*
pContext
)
VOID
*
pContext
)
...
@@ -331,6 +338,45 @@ static BOOL CALLBACK EnumJoysticks(
...
@@ -331,6 +338,45 @@ static BOOL CALLBACK EnumJoysticks(
ok
(
js
.
rgdwPOV
[
3
]
==
-
1
,
"Default for unassigned POV should be -1 not: %d
\n
"
,
js
.
rgdwPOV
[
3
]);
ok
(
js
.
rgdwPOV
[
3
]
==
-
1
,
"Default for unassigned POV should be -1 not: %d
\n
"
,
js
.
rgdwPOV
[
3
]);
}
}
if
(
caps
.
dwFlags
&
DIDC_FORCEFEEDBACK
)
{
DWORD
axes
[
2
]
=
{
DIJOFS_X
,
DIJOFS_Y
};
LONG
direction
[
2
]
=
{
0
,
0
};
DICONSTANTFORCE
force
=
{
0
};
DIEFFECT
eff
;
LPDIRECTINPUTEFFECT
effect
=
NULL
;
LONG
cnt1
,
cnt2
;
trace
(
"Testing force-feedback
\n
"
);
memset
(
&
eff
,
0
,
sizeof
(
eff
));
eff
.
dwSize
=
sizeof
(
eff
);
eff
.
dwFlags
=
DIEFF_CARTESIAN
|
DIEFF_OBJECTOFFSETS
;
eff
.
dwDuration
=
INFINITE
;
eff
.
dwGain
=
DI_FFNOMINALMAX
;
eff
.
dwTriggerButton
=
DIEB_NOTRIGGER
;
eff
.
cAxes
=
sizeof
(
axes
)
/
sizeof
(
axes
[
0
]);
eff
.
rgdwAxes
=
axes
;
eff
.
rglDirection
=
direction
;
eff
.
cbTypeSpecificParams
=
sizeof
(
force
);
eff
.
lpvTypeSpecificParams
=
&
force
;
cnt1
=
get_refcount
((
IUnknown
*
)
pJoystick
);
hr
=
IDirectInputDevice2_CreateEffect
((
LPDIRECTINPUTDEVICE2
)
pJoystick
,
&
GUID_ConstantForce
,
&
eff
,
&
effect
,
NULL
);
ok
(
hr
==
DI_OK
,
"IDirectInputDevice_CreateEffect() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
cnt2
=
get_refcount
((
IUnknown
*
)
pJoystick
);
ok
(
cnt1
==
cnt2
,
"Ref count is wrong %d != %d
\n
"
,
cnt1
,
cnt2
);
if
(
effect
)
{
ref
=
IUnknown_Release
(
effect
);
ok
(
ref
==
0
,
"IDirectInputDevice_Release() reference count = %d
\n
"
,
ref
);
}
cnt1
=
get_refcount
((
IUnknown
*
)
pJoystick
);
ok
(
cnt1
==
cnt2
,
"Ref count is wrong %d != %d
\n
"
,
cnt1
,
cnt2
);
}
if
(
winetest_interactive
)
{
if
(
winetest_interactive
)
{
trace
(
"You have 30 seconds to test all axes, sliders, POVs and buttons
\n
"
);
trace
(
"You have 30 seconds to test all axes, sliders, POVs and buttons
\n
"
);
count
=
300
;
count
=
300
;
...
...
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