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
f47c63a1
Commit
f47c63a1
authored
Aug 19, 2007
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Aug 20, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Don't try to create non existing device.
parent
55b63fe0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
18 deletions
+31
-18
joystick_linuxinput.c
dlls/dinput/joystick_linuxinput.c
+31
-18
No files found.
dlls/dinput/joystick_linuxinput.c
View file @
f47c63a1
...
@@ -505,24 +505,31 @@ static HRESULT joydev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, RE
...
@@ -505,24 +505,31 @@ static HRESULT joydev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, RE
find_joydevs
();
find_joydevs
();
if
((
index
=
get_joystick_index
(
rguid
))
<
MAX_JOYDEV
)
{
if
((
index
=
get_joystick_index
(
rguid
))
<
MAX_JOYDEV
&&
have_joydevs
&&
index
<
have_joydevs
)
{
if
((
riid
==
NULL
)
||
if
((
riid
==
NULL
)
||
IsEqualGUID
(
&
IID_IDirectInputDeviceA
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDeviceA
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDevice2A
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDevice2A
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDevice7A
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDevice7A
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDevice8A
,
riid
))
{
IsEqualGUID
(
&
IID_IDirectInputDevice8A
,
riid
))
{
*
pdev
=
(
IDirectInputDeviceA
*
)
alloc_device
(
rguid
,
&
JoystickAvt
,
dinput
,
index
);
*
pdev
=
(
IDirectInputDeviceA
*
)
alloc_device
(
rguid
,
&
JoystickAvt
,
dinput
,
index
);
TRACE
(
"Creating a Joystick device (%p)
\n
"
,
*
pdev
);
TRACE
(
"Created a Joystick device (%p)
\n
"
,
*
pdev
);
if
(
*
pdev
==
0
)
{
if
(
*
pdev
==
NULL
)
{
ERR
(
"out of memory
\n
"
);
ERR
(
"out of memory
\n
"
);
return
DIERR_OUTOFMEMORY
;
return
DIERR_OUTOFMEMORY
;
}
}
return
DI_OK
;
return
DI_OK
;
}
else
{
return
DIERR_NOINTERFACE
;
}
}
WARN
(
"no interface
\n
"
);
return
DIERR_NOINTERFACE
;
}
}
WARN
(
"invalid device GUID
\n
"
);
return
DIERR_DEVICENOTREG
;
return
DIERR_DEVICENOTREG
;
}
}
...
@@ -533,24 +540,30 @@ static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, RE
...
@@ -533,24 +540,30 @@ static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, RE
find_joydevs
();
find_joydevs
();
if
((
index
=
get_joystick_index
(
rguid
))
<
MAX_JOYDEV
)
{
if
((
index
=
get_joystick_index
(
rguid
))
<
MAX_JOYDEV
&&
have_joydevs
&&
index
<
have_joydevs
)
{
if
((
riid
==
NULL
)
||
if
((
riid
==
NULL
)
||
IsEqualGUID
(
&
IID_IDirectInputDeviceW
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDeviceW
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDevice2W
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDevice2W
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDevice7W
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDevice7W
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectInputDevice8W
,
riid
))
{
IsEqualGUID
(
&
IID_IDirectInputDevice8W
,
riid
))
{
*
pdev
=
(
IDirectInputDeviceW
*
)
alloc_device
(
rguid
,
&
JoystickWvt
,
dinput
,
index
);
*
pdev
=
(
IDirectInputDeviceW
*
)
alloc_device
(
rguid
,
&
JoystickWvt
,
dinput
,
index
);
TRACE
(
"Creating a Joystick device (%p)
\n
"
,
*
pdev
);
TRACE
(
"Created a Joystick device (%p)
\n
"
,
*
pdev
);
if
(
*
pdev
==
0
)
{
if
(
*
pdev
==
NULL
)
{
ERR
(
"out of memory
\n
"
);
ERR
(
"out of memory
\n
"
);
return
DIERR_OUTOFMEMORY
;
return
DIERR_OUTOFMEMORY
;
}
}
return
DI_OK
;
return
DI_OK
;
}
else
{
return
DIERR_NOINTERFACE
;
}
}
WARN
(
"no interface
\n
"
);
return
DIERR_NOINTERFACE
;
}
}
WARN
(
"invalid device GUID
\n
"
);
return
DIERR_DEVICENOTREG
;
return
DIERR_DEVICENOTREG
;
}
}
...
...
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