ReactOS  0.4.14-dev-55-g2da92ac
config.c File Reference
#include "wine/unicode.h"
#include "objbase.h"
#include "dinput_private.h"
#include "device_private.h"
#include "resource.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 count_devices (LPCDIDEVICEINSTANCEW lpddi, IDirectInputDevice8W *lpdid, DWORD dwFlags, DWORD dwRemaining, 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 LPDIACTIONFORMATW get_cur_lpdiaf (HWND dialog)
 
static int dialog_display_only (HWND dialog)
 
static void init_devices (HWND dialog, IDirectInput8W *lpDI, DIDevicesData *data, LPDIACTIONFORMATW lpdiaf)
 
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 copy_actions (LPDIACTIONFORMATW to, LPDIACTIONFORMATW from)
 
static void reset_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 441 of file config.c.

447 {
449  data.lpDI = iface;
450  data.lpdiaf = lpdiCDParams->lprgFormats;
451  data.display_only = !(dwFlags & DICD_EDIT);
452 
454 
456  lpdiCDParams->hwnd, ConfigureDevicesDlgProc, (LPARAM)&data);
457 
458  return DI_OK;
459 }
#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:96
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPDIACTIONFORMATW lprgFormats
Definition: dinput.h:1401
#define DICD_EDIT
Definition: dinput.h:1364
#define IDD_CONFIGUREDEVICES
Definition: resource.h:23
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:351
#define DI_OK
Definition: dinput.h:128
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863

Referenced by IDirectInput8WImpl_ConfigureDevices().

◆ assign_action()

static void assign_action ( HWND  dialog)
static

Definition at line 291 of file config.c.

292 {
295  LVFINDINFOW lvFind;
298  int obj = lv_get_cur_item(dialog);
299  int old_action = lv_get_item_data(dialog, obj);
300  int used_obj;
301 
302  DIDEVICEOBJECTINSTANCEW ddo = device->ddo[obj];
303 
304  if (old_action == action) return;
305 
306  /* Clear old action */
307  if (old_action != -1)
308  {
309  lpdiaf->rgoAction[old_action].dwObjID = 0;
310  lpdiaf->rgoAction[old_action].guidInstance = GUID_NULL;
311  lpdiaf->rgoAction[old_action].dwHow = DIAH_UNMAPPED;
312  }
313 
314  /* Find if action text is already set for other object and unset it */
315  lvFind.flags = LVFI_PARAM;
316  lvFind.lParam = action;
317 
319 
320  lv_set_action(dialog, used_obj, -1, lpdiaf);
321 
322  /* Set new action */
323  lpdiaf->rgoAction[action].dwObjID = ddo.dwType;
324  lpdiaf->rgoAction[action].guidInstance = device->ddi.guidInstance;
326 
327  /* Set new action in the list */
328  lv_set_action(dialog, obj, action, lpdiaf);
329 }
DWORD dwObjID
Definition: dinput.h:1286
static int lv_get_cur_item(HWND dialog)
Definition: config.c:113
#define LVM_FINDITEMW
Definition: commctrl.h:2438
#define LB_GETITEMDATA
Definition: winuser.h:2023
LPARAM lParam
Definition: commctrl.h:2430
static void lv_set_action(HWND dialog, int item, int action, LPDIACTIONFORMATW lpdiaf)
Definition: config.c:133
GUID guidInstance
Definition: dinput.h:1285
static LPDIACTIONFORMATW get_cur_lpdiaf(HWND dialog)
Definition: config.c:173
#define LVFI_PARAM
Definition: commctrl.h:2408
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
Definition: devices.h:37
#define IDC_ACTIONLIST
Definition: resource.h:32
LONG_PTR LPARAM
Definition: windef.h:208
#define DIAH_UNMAPPED
Definition: dinput.h:1301
#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:1332
static DeviceData * get_cur_device(HWND dialog)
Definition: config.c:166
const WCHAR * action
Definition: action.c:7783
#define DIAH_USERCONFIG
Definition: dinput.h:1302
#define LB_GETCURSEL
Definition: winuser.h:2021
static HWND dialog
Definition: gui.c:33
DWORD dwHow
Definition: dinput.h:1287
static int lv_get_item_data(HWND dialog, int index)
Definition: config.c:118

Referenced by ConfigureDevicesDlgProc().

