[2/8] dinput: Added ConfigureDevices dialog (try 2)

Lucas Fialho Zawacki lfzawacki at gmail.com
Thu Aug 4 12:21:05 CDT 2011


Renamed the files to use shorter and more reasonable names.
---
 dlls/dinput/Makefile.in      |    7 +++--
 dlls/dinput/config.c         |   43 ++++++++++++++++++++++++++++++++++++++++
 dlls/dinput/dinput.rc        |   45 ++++++++++++++++++++++++++++++++++++++++++
 dlls/dinput/dinput_main.c    |    3 +-
 dlls/dinput/dinput_private.h |    2 +
 dlls/dinput/resource.h       |   17 +++++++++++++++
 6 files changed, 113 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..26625ac
--- /dev/null
+++ b/dlls/dinput/config.c
@@ -0,0 +1,43 @@
+/*
+ * 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);
+
+static HINSTANCE g_hinstance;
+
+HRESULT _configure_devices(LPDIRECTINPUT8W iface,
+                           LPDICONFIGUREDEVICESCALLBACK lpdiCallback,
+                           LPDICONFIGUREDEVICESPARAMSW lpdiCDParams,
+                           DWORD dwFlags,
+                           LPVOID pvRefData,
+                           HINSTANCE hinstance)
+{
+    InitCommonControls();
+
+    g_hinstance = hinstance;
+    DialogBoxParamW(g_hinstance, (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..bfe39de
--- /dev/null
+++ b/dlls/dinput/dinput.rc
@@ -0,0 +1,45 @@
+/*
+ * 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_NOACTION           "-"
+    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 8907897..6aed515 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, DINPUT_instance);
 }
 
 static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(
diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h
index 94b16a5..6427ffa 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(LPDIRECTINPUT8W iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData, HINSTANCE hinstance) 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..cf597ab
--- /dev/null
+++ b/dlls/dinput/resource.h
@@ -0,0 +1,17 @@
+#include <shlobj.h>
+
+#define IDD_CONFIGUREDEVICES                    100
+#define IDC_DEVICETEXT                          1000
+#define IDRESET                                 1001
+#define IDC_ACTIONTEXT                          1002
+#define IDC_PLAYERTEXT                          1005
+#define IDC_DEVICEOBJECTSTEXT                   1006
+#define IDC_CONTROLLERCOMBO                     1009
+#define IDC_PLAYERCOMBO                         1010
+#define IDC_ACTIONLIST                          1012
+#define IDC_DEVICEOBJECTSLIST                   1013
+#define IDC_CHECKBOXSORT                        1014
+#define IDC_MAPPINGTEXT                         1015
+#define IDS_NOACTION                            1016
+#define IDS_ACTIONCOLUMN                        1017
+#define IDS_OBJECTCOLUMN                        1018
-- 
1.7.0.4



More information about the wine-patches mailing list