ReactOS  0.4.14-dev-599-g2d4d3f5
config.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Lucas Fialho Zawacki
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #define NONAMELESSUNION
20 
21 
22 #include "wine/unicode.h"
23 #include "objbase.h"
24 #include "dinput_private.h"
25 #include "device_private.h"
26 #include "resource.h"
27 
28 #include "wine/heap.h"
29 
30 typedef struct {
31  int nobjects;
32  IDirectInputDevice8W *lpdid;
35  /* ActionFormat for every user.
36  * In same order as ConfigureDevicesData usernames */
38 } DeviceData;
39 
40 typedef struct {
41  int ndevices;
44 
45 typedef struct {
46  IDirectInput8W *lpDI;
53 
54 /*
55  * Enumeration callback functions
56  */
58 {
59  DeviceData *data = (DeviceData*) pvRef;
60 
61  data->ddo[data->nobjects] = *lpddo;
62 
63  data->nobjects++;
64  return DIENUM_CONTINUE;
65 }
66 
67 static BOOL CALLBACK collect_devices(LPCDIDEVICEINSTANCEW lpddi, IDirectInputDevice8W *lpdid, DWORD dwFlags, DWORD dwRemaining, LPVOID pvRef)
68 {
71  int i, j;
72 
74 
75  /* alloc array for devices if this is our first device */
76  if (!data->devices_data.ndevices)
77  data->devices_data.devices = HeapAlloc(GetProcessHeap(), 0, sizeof(DeviceData) * (dwRemaining + 1));
78  device = &data->devices_data.devices[data->devices_data.ndevices];
79  device->lpdid = lpdid;
80  device->ddi = *lpddi;
81 
82  device->nobjects = 0;
84 
85  device->user_afs = heap_alloc(sizeof(*device->user_afs) * data->nusernames);
86  memset(device->user_afs, 0, sizeof(*device->user_afs) * data->nusernames);
87  for (i = 0; i < data->nusernames; i++)
88  {
89  DIACTIONFORMATW *user_af = &device->user_afs[i];
90  user_af->dwNumActions = data->original_lpdiaf->dwNumActions;
91  user_af->guidActionMap = data->original_lpdiaf->guidActionMap;
92  user_af->rgoAction = heap_alloc(sizeof(DIACTIONW) * data->original_lpdiaf->dwNumActions);
93  memset(user_af->rgoAction, 0, sizeof(DIACTIONW) * data->original_lpdiaf->dwNumActions);
94  for (j = 0; j < user_af->dwNumActions; j++)
95  {
96  user_af->rgoAction[j].dwSemantic = data->original_lpdiaf->rgoAction[j].dwSemantic;
97  user_af->rgoAction[j].dwFlags = data->original_lpdiaf->rgoAction[j].dwFlags;
98  user_af->rgoAction[j].u.lptszActionName = data->original_lpdiaf->rgoAction[j].u.lptszActionName;
99  }
100  IDirectInputDevice8_BuildActionMap(lpdid, user_af, data->usernames[i], 0);
101  }
102 
103  data->devices_data.ndevices++;
104  return DIENUM_CONTINUE;
105 }
106 
107 /*
108  * Listview utility functions
109  */
111 {
112  LVCOLUMNW listColumn;
113  RECT viewRect;
114  int width;
116 
118  width = (viewRect.right - viewRect.left)/2;
119 
121  listColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
122  listColumn.pszText = column;
123  listColumn.cchTextMax = lstrlenW(listColumn.pszText);
124  listColumn.cx = width;
125 
127 
129  listColumn.cx = width;
130  listColumn.pszText = column;
131  listColumn.cchTextMax = lstrlenW(listColumn.pszText);
132 
134 }
135 
137 {
139 }
140 
142 {
143  LVITEMW item;
144 
145  if (index < 0) return -1;
146 
147  item.mask = LVIF_PARAM;
148  item.iItem = index;
149  item.iSubItem = 0;
150 
152 
153  return item.lParam;
154 }
155 
156 static void lv_set_action(HWND dialog, int item, int action, LPDIACTIONFORMATW lpdiaf)
157 {
158  static const WCHAR no_action[] = {'-','\0'};
159  const WCHAR *action_text = no_action;
160  LVITEMW lvItem;
161 
162  if (item < 0) return;
163 
164  if (action != -1)
165  action_text = lpdiaf->rgoAction[action].u.lptszActionName;
166 
167  /* Keep the action and text in the listview item */
168  lvItem.iItem = item;
169 
170  lvItem.mask = LVIF_PARAM;
171  lvItem.iSubItem = 0;
172  lvItem.lParam = (LPARAM) action;
173 
174  /* Action index */
176 
177  lvItem.mask = LVIF_TEXT;
178  lvItem.iSubItem = 1;
179  lvItem.pszText = (WCHAR *)action_text;
180  lvItem.cchTextMax = lstrlenW(lvItem.pszText);
181 
182  /* Text */
184 }
185 
186 /*
187  * Utility functions
188  */
190 {
193  return &data->devices_data.devices[sel];
194 }
195 
197 {
199  int controller_sel = SendDlgItemMessageW(dialog, IDC_CONTROLLERCOMBO, CB_GETCURSEL, 0, 0);
200  int player_sel = SendDlgItemMessageW(dialog, IDC_PLAYERCOMBO, CB_GETCURSEL, 0, 0);
201  return &data->devices_data.devices[controller_sel].user_afs[player_sel];
202 }
203 
205 {
207  return data->original_lpdiaf;
208 }
209 
211 {
213  return data->display_only;
214 }
215 
217 {
218  int i;
219 
220  /* Collect and insert */
221  data->devices_data.ndevices = 0;
223 
224  for (i = 0; i < data->devices_data.ndevices; i++)
225  SendDlgItemMessageW(dialog, IDC_CONTROLLERCOMBO, CB_ADDSTRING, 0, (LPARAM) data->devices_data.devices[i].ddi.tszProductName );
226  for (i = 0; i < data->nusernames; i++)
228 }
229 
231 {
232  int i, j;
234  DIDevicesData *devices_data = &data->devices_data;
235 
236  /* Free the devices */
237  for (i=0; i < devices_data->ndevices; i++)
238  {
239  IDirectInputDevice8_Release(devices_data->devices[i].lpdid);
240  for (j=0; j < data->nusernames; j++)
241  heap_free(devices_data->devices[i].user_afs[j].rgoAction);
242  heap_free(devices_data->devices[i].user_afs);
243  }
244 
245  HeapFree(GetProcessHeap(), 0, devices_data->devices);
246 }
247 
249 {
252  LVITEMW item;
253  int i, j;
254 
255  /* Clean the listview */
257 
258  /* Add each object */
259  for (i=0; i < device->nobjects; i++)
260  {
261  DWORD ddo_inst, ddo_type;
262  int action = -1;
263 
264  item.mask = LVIF_TEXT | LVIF_PARAM;
265  item.iItem = i;
266  item.iSubItem = 0;
267  item.pszText = device->ddo[i].tszName;
268  item.cchTextMax = lstrlenW(item.pszText);
269 
270  /* Add the item */
272  ddo_inst = DIDFT_GETINSTANCE(device->ddo[i].dwType);
273  ddo_type = DIDFT_GETTYPE(device->ddo[i].dwType);
274 
275  /* Search for an assigned action for this device */
276  for (j=0; j < lpdiaf->dwNumActions; j++)
277  {
278  DWORD af_inst = DIDFT_GETINSTANCE(lpdiaf->rgoAction[j].dwObjID);
279  DWORD af_type = DIDFT_GETTYPE(lpdiaf->rgoAction[j].dwObjID);
280  if (af_type == DIDFT_PSHBUTTON) af_type = DIDFT_BUTTON;
281  if (af_type == DIDFT_RELAXIS) af_type = DIDFT_AXIS;
282  /* NOTE previously compared dwType == dwObjId but default buildActionMap actions
283  * were PSHBUTTON and RELAXS and didnt show up on config */
284  if (IsEqualGUID(&lpdiaf->rgoAction[j].guidInstance, &device->ddi.guidInstance) &&
285  ddo_inst == af_inst && ddo_type & af_type)
286  {
287  action = j;
288  break;
289  }
290  }
291 
292  lv_set_action(dialog, i, action, lpdiaf);
293  }
294 }
295 
297 {
300  int i, added = 0;
301  int obj = lv_get_cur_item(dialog);
302 
303  if (obj < 0) return;
304 
306 
307  for (i=0; i < lpdiaf->dwNumActions; i++)
308  {
309  /* Skip keyboard actions for non keyboards */
310  if (GET_DIDEVICE_TYPE(device->ddi.dwDevType) != DI8DEVTYPE_KEYBOARD &&
311  (lpdiaf->rgoAction[i].dwSemantic & DIKEYBOARD_MASK) == DIKEYBOARD_MASK) continue;
312 
313  /* Skip mouse actions for non mouses */
314  if (GET_DIDEVICE_TYPE(device->ddi.dwDevType) != DI8DEVTYPE_MOUSE &&
315  (lpdiaf->rgoAction[i].dwSemantic & DIMOUSE_MASK) == DIMOUSE_MASK) continue;
316 
317  /* Add action string and index in the action format to the list entry */
318  if (DIDFT_GETINSTANCE(lpdiaf->rgoAction[i].dwSemantic) & DIDFT_GETTYPE(device->ddo[obj].dwType))
319  {
322  added++;
323  }
324  }
325 }
326 
328 {
331  LVFINDINFOW lvFind;
334  int obj = lv_get_cur_item(dialog);
335  int old_action = lv_get_item_data(dialog, obj);
336  int used_obj;
337  DWORD type;
338 
339  if (old_action == action) return;
340  if (obj < 0) return;
341  if (lpdiaf->rgoAction[old_action].dwFlags & DIA_APPFIXED) return;
342 
343  type = device->ddo[obj].dwType;
344 
345  /* Clear old action */
346  if (old_action != -1)
347  {
348  lpdiaf->rgoAction[old_action].dwObjID = 0;
349  lpdiaf->rgoAction[old_action].guidInstance = GUID_NULL;
350  lpdiaf->rgoAction[old_action].dwHow = DIAH_UNMAPPED;
351  }
352 
353  /* Find if action text is already set for other object and unset it */
354  lvFind.flags = LVFI_PARAM;
355  lvFind.lParam = action;
356 
358 
359  lv_set_action(dialog, used_obj, -1, lpdiaf);
360 
361  /* Set new action */
362  lpdiaf->rgoAction[action].dwObjID = type;
363  lpdiaf->rgoAction[action].guidInstance = device->ddi.guidInstance;
365 
366  /* Set new action in the list */
367  lv_set_action(dialog, obj, action, lpdiaf);
368 }
369 
371 {
373  DIDevicesData *ddata = (DIDevicesData*) &data->devices_data;
374  unsigned i, j;
375 
376  for (i = 0; i < data->devices_data.ndevices; i++)
377  {
378  DeviceData *device = &ddata->devices[i];
379  for (j = 0; j < data->nusernames; j++)
380  IDirectInputDevice8_BuildActionMap(device->lpdid, &device->user_afs[j], data->usernames[j], DIDBAM_HWDEFAULTS);
381  }
382 }
383 
384 static void save_actions(HWND dialog) {
386  DIDevicesData *ddata = (DIDevicesData*) &data->devices_data;
387  unsigned i, j;
388  if (!data->display_only) {
389  for (i = 0; i < ddata->ndevices; i++)
390  {
391  DeviceData *device = &ddata->devices[i];
392  for (j = 0; j < data->nusernames; j++)
393  {
394  if (save_mapping_settings(device->lpdid, &device->user_afs[j], data->usernames[j]) != DI_OK)
395  MessageBoxA(dialog, "Could not save settings", 0, MB_ICONERROR);
396  }
397  }
398  }
399 }
400 
402 {
403  switch(uMsg)
404  {
405  case WM_INITDIALOG:
406  {
408 
409  /* Initialize action format and enumerate devices */
411 
412  /* Store information in the window */
414 
416 
417  /* Select the first device and show its actions */
421 
422  ShowCursor(TRUE);
423 
424  break;
425  }
426 
427  case WM_DESTROY:
428  ShowCursor(FALSE);
429  break;
430 
431  case WM_NOTIFY:
432 
433  switch (((LPNMHDR)lParam)->code)
434  {
435  case LVN_ITEMCHANGED:
437  break;
438  }
439  break;
440 
441 
442  case WM_COMMAND:
443 
444  switch(LOWORD(wParam))
445  {
446 
447  case IDC_ACTIONLIST:
448 
449  switch (HIWORD(wParam))
450  {
451  case LBN_DBLCLK:
452  /* Ignore this if app did not ask for editing */
453  if (dialog_display_only(dialog)) break;
454 
456  break;
457  }
458  break;
459 
460  case IDC_CONTROLLERCOMBO:
461  case IDC_PLAYERCOMBO:
462 
463  switch (HIWORD(wParam))
464  {
465  case CBN_SELCHANGE:
467  break;
468  }
469  break;
470 
471  case IDOK:
473  EndDialog(dialog, 0);
475  break;
476 
477  case IDCANCEL:
478  EndDialog(dialog, 0);
480  break;
481 
482  case IDC_RESET:
485  break;
486  }
487  break;
488  }
489 
490  return FALSE;
491 }
492 
493 HRESULT _configure_devices(IDirectInput8W *iface,
494  LPDICONFIGUREDEVICESCALLBACK lpdiCallback,
495  LPDICONFIGUREDEVICESPARAMSW lpdiCDParams,
496  DWORD dwFlags,
497  LPVOID pvRefData
498 )
499 {
500  int i;
501  DWORD size;
502  WCHAR *username = NULL;
504  data.lpDI = iface;
505  data.original_lpdiaf = lpdiCDParams->lprgFormats;
506  data.display_only = !(dwFlags & DICD_EDIT);
507  data.nusernames = lpdiCDParams->dwcUsers;
508  if (lpdiCDParams->lptszUserNames == NULL)
509  {
510  /* Get default user name */
512  username = heap_alloc(size * sizeof(WCHAR) );
514  data.nusernames = 1;
515  data.usernames = heap_alloc(sizeof(WCHAR *));
516  data.usernames[0] = username;
517  }
518  else
519  {
520  WCHAR *p = lpdiCDParams->lptszUserNames;
521  data.usernames = heap_alloc(sizeof(WCHAR *) * data.nusernames);
522  for (i = 0; i < data.nusernames; i++)
523  {
524  if (*p)
525  {
526  data.usernames[i] = p;
527  while (*(p++));
528  }
529  else
530  /* Return if there is an empty string */
531  return DIERR_INVALIDPARAM;
532  }
533  }
534 
536 
538  lpdiCDParams->hwnd, ConfigureDevicesDlgProc, (LPARAM)&data);
539 
541  heap_free(data.usernames);
542 
543  return DI_OK;
544 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
GLint GLint GLsizei width
Definition: gl.h:1546
static BOOL CALLBACK collect_objects(LPCDIDEVICEOBJECTINSTANCEW lpddo, LPVOID pvRef)
Definition: config.c:57
static void init_listview_columns(HWND dialog)
Definition: config.c:110
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
DIDevicesData devices_data
Definition: config.c:48
#define LVCF_WIDTH
Definition: commctrl.h:2583
DWORD dwObjID
Definition: dinput.h:1284
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define LB_ADDSTRING
Definition: winuser.h:2013
#define LVCF_TEXT
Definition: commctrl.h:2584
static int lv_get_cur_item(HWND dialog)
Definition: config.c:136
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
#define IDirectInputDevice_EnumObjects(p, a, b, c)
Definition: dinput.h:1605
static void assign_action(HWND dialog)
Definition: config.c:327
#define LVM_FINDITEMW
Definition: commctrl.h:2462
#define LB_GETITEMDATA
Definition: winuser.h:2023
#define DIA_APPFIXED
Definition: dinput.h:1297
#define LVN_ITEMCHANGED
Definition: commctrl.h:3127
HRESULT _configure_devices(IDirectInput8W *iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData)
Definition: config.c:493
LPARAM lParam
Definition: commctrl.h:2454
#define CALLBACK
Definition: compat.h:27
static void lv_set_action(HWND dialog, int item, int action, LPDIACTIONFORMATW lpdiaf)
Definition: config.c:156
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LPDIACTIONFORMATW original_lpdiaf
Definition: config.c:47
#define IDirectInputDevice_AddRef(p)
Definition: dinput.h:1601
void ShowCursor(void)
Definition: hardware.c:556
#define LVNI_SELECTED
Definition: commctrl.h:2420
UINT_PTR WPARAM
Definition: windef.h:207
GUID guidInstance
Definition: dinput.h:1283
#define GetWindowLongPtrW
Definition: winuser.h:4804
LONG left
Definition: windef.h:306
int32_t INT_PTR
Definition: typedefs.h:62
#define DI8DEVTYPE_KEYBOARD
Definition: dinput.h:211
HINSTANCE DINPUT_instance
Definition: dinput_main.c:98
DIACTIONFORMATW * user_afs
Definition: config.c:37
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:415
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define CB_GETCURSEL
Definition: winuser.h:1925
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define IDirectInputDevice8_BuildActionMap(p, a, b, c)
Definition: dinput.h:2067
#define LVFI_PARAM
Definition: commctrl.h:2432
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
int ndevices
Definition: config.c:41
#define LVIF_TEXT
Definition: commctrl.h:2305
#define LVCF_SUBITEM
Definition: commctrl.h:2585
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LB_RESETCONTENT
Definition: winuser.h:2037
int nobjects
Definition: config.c:31
static DIACTIONFORMATW * get_cur_lpdiaf(HWND dialog)
Definition: config.c:196
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2628
Definition: devices.h:37
#define DIDFT_BUTTON
Definition: dinput.h:756
int iSubItem
Definition: commctrl.h:2358
#define IDC_CONTROLLERCOMBO
Definition: resource.h:30
LPARAM lParam
Definition: commctrl.h:2364
#define CB_ADDSTRING
Definition: winuser.h:1918
smooth NULL
Definition: ftsmooth.c:416
#define IDC_PLAYERCOMBO
Definition: resource.h:31
#define IDC_ACTIONLIST
Definition: resource.h:32
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_OBJECTCOLUMN
Definition: resource.h:37
GLuint index
Definition: glext.h:6031
#define IDirectInputDevice8_Release(p)
Definition: dinput.h:2036
#define WM_DESTROY
Definition: winuser.h:1591
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static WCHAR username[]
Definition: url.c:32
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
#define DIAH_UNMAPPED
Definition: dinput.h:1299
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:714
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
IDirectInputDevice8W * lpdid
Definition: config.c:32
WCHAR ** usernames
Definition: config.c:51
LPDIACTIONFORMATW lprgFormats
Definition: dinput.h:1399
#define MAX_PATH
Definition: compat.h:26
#define DICD_EDIT
Definition: dinput.h:1362
LPWSTR pszText
Definition: commctrl.h:2563
#define IDD_CONFIGUREDEVICES
Definition: resource.h:23
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_DEVICEOBJECTSLIST
Definition: resource.h:33
#define GET_DIDEVICE_TYPE(dwDevType)
Definition: dinput.h:320
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_SETITEMDATA
Definition: winuser.h:2047
#define LBN_DBLCLK
Definition: winuser.h:2053
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUsername)
Definition: device.c:695
UINT mask
Definition: commctrl.h:2356
DeviceData * devices
Definition: config.c:42
#define index(s, c)
Definition: various.h:29
static void init_devices(HWND dialog, ConfigureDevicesData *data)
Definition: config.c:216
#define DIDBAM_HWDEFAULTS
Definition: dinput.h:1355
#define DIDFT_AXIS
Definition: dinput.h:753
#define DWLP_USER
Definition: winuser.h:866
IDirectInput8W * lpDI
Definition: config.c:46
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define MB_ICONERROR
Definition: winuser.h:781
#define GUID_NULL
Definition: ks.h:106
static void destroy_data(HWND dialog)
Definition: config.c:230
#define CB_SETCURSEL
Definition: winuser.h:1943
#define DIKEYBOARD_MASK
#define WM_COMMAND
Definition: winuser.h:1722
LPDIACTIONW rgoAction
Definition: dinput.h:1330
static INT_PTR CALLBACK ConfigureDevicesDlgProc(HWND dialog, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: config.c:401
#define LVM_DELETEALLITEMS
Definition: commctrl.h:2409
#define DIMOUSE_MASK
static int dialog_display_only(HWND dialog)
Definition: config.c:210
int cchTextMax
Definition: commctrl.h:2564
static DeviceData * get_cur_device(HWND dialog)
Definition: config.c:189
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define IDirectInput8_EnumDevicesBySemantics(p, a, b, c, d, e)
Definition: dinput.h:2519
DWORD dwFlags
Definition: dinput.h:1278
#define LVM_INSERTITEMW
Definition: commctrl.h:2400
static void show_suitable_actions(HWND dialog)
Definition: config.c:296
const WCHAR * action
Definition: action.c:7783
static ATOM item
Definition: dde.c:856
#define DIAH_USERCONFIG
Definition: dinput.h:1300
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL(CALLBACK * LPDICONFIGUREDEVICESCALLBACK)(LPUNKNOWN, LPVOID)
Definition: dinput.h:462
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define IDC_RESET
Definition: resource.h:26
#define LB_GETCURSEL
Definition: winuser.h:2021
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
GUID guidActionMap
Definition: dinput.h:1331
#define CBN_SELCHANGE
Definition: winuser.h:1961
static DIACTIONFORMATW * get_original_lpdiaf(HWND dialog)
Definition: config.c:204
#define DI8DEVTYPE_MOUSE
Definition: dinput.h:210
static HWND dialog
Definition: gui.c:33
#define LVM_SETITEMW
Definition: commctrl.h:2393
#define LVM_GETITEMW
Definition: commctrl.h:2386
#define LVIF_PARAM
Definition: commctrl.h:2307
#define IDS_ACTIONCOLUMN
Definition: resource.h:36
static BOOL CALLBACK collect_devices(LPCDIDEVICEINSTANCEW lpddi, IDirectInputDevice8W *lpdid, DWORD dwFlags, DWORD dwRemaining, LPVOID pvRef)
Definition: config.c:67
#define DI_OK
Definition: dinput.h:128
#define DIENUM_CONTINUE
Definition: dinput.h:188
DIDEVICEINSTANCEW ddi
Definition: config.c:33
#define HIWORD(l)
Definition: typedefs.h:246
DWORD dwHow
Definition: dinput.h:1285
static void reset_actions(HWND dialog)
Definition: config.c:370
#define SetWindowLongPtrW
Definition: winuser.h:5321
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
DWORD dwNumActions
Definition: dinput.h:1329
#define DIDFT_ALL
Definition: dinput.h:750
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664
GLfloat GLfloat p
Definition: glext.h:8902
#define IDCANCEL
Definition: winuser.h:825
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define LVM_GETNEXTITEM
Definition: commctrl.h:2429
#define memset(x, y, z)
Definition: compat.h:39
static void fill_device_object_list(HWND dialog)
Definition: config.c:248
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:402
#define WM_NOTIFY
Definition: richedit.h:61
static void save_actions(HWND dialog)
Definition: config.c:384
#define DIDFT_RELAXIS
Definition: dinput.h:751
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
DWORD dwSemantic
Definition: dinput.h:1277
static int lv_get_item_data(HWND dialog, int index)
Definition: config.c:141
LPCWSTR lptszActionName
Definition: dinput.h:1280