◆ collect_devices()

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

Definition at line 68 of file config.c.

69 {
70  DIDevicesData *data = (DIDevicesData*) pvRef;
71  DeviceData *device = &data->devices[data->ndevices];
72  device->lpdid = lpdid;
73  device->ddi = *lpddi;
74 
76 
77  device->nobjects = 0;
79 
80  data->ndevices++;
81  return DIENUM_CONTINUE;
82 }
static BOOL CALLBACK collect_objects(LPCDIDEVICEOBJECTINSTANCEW lpddo, LPVOID pvRef)
Definition: config.c:50
#define IDirectInputDevice_EnumObjects(p, a, b, c)
Definition: dinput.h:1607
#define IDirectInputDevice_AddRef(p)
Definition: dinput.h:1603
Definition: devices.h:37
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define DIENUM_CONTINUE
Definition: dinput.h:188
#define DIDFT_ALL
Definition: dinput.h:750

Referenced by init_devices().

◆ collect_objects()

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

Definition at line 50 of file config.c.

51 {
52  DeviceData *data = (DeviceData*) pvRef;
53 
54  data->ddo[data->nobjects] = *lpddo;
55 
56  data->nobjects++;
57  return DIENUM_CONTINUE;
58 }
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:31

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 351 of file config.c.

352 {
353  switch(uMsg)
354  {
355  case WM_INITDIALOG:
356  {
358 
359  /* Initialize action format and enumerate devices */
360  init_devices(dialog, data->lpDI, &data->devices_data, data->lpdiaf);
361 
362  /* Store information in the window */
364 
366 
367  /* Create a backup action format for CANCEL and RESET operations */
368  data->original_lpdiaf = HeapAlloc(GetProcessHeap(), 0, sizeof(*data->original_lpdiaf));
369  data->original_lpdiaf->dwNumActions = data->lpdiaf->dwNumActions;
370  data->original_lpdiaf->rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*data->lpdiaf->dwNumActions);
371  copy_actions(data->original_lpdiaf, data->lpdiaf);
372 
373  /* Select the first device and show its actions */
376 
377  break;
378  }
379 
380  case WM_NOTIFY:
381 
382  switch (((LPNMHDR)lParam)->code)
383  {
384  case LVN_ITEMCHANGED:
386  break;
387  }
388  break;
389 
390 
391  case WM_COMMAND:
392 
393  switch(LOWORD(wParam))
394  {
395 
396  case IDC_ACTIONLIST:
397 
398  switch (HIWORD(wParam))
399  {
400  case LBN_DBLCLK:
401  /* Ignore this if app did not ask for editing */
402  if (dialog_display_only(dialog)) break;
403 
405  break;
406  }
407  break;
408 
409  case IDC_CONTROLLERCOMBO:
410 
411  switch (HIWORD(wParam))
412  {
413  case CBN_SELCHANGE:
415  break;
416  }
417  break;
418 
419  case IDOK:
420  EndDialog(dialog, 0);
422  break;
423 
424  case IDCANCEL:
426  EndDialog(dialog, 0);
428  break;
429 
430  case IDC_RESET:
433  break;
434  }
435  break;
436  }
437 
438  return FALSE;
439 }
static void init_listview_columns(HWND dialog)
Definition: config.c:87
#define IDOK
Definition: winuser.h:824
static void assign_action(HWND dialog)
Definition: config.c:291
#define LVN_ITEMCHANGED
Definition: commctrl.h:3103
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define IDC_CONTROLLERCOMBO
Definition: resource.h:30
#define IDC_ACTIONLIST
Definition: resource.h:32
static void init_devices(HWND dialog, IDirectInput8W *lpDI, DIDevicesData *data, LPDIACTIONFORMATW lpdiaf)
Definition: config.c:185
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
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
#define DWLP_USER
Definition: winuser.h:866
static void destroy_data(HWND dialog)
Definition: config.c:204
#define CB_SETCURSEL
Definition: winuser.h:1943
#define WM_COMMAND
Definition: winuser.h:1722
static int dialog_display_only(HWND dialog)
Definition: config.c:179
static void copy_actions(LPDIACTIONFORMATW to, LPDIACTIONFORMATW from)
Definition: config.c:331
static void show_suitable_actions(HWND dialog)
Definition: config.c:260
__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:343
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define IDCANCEL
Definition: winuser.h:825
static void fill_device_object_list(HWND dialog)
Definition: config.c:221
#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

