ReactOS 0.4.16-dev-106-g10b08aa
dinput_private.h File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "dinput.h"
#include "dinputd.h"
#include "wine/list.h"
Include dependency graph for dinput_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  IDirectInputImpl
 
struct  dinput_device
 
struct  DevicePlayer
 

Macros

#define IS_DIPROP(x)   (((ULONG_PTR)(x) >> 16) == 0)
 
#define DIKEYBOARD_MASK   0x81000000
 
#define DIMOUSE_MASK   0x82000000
 
#define DIGENRE_ANY   0xFF000000
 

Typedefs

typedef struct IDirectInputImpl IDirectInputImpl
 
typedef int(* DI_EVENT_PROC) (LPDIRECTINPUTDEVICE8A, WPARAM, LPARAM)
 

Functions

void check_dinput_hooks (LPDIRECTINPUTDEVICE8W, BOOL) DECLSPEC_HIDDEN
 
void check_dinput_events (void) DECLSPEC_HIDDEN
 
void _copy_diactionformatAtoW (LPDIACTIONFORMATW, LPDIACTIONFORMATA) DECLSPEC_HIDDEN
 
void _copy_diactionformatWtoA (LPDIACTIONFORMATA, LPDIACTIONFORMATW) DECLSPEC_HIDDEN
 
HRESULT _configure_devices (IDirectInput8W *iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData) DECLSPEC_HIDDEN
 
WCHARget_mapping_path (const WCHAR *device, const WCHAR *username) DECLSPEC_HIDDEN
 
DWORD get_device_type (DWORD version, BOOL is_joystick) DECLSPEC_HIDDEN
 

Variables

HINSTANCE DINPUT_instance
 
const struct dinput_device mouse_device DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ DIGENRE_ANY

#define DIGENRE_ANY   0xFF000000

Definition at line 90 of file dinput_private.h.

◆ DIKEYBOARD_MASK

#define DIKEYBOARD_MASK   0x81000000

Definition at line 88 of file dinput_private.h.

◆ DIMOUSE_MASK

#define DIMOUSE_MASK   0x82000000

Definition at line 89 of file dinput_private.h.

◆ IS_DIPROP

#define IS_DIPROP (   x)    (((ULONG_PTR)(x) >> 16) == 0)

Definition at line 86 of file dinput_private.h.

Typedef Documentation

◆ DI_EVENT_PROC

typedef int(* DI_EVENT_PROC) (LPDIRECTINPUTDEVICE8A, WPARAM, LPARAM)

Definition at line 76 of file dinput_private.h.

◆ IDirectInputImpl

Definition at line 33 of file dinput_private.h.

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

Referenced by IDirectInput8WImpl_ConfigureDevices().

◆ _copy_diactionformatAtoW()

void _copy_diactionformatAtoW ( LPDIACTIONFORMATW  to,
LPDIACTIONFORMATA  from 
)

Definition at line 339 of file dinput_main.c.

