ReactOS  0.4.14-dev-604-gcfdd483
config.c File Reference
#include "wine/unicode.h"
#include "objbase.h"
#include "dinput_private.h"
#include "device_private.h"
#include "resource.h"
#include "wine/heap.h"
Include dependency graph for config.c:

Go to the source code of this file.

Classes

struct  DeviceData
 
struct  DIDevicesData
 
struct  ConfigureDevicesData
 

Macros

#define NONAMELESSUNION
 

Functions

static BOOL CALLBACK collect_objects (LPCDIDEVICEOBJECTINSTANCEW lpddo, LPVOID pvRef)
 
static BOOL CALLBACK collect_devices (LPCDIDEVICEINSTANCEW lpddi, IDirectInputDevice8W *lpdid, DWORD dwFlags, DWORD dwRemaining, LPVOID pvRef)
 
static void init_listview_columns (HWND dialog)
 
static int lv_get_cur_item (HWND dialog)
 
static int lv_get_item_data (HWND dialog, int index)
 
static void lv_set_action (HWND dialog, int item, int action, LPDIACTIONFORMATW lpdiaf)
 
static DeviceDataget_cur_device (HWND dialog)
 
static DIACTIONFORMATWget_cur_lpdiaf (HWND dialog)
 
static DIACTIONFORMATWget_original_lpdiaf (HWND dialog)
 
static int dialog_display_only (HWND dialog)
 
static void init_devices (HWND dialog, ConfigureDevicesData *data)
 
static void destroy_data (HWND dialog)
 
static void fill_device_object_list (HWND dialog)
 
static void show_suitable_actions (HWND dialog)
 
static void assign_action (HWND dialog)
 
static void reset_actions (HWND dialog)
 
static void save_actions (HWND dialog)
 