Referenced by _configure_devices().

◆ copy_actions()

static void copy_actions ( LPDIACTIONFORMATW  to,
LPDIACTIONFORMATW  from 
)
static

Definition at line 331 of file config.c.

332 {
333  DWORD i;
334  for (i=0; i < from->dwNumActions; i++)
335  {
336  to->rgoAction[i].guidInstance = from->rgoAction[i].guidInstance;
337  to->rgoAction[i].dwObjID = from->rgoAction[i].dwObjID;
338  to->rgoAction[i].dwHow = from->rgoAction[i].dwHow;
339  to->rgoAction[i].u.lptszActionName = from->rgoAction[i].u.lptszActionName;
340  }
341 }
DWORD dwObjID
Definition: dinput.h:1286
GUID guidInstance
Definition: dinput.h:1285
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
unsigned long DWORD
Definition: ntddk_ex.h:95
LPDIACTIONW rgoAction
Definition: dinput.h:1332
DWORD dwHow
Definition: dinput.h:1287
CardRegion * from
Definition: spigame.cpp:19
LPCWSTR lptszActionName
Definition: dinput.h:1282

Referenced by ConfigureDevicesDlgProc(), and reset_actions().

◆ count_devices()

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

Definition at line 60 of file config.c.

61 {
62  DIDevicesData *data = (DIDevicesData*) pvRef;
63 
64  data->ndevices++;
65  return DIENUM_CONTINUE;
66 }
int ndevices
Definition: config.c:35
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define DIENUM_CONTINUE
Definition: dinput.h:188

Referenced by init_devices().

◆ destroy_data()

static void destroy_data ( HWND  dialog)
static

Definition at line 204 of file config.c.

205 {
206  int i;
208  DIDevicesData *devices_data = &data->devices_data;
209 
210  /* Free the devices */
211  for (i=0; i < devices_data->ndevices; i++)
212  IDirectInputDevice8_Release(devices_data->devices[i].lpdid);
213 
214  HeapFree(GetProcessHeap(), 0, devices_data->devices);
215 
216  /* Free the backup LPDIACTIONFORMATW */
217  HeapFree(GetProcessHeap(), 0, data->original_lpdiaf->rgoAction);
218  HeapFree(GetProcessHeap(), 0, data->original_lpdiaf);
219 }
#define GetWindowLongPtrW
Definition: winuser.h:4730
int ndevices
Definition: config.c:35
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:2038
#define GetProcessHeap()
Definition: compat.h:395
IDirectInputDevice8W * lpdid
Definition: config.c:29
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
DeviceData * devices
Definition: config.c:36
#define DWLP_USER
Definition: winuser.h:866
static HWND dialog
Definition: gui.c:33
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by ConfigureDevicesDlgProc().

◆ dialog_display_only()

static int dialog_display_only ( HWND  dialog)
static

Definition at line 179 of file config.c.

180 {
182  return data->display_only;
183 }
#define GetWindowLongPtrW
Definition: winuser.h:4730
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 221 of file config.c.

222 {
225  LVITEMW item;
226  int i, j;
227 
228  /* Clean the listview */
230 
231  /* Add each object */
232  for (i=0; i < device->nobjects; i++)
233  {
234  int action = -1;
235 
236  item.mask = LVIF_TEXT | LVIF_PARAM;
237  item.iItem = i;
238  item.iSubItem = 0;
239  item.pszText = device->ddo[i].tszName;
240  item.cchTextMax = lstrlenW(item.pszText);
241 
242  /* Add the item */
244 
245  /* Search for an assigned action for this device */
246  for (j=0; j < lpdiaf->dwNumActions; j++)
247  {
248  if (IsEqualGUID(&lpdiaf->rgoAction[j].guidInstance, &device->ddi.guidInstance) &&
249  lpdiaf->rgoAction[j].dwObjID == device->ddo[i].dwType)
250  {
251  action = j;
252  break;
253  }
254  }
255 
256  lv_set_action(dialog, i, action, lpdiaf);
257  }
258 }
DWORD dwObjID
Definition: dinput.h:1286
static void lv_set_action(HWND dialog, int item, int action, LPDIACTIONFORMATW lpdiaf)
Definition: config.c:133
GUID guidInstance
Definition: dinput.h:1285
static LPDIACTIONFORMATW get_cur_lpdiaf(HWND dialog)
Definition: config.c:173
#define lstrlenW
Definition: compat.h:407
#define LVIF_TEXT
Definition: commctrl.h:2281
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
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
#define IDC_DEVICEOBJECTSLIST
Definition: resource.h:33
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPDIACTIONW rgoAction
Definition: dinput.h:1332
#define LVM_DELETEALLITEMS
Definition: commctrl.h:2385
static DeviceData * get_cur_device(HWND dialog)
Definition: config.c:166
#define LVM_INSERTITEMW
Definition: commctrl.h:2376
const WCHAR * action
Definition: action.c:7783
static ATOM item
Definition: dde.c:856
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static HWND dialog
Definition: gui.c:33
#define LVIF_PARAM
Definition: commctrl.h:2283
DWORD dwNumActions
Definition: dinput.h:1331

