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
9bbe3b45
Commit
9bbe3b45
authored
Sep 01, 2011
by
Lucas Fialho Zawacki
Committed by
Alexandre Julliard
Sep 06, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Added enumerated devices to ConfigureDevices dialog.
parent
0ae47109
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
119 additions
and
1 deletion
+119
-1
config.c
dlls/dinput/config.c
+119
-1
No files found.
dlls/dinput/config.c
View file @
9bbe3b45
...
...
@@ -25,6 +25,120 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dinput
);
typedef
struct
{
int
nobjects
;
IDirectInputDevice8W
*
lpdid
;
DIDEVICEINSTANCEW
ddi
;
DIDEVICEOBJECTINSTANCEW
ddo
[
256
];
}
DeviceData
;
typedef
struct
{
int
ndevices
;
DeviceData
*
devices
;
}
DIDevicesData
;
typedef
struct
{
IDirectInput8W
*
lpDI
;
LPDIACTIONFORMATW
lpdiaf
;
DIDevicesData
devices_data
;
}
ConfigureDevicesData
;
/*
* Enumeration callback functions
*/
static
BOOL
CALLBACK
count_devices
(
LPCDIDEVICEINSTANCEW
lpddi
,
IDirectInputDevice8W
*
lpdid
,
DWORD
dwFlags
,
DWORD
dwRemaining
,
LPVOID
pvRef
)
{
DIDevicesData
*
data
=
(
DIDevicesData
*
)
pvRef
;
data
->
ndevices
++
;
return
DIENUM_CONTINUE
;
}
static
BOOL
CALLBACK
collect_devices
(
LPCDIDEVICEINSTANCEW
lpddi
,
IDirectInputDevice8W
*
lpdid
,
DWORD
dwFlags
,
DWORD
dwRemaining
,
LPVOID
pvRef
)
{
DIDevicesData
*
data
=
(
DIDevicesData
*
)
pvRef
;
DeviceData
*
device
=
&
data
->
devices
[
data
->
ndevices
];
device
->
lpdid
=
lpdid
;
device
->
ddi
=
*
lpddi
;
IDirectInputDevice_AddRef
(
lpdid
);
data
->
ndevices
++
;
return
DIENUM_CONTINUE
;
}
/*
* Utility functions
*/
static
void
init_devices
(
HWND
dialog
,
IDirectInput8W
*
lpDI
,
DIDevicesData
*
data
,
LPDIACTIONFORMATW
lpdiaf
)
{
int
i
;
/* Count devices */
IDirectInput8_EnumDevicesBySemantics
(
lpDI
,
NULL
,
lpdiaf
,
count_devices
,
(
LPVOID
)
data
,
0
);
/* Allocate devices */
data
->
devices
=
(
DeviceData
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DeviceData
)
*
data
->
ndevices
);
/* Collect and insert */
data
->
ndevices
=
0
;
IDirectInput8_EnumDevicesBySemantics
(
lpDI
,
NULL
,
lpdiaf
,
collect_devices
,
(
LPVOID
)
data
,
0
);
for
(
i
=
0
;
i
<
data
->
ndevices
;
i
++
)
SendDlgItemMessageW
(
dialog
,
IDC_CONTROLLERCOMBO
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
data
->
devices
[
i
].
ddi
.
tszProductName
);
}
static
void
destroy_devices
(
HWND
dialog
)
{
int
i
;
ConfigureDevicesData
*
data
=
(
ConfigureDevicesData
*
)
GetWindowLongPtrW
(
dialog
,
DWLP_USER
);
DIDevicesData
*
devices_data
=
&
data
->
devices_data
;
for
(
i
=
0
;
i
<
devices_data
->
ndevices
;
i
++
)
IDirectInputDevice8_Release
(
devices_data
->
devices
[
i
].
lpdid
);
HeapFree
(
GetProcessHeap
(),
0
,
devices_data
->
devices
);
}
static
INT_PTR
CALLBACK
ConfigureDevicesDlgProc
(
HWND
dialog
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
switch
(
uMsg
)
{
case
WM_INITDIALOG
:
{
ConfigureDevicesData
*
data
=
(
ConfigureDevicesData
*
)
lParam
;
/* Initialize action format and enumerate devices */
init_devices
(
dialog
,
data
->
lpDI
,
&
data
->
devices_data
,
data
->
lpdiaf
);
/* Store information in the window */
SetWindowLongPtrW
(
dialog
,
DWLP_USER
,
(
LONG_PTR
)
data
);
break
;
}
case
WM_COMMAND
:
switch
(
LOWORD
(
wParam
))
{
case
IDOK
:
EndDialog
(
dialog
,
0
);
destroy_devices
(
dialog
);
break
;
case
IDCANCEL
:
EndDialog
(
dialog
,
0
);
destroy_devices
(
dialog
);
break
;
case
IDC_RESET
:
break
;
}
break
;
}
return
FALSE
;
}
HRESULT
_configure_devices
(
IDirectInput8W
*
iface
,
LPDICONFIGUREDEVICESCALLBACK
lpdiCallback
,
LPDICONFIGUREDEVICESPARAMSW
lpdiCDParams
,
...
...
@@ -32,9 +146,13 @@ HRESULT _configure_devices(IDirectInput8W *iface,
LPVOID
pvRefData
)
{
ConfigureDevicesData
data
;
data
.
lpDI
=
iface
;
data
.
lpdiaf
=
lpdiCDParams
->
lprgFormats
;
InitCommonControls
();
DialogBoxParamW
(
GetModuleHandleA
(
"dinput.dll"
),
(
LPCWSTR
)
MAKEINTRESOURCE
(
IDD_CONFIGUREDEVICES
),
lpdiCDParams
->
hwnd
,
0
,
0
);
DialogBoxParamW
(
GetModuleHandleA
(
"dinput.dll"
),
(
LPCWSTR
)
MAKEINTRESOURCE
(
IDD_CONFIGUREDEVICES
),
lpdiCDParams
->
hwnd
,
ConfigureDevicesDlgProc
,
(
LPARAM
)
&
data
);
return
DI_OK
;
}
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