340{
341 int i;
342
343 to->dwSize = sizeof(DIACTIONFORMATW);
344 to->dwActionSize = sizeof(DIACTIONW);
345 to->dwDataSize = from->dwDataSize;
346 to->dwNumActions = from->dwNumActions;
347 to->guidActionMap = from->guidActionMap;
348 to->dwGenre = from->dwGenre;
349 to->dwBufferSize = from->dwBufferSize;
350 to->lAxisMin = from->lAxisMin;
351 to->lAxisMax = from->lAxisMax;
352 to->dwCRC = from->dwCRC;
353 to->ftTimeStamp = from->ftTimeStamp;
354
355 for (i=0; i < to->dwNumActions; i++)
356 {
357 to->rgoAction[i].uAppData = from->rgoAction[i].uAppData;
358 to->rgoAction[i].dwSemantic = from->rgoAction[i].dwSemantic;
359 to->rgoAction[i].dwFlags = from->rgoAction[i].dwFlags;
360 to->rgoAction[i].guidInstance = from->rgoAction[i].guidInstance;
361 to->rgoAction[i].dwObjID = from->rgoAction[i].dwObjID;
362 to->rgoAction[i].dwHow = from->rgoAction[i].dwHow;
363 }
364}
struct _DIACTIONW DIACTIONW
struct _DIACTIONFORMATW DIACTIONFORMATW
CardRegion * from
Definition: spigame.cpp:19
DWORD dwBufferSize
Definition: dinput.h:1333
LPDIACTIONW rgoAction
Definition: dinput.h:1330
FILETIME ftTimeStamp
Definition: dinput.h:1337
DWORD dwActionSize
Definition: dinput.h:1327
DWORD dwNumActions
Definition: dinput.h:1329
DWORD dwDataSize
Definition: dinput.h:1328
GUID guidActionMap
Definition: dinput.h:1331
DWORD dwFlags
Definition: dinput.h:1278
GUID guidInstance
Definition: dinput.h:1283
UINT_PTR uAppData
Definition: dinput.h:1276
DWORD dwHow
Definition: dinput.h:1285
DWORD dwSemantic
Definition: dinput.h:1277
DWORD dwObjID
Definition: dinput.h:1284

Referenced by IDirectInput8AImpl_ConfigureDevices(), JoystickAGenericImpl_BuildActionMap(), JoystickAGenericImpl_SetActionMap(), SysKeyboardAImpl_BuildActionMap(), SysKeyboardAImpl_SetActionMap(), SysMouseAImpl_BuildActionMap(), and SysMouseAImpl_SetActionMap().

◆ _copy_diactionformatWtoA()

void _copy_diactionformatWtoA ( LPDIACTIONFORMATA  to,
LPDIACTIONFORMATW  from 
)

Definition at line 366 of file dinput_main.c.

367{
368 int i;
369
370 to->dwSize = sizeof(DIACTIONFORMATA);
371 to->dwActionSize = sizeof(DIACTIONA);
372 to->dwDataSize = from->dwDataSize;
373 to->dwNumActions = from->dwNumActions;
374 to->guidActionMap = from->guidActionMap;
375 to->dwGenre = from->dwGenre;
376 to->dwBufferSize = from->dwBufferSize;
377 to->lAxisMin = from->lAxisMin;
378 to->lAxisMax = from->lAxisMax;
379 to->dwCRC = from->dwCRC;
380 to->ftTimeStamp = from->ftTimeStamp;
381
382 for (i=0; i < to->dwNumActions; i++)
383 {
384 to->rgoAction[i].uAppData = from->rgoAction[i].uAppData;
385 to->rgoAction[i].dwSemantic = from->rgoAction[i].dwSemantic;
386 to->rgoAction[i].dwFlags = from->rgoAction[i].dwFlags;
387 to->rgoAction[i].guidInstance = from->rgoAction[i].guidInstance;
388 to->rgoAction[i].dwObjID = from->rgoAction[i].dwObjID;
389 to->rgoAction[i].dwHow = from->rgoAction[i].dwHow;
390 }
391}
struct _DIACTIONFORMATA DIACTIONFORMATA
struct _DIACTIONA DIACTIONA
DWORD dwHow
Definition: dinput.h:1271
DWORD dwFlags
Definition: dinput.h:1264
DWORD dwObjID
Definition: dinput.h:1270
DWORD dwSemantic
Definition: dinput.h:1263
UINT_PTR uAppData
Definition: dinput.h:1262
GUID guidInstance
Definition: dinput.h:1269
DWORD dwDataSize
Definition: dinput.h:1310
LPDIACTIONA rgoAction
Definition: dinput.h:1312
DWORD dwBufferSize
Definition: dinput.h:1315
FILETIME ftTimeStamp
Definition: dinput.h:1319
DWORD dwNumActions
Definition: dinput.h:1311
DWORD dwActionSize
Definition: dinput.h:1309
GUID guidActionMap
Definition: dinput.h:1313

Referenced by IDirectInput8AImpl_ConfigureDevices(), JoystickAGenericImpl_BuildActionMap(), SysKeyboardAImpl_BuildActionMap(), and SysMouseAImpl_BuildActionMap().