static INT_PTR CALLBACK ConfigureDevicesDlgProc (HWND dialog, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
HRESULT _configure_devices (IDirectInput8W *iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData)
 

Macro Definition Documentation

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 19 of file config.c.

Function Documentation

◆ _configure_devices()

HRESULT _configure_devices ( IDirectInput8W *  iface,
LPDICONFIGUREDEVICESCALLBACK  lpdiCallback,
LPDICONFIGUREDEVICESPARAMSW  lpdiCDParams,
DWORD  dwFlags,
LPVOID  pvRefData 
)

Definition at line 493 of file config.c.

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
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
HINSTANCE DINPUT_instance
Definition: dinput_main.c:98
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
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
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
static WCHAR username[]
Definition: url.c:32
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPDIACTIONFORMATW lprgFormats
Definition: dinput.h:1399
#define DICD_EDIT
Definition: dinput.h:1362
#define IDD_CONFIGUREDEVICES
Definition: resource.h:23
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static INT_PTR CALLBACK ConfigureDevicesDlgProc(HWND dialog, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: config.c:401
#define DI_OK
Definition: dinput.h:128
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
GLfloat GLfloat p
Definition: glext.h:8902
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by IDirectInput8WImpl_ConfigureDevices().

◆ assign_action()

static void assign_action ( HWND  dialog)
static

Definition at line 327 of file config.c.

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 }
DWORD dwObjID
Definition: dinput.h:1284
static int lv_get_cur_item(HWND dialog)
Definition: config.c:136
#define LVM_FINDITEMW
Definition: commctrl.h:2462
#define LB_GETITEMDATA
Definition: winuser.h:2023
#define DIA_APPFIXED
Definition: dinput.h:1297
LPARAM lParam
Definition: commctrl.h:2454
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
GUID guidInstance
Definition: dinput.h:1283
#define LVFI_PARAM
Definition: commctrl.h:2432
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
static DIACTIONFORMATW * get_cur_lpdiaf(HWND dialog)
Definition: config.c:196
Definition: devices.h:37
#define IDC_ACTIONLIST
Definition: resource.h:32
LONG_PTR LPARAM
Definition: windef.h:208
#define DIAH_UNMAPPED
Definition: dinput.h:1299
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_DEVICEOBJECTSLIST
Definition: resource.h:33
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GUID_NULL
Definition: ks.h:106
LPDIACTIONW rgoAction
Definition: dinput.h:1330
static DeviceData * get_cur_device(HWND dialog)
Definition: config.c:189
DWORD dwFlags
Definition: dinput.h:1278
const WCHAR * action
Definition: action.c:7783
#define DIAH_USERCONFIG
Definition: dinput.h:1300
#define LB_GETCURSEL
Definition: winuser.h:2021
static HWND dialog
Definition: gui.c:33
DWORD dwHow
Definition: dinput.h:1285
static int lv_get_item_data(HWND dialog, int index)
Definition: config.c:141

Referenced by ConfigureDevicesDlgProc().

◆ collect_devices()

static BOOL CALLBACK collect_devices ( LPCDIDEVICEINSTANCEW  lpddi,
IDirectInputDevice8W *  lpdid,
DWORD  dwFlags,
DWORD  dwRemaining,
LPVOID  pvRef 
)
static

Definition at line 67 of file config.c.

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 }
static BOOL CALLBACK collect_objects(LPCDIDEVICEOBJECTINSTANCEW lpddo, LPVOID pvRef)
Definition: config.c:57
#define IDirectInputDevice_EnumObjects(p, a, b, c)
Definition: dinput.h:1605
#define IDirectInputDevice_AddRef(p)
Definition: dinput.h:1601
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define IDirectInputDevice8_BuildActionMap(p, a, b, c)
Definition: dinput.h:2067
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
Definition: devices.h:37
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
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPDIACTIONW rgoAction
Definition: dinput.h:1330
DWORD dwFlags
Definition: dinput.h:1278
GUID guidActionMap
Definition: dinput.h:1331
#define DIENUM_CONTINUE
Definition: dinput.h:188
DWORD dwNumActions
Definition: dinput.h:1329
#define DIDFT_ALL
Definition: dinput.h:750
#define memset(x, y, z)
Definition: compat.h:39
DWORD dwSemantic
Definition: dinput.h:1277
LPCWSTR lptszActionName
Definition: dinput.h:1280

Referenced by init_devices().

◆ collect_objects()

static BOOL CALLBACK collect_objects ( LPCDIDEVICEOBJECTINSTANCEW  lpddo,
LPVOID  pvRef 
)
static

Definition at line 57 of file config.c.

58 {
59  DeviceData *data = (DeviceData*) pvRef;
60 
61  data->ddo[data->nobjects] = *lpddo;
62 
63  data->nobjects++;
64  return DIENUM_CONTINUE;
65 }
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define DIENUM_CONTINUE
Definition: dinput.h:188
DIDEVICEOBJECTINSTANCEW ddo[256]
Definition: config.c:34

Referenced by collect_devices(), and release_script().

◆ ConfigureDevicesDlgProc()

static INT_PTR CALLBACK ConfigureDevicesDlgProc ( HWND  dialog,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 401 of file config.c.

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 }
static void init_listview_columns(HWND dialog)
Definition: config.c:110
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
static void assign_action(HWND dialog)
Definition: config.c:327
#define LVN_ITEMCHANGED
Definition: commctrl.h:3127
void ShowCursor(void)
Definition: hardware.c:556
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define IDC_CONTROLLERCOMBO
Definition: resource.h:30
#define IDC_PLAYERCOMBO
Definition: resource.h:31
#define IDC_ACTIONLIST
Definition: resource.h:32
#define WM_DESTROY
Definition: winuser.h:1591
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LBN_DBLCLK
Definition: winuser.h:2053
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static void init_devices(HWND dialog, ConfigureDevicesData *data)
Definition: config.c:216
#define DWLP_USER
Definition: winuser.h:866
static void destroy_data(HWND dialog)
Definition: config.c:230
#define CB_SETCURSEL
Definition: winuser.h:1943
#define WM_COMMAND
Definition: winuser.h:1722
static int dialog_display_only(HWND dialog)
Definition: config.c:210
static void show_suitable_actions(HWND dialog)
Definition: config.c:296
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define IDC_RESET
Definition: resource.h:26
#define CBN_SELCHANGE
Definition: winuser.h:1961
static HWND dialog
Definition: gui.c:33
#define HIWORD(l)
Definition: typedefs.h:246
static void reset_actions(HWND dialog)
Definition: config.c:370
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define IDCANCEL
Definition: winuser.h:825
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 WM_NOTIFY
Definition: richedit.h:61
static void save_actions(HWND dialog)
Definition: config.c:384