Referenced by ConfigureDevicesDlgProc().

◆ get_cur_device()

static DeviceData* get_cur_device ( HWND  dialog)
static

Definition at line 166 of file config.c.

167 {
170  return &data->devices_data.devices[sel];
171 }
#define GetWindowLongPtrW
Definition: winuser.h:4730
#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 LPDIACTIONFORMATW get_cur_lpdiaf ( HWND  dialog)
static

Definition at line 173 of file config.c.

174 {
176  return data->lpdiaf;
177 }
#define GetWindowLongPtrW
Definition: winuser.h:4730
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().

◆ init_devices()

static void init_devices ( HWND  dialog,
IDirectInput8W *  lpDI,
DIDevicesData data,
LPDIACTIONFORMATW  lpdiaf 
)
static

Definition at line 185 of file config.c.

186 {
187  int i;
188 
189  /* Count devices */
190  data->ndevices = 0;
192 
193  /* Allocate devices */
194  data->devices = HeapAlloc(GetProcessHeap(), 0, sizeof(DeviceData) * data->ndevices);
195 
196  /* Collect and insert */
197  data->ndevices = 0;
199 
200  for (i=0; i < data->ndevices; i++)
201  SendDlgItemMessageW(dialog, IDC_CONTROLLERCOMBO, CB_ADDSTRING, 0, (LPARAM) data->devices[i].ddi.tszProductName );
202 }
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
LONG_PTR LPARAM
Definition: windef.h:208
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
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:2466
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:68
static BOOL CALLBACK count_devices(LPCDIDEVICEINSTANCEW lpddi, IDirectInputDevice8W *lpdid, DWORD dwFlags, DWORD dwRemaining, LPVOID pvRef)
Definition: config.c:60

Referenced by ConfigureDevicesDlgProc().

◆ init_listview_columns()

static void init_listview_columns ( HWND  dialog)
static

Definition at line 87 of file config.c.

