Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
070e1f5e
Commit
070e1f5e
authored
Jan 21, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Jan 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Remove unnecessary initialization helpers.
parent
21fa1be5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
39 deletions
+25
-39
dinput_main.c
dlls/dinput/dinput_main.c
+25
-38
dinput_private.h
dlls/dinput/dinput_private.h
+0
-1
No files found.
dlls/dinput/dinput_main.c
View file @
070e1f5e
...
...
@@ -86,9 +86,6 @@ static struct list acquired_rawmouse_list = LIST_INIT( acquired_rawmouse_list );
static
struct
list
acquired_keyboard_list
=
LIST_INIT
(
acquired_keyboard_list
);
static
struct
list
acquired_device_list
=
LIST_INIT
(
acquired_device_list
);
static
HRESULT
initialize_directinput_instance
(
struct
dinput
*
impl
,
DWORD
version
);
static
void
uninitialize_directinput_instance
(
struct
dinput
*
impl
);
void
dinput_hooks_acquire_device
(
IDirectInputDevice8W
*
iface
)
{
struct
dinput_device
*
impl
=
impl_from_IDirectInputDevice8W
(
iface
);
...
...
@@ -140,6 +137,8 @@ static HRESULT dinput_create( IUnknown **out )
impl
->
IDirectInputJoyConfig8_iface
.
lpVtbl
=
&
joy_config_vtbl
;
impl
->
ref
=
1
;
list_init
(
&
impl
->
device_players
);
#if DIRECTINPUT_VERSION == 0x0700
*
out
=
(
IUnknown
*
)
&
impl
->
IDirectInput7W_iface
;
#else
...
...
@@ -299,7 +298,11 @@ static ULONG WINAPI dinput7_Release( IDirectInput7W *iface )
if
(
ref
==
0
)
{
uninitialize_directinput_instance
(
impl
);
struct
DevicePlayer
*
device_player
,
*
device_player2
;
LIST_FOR_EACH_ENTRY_SAFE
(
device_player
,
device_player2
,
&
impl
->
device_players
,
struct
DevicePlayer
,
entry
)
free
(
device_player
);
free
(
impl
);
}
...
...
@@ -395,34 +398,6 @@ static void unregister_di_em_win_class(void)
WARN
(
"Unable to unregister message window class
\n
"
);
}
static
HRESULT
initialize_directinput_instance
(
struct
dinput
*
impl
,
DWORD
version
)
{
if
(
!
impl
->
initialized
)
{
impl
->
dwVersion
=
version
;
impl
->
evsequence
=
1
;
list_init
(
&
impl
->
device_players
);
impl
->
initialized
=
TRUE
;
}
return
DI_OK
;
}
static
void
uninitialize_directinput_instance
(
struct
dinput
*
impl
)
{
if
(
impl
->
initialized
)
{
struct
DevicePlayer
*
device_player
,
*
device_player2
;
LIST_FOR_EACH_ENTRY_SAFE
(
device_player
,
device_player2
,
&
impl
->
device_players
,
struct
DevicePlayer
,
entry
)
free
(
device_player
);
impl
->
initialized
=
FALSE
;
}
}
enum
directinput_versions
{
DIRECTINPUT_VERSION_300
=
0x0300
,
...
...
@@ -452,7 +427,13 @@ static HRESULT WINAPI dinput7_Initialize( IDirectInput7W *iface, HINSTANCE hinst
version
!=
DIRECTINPUT_VERSION_700
&&
version
!=
DIRECTINPUT_VERSION
)
return
DIERR_BETADIRECTINPUTVERSION
;
return
initialize_directinput_instance
(
impl
,
version
);
if
(
!
impl
->
dwVersion
)
{
impl
->
dwVersion
=
version
;
impl
->
evsequence
=
1
;
}
return
DI_OK
;
}
static
HRESULT
WINAPI
dinput7_GetDeviceStatus
(
IDirectInput7W
*
iface
,
const
GUID
*
guid
)
...
...
@@ -464,7 +445,7 @@ static HRESULT WINAPI dinput7_GetDeviceStatus( IDirectInput7W *iface, const GUID
TRACE
(
"iface %p, guid %s.
\n
"
,
iface
,
debugstr_guid
(
guid
)
);
if
(
!
guid
)
return
E_POINTER
;
if
(
!
impl
->
initialized
)
return
DIERR_NOTINITIALIZED
;
if
(
!
impl
->
dwVersion
)
return
DIERR_NOTINITIALIZED
;
hr
=
IDirectInput_CreateDevice
(
iface
,
guid
,
&
device
,
NULL
);
if
(
hr
!=
DI_OK
)
return
DI_NOTATTACHED
;
...
...
@@ -485,7 +466,7 @@ static HRESULT WINAPI dinput7_RunControlPanel( IDirectInput7W *iface, HWND owner
if
(
owner
&&
!
IsWindow
(
owner
))
return
E_HANDLE
;
if
(
flags
)
return
DIERR_INVALIDPARAM
;
if
(
!
impl
->
initialized
)
return
DIERR_NOTINITIALIZED
;
if
(
!
impl
->
dwVersion
)
return
DIERR_NOTINITIALIZED
;
if
(
!
CreateProcessW
(
NULL
,
control_exe
,
NULL
,
NULL
,
FALSE
,
DETACHED_PROCESS
,
NULL
,
NULL
,
&
si
,
&
pi
))
return
HRESULT_FROM_WIN32
(
GetLastError
());
...
...
@@ -514,7 +495,7 @@ static HRESULT WINAPI dinput7_CreateDeviceEx( IDirectInput7W *iface, const GUID
*
out
=
NULL
;
if
(
!
guid
)
return
E_POINTER
;
if
(
!
impl
->
initialized
)
return
DIERR_NOTINITIALIZED
;
if
(
!
impl
->
dwVersion
)
return
DIERR_NOTINITIALIZED
;
if
(
IsEqualGUID
(
&
GUID_SysKeyboard
,
guid
))
hr
=
keyboard_create_device
(
impl
,
guid
,
&
device
);
else
if
(
IsEqualGUID
(
&
GUID_SysMouse
,
guid
))
hr
=
mouse_create_device
(
impl
,
guid
,
&
device
);
...
...
@@ -593,7 +574,7 @@ static HRESULT WINAPI dinput8_EnumDevices( IDirectInput8W *iface, DWORD type, LP
DIEDFL_INCLUDEPHANTOMS
|
DIEDFL_INCLUDEHIDDEN
))
return
DIERR_INVALIDPARAM
;
if
(
!
impl
->
initialized
)
return
DIERR_NOTINITIALIZED
;
if
(
!
impl
->
dwVersion
)
return
DIERR_NOTINITIALIZED
;
if
(
type
<=
DI8DEVCLASS_GAMECTRL
)
device_class
=
type
;
else
device_type
=
type
;
...
...
@@ -652,7 +633,13 @@ static HRESULT WINAPI dinput8_Initialize( IDirectInput8W *iface, HINSTANCE hinst
else
if
(
version
>
DIRECTINPUT_VERSION
)
return
DIERR_OLDDIRECTINPUTVERSION
;
return
initialize_directinput_instance
(
impl
,
version
);
if
(
!
impl
->
dwVersion
)
{
impl
->
dwVersion
=
version
;
impl
->
evsequence
=
1
;
}
return
DI_OK
;
}
static
HRESULT
WINAPI
dinput8_FindDevice
(
IDirectInput8W
*
iface
,
const
GUID
*
guid
,
const
WCHAR
*
name
,
GUID
*
instance_guid
)
...
...
dlls/dinput/dinput_private.h
View file @
070e1f5e
...
...
@@ -38,7 +38,6 @@ struct dinput
IDirectInputJoyConfig8
IDirectInputJoyConfig8_iface
;
LONG
ref
;
BOOL
initialized
;
DWORD
dwVersion
;
/* direct input version number */
DWORD
evsequence
;
/* unique sequence number for events */
struct
list
device_players
;
/* device instance guid to player name */
...
...
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