[1/6] dinput: Added ConfigureDevices dialog (try 3)
Lucas Fialho Zawacki
lfzawacki at gmail.com
Thu Sep 1 13:34:35 CDT 2011
From: Lucas Fialho Zawacki <lfzawacki at gmail.com>
Changes from first try:
* Renamed the files to use shorter and more reasonable names.
* Removed the hinstance parameter and the global variable
* Some COM cleanup
---
dlls/dinput/Makefile.in | 7 +++--
dlls/dinput/config.c | 40 ++++++++++++++++++++++++++++++++++++++
dlls/dinput/dinput.rc | 44 ++++++++++++++++++++++++++++++++++++++++++
dlls/dinput/dinput_main.c | 3 +-
dlls/dinput/dinput_private.h | 2 +
dlls/dinput/resource.h | 34 ++++++++++++++++++++++++++++++++
6 files changed, 126 insertions(+), 4 deletions(-)
create mode 100644 dlls/dinput/config.c
create mode 100644 dlls/dinput/dinput.rc
create mode 100644 dlls/dinput/resource.h
diff --git a/dlls/dinput/Makefile.in b/dlls/dinput/Makefile.in
index 24502e6..6f6d229 100644
--- a/dlls/dinput/Makefile.in
+++ b/dlls/dinput/Makefile.in
@@ -1,6 +1,6 @@
MODULE = dinput.dll
IMPORTLIB = dinput
-IMPORTS = dxguid uuid ole32 user32 advapi32
+IMPORTS = dxguid uuid ole32 user32 advapi32 comctl32
EXTRALIBS = @IOKITLIB@
C_SRCS = \
@@ -13,12 +13,13 @@ C_SRCS = \
joystick_linuxinput.c \
joystick_osx.c \
keyboard.c \
- mouse.c
+ mouse.c \
+ config.c
IMPLIB_SRCS = data_formats.c
IDL_R_SRCS = dinput_classes.idl
-RC_SRCS = version.rc
+RC_SRCS = version.rc dinput.rc
@MAKE_DLL_RULES@
diff --git a/dlls/dinput/config.c b/dlls/dinput/config.c
new file mode 100644
index 0000000..63ac507
--- /dev/null
+++ b/dlls/dinput/config.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2011 Lucas Fialho Zawacki
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
+#include "objbase.h"
+#include "dinput_private.h"
+#include "device_private.h"
+#include "resource.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dinput);
+
+HRESULT _configure_devices(IDirectInput8W *iface,
+ LPDICONFIGUREDEVICESCALLBACK lpdiCallback,
+ LPDICONFIGUREDEVICESPARAMSW lpdiCDParams,
+ DWORD dwFlags,
+ LPVOID pvRefData
+)
+{
+ InitCommonControls();
+
+ DialogBoxParamW(GetModuleHandleA("dinput.dll"), (LPCWSTR) MAKEINTRESOURCE(IDD_CONFIGUREDEVICES), lpdiCDParams->hwnd, 0, 0);
+
+ return DI_OK;
+}
diff --git a/dlls/dinput/dinput.rc b/dlls/dinput/dinput.rc
new file mode 100644
index 0000000..05aba8c
--- /dev/null
+++ b/dlls/dinput/dinput.rc
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2011 Lucas Fialho Zawacki
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "resource.h"
+
+STRINGTABLE
+BEGIN
+ IDS_ACTIONCOLUMN "Action"
+ IDS_OBJECTCOLUMN "Object"
+END
+
+IDD_CONFIGUREDEVICES DIALOG 0, 0, 270, 260
+STYLE DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE
+CAPTION "Configure Devices"
+FONT 8, "Ms Shell Dlg"
+{
+ DEFPUSHBUTTON "OK", IDOK, 10, 236, 50, 14
+ DEFPUSHBUTTON "Cancel", IDCANCEL, 65, 236, 50, 14
+ DEFPUSHBUTTON "Reset", IDRESET, 210, 236, 50, 14
+ COMBOBOX IDC_PLAYERCOMBO, 10, 50, 90, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
+ COMBOBOX IDC_CONTROLLERCOMBO, 10, 20, 90, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
+ LTEXT "Player", IDC_PLAYERTEXT, 10, 40, 21, 8, SS_LEFT
+ LTEXT "Device", IDC_DEVICETEXT, 10, 10, 22, 8, SS_LEFT
+ LTEXT "Actions", IDC_ACTIONTEXT, 10, 70, 24, 8, SS_LEFT
+ LTEXT "Mapping", IDC_MAPPINGTEXT, 120, 8, 28, 8, SS_LEFT
+ LISTBOX IDC_ACTIONLIST, 10, 80, 90, 130, WS_TABSTOP | WS_VSCROLL | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY
+ AUTOCHECKBOX "Sort Assigned", IDC_CHECKBOXSORT, 120, 215, 60, 8
+ CONTROL "Listview", IDC_DEVICEOBJECTSLIST, "SysListView32", LVS_REPORT | LVS_AUTOARRANGE | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP, 120, 20, 140, 190
+}
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index 17ba595..028d901 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -1008,7 +1008,8 @@ static HRESULT WINAPI IDirectInput8WImpl_ConfigureDevices(
FIXME("(this=%p,%p,%p,%04x,%p): stub\n", This, lpdiCallback, lpdiCDParams, dwFlags, pvRefData);
- return DI_OK;
+ /* Call helper function in config.c to do the real work */
+ return _configure_devices(iface, lpdiCallback, lpdiCDParams, dwFlags, pvRefData);
}
static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(
diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h
index 94b16a5..9a5c8ba 100644
--- a/dlls/dinput/dinput_private.h
+++ b/dlls/dinput/dinput_private.h
@@ -66,6 +66,8 @@ typedef int (*DI_EVENT_PROC)(LPDIRECTINPUTDEVICE8A, WPARAM, LPARAM);
extern void _copy_diactionformatAtoW(LPDIACTIONFORMATW, LPDIACTIONFORMATA) DECLSPEC_HIDDEN;
extern void _copy_diactionformatWtoA(LPDIACTIONFORMATA, LPDIACTIONFORMATW) DECLSPEC_HIDDEN;
+extern HRESULT _configure_devices(IDirectInput8W *iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData) DECLSPEC_HIDDEN;
+
#define IS_DIPROP(x) (((ULONG_PTR)(x) >> 16) == 0)
#define DIKEYBOARD_MASK 0x81000000
diff --git a/dlls/dinput/resource.h b/dlls/dinput/resource.h
new file mode 100644
index 0000000..933c862
--- /dev/null
+++ b/dlls/dinput/resource.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2011 Lucas Fialho Zawacki
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "shlobj.h"
+
+#define IDD_CONFIGUREDEVICES 1
+#define IDC_DEVICETEXT 2
+#define IDRESET 3
+#define IDC_ACTIONTEXT 4
+#define IDC_PLAYERTEXT 5
+#define IDC_DEVICEOBJECTSTEXT 6
+#define IDC_CONTROLLERCOMBO 7
+#define IDC_PLAYERCOMBO 8
+#define IDC_ACTIONLIST 9
+#define IDC_DEVICEOBJECTSLIST 10
+#define IDC_CHECKBOXSORT 11
+#define IDC_MAPPINGTEXT 12
+#define IDS_ACTIONCOLUMN 13
+#define IDS_OBJECTCOLUMN 14
--
1.7.0.4
More information about the wine-patches
mailing list