88 {
89  LVCOLUMNW listColumn;
90  RECT viewRect;
91  int width;
93 
95  width = (viewRect.right - viewRect.left)/2;
96 
98  listColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
99  listColumn.pszText = column;
100  listColumn.cchTextMax = lstrlenW(listColumn.pszText);
101  listColumn.cx = width;
102 
104 
106  listColumn.cx = width;
107  listColumn.pszText = column;
108  listColumn.cchTextMax = lstrlenW(listColumn.pszText);
109 
111 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define LVCF_WIDTH
Definition: commctrl.h:2559
#define LVCF_TEXT
Definition: commctrl.h:2560
LONG left
Definition: windef.h:291
HINSTANCE DINPUT_instance
Definition: dinput_main.c:96
LONG right
Definition: windef.h:293
#define lstrlenW
Definition: compat.h:407
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:2561
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2604
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:2539
#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:2540
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 113 of file config.c.

114 {
116 }
#define LVNI_SELECTED
Definition: commctrl.h:2396
#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:2405

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 118 of file config.c.

119 {
120  LVITEMW item;
121 
122  if (index < 0) return -1;
123 
124  item.mask = LVIF_PARAM;
125  item.iItem = index;
126  item.iSubItem = 0;
127 
129 
130  return item.lParam;
131 }
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:2362
#define LVIF_PARAM
Definition: commctrl.h:2283

Referenced by assign_action().

◆ lv_set_action()

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

Definition at line 133 of file config.c.

134 {
135  static const WCHAR no_action[] = {'-','\0'};
136  const WCHAR *action_text = no_action;
137  LVITEMW lvItem;
138 
139  if (item < 0) return;
140 
141  if (action != -1)
142  action_text = lpdiaf->rgoAction[action].u.lptszActionName;
143 
144  /* Keep the action and text in the listview item */
145  lvItem.iItem = item;
146 
147  lvItem.mask = LVIF_PARAM;
148  lvItem.iSubItem = 0;
149  lvItem.lParam = (LPARAM) action;
150 
151  /* Action index */
153 
154  lvItem.mask = LVIF_TEXT;
155  lvItem.iSubItem = 1;
156  lvItem.pszText = (WCHAR *)action_text;
157  lvItem.cchTextMax = lstrlenW(lvItem.pszText);
158 
159  /* Text */
161 }
#define lstrlenW
Definition: compat.h:407
#define LVIF_TEXT
Definition: commctrl.h:2281
int cchTextMax
Definition: commctrl.h:2338
int iSubItem
Definition: commctrl.h:2334
LPARAM lParam
Definition: commctrl.h:2340
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszText
Definition: commctrl.h:2337
#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:2332
LPDIACTIONW rgoAction
Definition: dinput.h:1332
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:2369
#define LVIF_PARAM
Definition: commctrl.h:2283
LPCWSTR lptszActionName
Definition: dinput.h:1282

Referenced by assign_action(), and fill_device_object_list().

◆ reset_actions()

static void reset_actions ( HWND  dialog)
static

Definition at line 343 of file config.c.

344 {
346  LPDIACTIONFORMATW to = data->lpdiaf, from = data->original_lpdiaf;
347 
348  copy_actions(to, from);
349 }
#define GetWindowLongPtrW
Definition: winuser.h:4730
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define DWLP_USER
Definition: winuser.h:866
static void copy_actions(LPDIACTIONFORMATW to, LPDIACTIONFORMATW from)
Definition: config.c:331
static HWND dialog
Definition: gui.c:33
CardRegion * from
Definition: spigame.cpp:19

Referenced by ConfigureDevicesDlgProc().

◆ show_suitable_actions()

static void show_suitable_actions ( HWND  dialog)
static

Definition at line 260 of file config.c.

261 {
264  int i, added = 0;
265  int obj = lv_get_cur_item(dialog);
266 
267  if (obj < 0) return;
268 
270 
271  for (i=0; i < lpdiaf->dwNumActions; i++)
272  {
273  /* Skip keyboard actions for non keyboards */
274  if (GET_DIDEVICE_TYPE(device->ddi.dwDevType) != DI8DEVTYPE_KEYBOARD &&
275  (lpdiaf->rgoAction[i].dwSemantic & DIKEYBOARD_MASK) == DIKEYBOARD_MASK) continue;
276 
277  /* Skip mouse actions for non mouses */
278  if (GET_DIDEVICE_TYPE(device->ddi.dwDevType) != DI8DEVTYPE_MOUSE &&
279  (lpdiaf->rgoAction[i].dwSemantic & DIMOUSE_MASK) == DIMOUSE_MASK) continue;
280 
281  /* Add action string and index in the action format to the list entry */
282  if (DIDFT_GETINSTANCE(lpdiaf->rgoAction[i].dwSemantic) & DIDFT_GETTYPE(device->ddo[obj].dwType))
283  {
286  added++;
287  }
288  }
289 }
#define LB_ADDSTRING
Definition: winuser.h:2013
static int lv_get_cur_item(HWND dialog)
Definition: config.c:113
#define DI8DEVTYPE_KEYBOARD
Definition: dinput.h:211
static LPDIACTIONFORMATW get_cur_lpdiaf(HWND dialog)
Definition: config.c:173
#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:1332
#define DIMOUSE_MASK
static DeviceData * get_cur_device(HWND dialog)
Definition: config.c:166
#define DI8DEVTYPE_MOUSE
Definition: dinput.h:210
static HWND dialog
Definition: gui.c:33
DWORD dwNumActions
Definition: dinput.h:1331
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
DWORD dwSemantic
Definition: dinput.h:1279
LPCWSTR lptszActionName
Definition: dinput.h:1282

Referenced by ConfigureDevicesDlgProc().