◆ check_dinput_events()

void check_dinput_events ( void  )

Definition at line 1900 of file dinput_main.c.

1901{
1902 /* Windows does not do that, but our current implementation of winex11
1903 * requires periodic event polling to forward events to the wineserver.
1904 *
1905 * We have to call this function from multiple places, because:
1906 * - some games do not explicitly poll for mouse events
1907 * (for example Culpa Innata)
1908 * - some games only poll the device, and neither keyboard nor mouse
1909 * (for example Civilization: Call to Power 2)
1910 */
1911#ifndef __REACTOS__
1913#endif
1914}
#define QS_ALLINPUT
Definition: winuser.h:906
DWORD WINAPI MsgWaitForMultipleObjectsEx(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask, _In_ DWORD dwFlags)

Referenced by IDirectInputDevice2WImpl_Poll(), SysKeyboardWImpl_GetDeviceState(), and SysMouseWImpl_GetDeviceState().

◆ check_dinput_hooks()

void check_dinput_hooks ( LPDIRECTINPUTDEVICE8W  iface,
BOOL  acquired 
)

Definition at line 1863 of file dinput_main.c.

1864{
1865 static HHOOK callwndproc_hook;
1866 static ULONG foreground_cnt;
1868
1870
1871 if (dev->dwCoopLevel & DISCL_FOREGROUND)
1872 {
1873 if (acquired)
1874 foreground_cnt++;
1875 else
1876 foreground_cnt--;
1877 }
1878
1879 if (foreground_cnt && !callwndproc_hook)
1882 else if (!foreground_cnt && callwndproc_hook)
1883 {
1884 UnhookWindowsHookEx( callwndproc_hook );
1885 callwndproc_hook = NULL;
1886 }
1887
1888 if (hook_thread_event) /* if thread is not started yet */
1889 {
1893 }
1894
1896
1898}
#define DISCL_FOREGROUND
Definition: dinput.h:965
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: dinput_main.c:84
static LRESULT CALLBACK callwndproc_proc(int code, WPARAM wparam, LPARAM lparam)
Definition: dinput_main.c:1709
static CRITICAL_SECTION dinput_hook_crit
Definition: dinput_main.c:101
static HANDLE hook_thread_event
Definition: dinput_main.c:1818
static DWORD hook_thread_id
Definition: dinput_main.c:1817
#define CloseHandle
Definition: compat.h:739
#define INFINITE
Definition: serial.h:102
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
uint32_t ULONG
Definition: typedefs.h:59
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
HHOOK WINAPI SetWindowsHookExW(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_USER
Definition: winuser.h:1898
#define WH_CALLWNDPROC
Definition: winuser.h:34

Referenced by IDirectInputDevice2WImpl_Acquire(), and IDirectInputDevice2WImpl_Unacquire().

◆ get_device_type()

DWORD get_device_type ( DWORD  version,
BOOL  is_joystick 
)

Definition at line 107 of file joystick.c.

108{
109 if (is_joystick)
110 return version >= 0x0800 ? DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8) :
112
113 return version >= 0x0800 ? DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8) :
115}
#define DIDEVTYPE_JOYSTICK
Definition: dinput.h:200
#define DI8DEVTYPE_GAMEPAD
Definition: dinput.h:213
#define DIDEVTYPEJOYSTICK_TRADITIONAL
Definition: dinput.h:243
#define DIDEVTYPEJOYSTICK_GAMEPAD
Definition: dinput.h:245
#define DI8DEVTYPE_JOYSTICK
Definition: dinput.h:212
#define DI8DEVTYPEJOYSTICK_STANDARD
Definition: dinput.h:274
static const WCHAR version[]
Definition: asmname.c:66

◆ get_mapping_path()

WCHAR * get_mapping_path ( const WCHAR device,
const WCHAR username 
)

Variable Documentation

◆ DECLSPEC_HIDDEN

Definition at line 69 of file dinput_private.h.

◆ DINPUT_instance