Referenced by _configure_devices().

◆ destroy_data()

static void destroy_data ( HWND  dialog)
static

Definition at line 230 of file config.c.

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 }
#define GetWindowLongPtrW
Definition: winuser.h:4804
DIACTIONFORMATW * user_afs
Definition: config.c:37
int ndevices
Definition: config.c:41
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 IDirectInputDevice8_Release(p)
Definition: dinput.h:2036
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
#define GetProcessHeap()
Definition: compat.h:403
IDirectInputDevice8W * lpdid
Definition: config.c:32
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
DeviceData * devices
Definition: config.c:42
#define DWLP_USER
Definition: winuser.h:866
LPDIACTIONW rgoAction
Definition: dinput.h:1330
static HWND dialog
Definition: gui.c:33
#define HeapFree(x, y, z)
Definition: compat.h:402
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by ConfigureDevicesDlgProc().

◆ dialog_display_only()

static int dialog_display_only ( HWND  dialog)
static

Definition at line 210 of file config.c.

211 {
213  return data->display_only;
214 }
#define GetWindowLongPtrW
Definition: winuser.h:4804
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define DWLP_USER
Definition: winuser.h:866
static HWND dialog
Definition: gui.c:33

Referenced by ConfigureDevicesDlgProc().

◆ fill_device_object_list()

static void fill_device_object_list ( HWND  dialog)
static

Definition at line 248 of file config.c.

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 }
DWORD dwObjID
Definition: dinput.h:1284
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
static void lv_set_action(HWND dialog, int item, int action, LPDIACTIONFORMATW lpdiaf)
Definition: config.c:156
GUID guidInstance
Definition: dinput.h:1283
#define lstrlenW
Definition: compat.h:415
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
#define LVIF_TEXT
Definition: commctrl.h:2305
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
static DIACTIONFORMATW * get_cur_lpdiaf(HWND dialog)
Definition: config.c:196
Definition: devices.h:37
#define DIDFT_BUTTON
Definition: dinput.h:756
LONG_PTR LPARAM
Definition: windef.h:208
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
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_DEVICEOBJECTSLIST
Definition: resource.h:33
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DIDFT_AXIS
Definition: dinput.h:753
LPDIACTIONW rgoAction
Definition: dinput.h:1330
#define LVM_DELETEALLITEMS
Definition: commctrl.h:2409
static DeviceData * get_cur_device(HWND dialog)
Definition: config.c:189
#define LVM_INSERTITEMW
Definition: commctrl.h:2400
const WCHAR * action
Definition: action.c:7783
static ATOM item
Definition: dde.c:856
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static HWND dialog
Definition: gui.c:33
#define LVIF_PARAM
Definition: commctrl.h:2307
DWORD dwNumActions
Definition: dinput.h:1329
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define DIDFT_RELAXIS
Definition: dinput.h:751

Referenced by ConfigureDevicesDlgProc().

◆ get_cur_device()

static DeviceData* get_cur_device ( HWND  dialog)
static

Definition at line 189 of file config.c.

