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
f2094069
Commit
f2094069
authored
Mar 20, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Move mouse_create_device function around.
parent
256f35dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
51 deletions
+51
-51
mouse.c
dlls/dinput/mouse.c
+51
-51
No files found.
dlls/dinput/mouse.c
View file @
f2094069
...
...
@@ -102,57 +102,6 @@ static BOOL CALLBACK init_object_properties( const DIDEVICEOBJECTINSTANCEW *inst
return
DIENUM_CONTINUE
;
}
HRESULT
mouse_create_device
(
struct
dinput
*
dinput
,
const
GUID
*
guid
,
IDirectInputDevice8W
**
out
)
{
struct
mouse
*
impl
;
HKEY
hkey
,
appkey
;
WCHAR
buffer
[
20
];
HRESULT
hr
;
TRACE
(
"dinput %p, guid %s, out %p
\n
"
,
dinput
,
debugstr_guid
(
guid
),
out
);
*
out
=
NULL
;
if
(
!
IsEqualGUID
(
&
GUID_SysMouse
,
guid
))
return
DIERR_DEVICENOTREG
;
if
(
!
(
impl
=
calloc
(
1
,
sizeof
(
*
impl
)
)))
return
E_OUTOFMEMORY
;
dinput_device_init
(
&
impl
->
base
,
&
mouse_vtbl
,
guid
,
dinput
);
impl
->
base
.
crit
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": struct mouse*->base.crit"
);
mouse_enum_device
(
0
,
0
,
&
impl
->
base
.
instance
,
dinput
->
dwVersion
);
impl
->
base
.
caps
.
dwDevType
=
impl
->
base
.
instance
.
dwDevType
;
impl
->
base
.
caps
.
dwFirmwareRevision
=
100
;
impl
->
base
.
caps
.
dwHardwareRevision
=
100
;
impl
->
base
.
dwCoopLevel
=
DISCL_NONEXCLUSIVE
|
DISCL_BACKGROUND
;
if
(
dinput
->
dwVersion
>=
0x0800
)
impl
->
base
.
use_raw_input
=
TRUE
;
/* One object_properties per axis */
impl
->
base
.
object_properties
=
calloc
(
3
,
sizeof
(
struct
object_properties
)
);
if
(
!
impl
->
base
.
object_properties
)
{
IDirectInputDevice_Release
(
&
impl
->
base
.
IDirectInputDevice8W_iface
);
return
E_OUTOFMEMORY
;
}
IDirectInputDevice8_EnumObjects
(
&
impl
->
base
.
IDirectInputDevice8W_iface
,
init_object_properties
,
impl
,
DIDFT_RELAXIS
);
if
(
FAILED
(
hr
=
dinput_device_init_device_format
(
&
impl
->
base
.
IDirectInputDevice8W_iface
)))
goto
failed
;
get_app_key
(
&
hkey
,
&
appkey
);
if
(
!
get_config_key
(
hkey
,
appkey
,
L"MouseWarpOverride"
,
buffer
,
sizeof
(
buffer
)
))
{
if
(
!
wcsnicmp
(
buffer
,
L"disable"
,
-
1
))
impl
->
warp_override
=
WARP_DISABLE
;
else
if
(
!
wcsnicmp
(
buffer
,
L"force"
,
-
1
))
impl
->
warp_override
=
WARP_FORCE_ON
;
}
if
(
appkey
)
RegCloseKey
(
appkey
);
if
(
hkey
)
RegCloseKey
(
hkey
);
*
out
=
&
impl
->
base
.
IDirectInputDevice8W_iface
;
return
DI_OK
;
failed:
IDirectInputDevice_Release
(
&
impl
->
base
.
IDirectInputDevice8W_iface
);
return
hr
;
}
void
dinput_mouse_rawinput_hook
(
IDirectInputDevice8W
*
iface
,
WPARAM
wparam
,
LPARAM
lparam
,
RAWINPUT
*
ri
)
{
struct
mouse
*
impl
=
impl_from_IDirectInputDevice8W
(
iface
);
...
...
@@ -559,6 +508,57 @@ static HRESULT mouse_enum_objects( IDirectInputDevice8W *iface, const DIPROPHEAD
return
DIENUM_CONTINUE
;
}
HRESULT
mouse_create_device
(
struct
dinput
*
dinput
,
const
GUID
*
guid
,
IDirectInputDevice8W
**
out
)
{
struct
mouse
*
impl
;
HKEY
hkey
,
appkey
;
WCHAR
buffer
[
20
];
HRESULT
hr
;
TRACE
(
"dinput %p, guid %s, out %p
\n
"
,
dinput
,
debugstr_guid
(
guid
),
out
);
*
out
=
NULL
;
if
(
!
IsEqualGUID
(
&
GUID_SysMouse
,
guid
))
return
DIERR_DEVICENOTREG
;
if
(
!
(
impl
=
calloc
(
1
,
sizeof
(
*
impl
)
)))
return
E_OUTOFMEMORY
;
dinput_device_init
(
&
impl
->
base
,
&
mouse_vtbl
,
guid
,
dinput
);
impl
->
base
.
crit
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": struct mouse*->base.crit"
);
mouse_enum_device
(
0
,
0
,
&
impl
->
base
.
instance
,
dinput
->
dwVersion
);
impl
->
base
.
caps
.
dwDevType
=
impl
->
base
.
instance
.
dwDevType
;
impl
->
base
.
caps
.
dwFirmwareRevision
=
100
;
impl
->
base
.
caps
.
dwHardwareRevision
=
100
;
impl
->
base
.
dwCoopLevel
=
DISCL_NONEXCLUSIVE
|
DISCL_BACKGROUND
;
if
(
dinput
->
dwVersion
>=
0x0800
)
impl
->
base
.
use_raw_input
=
TRUE
;
/* One object_properties per axis */
impl
->
base
.
object_properties
=
calloc
(
3
,
sizeof
(
struct
object_properties
)
);
if
(
!
impl
->
base
.
object_properties
)
{
IDirectInputDevice_Release
(
&
impl
->
base
.
IDirectInputDevice8W_iface
);
return
E_OUTOFMEMORY
;
}
IDirectInputDevice8_EnumObjects
(
&
impl
->
base
.
IDirectInputDevice8W_iface
,
init_object_properties
,
impl
,
DIDFT_RELAXIS
);
if
(
FAILED
(
hr
=
dinput_device_init_device_format
(
&
impl
->
base
.
IDirectInputDevice8W_iface
)))
goto
failed
;
get_app_key
(
&
hkey
,
&
appkey
);
if
(
!
get_config_key
(
hkey
,
appkey
,
L"MouseWarpOverride"
,
buffer
,
sizeof
(
buffer
)
))
{
if
(
!
wcsnicmp
(
buffer
,
L"disable"
,
-
1
))
impl
->
warp_override
=
WARP_DISABLE
;
else
if
(
!
wcsnicmp
(
buffer
,
L"force"
,
-
1
))
impl
->
warp_override
=
WARP_FORCE_ON
;
}
if
(
appkey
)
RegCloseKey
(
appkey
);
if
(
hkey
)
RegCloseKey
(
hkey
);
*
out
=
&
impl
->
base
.
IDirectInputDevice8W_iface
;
return
DI_OK
;
failed:
IDirectInputDevice_Release
(
&
impl
->
base
.
IDirectInputDevice8W_iface
);
return
hr
;
}
static
const
struct
dinput_device_vtbl
mouse_vtbl
=
{
NULL
,
...
...
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