190 {
193  return &data->devices_data.devices[sel];
194 }
#define GetWindowLongPtrW
Definition: winuser.h:4804
#define CB_GETCURSEL
Definition: winuser.h:1925
#define IDC_CONTROLLERCOMBO
Definition: resource.h:30
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define DWLP_USER
Definition: winuser.h:866
static HWND dialog
Definition: gui.c:33

Referenced by assign_action(), fill_device_object_list(), and show_suitable_actions().

◆ get_cur_lpdiaf()

static DIACTIONFORMATW* get_cur_lpdiaf ( HWND  dialog)
static

Definition at line 196 of file config.c.

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 }
#define GetWindowLongPtrW
Definition: winuser.h:4804
#define CB_GETCURSEL
Definition: winuser.h:1925
#define IDC_CONTROLLERCOMBO
Definition: resource.h:30
#define IDC_PLAYERCOMBO
Definition: resource.h:31
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define DWLP_USER
Definition: winuser.h:866
static HWND dialog
Definition: gui.c:33

Referenced by assign_action(), and fill_device_object_list().

◆ get_original_lpdiaf()

static DIACTIONFORMATW* get_original_lpdiaf ( HWND  dialog)
static

Definition at line 204 of file config.c.

205 {
207  return data->original_lpdiaf;
208 }
#define GetWindowLongPtrW
Definition: winuser.h:4804
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define DWLP_USER
Definition: winuser.h:866
static HWND dialog
Definition: gui.c:33

Referenced by show_suitable_actions().

◆ init_devices()

static void init_devices ( HWND  dialog,
ConfigureDevicesData data 
)
static

Definition at line 216 of file config.c.

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 }
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 IDC_CONTROLLERCOMBO
Definition: resource.h:30
#define CB_ADDSTRING
Definition: winuser.h:1918
smooth NULL
Definition: ftsmooth.c:416
#define IDC_PLAYERCOMBO
Definition: resource.h:31
LONG_PTR LPARAM
Definition: windef.h:208
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define IDirectInput8_EnumDevicesBySemantics(p, a, b, c, d, e)
Definition: dinput.h:2519
static HWND dialog
Definition: gui.c:33
static BOOL CALLBACK collect_devices(LPCDIDEVICEINSTANCEW lpddi, IDirectInputDevice8W *lpdid, DWORD dwFlags, DWORD dwRemaining, LPVOID pvRef)
Definition: config.c:67

Referenced by ConfigureDevicesDlgProc().

◆ init_listview_columns()

static void init_listview_columns ( HWND  dialog)
static

Definition at line 110 of file config.c.

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 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define LVCF_WIDTH
Definition: commctrl.h:2583
#define LVCF_TEXT
Definition: commctrl.h:2584
LONG left
Definition: windef.h:306
HINSTANCE DINPUT_instance
Definition: dinput_main.c:98
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 LVCF_SUBITEM
Definition: commctrl.h:2585
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2628
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_OBJECTCOLUMN
Definition: resource.h:37
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
LPWSTR pszText
Definition: commctrl.h:2563
#define IDC_DEVICEOBJECTSLIST
Definition: resource.h:33
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int cchTextMax
Definition: commctrl.h:2564
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define ARRAY_SIZE(a)
Definition: main.h:24
static HWND dialog
Definition: gui.c:33
#define IDS_ACTIONCOLUMN
Definition: resource.h:36
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664

Referenced by ConfigureDevicesDlgProc().

◆ lv_get_cur_item()

static int lv_get_cur_item ( HWND  dialog)
static

Definition at line 136 of file config.c.

137 {
139 }
#define LVNI_SELECTED
Definition: commctrl.h:2420
#define IDC_DEVICEOBJECTSLIST
Definition: resource.h:33
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HWND dialog
Definition: gui.c:33
#define LVM_GETNEXTITEM
Definition: commctrl.h:2429

Referenced by assign_action(), and show_suitable_actions().

◆ lv_get_item_data()

static int lv_get_item_data ( HWND  dialog,
int  index 
)
static

Definition at line 141 of file config.c.

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 }
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
#define IDC_DEVICEOBJECTSLIST
Definition: resource.h:33
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define index(s, c)
Definition: various.h:29
static ATOM item
Definition: dde.c:856
static HWND dialog
Definition: gui.c:33
#define LVM_GETITEMW
Definition: commctrl.h:2386
#define LVIF_PARAM
Definition: commctrl.h:2307

Referenced by assign_action().

◆ lv_set_action()

static void lv_set_action ( HWND  dialog,
int  item,
int  action,
LPDIACTIONFORMATW  lpdiaf 
)
static

Definition at line 156 of file config.c.

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 }
#define lstrlenW
Definition: compat.h:415
#define LVIF_TEXT
Definition: commctrl.h:2305
int cchTextMax
Definition: commctrl.h:2362
int iSubItem
Definition: commctrl.h:2358
LPARAM lParam
Definition: commctrl.h:2364
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszText
Definition: commctrl.h:2361
#define IDC_DEVICEOBJECTSLIST
Definition: resource.h:33
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT mask
Definition: commctrl.h:2356
LPDIACTIONW rgoAction
Definition: dinput.h:1330
const WCHAR * action
Definition: action.c:7783
static ATOM item
Definition: dde.c:856
static HWND dialog
Definition: gui.c:33
#define LVM_SETITEMW
Definition: commctrl.h:2393
#define LVIF_PARAM
Definition: commctrl.h:2307
LPCWSTR lptszActionName
Definition: dinput.h:1280

Referenced by assign_action(), and fill_device_object_list().

◆ reset_actions()

static void reset_actions ( HWND  dialog)
static

Definition at line 370 of file config.c.

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 }
#define GetWindowLongPtrW
Definition: winuser.h:4804
#define IDirectInputDevice8_BuildActionMap(p, a, b, c)
Definition: dinput.h:2067
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
Definition: devices.h:37
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
#define for
Definition: utility.h:88
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
DeviceData * devices
Definition: config.c:42
#define DIDBAM_HWDEFAULTS
Definition: dinput.h:1355
#define DWLP_USER
Definition: winuser.h:866
static HWND dialog
Definition: gui.c:33

Referenced by ConfigureDevicesDlgProc().

◆ save_actions()

static void save_actions ( HWND  dialog)
static

Definition at line 384 of file config.c.

384  {
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 }
#define GetWindowLongPtrW
Definition: winuser.h:4804
int ndevices
Definition: config.c:41
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
Definition: devices.h:37
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
if(!(yy_init))
Definition: macro.lex.yy.c:714
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
DeviceData * devices
Definition: config.c:42
#define DWLP_USER
Definition: winuser.h:866
#define MB_ICONERROR
Definition: winuser.h:781
static HWND dialog
Definition: gui.c:33
#define DI_OK
Definition: dinput.h:128

Referenced by ConfigureDevicesDlgProc().

◆ show_suitable_actions()

static void show_suitable_actions ( HWND  dialog)
static

Definition at line 296 of file config.c.

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 }
#define LB_ADDSTRING
Definition: winuser.h:2013
static int lv_get_cur_item(HWND dialog)
Definition: config.c:136
#define DI8DEVTYPE_KEYBOARD
Definition: dinput.h:211
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
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
Definition: devices.h:37
#define IDC_ACTIONLIST
Definition: resource.h:32
LONG_PTR LPARAM
Definition: windef.h:208
#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 DIKEYBOARD_MASK
LPDIACTIONW rgoAction
Definition: dinput.h:1330
#define DIMOUSE_MASK
static DeviceData * get_cur_device(HWND dialog)
Definition: config.c:189
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
DWORD dwNumActions
Definition: dinput.h:1329
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
DWORD dwSemantic
Definition: dinput.h:1277
LPCWSTR lptszActionName
Definition: dinput.h:1280

Referenced by ConfigureDevicesDlgProc().