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

Go to the source code of this file.

Classes

struct  DataTransform
 
struct  DataFormat
 
struct  ActionMap
 
struct  IDirectInputDeviceImpl
 
struct  ObjProps
 
struct  effect_list_item
 

Typedefs

typedef struct IDirectInputDeviceImpl IDirectInputDeviceImpl
 

Functions

BOOL get_app_key (HKEY *, HKEY *) DECLSPEC_HIDDEN
 
DWORD get_config_key (HKEY, HKEY, const char *, char *, DWORD) DECLSPEC_HIDDEN
 
void fill_DataFormat (void *out, DWORD size, const void *in, const DataFormat *df) DECLSPEC_HIDDEN
 
void release_DataFormat (DataFormat *df) DECLSPEC_HIDDEN
 
void queue_event (LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq) DECLSPEC_HIDDEN
 
int id_to_object (LPCDIDATAFORMAT df, int id) DECLSPEC_HIDDEN
 
int find_property (const DataFormat *df, LPCDIPROPHEADER ph) DECLSPEC_HIDDEN
 
DWORD joystick_map_pov (const POINTL *p) DECLSPEC_HIDDEN
 
LONG joystick_map_axis (ObjProps *props, int val) DECLSPEC_HIDDEN
 
void _dump_DIPROPHEADER (LPCDIPROPHEADER diph) DECLSPEC_HIDDEN
 
void _dump_OBJECTINSTANCEA (const DIDEVICEOBJECTINSTANCEA *ddoi) DECLSPEC_HIDDEN
 
void _dump_OBJECTINSTANCEW (const DIDEVICEOBJECTINSTANCEW *ddoi) DECLSPEC_HIDDEN
 
void _dump_DIDATAFORMAT (const DIDATAFORMAT *df) DECLSPEC_HIDDEN
 
const char_dump_dinput_GUID (const GUID *guid) DECLSPEC_HIDDEN
 
LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type (LPCDIDATAFORMAT df, int n, DWORD type) DECLSPEC_HIDDEN
 
HRESULT save_mapping_settings (IDirectInputDevice8W *iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUsername) DECLSPEC_HIDDEN
 
BOOL load_mapping_settings (IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username) DECLSPEC_HIDDEN
 
HRESULT _build_action_map (LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN
 
HRESULT _set_action_map (LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_Acquire (LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_Acquire (LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire (LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire (LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat (LPDIRECTINPUTDEVICE8A iface, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat (LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel (LPDIRECTINPUTDEVICE8A iface, HWND hwnd, DWORD dwflags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel (LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification (LPDIRECTINPUTDEVICE8A iface, HANDLE hnd) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification (LPDIRECTINPUTDEVICE8W iface, HANDLE hnd) DECLSPEC_HIDDEN
 
ULONG WINAPI IDirectInputDevice2AImpl_Release (LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN
 
ULONG WINAPI IDirectInputDevice2WImpl_Release (LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface (LPDIRECTINPUTDEVICE8A iface, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface (LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN
 
ULONG WINAPI IDirectInputDevice2AImpl_AddRef (LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN
 
ULONG WINAPI IDirectInputDevice2WImpl_AddRef (LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects (LPDIRECTINPUTDEVICE8A iface, LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects (LPDIRECTINPUTDEVICE8W iface, LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty (LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty (LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty (LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty (LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo (LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo (LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData (LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData (LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel (LPDIRECTINPUTDEVICE8A iface, HWND hwndOwner, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel (LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_Initialize (LPDIRECTINPUTDEVICE8A iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_Initialize (LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect (LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect (LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects (LPDIRECTINPUTDEVICE8A iface, LPDIENUMEFFECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects (LPDIRECTINPUTDEVICE8W iface, LPDIENUMEFFECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo (LPDIRECTINPUTDEVICE8A iface, LPDIEFFECTINFOA lpdei, REFGUID rguid) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo (LPDIRECTINPUTDEVICE8W iface, LPDIEFFECTINFOW lpdei, REFGUID rguid) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState (LPDIRECTINPUTDEVICE8A iface, LPDWORD pdwOut) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState (LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand (LPDIRECTINPUTDEVICE8A iface, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand (LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects (LPDIRECTINPUTDEVICE8A iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects (LPDIRECTINPUTDEVICE8W iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_Escape (LPDIRECTINPUTDEVICE8A iface, LPDIEFFESCAPE lpDIEEsc) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_Escape (LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_Poll (LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_Poll (LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData (LPDIRECTINPUTDEVICE8A iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData (LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile (LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile (LPDIRECTINPUTDEVICE8W iface, LPCWSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile (LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile (LPDIRECTINPUTDEVICE8W iface, LPCWSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap (LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo (LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader) DECLSPEC_HIDDEN
 
HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo (LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader) DECLSPEC_HIDDEN
 

Variables

const GUID DInput_PIDVID_Product_GUID DECLSPEC_HIDDEN
 

Typedef Documentation

◆ IDirectInputDeviceImpl

Function Documentation

◆ _build_action_map()

HRESULT _build_action_map ( LPDIRECTINPUTDEVICE8W  iface,
LPDIACTIONFORMATW  lpdiaf,
LPCWSTR  lpszUserName,
DWORD  dwFlags,
DWORD  devMask,
LPCDIDATAFORMAT  df 
)

Definition at line 791 of file device.c.

792{
795 DWORD username_size = MAX_PATH;
796 int i;
797 BOOL load_success = FALSE, has_actions = FALSE;
798
799 /* Unless asked the contrary by these flags, try to load a previous mapping */
800 if (!(dwFlags & DIDBAM_HWDEFAULTS))
801 {
802 /* Retrieve logged user name if necessary */
803 if (lpszUserName == NULL)
804 GetUserNameW(username, &username_size);
805 else
806 lstrcpynW(username, lpszUserName, MAX_PATH);
807
808 load_success = load_mapping_settings(This, lpdiaf, username);
809 }
810
811 if (load_success) {
812 /* Update dwCRC to track if action format has changed */
813 for (i=0; i < lpdiaf->dwNumActions; i++)
814 {
815 lpdiaf->dwCRC ^= (lpdiaf->rgoAction[i].dwObjID << i * 2) | (lpdiaf->rgoAction[i].dwObjID >> (sizeof(lpdiaf->dwCRC) * 8 - i * 2));
816 lpdiaf->dwCRC ^= (lpdiaf->rgoAction[i].dwSemantic << (i * 2 + 5)) | (lpdiaf->rgoAction[i].dwSemantic >> (sizeof(lpdiaf->dwCRC) * 8 - (i * 2 + 5)));
817 }
818 return DI_OK;
819 }
820
821 for (i=0; i < lpdiaf->dwNumActions; i++)
822 {
823 if ((lpdiaf->rgoAction[i].dwSemantic & devMask) == devMask)
824 {
826 DWORD type = DIDFT_GETTYPE(obj_id);
827 DWORD inst = DIDFT_GETINSTANCE(obj_id);
828
830
833
834 /* Make sure the object exists */
835 odf = dataformat_to_odf_by_type(df, inst, type);
836
837 if (odf != NULL)
838 {
839 lpdiaf->rgoAction[i].dwObjID = obj_id;
840 lpdiaf->rgoAction[i].guidInstance = This->guid;
841 lpdiaf->rgoAction[i].dwHow = DIAH_DEFAULT;
842 has_actions = TRUE;
843 }
844 }
845 else if (!(dwFlags & DIDBAM_PRESERVE))
846 {
847 /* We must clear action data belonging to other devices */
848 memset(&lpdiaf->rgoAction[i].guidInstance, 0, sizeof(GUID));
849 lpdiaf->rgoAction[i].dwHow = DIAH_UNMAPPED;
850 }
851 }
852
853 /* Update dwCRC to track if action format has changed */
854 lpdiaf->dwCRC = 0;
855 for (i=0; i < lpdiaf->dwNumActions; i++)
856 {
857 lpdiaf->dwCRC ^= (lpdiaf->rgoAction[i].dwObjID << i * 2) | (lpdiaf->rgoAction[i].dwObjID >> (sizeof(lpdiaf->dwCRC) * 8 - i * 2));
858 lpdiaf->dwCRC ^= (lpdiaf->rgoAction[i].dwSemantic << (i * 2 + 5)) | (lpdiaf->rgoAction[i].dwSemantic >> (sizeof(lpdiaf->dwCRC) * 8 - (i * 2 + 5)));
859 }
860
861 if (!has_actions) return DI_NOEFFECT;
862
863 return IDirectInputDevice8WImpl_BuildActionMap(iface, lpdiaf, lpszUserName, dwFlags);
864}
#define DIAH_UNMAPPED
Definition: dinput.h:1299
#define DIDBAM_HWDEFAULTS
Definition: dinput.h:1355
#define DIDFT_RELAXIS
Definition: dinput.h:751
#define DIDBAM_PRESERVE
Definition: dinput.h:1353
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define DIAH_DEFAULT
Definition: dinput.h:1304
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
#define DIDFT_AXIS
Definition: dinput.h:753
#define DI_OK
Definition: dinput.h:128
#define DI_NOEFFECT
Definition: dinput.h:132
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
#define DIDFT_BUTTON
Definition: dinput.h:756
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD type)
Definition: device.c:412
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
static DWORD semantic_to_obj_id(IDirectInputDeviceImpl *This, DWORD dwSemantic)
Definition: device.c:619
HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
Definition: device.c:1924
BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username)
Definition: device.c:740
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define MAX_PATH
Definition: compat.h:34
#define lstrcpynW
Definition: compat.h:738
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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
#define memset(x, y, z)
Definition: compat.h:39
LPDIACTIONW rgoAction
Definition: dinput.h:1330
DWORD dwNumActions
Definition: dinput.h:1329
GUID guidInstance
Definition: dinput.h:1283
DWORD dwHow
Definition: dinput.h:1285
DWORD dwSemantic
Definition: dinput.h:1277
DWORD dwObjID
Definition: dinput.h:1284
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by SysKeyboardWImpl_BuildActionMap(), and SysMouseWImpl_BuildActionMap().

◆ _dump_DIDATAFORMAT()

void _dump_DIDATAFORMAT ( const DIDATAFORMAT df)

Definition at line 242 of file device.c.

242 {
243 unsigned int i;
244
245 TRACE("Dumping DIDATAFORMAT structure:\n");
246 TRACE(" - dwSize: %d\n", df->dwSize);
247 if (df->dwSize != sizeof(DIDATAFORMAT)) {
248 WARN("Non-standard DIDATAFORMAT structure size %d\n", df->dwSize);
249 }
250 TRACE(" - dwObjsize: %d\n", df->dwObjSize);
251 if (df->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) {
252 WARN("Non-standard DIOBJECTDATAFORMAT structure size %d\n", df->dwObjSize);
253 }
254 TRACE(" - dwFlags: 0x%08x (", df->dwFlags);
255 switch (df->dwFlags) {
256 case DIDF_ABSAXIS: TRACE("DIDF_ABSAXIS"); break;
257 case DIDF_RELAXIS: TRACE("DIDF_RELAXIS"); break;
258 default: TRACE("unknown"); break;
259 }
260 TRACE(")\n");
261 TRACE(" - dwDataSize: %d\n", df->dwDataSize);
262 TRACE(" - dwNumObjs: %d\n", df->dwNumObjs);
263
264 for (i = 0; i < df->dwNumObjs; i++) {
265 TRACE(" - Object %d:\n", i);
266 TRACE(" * GUID: %s ('%s')\n", debugstr_guid(df->rgodf[i].pguid), _dump_dinput_GUID(df->rgodf[i].pguid));
267 TRACE(" * dwOfs: %d\n", df->rgodf[i].dwOfs);
268 TRACE(" * dwType: 0x%08x\n", df->rgodf[i].dwType);
269 TRACE(" "); _dump_EnumObjects_flags(df->rgodf[i].dwType); TRACE("\n");
270 TRACE(" * dwFlags: 0x%08x\n", df->rgodf[i].dwFlags);
272 }
273}
#define WARN(fmt,...)
Definition: precomp.h:61
#define DIDF_RELAXIS
Definition: dinput.h:776
#define DIDF_ABSAXIS
Definition: dinput.h:775
static void _dump_ObjectDataFormat_flags(DWORD dwFlags)
Definition: device.c:91
static void _dump_EnumObjects_flags(DWORD dwFlags)
Definition: device.c:127
const char * _dump_dinput_GUID(const GUID *guid)
Definition: device.c:197
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LPDIOBJECTDATAFORMAT rgodf
Definition: dinput.h:813
DWORD dwFlags
Definition: dinput.h:810
DWORD dwSize
Definition: dinput.h:808
DWORD dwObjSize
Definition: dinput.h:809
DWORD dwDataSize
Definition: dinput.h:811
DWORD dwNumObjs
Definition: dinput.h:812
const GUID * pguid
Definition: dinput.h:800

Referenced by IDirectInputDevice2WImpl_SetDataFormat().

◆ _dump_dinput_GUID()

const char * _dump_dinput_GUID ( const GUID guid)

Definition at line 197 of file device.c.

197 {
198 unsigned int i;
199 static const struct {
200 const GUID *guid;
201 const char *name;
202 } guids[] = {
203#define FE(x) { &x, #x}
204 FE(GUID_XAxis),
205 FE(GUID_YAxis),
206 FE(GUID_ZAxis),
207 FE(GUID_RxAxis),
208 FE(GUID_RyAxis),
209 FE(GUID_RzAxis),
210 FE(GUID_Slider),
211 FE(GUID_Button),
212 FE(GUID_Key),
213 FE(GUID_POV),
214 FE(GUID_Unknown),
215 FE(GUID_SysMouse),
216 FE(GUID_SysKeyboard),
217 FE(GUID_Joystick),
218 FE(GUID_ConstantForce),
219 FE(GUID_RampForce),
220 FE(GUID_Square),
221 FE(GUID_Sine),
222 FE(GUID_Triangle),
223 FE(GUID_SawtoothUp),
224 FE(GUID_SawtoothDown),
225 FE(GUID_Spring),
226 FE(GUID_Damper),
227 FE(GUID_Inertia),
228 FE(GUID_Friction),
229 FE(GUID_CustomForce)
230#undef FE
231 };
232 if (guid == NULL)
233 return "null GUID";
234 for (i = 0; i < ARRAY_SIZE(guids); i++) {
235 if (IsEqualGUID(guids[i].guid, guid)) {
236 return guids[i].name;
237 }
238 }
239 return debugstr_guid(guid);
240}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FE(x)
const GUID * guid
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
char * name
Definition: compiler.c:66
Definition: name.c:39

Referenced by _dump_DIDATAFORMAT(), _dump_OBJECTINSTANCEA(), _dump_OBJECTINSTANCEW(), create_DataFormat(), and typeFromGUID().

◆ _dump_DIPROPHEADER()

void _dump_DIPROPHEADER ( LPCDIPROPHEADER  diph)

Definition at line 176 of file device.c.

176 {
177 if (TRACE_ON(dinput)) {
178 TRACE(" - dwObj = 0x%08x\n", diph->dwObj);
179 TRACE(" - dwHow = %s\n",
180 ((diph->dwHow == DIPH_DEVICE) ? "DIPH_DEVICE" :
181 ((diph->dwHow == DIPH_BYOFFSET) ? "DIPH_BYOFFSET" :
182 ((diph->dwHow == DIPH_BYID)) ? "DIPH_BYID" : "unknown")));
183 }
184}
#define DIPH_BYOFFSET
Definition: dinput.h:836
#define DIPH_BYID
Definition: dinput.h:837
#define DIPH_DEVICE
Definition: dinput.h:835
#define TRACE_ON(x)
Definition: compat.h:75
DWORD dwObj
Definition: dinput.h:830
DWORD dwHow
Definition: dinput.h:831

Referenced by IDirectInputDevice2WImpl_GetProperty(), IDirectInputDevice2WImpl_SetProperty(), JoystickWGenericImpl_GetProperty(), JoystickWGenericImpl_SetProperty(), SysKeyboardWImpl_GetProperty(), and SysMouseWImpl_GetProperty().

◆ _dump_OBJECTINSTANCEA()

void _dump_OBJECTINSTANCEA ( const DIDEVICEOBJECTINSTANCEA ddoi)

Definition at line 186 of file device.c.

186 {
187 TRACE(" - enumerating : %s ('%s') - %2d - 0x%08x - %s - 0x%x\n",
188 debugstr_guid(&ddoi->guidType), _dump_dinput_GUID(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, ddoi->tszName, ddoi->dwFlags);
189}
CHAR tszName[MAX_PATH]
Definition: dinput.h:352

Referenced by SysKeyboardAImpl_GetObjectInfo().

◆ _dump_OBJECTINSTANCEW()

void _dump_OBJECTINSTANCEW ( const DIDEVICEOBJECTINSTANCEW ddoi)

Definition at line 191 of file device.c.

191 {
192 TRACE(" - enumerating : %s ('%s'), - %2d - 0x%08x - %s - 0x%x\n",
193 debugstr_guid(&ddoi->guidType), _dump_dinput_GUID(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, debugstr_w(ddoi->tszName), ddoi->dwFlags);
194}
#define debugstr_w
Definition: kernel32.h:32
WCHAR tszName[MAX_PATH]
Definition: dinput.h:371

Referenced by JoystickWGenericImpl_GetObjectInfo(), SysKeyboardWImpl_GetObjectInfo(), and SysMouseWImpl_GetObjectInfo().

◆ _set_action_map()

HRESULT _set_action_map ( LPDIRECTINPUTDEVICE8W  iface,
LPDIACTIONFORMATW  lpdiaf,
LPCWSTR  lpszUserName,
DWORD  dwFlags,
LPCDIDATAFORMAT  df 
)

Definition at line 866 of file device.c.

867{
870 DIOBJECTDATAFORMAT *obj_df = NULL;
871 DIPROPDWORD dp;
872 DIPROPRANGE dpr;
873 DIPROPSTRING dps;
875 DWORD username_size = MAX_PATH;
876 DWORD new_crc = 0;
877 int i, action = 0, num_actions = 0;
878 unsigned int offset = 0;
879
880 if (This->acquired) return DIERR_ACQUIRED;
881
886
887 /* Calculate checksum for actionformat */
888 for (i=0; i < lpdiaf->dwNumActions; i++)
889 {
890 new_crc ^= (lpdiaf->rgoAction[i].dwObjID << i * 2) | (lpdiaf->rgoAction[i].dwObjID >> (sizeof(lpdiaf->dwCRC) * 8 - i * 2));
891 new_crc ^= (lpdiaf->rgoAction[i].dwSemantic << (i * 2 + 5)) | (lpdiaf->rgoAction[i].dwSemantic >> (sizeof(lpdiaf->dwCRC) * 8 - (i * 2 + 5)));
892 }
893
894 /* Count the actions */
895 for (i=0; i < lpdiaf->dwNumActions; i++)
896 {
897 if (IsEqualGUID(&This->guid, &lpdiaf->rgoAction[i].guidInstance) ||
899 ((lpdiaf->rgoAction[i].dwSemantic & lpdiaf->dwGenre) == lpdiaf->dwGenre ||
900 (lpdiaf->rgoAction[i].dwSemantic & 0xff000000) == 0xff000000 /* Any Axis */) ))
901 {
902 num_actions++;
903 }
904 }
905
906 /* Should return DI_NOEFFECT if we dont have any actions and actionformat has not changed */
907 if (num_actions == 0 && lpdiaf->dwCRC == new_crc && !(dwFlags & DIDSAM_FORCESAVE)) return DI_NOEFFECT;
908
909 /* update dwCRC to track if action format has changed */
910 lpdiaf->dwCRC = new_crc;
911
912 This->num_actions = num_actions;
913
914 /* Construct the dataformat and actionmap */
915 obj_df = HeapAlloc(GetProcessHeap(), 0, sizeof(DIOBJECTDATAFORMAT)*num_actions);
917 data_format.dwNumObjs = num_actions;
918
919 HeapFree(GetProcessHeap(), 0, This->action_map);
920 This->action_map = HeapAlloc(GetProcessHeap(), 0, sizeof(ActionMap)*num_actions);
921
922 for (i = 0; i < lpdiaf->dwNumActions; i++)
923 {
924 if (IsEqualGUID(&This->guid, &lpdiaf->rgoAction[i].guidInstance))
925 {
926 DWORD inst = DIDFT_GETINSTANCE(lpdiaf->rgoAction[i].dwObjID);
929
932
934
935 memcpy(&obj_df[action], obj, df->dwObjSize);
936
937 This->action_map[action].uAppData = lpdiaf->rgoAction[i].uAppData;
938 This->action_map[action].offset = offset;
939 obj_df[action].dwOfs = offset;
940 offset += (type & DIDFT_BUTTON) ? 1 : 4;
941
942 action++;
943 }
944 else if ((lpdiaf->rgoAction[i].dwSemantic & lpdiaf->dwGenre) == lpdiaf->dwGenre ||
945 (lpdiaf->rgoAction[i].dwSemantic & 0xff000000) == 0xff000000 /* Any Axis */)
946 {
948 DWORD type = DIDFT_GETTYPE(obj_id);
949 DWORD inst = DIDFT_GETINSTANCE(obj_id);
951
953 else if (type == DIDFT_RELAXIS) type = DIDFT_AXIS;
954
956 TRACE("obj %p, inst 0x%08x, type 0x%08x\n", obj, inst, type);
957 if(obj)
958 {
959 memcpy(&obj_df[action], obj, df->dwObjSize);
960
961 This->action_map[action].uAppData = lpdiaf->rgoAction[i].uAppData;
962 This->action_map[action].offset = offset;
963 obj_df[action].dwOfs = offset;
964 offset += (type & DIDFT_BUTTON) ? 1 : 4;
965
966 action++;
967 }
968 }
969 }
970
971 if (action == 0)
972 {
973 HeapFree(GetProcessHeap(), 0, obj_df);
974 return DI_NOEFFECT;
975 }
977
979
980 HeapFree(GetProcessHeap(), 0, obj_df);
981
982 /* Set the device properties according to the action format */
983 dpr.diph.dwSize = sizeof(DIPROPRANGE);
984 dpr.lMin = lpdiaf->lAxisMin;
985 dpr.lMax = lpdiaf->lAxisMax;
986 dpr.diph.dwHeaderSize = sizeof(DIPROPHEADER);
987 dpr.diph.dwHow = DIPH_DEVICE;
989
990 if (lpdiaf->dwBufferSize > 0)
991 {
992 dp.diph.dwSize = sizeof(DIPROPDWORD);
993 dp.dwData = lpdiaf->dwBufferSize;
994 dp.diph.dwHeaderSize = sizeof(DIPROPHEADER);
997 }
998
999 /* Retrieve logged user name if necessary */
1000 if (lpszUserName == NULL)
1001 GetUserNameW(username, &username_size);
1002 else
1003 lstrcpynW(username, lpszUserName, MAX_PATH);
1004
1005 dps.diph.dwSize = sizeof(dps);
1006 dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
1007 dps.diph.dwObj = 0;
1008 dps.diph.dwHow = DIPH_DEVICE;
1009 if (dwFlags & DIDSAM_NOUSER)
1010 dps.wsz[0] = '\0';
1011 else
1012 lstrcpynW(dps.wsz, username, ARRAY_SIZE(dps.wsz));
1014
1015 /* Save the settings to disk */
1016 save_mapping_settings(iface, lpdiaf, username);
1017
1018 return DI_OK;
1019}
#define DIPROP_RANGE
Definition: dinput.h:892
struct _DIOBJECTDATAFORMAT DIOBJECTDATAFORMAT
#define DIDSAM_FORCESAVE
Definition: dinput.h:1359
#define DIDSAM_NOUSER
Definition: dinput.h:1358
#define IDirectInputDevice8_SetProperty(p, a, b)
Definition: dinput.h:2041
#define DIPROP_USERNAME
Definition: dinput.h:919
#define DIERR_ACQUIRED
Definition: dinput.h:165
#define IDirectInputDevice8_SetDataFormat(p, a)
Definition: dinput.h:2046
struct _DIOBJECTDATAFORMAT * LPDIOBJECTDATAFORMAT
#define DIPROP_BUFFERSIZE
Definition: dinput.h:885
HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUsername)
Definition: device.c:695
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
const WCHAR * action
Definition: action.c:7509
GLintptr offset
Definition: glext.h:5920
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const DIDATAFORMAT data_format
Definition: device.c:49
#define IID_NULL
Definition: guiddef.h:98
DIPROPHEADER diph
Definition: dinput.h:843
DWORD dwData
Definition: dinput.h:844
DWORD dwSize
Definition: dinput.h:828
DWORD dwHeaderSize
Definition: dinput.h:829
LONG lMin
Definition: dinput.h:850
LONG lMax
Definition: dinput.h:851
DIPROPHEADER diph
Definition: dinput.h:849
DIPROPHEADER diph
Definition: dinput.h:874
WCHAR wsz[MAX_PATH]
Definition: dinput.h:875
DWORD dwBufferSize
Definition: dinput.h:1333
DWORD dwDataSize
Definition: dinput.h:1328
UINT_PTR uAppData
Definition: dinput.h:1276

Referenced by JoystickWGenericImpl_SetActionMap(), SysKeyboardWImpl_SetActionMap(), and SysMouseWImpl_SetActionMap().

◆ dataformat_to_odf_by_type()

LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type ( LPCDIDATAFORMAT  df,
int  n,
DWORD  type 
)

Definition at line 412 of file device.c.

413{
414 int i, nfound = 0;
415
416 for (i=0; i < df->dwNumObjs; i++)
417 {
419
420 if (odf->dwType & type)
421 {
422 if (n == nfound)
423 return odf;
424
425 nfound++;
426 }
427 }
428
429 return NULL;
430}
static LPDIOBJECTDATAFORMAT dataformat_to_odf(LPCDIDATAFORMAT df, int idx)
Definition: device.c:403
GLdouble n
Definition: glext.h:7729

Referenced by _build_action_map(), _set_action_map(), and JoystickWGenericImpl_BuildActionMap().

◆ fill_DataFormat()

void fill_DataFormat ( void out,
DWORD  size,
const void in,
const DataFormat df 
)

Definition at line 326 of file device.c.

327{
328 int i;
329 const char *in_c = in;
330 char *out_c = out;
331
332 memset(out, 0, size);
333 if (df->dt == NULL) {
334 /* This means that the app uses Wine's internal data format */
336 } else {
337 for (i = 0; i < df->size; i++) {
338 if (df->dt[i].offset_in >= 0) {
339 switch (df->dt[i].size) {
340 case 1:
341 TRACE("Copying (c) to %d from %d (value %d)\n",
342 df->dt[i].offset_out, df->dt[i].offset_in, *(in_c + df->dt[i].offset_in));
343 *(out_c + df->dt[i].offset_out) = *(in_c + df->dt[i].offset_in);
344 break;
345
346 case 2:
347 TRACE("Copying (s) to %d from %d (value %d)\n",
348 df->dt[i].offset_out, df->dt[i].offset_in, *((const short *)(in_c + df->dt[i].offset_in)));
349 *((short *)(out_c + df->dt[i].offset_out)) = *((const short *)(in_c + df->dt[i].offset_in));
350 break;
351
352 case 4:
353 TRACE("Copying (i) to %d from %d (value %d)\n",
354 df->dt[i].offset_out, df->dt[i].offset_in, *((const int *)(in_c + df->dt[i].offset_in)));
355 *((int *)(out_c + df->dt[i].offset_out)) = *((const int *)(in_c + df->dt[i].offset_in));
356 break;
357
358 default:
359 memcpy((out_c + df->dt[i].offset_out), (in_c + df->dt[i].offset_in), df->dt[i].size);
360 break;
361 }
362 } else {
363 switch (df->dt[i].size) {
364 case 1:
365 TRACE("Copying (c) to %d default value %d\n",
366 df->dt[i].offset_out, df->dt[i].value);
367 *(out_c + df->dt[i].offset_out) = (char) df->dt[i].value;
368 break;
369
370 case 2:
371 TRACE("Copying (s) to %d default value %d\n",
372 df->dt[i].offset_out, df->dt[i].value);
373 *((short *) (out_c + df->dt[i].offset_out)) = (short) df->dt[i].value;
374 break;
375
376 case 4:
377 TRACE("Copying (i) to %d default value %d\n",
378 df->dt[i].offset_out, df->dt[i].value);
379 *((int *) (out_c + df->dt[i].offset_out)) = df->dt[i].value;
380 break;
381
382 default:
383 memset((out_c + df->dt[i].offset_out), 0, df->dt[i].size);
384 break;
385 }
386 }
387 }
388 }
389}
GLsizeiptr size
Definition: glext.h:5919
GLuint in
Definition: glext.h:9616
#define min(a, b)
Definition: monoChain.cc:55
static FILE * out
Definition: regtests2xml.c:44
DataTransform * dt
int internal_format_size

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

◆ find_property()

int find_property ( const DataFormat df,
LPCDIPROPHEADER  ph 
)

Definition at line 607 of file device.c.

608{
609 switch (ph->dwHow)
610 {
611 case DIPH_BYID: return id_to_object(df->wine_df, ph->dwObj);
612 case DIPH_BYOFFSET: return offset_to_object(df, ph->dwObj);
613 }
614 FIXME("Unhandled ph->dwHow=='%04X'\n", (unsigned int)ph->dwHow);
615
616 return -1;
617}
#define FIXME(fmt,...)
Definition: precomp.h:53
int id_to_object(LPCDIDATAFORMAT df, int id)
Definition: device.c:588
static int offset_to_object(const DataFormat *df, int offset)
Definition: device.c:576
LPDIDATAFORMAT wine_df

Referenced by JoystickWGenericImpl_GetProperty(), and JoystickWGenericImpl_SetProperty().

◆ get_app_key()

BOOL get_app_key ( HKEY defkey,
HKEY appkey 
)

Definition at line 278 of file device.c.

279{
280 char buffer[MAX_PATH+16];
281 DWORD len;
282
283 *appkey = 0;
284
285 /* @@ Wine registry key: HKCU\Software\Wine\DirectInput */
286 if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\DirectInput", defkey))
287 *defkey = 0;
288
290 if (len && len < MAX_PATH)
291 {
292 HKEY tmpkey;
293
294 /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectInput */
295 if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey))
296 {
297 char *p, *appname = buffer;
298 if ((p = strrchr(appname, '/'))) appname = p + 1;
299 if ((p = strrchr(appname, '\\'))) appname = p + 1;
300 strcat(appname, "\\DirectInput");
301
302 if (RegOpenKeyA(tmpkey, appname, appkey)) *appkey = 0;
303 RegCloseKey(tmpkey);
304 }
305 }
306
307 return *defkey || *appkey;
308}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
GLuint buffer
Definition: glext.h:5915
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by alloc_device(), device_disabled_registry(), and setup_dinput_options().

◆ get_config_key()

DWORD get_config_key ( HKEY  defkey,
HKEY  appkey,
const char name,
char buffer,
DWORD  size 
)

Definition at line 313 of file device.c.

315{
316 if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)buffer, &size ))
317 return 0;
318
319 if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE)buffer, &size ))
320 return 0;
321
323}
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
unsigned char * LPBYTE
Definition: typedefs.h:53

Referenced by alloc_device(), device_disabled_registry(), and setup_dinput_options().

◆ id_to_object()

int id_to_object ( LPCDIDATAFORMAT  df,
int  id 
)

Definition at line 588 of file device.c.

589{
590 int i;
591
592 id &= 0x00ffffff;
593 for (i = 0; i < df->dwNumObjs; i++)
594 if ((dataformat_to_odf(df, i)->dwType & 0x00ffffff) == id)
595 return i;
596
597 return -1;
598}

Referenced by find_property(), and id_to_offset().

◆ IDirectInputDevice2AImpl_Acquire()

HRESULT WINAPI IDirectInputDevice2AImpl_Acquire ( LPDIRECTINPUTDEVICE8A  iface)

Definition at line 1097 of file device.c.

1098{
1101}
HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1076
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60

◆ IDirectInputDevice2AImpl_AddRef()

ULONG WINAPI IDirectInputDevice2AImpl_AddRef ( LPDIRECTINPUTDEVICE8A  iface)

Definition at line 1316 of file device.c.

1317{
1320}
ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1308

◆ IDirectInputDevice2AImpl_CreateEffect()

HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect ( LPDIRECTINPUTDEVICE8A  iface,
REFGUID  rguid,
LPCDIEFFECT  lpeff,
LPDIRECTINPUTEFFECT ppdef,
LPUNKNOWN  pUnkOuter 
)

Definition at line 1736 of file device.c.

1738{
1740 return IDirectInputDevice2WImpl_CreateEffect(IDirectInputDevice8W_from_impl(This), rguid, lpeff, ppdef, pUnkOuter);
1741}
HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
Definition: device.c:1725

◆ IDirectInputDevice2AImpl_EnumCreatedEffectObjects()

HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects ( LPDIRECTINPUTDEVICE8A  iface,
LPDIENUMCREATEDEFFECTOBJECTSCALLBACK  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1821 of file device.c.

1823{
1826}
HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1813

◆ IDirectInputDevice2AImpl_EnumEffects()

HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects ( LPDIRECTINPUTDEVICE8A  iface,
LPDIENUMEFFECTSCALLBACKA  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1743 of file device.c.

1748{
1750 FIXME("%p)->(%p,%p,0x%08x): stub!\n", This, lpCallback, lpvRef, dwFlags);
1751
1752 return DI_OK;
1753}

◆ IDirectInputDevice2AImpl_EnumObjects()

HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects ( LPDIRECTINPUTDEVICE8A  iface,
LPDIENUMDEVICEOBJECTSCALLBACKA  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1322 of file device.c.

1324{
1327 int i;
1328
1329 TRACE("(%p)->(%p,%p flags:%08x)\n", This, lpCallback, lpvRef, dwFlags);
1330 TRACE(" - flags = ");
1332 TRACE("\n");
1333
1334 /* Only the fields till dwFFMaxForce are relevant */
1335 memset(&ddoi, 0, sizeof(ddoi));
1336 ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
1337
1338 for (i = 0; i < This->data_format.wine_df->dwNumObjs; i++)
1339 {
1340 LPDIOBJECTDATAFORMAT odf = dataformat_to_odf(This->data_format.wine_df, i);
1341
1342 if (dwFlags != DIDFT_ALL && !(dwFlags & DIDFT_GETTYPE(odf->dwType))) continue;
1343 if (IDirectInputDevice_GetObjectInfo(iface, &ddoi, odf->dwType, DIPH_BYID) != DI_OK)
1344 continue;
1345
1346 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) break;
1347 }
1348
1349 return DI_OK;
1350}
#define DIENUM_CONTINUE
Definition: dinput.h:188
#define DIDFT_ALL
Definition: dinput.h:750
#define IDirectInputDevice_GetObjectInfo(p, a, b, c)
Definition: dinput.h:1615
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

◆ IDirectInputDevice2AImpl_Escape()

HRESULT WINAPI IDirectInputDevice2AImpl_Escape ( LPDIRECTINPUTDEVICE8A  iface,
LPDIEFFESCAPE  lpDIEEsc 
)

Definition at line 1835 of file device.c.

1836{
1839}
HRESULT WINAPI IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc)
Definition: device.c:1828

◆ IDirectInputDevice2AImpl_GetDeviceData()

HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData ( LPDIRECTINPUTDEVICE8A  iface,
DWORD  dodsize,
LPDIDEVICEOBJECTDATA  dod,
LPDWORD  entries,
DWORD  flags 
)

Definition at line 1685 of file device.c.

1687{
1690}
HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: device.c:1629
GLbitfield flags
Definition: glext.h:7161

◆ IDirectInputDevice2AImpl_GetEffectInfo()

HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo ( LPDIRECTINPUTDEVICE8A  iface,
LPDIEFFECTINFOA  lpdei,
REFGUID  rguid 
)

Definition at line 1767 of file device.c.

1771{
1773 FIXME("(%p)->(%p,%s): stub!\n", This, lpdei, debugstr_guid(rguid));
1774 return DI_OK;
1775}

◆ IDirectInputDevice2AImpl_GetForceFeedbackState()

HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState ( LPDIRECTINPUTDEVICE8A  iface,
LPDWORD  pdwOut 
)

Definition at line 1794 of file device.c.

1795{
1798}
HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut)
Definition: device.c:1787
_Out_ PDWORD pdwOut
Definition: ntgdi.h:1813

◆ IDirectInputDevice2AImpl_GetObjectInfo()

HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo ( LPDIRECTINPUTDEVICE8A  iface,
LPDIDEVICEOBJECTINSTANCEA  pdidoi,
DWORD  dwObj,
DWORD  dwHow 
)

Definition at line 1544 of file device.c.

1549{
1552 HRESULT res;
1553
1554 if (!pdidoi ||
1555 (pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEA) &&
1556 pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3A)))
1557 return DIERR_INVALIDPARAM;
1558
1559 didoiW.dwSize = sizeof(didoiW);
1561 if (res == DI_OK)
1562 {
1563 DWORD dwSize = pdidoi->dwSize;
1564
1565 memset(pdidoi, 0, pdidoi->dwSize);
1566 pdidoi->dwSize = dwSize;
1567 pdidoi->guidType = didoiW.guidType;
1568 pdidoi->dwOfs = didoiW.dwOfs;
1569 pdidoi->dwType = didoiW.dwType;
1570 pdidoi->dwFlags = didoiW.dwFlags;
1571 }
1572
1573 return res;
1574}
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
Definition: device.c:1576
GLuint res
Definition: glext.h:9613
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by SysKeyboardAImpl_GetObjectInfo().

◆ IDirectInputDevice2AImpl_GetProperty()

HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty ( LPDIRECTINPUTDEVICE8A  iface,
REFGUID  rguid,
LPDIPROPHEADER  pdiph 
)

Definition at line 1440 of file device.c.

1441{
1444}
HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: device.c:1386

Referenced by SysKeyboardWImpl_GetProperty().

◆ IDirectInputDevice2AImpl_Initialize()

HRESULT WINAPI IDirectInputDevice2AImpl_Initialize ( LPDIRECTINPUTDEVICE8A  iface,
HINSTANCE  hinst,
DWORD  dwVersion,
REFGUID  rguid 
)

Definition at line 1714 of file device.c.

1716{
1719}
DWORD dwVersion
Definition: LocaleTests.cpp:63
HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid)
Definition: device.c:1706
static HINSTANCE hinst
Definition: edit.c:551

◆ IDirectInputDevice2AImpl_Poll()

HRESULT WINAPI IDirectInputDevice2AImpl_Poll ( LPDIRECTINPUTDEVICE8A  iface)

Definition at line 1851 of file device.c.

1852{
1855}
HRESULT WINAPI IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1841

◆ IDirectInputDevice2AImpl_QueryInterface()

HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface ( LPDIRECTINPUTDEVICE8A  iface,
REFIID  riid,
LPVOID ppobj 
)

Definition at line 1302 of file device.c.

1303{
1306}
HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj)
Definition: device.c:1273
REFIID riid
Definition: atlbase.h:39

◆ IDirectInputDevice2AImpl_Release()

ULONG WINAPI IDirectInputDevice2AImpl_Release ( LPDIRECTINPUTDEVICE8A  iface)

Definition at line 1267 of file device.c.

1268{
1271}
ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1231

◆ IDirectInputDevice2AImpl_RunControlPanel()

HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel ( LPDIRECTINPUTDEVICE8A  iface,
HWND  hwndOwner,
DWORD  dwFlags 
)

Definition at line 1700 of file device.c.

1701{
1704}
HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags)
Definition: device.c:1692

◆ IDirectInputDevice2AImpl_SendDeviceData()

HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData ( LPDIRECTINPUTDEVICE8A  iface,
DWORD  cbObjectData,
LPCDIDEVICEOBJECTDATA  rgdod,
LPDWORD  pdwInOut,
DWORD  dwFlags 
)

Definition at line 1867 of file device.c.

1870{
1873 pdwInOut, dwFlags);
1874}
HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
Definition: device.c:1857

◆ IDirectInputDevice2AImpl_SendForceFeedbackCommand()

HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand ( LPDIRECTINPUTDEVICE8A  iface,
DWORD  dwFlags 
)

Definition at line 1807 of file device.c.

1808{
1811}
HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags)
Definition: device.c:1800

◆ IDirectInputDevice2AImpl_SetCooperativeLevel()

HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel ( LPDIRECTINPUTDEVICE8A  iface,
HWND  hwnd,
DWORD  dwflags 
)

Definition at line 1203 of file device.c.

1204{
1207}
HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags)
Definition: device.c:1167
static _In_ DWORD dwflags
Definition: dispmode.c:64
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

◆ IDirectInputDevice2AImpl_SetDataFormat()

HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat ( LPDIRECTINPUTDEVICE8A  iface,
LPCDIDATAFORMAT  df 
)

Definition at line 1156 of file device.c.

1157{
1160}
HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df)
Definition: device.c:1135

◆ IDirectInputDevice2AImpl_SetEventNotification()

HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification ( LPDIRECTINPUTDEVICE8A  iface,
HANDLE  hnd 
)

Definition at line 1224 of file device.c.

1225{
1228}
HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE event)
Definition: device.c:1212
struct _cl_event * event
Definition: glext.h:7739

◆ IDirectInputDevice2AImpl_SetProperty()

HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty ( LPDIRECTINPUTDEVICE8A  iface,
REFGUID  rguid,
LPCDIPROPHEADER  pdiph 
)

Definition at line 1537 of file device.c.

1539{
1542}
HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
Definition: device.c:1450

◆ IDirectInputDevice2AImpl_Unacquire()

HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire ( LPDIRECTINPUTDEVICE8A  iface)

Definition at line 1125 of file device.c.

1126{
1129}
HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1108

◆ IDirectInputDevice2WImpl_Acquire()

HRESULT WINAPI IDirectInputDevice2WImpl_Acquire ( LPDIRECTINPUTDEVICE8W  iface)

Definition at line 1076 of file device.c.

1077{
1079 HRESULT res;
1080
1081 TRACE("(%p)\n", This);
1082
1083 if (!This->data_format.user_df) return DIERR_INVALIDPARAM;
1084 if (This->dwCoopLevel & DISCL_FOREGROUND && This->win != GetForegroundWindow())
1085 return DIERR_OTHERAPPHASPRIO;
1086
1087 EnterCriticalSection(&This->crit);
1088 res = This->acquired ? S_FALSE : DI_OK;
1089 This->acquired = 1;
1090 LeaveCriticalSection(&This->crit);
1091 if (res == DI_OK)
1092 check_dinput_hooks(iface, TRUE);
1093
1094 return res;
1095}
#define DISCL_FOREGROUND
Definition: dinput.h:965
#define DIERR_OTHERAPPHASPRIO
Definition: dinput.h:162
void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
Definition: dinput_main.c:1863
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define S_FALSE
Definition: winerror.h:2357
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392

Referenced by IDirectInputDevice2AImpl_Acquire(), SysKeyboardWImpl_Acquire(), and SysMouseWImpl_Acquire().

◆ IDirectInputDevice2WImpl_AddRef()

ULONG WINAPI IDirectInputDevice2WImpl_AddRef ( LPDIRECTINPUTDEVICE8W  iface)

Definition at line 1308 of file device.c.

1309{
1312 TRACE( "(%p) ref %d\n", This, ref );
1313 return ref;
1314}
#define InterlockedIncrement
Definition: armddk.h:53
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

Referenced by IDirectInputDevice2AImpl_AddRef().

◆ IDirectInputDevice2WImpl_CreateEffect()

HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect ( LPDIRECTINPUTDEVICE8W  iface,
REFGUID  rguid,
LPCDIEFFECT  lpeff,
LPDIRECTINPUTEFFECT ppdef,
LPUNKNOWN  pUnkOuter 
)

Definition at line 1725 of file device.c.

1727{
1729 FIXME("(%p)->(%s,%p,%p,%p): stub!\n", This, debugstr_guid(rguid), lpeff, ppdef, pUnkOuter);
1730
1731 FIXME("not available in the generic implementation\n");
1732 *ppdef = NULL;
1733 return DIERR_UNSUPPORTED;
1734}
#define DIERR_UNSUPPORTED
Definition: dinput.h:156

Referenced by IDirectInputDevice2AImpl_CreateEffect().

◆ IDirectInputDevice2WImpl_EnumCreatedEffectObjects()

HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects ( LPDIRECTINPUTDEVICE8W  iface,
LPDIENUMCREATEDEFFECTOBJECTSCALLBACK  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1813 of file device.c.

1815{
1817 FIXME("(%p)0>(%p,%p,0x%08x): stub!\n", This, lpCallback, lpvRef, dwFlags);
1818 return DI_OK;
1819}

Referenced by IDirectInputDevice2AImpl_EnumCreatedEffectObjects().

◆ IDirectInputDevice2WImpl_EnumEffects()

HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects ( LPDIRECTINPUTDEVICE8W  iface,
LPDIENUMEFFECTSCALLBACKW  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1755 of file device.c.

1760{
1762 FIXME("(%p)->(%p,%p,0x%08x): stub!\n", This, lpCallback, lpvRef, dwFlags);
1763
1764 return DI_OK;
1765}

◆ IDirectInputDevice2WImpl_EnumObjects()

HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects ( LPDIRECTINPUTDEVICE8W  iface,
LPDIENUMDEVICEOBJECTSCALLBACKW  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1352 of file device.c.

1354{
1357 int i;
1358
1359 TRACE("(%p)->(%p,%p flags:%08x)\n", This, lpCallback, lpvRef, dwFlags);
1360 TRACE(" - flags = ");
1362 TRACE("\n");
1363
1364 /* Only the fields till dwFFMaxForce are relevant */
1365 memset(&ddoi, 0, sizeof(ddoi));
1366 ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW, dwFFMaxForce);
1367
1368 for (i = 0; i < This->data_format.wine_df->dwNumObjs; i++)
1369 {
1370 LPDIOBJECTDATAFORMAT odf = dataformat_to_odf(This->data_format.wine_df, i);
1371
1372 if (dwFlags != DIDFT_ALL && !(dwFlags & DIDFT_GETTYPE(odf->dwType))) continue;
1373 if (IDirectInputDevice_GetObjectInfo(iface, &ddoi, odf->dwType, DIPH_BYID) != DI_OK)
1374 continue;
1375
1376 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) break;
1377 }
1378
1379 return DI_OK;
1380}

◆ IDirectInputDevice2WImpl_Escape()

HRESULT WINAPI IDirectInputDevice2WImpl_Escape ( LPDIRECTINPUTDEVICE8W  iface,
LPDIEFFESCAPE  lpDIEEsc 
)

Definition at line 1828 of file device.c.

1829{
1831 FIXME("(%p)->(%p): stub!\n", This, lpDIEEsc);
1832 return DI_OK;
1833}

Referenced by IDirectInputDevice2AImpl_Escape().

◆ IDirectInputDevice2WImpl_GetDeviceData()

HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData ( LPDIRECTINPUTDEVICE8W  iface,
DWORD  dodsize,
LPDIDEVICEOBJECTDATA  dod,
LPDWORD  entries,
DWORD  flags 
)

Definition at line 1629 of file device.c.

1631{
1633 HRESULT ret = DI_OK;
1634 int len;
1635
1636 TRACE("(%p) %p -> %p(%d) x%d, 0x%08x\n",
1637 This, dod, entries, entries ? *entries : 0, dodsize, flags);
1638
1639 if (This->dinput->dwVersion == 0x0800 || dodsize == sizeof(DIDEVICEOBJECTDATA_DX3))
1640 {
1641 if (!This->queue_len) return DIERR_NOTBUFFERED;
1642 if (!This->acquired) return DIERR_NOTACQUIRED;
1643 }
1644
1645 if (!This->queue_len)
1646 return DI_OK;
1647 if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3))
1648 return DIERR_INVALIDPARAM;
1649
1651 EnterCriticalSection(&This->crit);
1652
1653 len = This->queue_head - This->queue_tail;
1654 if (len < 0) len += This->queue_len;
1655
1656 if ((*entries != INFINITE) && (len > *entries)) len = *entries;
1657
1658 if (dod)
1659 {
1660 int i;
1661 for (i = 0; i < len; i++)
1662 {
1663 int n = (This->queue_tail + i) % This->queue_len;
1664 memcpy((char *)dod + dodsize * i, This->data_queue + n, dodsize);
1665 }
1666 }
1667 *entries = len;
1668
1669 if (This->overflow && This->dinput->dwVersion == 0x0800)
1671
1672 if (!(flags & DIGDD_PEEK))
1673 {
1674 /* Advance reading position */
1675 This->queue_tail = (This->queue_tail + len) % This->queue_len;
1676 This->overflow = FALSE;
1677 }
1678
1679 LeaveCriticalSection(&This->crit);
1680
1681 TRACE("Returning %d events queued\n", *entries);
1682 return ret;
1683}
#define DIGDD_PEEK
Definition: dinput.h:778
#define DIERR_NOTBUFFERED
Definition: dinput.h:181
#define IDirectInputDevice2_Poll(p)
Definition: dinput.h:1750
#define DIERR_NOTACQUIRED
Definition: dinput.h:167
#define DI_BUFFEROVERFLOW
Definition: dinput.h:130
#define INFINITE
Definition: serial.h:102
int ret

Referenced by IDirectInputDevice2AImpl_GetDeviceData(), and SysMouseWImpl_GetDeviceData().

◆ IDirectInputDevice2WImpl_GetEffectInfo()

HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo ( LPDIRECTINPUTDEVICE8W  iface,
LPDIEFFECTINFOW  lpdei,
REFGUID  rguid 
)

Definition at line 1777 of file device.c.

1781{
1783 FIXME("(%p)->(%p,%s): stub!\n", This, lpdei, debugstr_guid(rguid));
1784 return DI_OK;
1785}

◆ IDirectInputDevice2WImpl_GetForceFeedbackState()

HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState ( LPDIRECTINPUTDEVICE8W  iface,
LPDWORD  pdwOut 
)

Definition at line 1787 of file device.c.

1788{
1790 FIXME("(%p)->(%p): stub!\n", This, pdwOut);
1791 return DI_OK;
1792}

Referenced by IDirectInputDevice2AImpl_GetForceFeedbackState().

◆ IDirectInputDevice2WImpl_GetObjectInfo()

HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo ( LPDIRECTINPUTDEVICE8W  iface,
LPDIDEVICEOBJECTINSTANCEW  pdidoi,
DWORD  dwObj,
DWORD  dwHow 
)

Definition at line 1576 of file device.c.

1581{
1583 DWORD dwSize;
1585 int idx = -1;
1586
1587 TRACE("(%p) %d(0x%08x) -> %p\n", This, dwHow, dwObj, pdidoi);
1588
1589 if (!pdidoi ||
1590 (pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEW) &&
1591 pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3W)))
1592 return DIERR_INVALIDPARAM;
1593
1594 switch (dwHow)
1595 {
1596 case DIPH_BYOFFSET:
1597 if (!This->data_format.offsets) break;
1598 for (idx = This->data_format.wine_df->dwNumObjs - 1; idx >= 0; idx--)
1599 if (This->data_format.offsets[idx] == dwObj) break;
1600 break;
1601 case DIPH_BYID:
1602 dwObj &= 0x00ffffff;
1603 for (idx = This->data_format.wine_df->dwNumObjs - 1; idx >= 0; idx--)
1604 if ((dataformat_to_odf(This->data_format.wine_df, idx)->dwType & 0x00ffffff) == dwObj)
1605 break;
1606 break;
1607
1608 case DIPH_BYUSAGE:
1609 FIXME("dwHow = DIPH_BYUSAGE not implemented\n");
1610 break;
1611 default:
1612 WARN("invalid parameter: dwHow = %08x\n", dwHow);
1613 return DIERR_INVALIDPARAM;
1614 }
1615 if (idx < 0) return DIERR_OBJECTNOTFOUND;
1616
1617 odf = dataformat_to_odf(This->data_format.wine_df, idx);
1618 dwSize = pdidoi->dwSize; /* save due to memset below */
1619 memset(pdidoi, 0, pdidoi->dwSize);
1620 pdidoi->dwSize = dwSize;
1621 if (odf->pguid) pdidoi->guidType = *odf->pguid;
1622 pdidoi->dwOfs = This->data_format.offsets ? This->data_format.offsets[idx] : odf->dwOfs;
1623 pdidoi->dwType = odf->dwType;
1624 pdidoi->dwFlags = odf->dwFlags;
1625
1626 return DI_OK;
1627}
#define DIERR_OBJECTNOTFOUND
Definition: dinput.h:150
#define DIPH_BYUSAGE
Definition: dinput.h:838
unsigned int idx
Definition: utils.c:41

Referenced by IDirectInputDevice2AImpl_GetObjectInfo(), JoystickWGenericImpl_GetObjectInfo(), SysKeyboardWImpl_GetObjectInfo(), and SysMouseWImpl_GetObjectInfo().

◆ IDirectInputDevice2WImpl_GetProperty()

HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty ( LPDIRECTINPUTDEVICE8W  iface,
REFGUID  rguid,
LPDIPROPHEADER  pdiph 
)

Definition at line 1386 of file device.c.

1387{
1389
1390 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(rguid), pdiph);
1391 _dump_DIPROPHEADER(pdiph);
1392
1393 if (!IS_DIPROP(rguid)) return DI_OK;
1394
1395 switch (LOWORD(rguid))
1396 {
1398 {
1399 LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
1400
1401 if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
1402
1403 pd->dwData = This->queue_len;
1404 TRACE("buffersize = %d\n", pd->dwData);
1405 break;
1406 }
1408 {
1409 LPDIPROPSTRING ps = (LPDIPROPSTRING)pdiph;
1410 struct DevicePlayer *device_player;
1411
1412 if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
1413
1414 LIST_FOR_EACH_ENTRY(device_player, &This->dinput->device_players,
1415 struct DevicePlayer, entry)
1416 {
1417 if (IsEqualGUID(&device_player->instance_guid, &This->guid))
1418 {
1419 if (*device_player->username)
1420 {
1421 lstrcpynW(ps->wsz, device_player->username, ARRAY_SIZE(ps->wsz));
1422 return DI_OK;
1423 }
1424 else break;
1425 }
1426 }
1427 return S_FALSE;
1428 }
1429 case (DWORD_PTR) DIPROP_VIDPID:
1430 FIXME("DIPROP_VIDPID not implemented\n");
1431 return DIERR_UNSUPPORTED;
1432 default:
1433 FIXME("Unknown property %s\n", debugstr_guid(rguid));
1434 return DIERR_INVALIDPARAM;
1435 }
1436
1437 return DI_OK;
1438}
struct DIPROPDWORD * LPDIPROPDWORD
struct DIPROPSTRING * LPDIPROPSTRING
#define DIPROP_VIDPID
Definition: dinput.h:918
#define IS_DIPROP(x)
void _dump_DIPROPHEADER(LPCDIPROPHEADER diph)
Definition: device.c:176
uint32_t entry
Definition: isohybrid.c:63
#define LOWORD(l)
Definition: pedump.c:82
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
WCHAR username[MAX_PATH]
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by IDirectInputDevice2AImpl_GetProperty(), JoystickWGenericImpl_GetProperty(), and SysMouseWImpl_GetProperty().

◆ IDirectInputDevice2WImpl_Initialize()

HRESULT WINAPI IDirectInputDevice2WImpl_Initialize ( LPDIRECTINPUTDEVICE8W  iface,
HINSTANCE  hinst,
DWORD  dwVersion,
REFGUID  rguid 
)

Definition at line 1706 of file device.c.

1708{
1710 FIXME("(%p)->(%p,%d,%s): stub!\n", This, hinst, dwVersion, debugstr_guid(rguid));
1711 return DI_OK;
1712}

Referenced by IDirectInputDevice2AImpl_Initialize().

◆ IDirectInputDevice2WImpl_Poll()

HRESULT WINAPI IDirectInputDevice2WImpl_Poll ( LPDIRECTINPUTDEVICE8W  iface)

Definition at line 1841 of file device.c.

1842{
1844
1845 if (!This->acquired) return DIERR_NOTACQUIRED;
1846
1848 return DI_OK;
1849}
void check_dinput_events(void)
Definition: dinput_main.c:1900

Referenced by IDirectInputDevice2AImpl_Poll().

◆ IDirectInputDevice2WImpl_QueryInterface()

HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface ( LPDIRECTINPUTDEVICE8W  iface,
REFIID  riid,
LPVOID ppobj 
)

Definition at line 1273 of file device.c.

1274{
1276
1277 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppobj);
1278 if (IsEqualGUID(&IID_IUnknown, riid) ||
1279 IsEqualGUID(&IID_IDirectInputDeviceA, riid) ||
1280 IsEqualGUID(&IID_IDirectInputDevice2A, riid) ||
1281 IsEqualGUID(&IID_IDirectInputDevice7A, riid) ||
1282 IsEqualGUID(&IID_IDirectInputDevice8A, riid))
1283 {
1286 return DI_OK;
1287 }
1288 if (IsEqualGUID(&IID_IDirectInputDeviceW, riid) ||
1289 IsEqualGUID(&IID_IDirectInputDevice2W, riid) ||
1290 IsEqualGUID(&IID_IDirectInputDevice7W, riid) ||
1291 IsEqualGUID(&IID_IDirectInputDevice8W, riid))
1292 {
1295 return DI_OK;
1296 }
1297
1298 WARN("Unsupported interface!\n");
1299 return E_NOINTERFACE;
1300}
const GUID IID_IUnknown
#define IDirectInputDevice2_AddRef(p)
Definition: dinput.h:1724
static IDirectInputDevice8A * IDirectInputDevice8A_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:56
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by IDirectInputDevice2AImpl_QueryInterface().

◆ IDirectInputDevice2WImpl_Release()

ULONG WINAPI IDirectInputDevice2WImpl_Release ( LPDIRECTINPUTDEVICE8W  iface)

Definition at line 1231 of file device.c.

1232{
1235
1236 TRACE("(%p) ref %d\n", This, ref);
1237
1238 if (ref) return ref;
1239
1241 /* Reset the FF state, free all effects, etc */
1243
1244 HeapFree(GetProcessHeap(), 0, This->data_queue);
1245
1246 /* Free data format */
1247 HeapFree(GetProcessHeap(), 0, This->data_format.wine_df->rgodf);
1248 HeapFree(GetProcessHeap(), 0, This->data_format.wine_df);
1249 release_DataFormat(&This->data_format);
1250
1251 /* Free action mapping */
1252 HeapFree(GetProcessHeap(), 0, This->action_map);
1253
1254 EnterCriticalSection( &This->dinput->crit );
1255 list_remove( &This->entry );
1256 LeaveCriticalSection( &This->dinput->crit );
1257
1258 IDirectInput_Release(&This->dinput->IDirectInput7A_iface);
1259 This->crit.DebugInfo->Spare[0] = 0;
1261
1263
1264 return ref;
1265}
#define InterlockedDecrement
Definition: armddk.h:52
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define DISFFC_RESET
Definition: dinput.h:970
#define IDirectInput_Release(p)
Definition: dinput.h:2294
#define IDirectInputDevice8_SendForceFeedbackCommand(p, a)
Definition: dinput.h:2058
#define IDirectInputDevice_Unacquire(p)
Definition: dinput.h:1609
void release_DataFormat(DataFormat *format)
Definition: device.c:391
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

Referenced by IDirectInputDevice2AImpl_Release().

◆ IDirectInputDevice2WImpl_RunControlPanel()

HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel ( LPDIRECTINPUTDEVICE8W  iface,
HWND  hwndOwner,
DWORD  dwFlags 
)

Definition at line 1692 of file device.c.

1693{
1695 FIXME("%p)->(%p,0x%08x): stub!\n", This, hwndOwner, dwFlags);
1696
1697 return DI_OK;
1698}

Referenced by IDirectInputDevice2AImpl_RunControlPanel().

◆ IDirectInputDevice2WImpl_SendDeviceData()

HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData ( LPDIRECTINPUTDEVICE8W  iface,
DWORD  cbObjectData,
LPCDIDEVICEOBJECTDATA  rgdod,
LPDWORD  pdwInOut,
DWORD  dwFlags 
)

Definition at line 1857 of file device.c.

1860{
1862 FIXME("(%p)->(0x%08x,%p,%p,0x%08x): stub!\n", This, cbObjectData, rgdod, pdwInOut, dwFlags);
1863
1864 return DI_OK;
1865}

Referenced by IDirectInputDevice2AImpl_SendDeviceData().

◆ IDirectInputDevice2WImpl_SendForceFeedbackCommand()

HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand ( LPDIRECTINPUTDEVICE8W  iface,
DWORD  dwFlags 
)

Definition at line 1800 of file device.c.

1801{
1803 TRACE("(%p)->(0x%08x)\n", This, dwFlags);
1804 return DI_NOEFFECT;
1805}

Referenced by IDirectInputDevice2AImpl_SendForceFeedbackCommand().

◆ IDirectInputDevice2WImpl_SetCooperativeLevel()

HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel ( LPDIRECTINPUTDEVICE8W  iface,
HWND  hwnd,
DWORD  dwflags 
)

Definition at line 1167 of file device.c.

1168{
1170
1171 TRACE("(%p) %p,0x%08x\n", This, hwnd, dwflags);
1173
1174 if ((dwflags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == 0 ||
1178 return DIERR_INVALIDPARAM;
1179
1181
1184
1185 if (!IsWindow(hwnd)) return E_HANDLE;
1186
1187 /* For security reasons native does not allow exclusive background level
1188 for mouse and keyboard only */
1190 (IsEqualGUID(&This->guid, &GUID_SysMouse) ||
1191 IsEqualGUID(&This->guid, &GUID_SysKeyboard)))
1192 return DIERR_UNSUPPORTED;
1193
1194 /* Store the window which asks for the mouse */
1195 EnterCriticalSection(&This->crit);
1196 This->win = hwnd;
1197 This->dwCoopLevel = dwflags;
1198 LeaveCriticalSection(&This->crit);
1199
1200 return DI_OK;
1201}
#define DISCL_BACKGROUND
Definition: dinput.h:966
#define DISCL_NONEXCLUSIVE
Definition: dinput.h:964
#define DISCL_EXCLUSIVE
Definition: dinput.h:963
static void _dump_cooperativelevel_DI(DWORD dwFlags)
Definition: device.c:68
#define WS_CHILD
Definition: pedump.c:617
#define E_HANDLE
Definition: winerror.h:2850
BOOL WINAPI IsWindow(_In_opt_ HWND)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define GWL_STYLE
Definition: winuser.h:855

Referenced by IDirectInputDevice2AImpl_SetCooperativeLevel().

◆ IDirectInputDevice2WImpl_SetDataFormat()

HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat ( LPDIRECTINPUTDEVICE8W  iface,
LPCDIDATAFORMAT  df 
)

Definition at line 1135 of file device.c.

1136{
1138 HRESULT res = DI_OK;
1139
1140 if (!df) return E_POINTER;
1141 TRACE("(%p) %p\n", This, df);
1143
1144 if (df->dwSize != sizeof(DIDATAFORMAT)) return DIERR_INVALIDPARAM;
1145 if (This->acquired) return DIERR_ACQUIRED;
1146
1147 EnterCriticalSection(&This->crit);
1148
1149 release_DataFormat(&This->data_format);
1150 res = create_DataFormat(df, &This->data_format);
1151
1152 LeaveCriticalSection(&This->crit);
1153 return res;
1154}
static HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *format)
Definition: device.c:432
void _dump_DIDATAFORMAT(const DIDATAFORMAT *df)
Definition: device.c:242
#define E_POINTER
Definition: winerror.h:2365

Referenced by IDirectInputDevice2AImpl_SetDataFormat().

◆ IDirectInputDevice2WImpl_SetEventNotification()

HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification ( LPDIRECTINPUTDEVICE8W  iface,
HANDLE  hnd 
)

Definition at line 1212 of file device.c.

1213{
1215
1216 TRACE("(%p) %p\n", This, event);
1217
1218 EnterCriticalSection(&This->crit);
1219 This->hEvent = event;
1220 LeaveCriticalSection(&This->crit);
1221 return DI_OK;
1222}

Referenced by IDirectInputDevice2AImpl_SetEventNotification().

◆ IDirectInputDevice2WImpl_SetProperty()

HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty ( LPDIRECTINPUTDEVICE8W  iface,
REFGUID  rguid,
LPCDIPROPHEADER  pdiph 
)

Definition at line 1450 of file device.c.

1452{
1454
1455 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(rguid), pdiph);
1456 _dump_DIPROPHEADER(pdiph);
1457
1458 if (!IS_DIPROP(rguid)) return DI_OK;
1459
1460 switch (LOWORD(rguid))
1461 {
1463 {
1464 LPCDIPROPDWORD pd = (LPCDIPROPDWORD)pdiph;
1465
1466 if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
1467 if (pdiph->dwHow == DIPH_DEVICE && pdiph->dwObj) return DIERR_INVALIDPARAM;
1468 if (This->acquired) return DIERR_ACQUIRED;
1469 if (pdiph->dwHow != DIPH_DEVICE) return DIERR_UNSUPPORTED;
1470 if (!This->data_format.user_df) return DI_OK;
1471
1472 TRACE("Axis mode: %s\n", pd->dwData == DIPROPAXISMODE_ABS ? "absolute" :
1473 "relative");
1474
1475 EnterCriticalSection(&This->crit);
1476 This->data_format.user_df->dwFlags &= ~DIDFT_AXIS;
1477 This->data_format.user_df->dwFlags |= pd->dwData == DIPROPAXISMODE_ABS ?
1479 LeaveCriticalSection(&This->crit);
1480 break;
1481 }
1483 {
1484 LPCDIPROPDWORD pd = (LPCDIPROPDWORD)pdiph;
1485
1486 if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
1487 if (This->acquired) return DIERR_ACQUIRED;
1488
1489 TRACE("buffersize = %d\n", pd->dwData);
1490
1491 EnterCriticalSection(&This->crit);
1492 HeapFree(GetProcessHeap(), 0, This->data_queue);
1493
1494 This->data_queue = !pd->dwData ? NULL : HeapAlloc(GetProcessHeap(), 0,
1495 pd->dwData * sizeof(DIDEVICEOBJECTDATA));
1496 This->queue_head = This->queue_tail = This->overflow = 0;
1497 This->queue_len = pd->dwData;
1498
1499 LeaveCriticalSection(&This->crit);
1500 break;
1501 }
1503 {
1504 LPCDIPROPSTRING ps = (LPCDIPROPSTRING)pdiph;
1505 struct DevicePlayer *device_player;
1506 BOOL found = FALSE;
1507
1508 if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
1509
1510 LIST_FOR_EACH_ENTRY(device_player, &This->dinput->device_players,
1511 struct DevicePlayer, entry)
1512 {
1513 if (IsEqualGUID(&device_player->instance_guid, &This->guid))
1514 {
1515 found = TRUE;
1516 break;
1517 }
1518 }
1519 if (!found && (device_player =
1520 HeapAlloc(GetProcessHeap(), 0, sizeof(struct DevicePlayer))))
1521 {
1522 list_add_tail(&This->dinput->device_players, &device_player->entry);
1523 device_player->instance_guid = This->guid;
1524 }
1525 if (device_player)
1526 lstrcpynW(device_player->username, ps->wsz, ARRAY_SIZE(device_player->username));
1527 break;
1528 }
1529 default:
1530 WARN("Unknown property %s\n", debugstr_guid(rguid));
1531 return DIERR_UNSUPPORTED;
1532 }
1533
1534 return DI_OK;
1535}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define DIPROPAXISMODE_ABS
Definition: dinput.h:888
const DIPROPSTRING * LPCDIPROPSTRING
Definition: dinput.h:877
#define DIPROP_AXISMODE
Definition: dinput.h:886
const DIPROPDWORD * LPCDIPROPDWORD
Definition: dinput.h:846
struct list entry

Referenced by IDirectInputDevice2AImpl_SetProperty(), and JoystickWGenericImpl_SetProperty().

◆ IDirectInputDevice2WImpl_Unacquire()

HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire ( LPDIRECTINPUTDEVICE8W  iface)

Definition at line 1108 of file device.c.

1109{
1111 HRESULT res;
1112
1113 TRACE("(%p)\n", This);
1114
1115 EnterCriticalSection(&This->crit);
1116 res = !This->acquired ? DI_NOEFFECT : DI_OK;
1117 This->acquired = 0;
1118 LeaveCriticalSection(&This->crit);
1119 if (res == DI_OK)
1120 check_dinput_hooks(iface, FALSE);
1121
1122 return res;
1123}

Referenced by IDirectInputDevice2AImpl_Unacquire(), and SysMouseWImpl_Unacquire().

◆ IDirectInputDevice7AImpl_EnumEffectsInFile()

HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile ( LPDIRECTINPUTDEVICE8A  iface,
LPCSTR  lpszFileName,
LPDIENUMEFFECTSINFILECALLBACK  pec,
LPVOID  pvRef,
DWORD  dwFlags 
)

Definition at line 1876 of file device.c.

1881{
1883 FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", This, lpszFileName, pec, pvRef, dwFlags);
1884
1885 return DI_OK;
1886}

◆ IDirectInputDevice7AImpl_WriteEffectToFile()

HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile ( LPDIRECTINPUTDEVICE8A  iface,
LPCSTR  lpszFileName,
DWORD  dwEntries,
LPDIFILEEFFECT  rgDiFileEft,
DWORD  dwFlags 
)

Definition at line 1900 of file device.c.

1905{
1907 FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", This, lpszFileName, dwEntries, rgDiFileEft, dwFlags);
1908
1909 return DI_OK;
1910}

◆ IDirectInputDevice7WImpl_EnumEffectsInFile()

HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile ( LPDIRECTINPUTDEVICE8W  iface,
LPCWSTR  lpszFileName,
LPDIENUMEFFECTSINFILECALLBACK  pec,
LPVOID  pvRef,
DWORD  dwFlags 
)

Definition at line 1888 of file device.c.

1893{
1895 FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", This, debugstr_w(lpszFileName), pec, pvRef, dwFlags);
1896
1897 return DI_OK;
1898}

◆ IDirectInputDevice7WImpl_WriteEffectToFile()

HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile ( LPDIRECTINPUTDEVICE8W  iface,
LPCWSTR  lpszFileName,
DWORD  dwEntries,
LPDIFILEEFFECT  rgDiFileEft,
DWORD  dwFlags 
)

Definition at line 1912 of file device.c.

1917{
1919 FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", This, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags);
1920
1921 return DI_OK;
1922}

◆ IDirectInputDevice8AImpl_GetImageInfo()

HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo ( LPDIRECTINPUTDEVICE8A  iface,
LPDIDEVICEIMAGEINFOHEADERA  lpdiDevImageInfoHeader 
)

Definition at line 1941 of file device.c.

1943{
1945 FIXME("(%p)->(%p): stub !\n", This, lpdiDevImageInfoHeader);
1946
1947 return DI_OK;
1948}

◆ IDirectInputDevice8WImpl_BuildActionMap()

HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap ( LPDIRECTINPUTDEVICE8W  iface,
LPDIACTIONFORMATW  lpdiaf,
LPCWSTR  lpszUserName,
DWORD  dwFlags 
)

Definition at line 1924 of file device.c.

1928{
1930 FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", This, lpdiaf, debugstr_w(lpszUserName), dwFlags);
1931#define X(x) if (dwFlags & x) FIXME("\tdwFlags =|"#x"\n");
1936#undef X
1937
1938 return DI_OK;
1939}
#define DIDBAM_DEFAULT
Definition: dinput.h:1352
#define DIDBAM_INITIALIZE
Definition: dinput.h:1354
#define X(x)

Referenced by _build_action_map(), and JoystickWGenericImpl_BuildActionMap().

◆ IDirectInputDevice8WImpl_GetImageInfo()

HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo ( LPDIRECTINPUTDEVICE8W  iface,
LPDIDEVICEIMAGEINFOHEADERW  lpdiDevImageInfoHeader 
)

Definition at line 1950 of file device.c.

1952{
1954 FIXME("(%p)->(%p): stub !\n", This, lpdiDevImageInfoHeader);
1955
1956 return DI_OK;
1957}

◆ joystick_map_axis()

LONG joystick_map_axis ( ObjProps props,
int  val 
)

Definition at line 985 of file joystick.c.

986{
987 LONG ret;
988 LONG dead_zone = MulDiv( props->lDeadZone, props->lDevMax - props->lDevMin, 10000 );
989 LONG dev_range = props->lDevMax - props->lDevMin - dead_zone;
990
991 /* Center input */
992 val -= (props->lDevMin + props->lDevMax) / 2;
993
994 /* Remove dead zone */
995 if (abs( val ) <= dead_zone / 2)
996 val = 0;
997 else
998 val = val < 0 ? val + dead_zone / 2 : val - dead_zone / 2;
999
1000 /* Scale and map the value from the device range into the required range */
1001 ret = MulDiv( val, props->lMax - props->lMin, dev_range ) +
1002 (props->lMin + props->lMax) / 2;
1003
1004 /* Clamp in case or rounding errors */
1005 if (ret > props->lMax) ret = props->lMax;
1006 else if (ret < props->lMin) ret = props->lMin;
1007
1008 TRACE( "(%d <%d> %d) -> (%d <%d> %d): val=%d ret=%d\n",
1009 props->lDevMin, dead_zone, props->lDevMax,
1010 props->lMin, props->lDeadZone, props->lMax,
1011 val, ret );
1012
1013 return ret;
1014}
#define abs(i)
Definition: fconv.c:206
GLuint GLfloat * val
Definition: glext.h:7180
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
long LONG
Definition: pedump.c:60
static const WCHAR props[]
Definition: wbemdisp.c:288

◆ joystick_map_pov()

DWORD joystick_map_pov ( const POINTL p)

Definition at line 1024 of file joystick.c.

1025{
1026 if (p->x > 0)
1027 return p->y < 0 ? 4500 : !p->y ? 9000 : 13500;
1028 else if (p->x < 0)
1029 return p->y < 0 ? 31500 : !p->y ? 27000 : 22500;
1030 else
1031 return p->y < 0 ? 0 : !p->y ? -1 : 18000;
1032}

◆ load_mapping_settings()

BOOL load_mapping_settings ( IDirectInputDeviceImpl This,
LPDIACTIONFORMATW  lpdiaf,
const WCHAR username 
)

Definition at line 740 of file device.c.

741{
742 HKEY hkey;
743 WCHAR *guid_str;
744 DIDEVICEINSTANCEW didev;
745 int i;
746
747 didev.dwSize = sizeof(didev);
748 IDirectInputDevice8_GetDeviceInfo(&This->IDirectInputDevice8W_iface, &didev);
749
750 if (StringFromCLSID(&lpdiaf->guidActionMap, &guid_str) != S_OK)
751 return FALSE;
752
753 hkey = get_mapping_key(didev.tszInstanceName, username, guid_str, FALSE);
754
755 if (!hkey)
756 {
757 CoTaskMemFree(guid_str);
758 return FALSE;
759 }
760
761 /* Try to read each action in the DIACTIONFORMAT from registry */
762 for (i = 0; i < lpdiaf->dwNumActions; i++)
763 {
764 static const WCHAR format[] = {'%','x','\0'};
765 DWORD id, size = sizeof(DWORD);
766 WCHAR label[9];
767
769
770 if (!RegQueryValueExW(hkey, label, 0, NULL, (LPBYTE) &id, &size))
771 {
772 lpdiaf->rgoAction[i].dwObjID = id;
773 lpdiaf->rgoAction[i].guidInstance = didev.guidInstance;
774 lpdiaf->rgoAction[i].dwHow = DIAH_USERCONFIG;
775 }
776 else
777 {
778 memset(&lpdiaf->rgoAction[i].guidInstance, 0, sizeof(GUID));
779 lpdiaf->rgoAction[i].dwHow = DIAH_UNMAPPED;
780 }
781
782 }
783
784 RegCloseKey(hkey);
785 CoTaskMemFree(guid_str);
786
787 /* On Windows BuildActionMap can open empty mapping, so always return TRUE if get_mapping_key is success */
788 return TRUE;
789}
#define DIAH_USERCONFIG
Definition: dinput.h:1300
#define IDirectInputDevice8_GetDeviceInfo(p, a)
Definition: dinput.h:2050
static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WCHAR *guid, BOOL create)
Definition: device.c:669
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
GLuint id
Definition: glext.h:5910
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define S_OK
Definition: intsafe.h:52
static const WCHAR label[]
Definition: itemdlg.c:1546
#define DWORD
Definition: nt_native.h:44
#define sprintfW
Definition: unicode.h:64
WCHAR tszInstanceName[MAX_PATH]
Definition: dinput.h:429
GUID guidInstance
Definition: dinput.h:426
GUID guidActionMap
Definition: dinput.h:1331
Definition: format.c:58

Referenced by _build_action_map(), and JoystickWGenericImpl_BuildActionMap().

◆ queue_event()

void queue_event ( LPDIRECTINPUTDEVICE8A  iface,
int  inst_id,
DWORD  data,
DWORD  time,
DWORD  seq 
)

Definition at line 1025 of file device.c.

1026{
1028 int next_pos, ofs = id_to_offset(&This->data_format, inst_id);
1029
1030 /* Event is being set regardless of the queue state */
1031 if (This->hEvent) SetEvent(This->hEvent);
1032
1034
1035 if (!This->queue_len || This->overflow || ofs < 0) return;
1036
1037 next_pos = (This->queue_head + 1) % This->queue_len;
1038 if (next_pos == This->queue_tail)
1039 {
1040 TRACE(" queue overflowed\n");
1041 This->overflow = TRUE;
1042 return;
1043 }
1044
1045 TRACE(" queueing %d at offset %d (queue head %d / size %d)\n",
1046 data, ofs, This->queue_head, This->queue_len);
1047
1048 This->data_queue[This->queue_head].dwOfs = ofs;
1049 This->data_queue[This->queue_head].dwData = data;
1050 This->data_queue[This->queue_head].dwTimeStamp = time;
1051 This->data_queue[This->queue_head].dwSequence = seq;
1052
1053 /* Set uAppData by means of action mapping */
1054 if (This->num_actions > 0)
1055 {
1056 int i;
1057 for (i=0; i < This->num_actions; i++)
1058 {
1059 if (This->action_map[i].offset == ofs)
1060 {
1061 TRACE("Offset %d mapped to uAppData %lu\n", ofs, This->action_map[i].uAppData);
1062 This->data_queue[This->queue_head].uAppData = This->action_map[i].uAppData;
1063 break;
1064 }
1065 }
1066 }
1067
1068 This->queue_head = next_pos;
1069 /* Send event if asked */
1070}
#define WM_WINE_NOTIFY_ACTIVITY
Definition: device.c:43
static int id_to_offset(const DataFormat *df, int id)
Definition: device.c:600
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
if(dx< 0)
Definition: linetemp.h:194
__u16 time
Definition: mkdosfs.c:8
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by dinput_mouse_hook(), and KeyboardCallback().

◆ release_DataFormat()

void release_DataFormat ( DataFormat df)

Definition at line 391 of file device.c.

392{
393 TRACE("Deleting DataFormat: %p\n", format);
394
395 HeapFree(GetProcessHeap(), 0, format->dt);
396 format->dt = NULL;
397 HeapFree(GetProcessHeap(), 0, format->offsets);
398 format->offsets = NULL;
399 HeapFree(GetProcessHeap(), 0, format->user_df);
400 format->user_df = NULL;
401}

Referenced by IDirectInputDevice2WImpl_Release(), and IDirectInputDevice2WImpl_SetDataFormat().

◆ save_mapping_settings()

HRESULT save_mapping_settings ( IDirectInputDevice8W *  iface,
LPDIACTIONFORMATW  lpdiaf,
LPCWSTR  lpszUsername 
)

Definition at line 695 of file device.c.

696{
697 WCHAR *guid_str = NULL;
698 DIDEVICEINSTANCEW didev;
699 HKEY hkey;
700 int i;
701
702 didev.dwSize = sizeof(didev);
704
705 if (StringFromCLSID(&lpdiaf->guidActionMap, &guid_str) != S_OK)
706 return DI_SETTINGSNOTSAVED;
707
708 del_mapping_key(didev.tszInstanceName, lpszUsername, guid_str);
709
710 hkey = get_mapping_key(didev.tszInstanceName, lpszUsername, guid_str, TRUE);
711
712 if (!hkey)
713 {
714 CoTaskMemFree(guid_str);
715 return DI_SETTINGSNOTSAVED;
716 }
717
718 /* Write each of the actions mapped for this device.
719 Format is "dwSemantic"="dwObjID" and key is of type REG_DWORD
720 */
721 for (i = 0; i < lpdiaf->dwNumActions; i++)
722 {
723 static const WCHAR format[] = {'%','x','\0'};
724 WCHAR label[9];
725
726 if (IsEqualGUID(&didev.guidInstance, &lpdiaf->rgoAction[i].guidInstance) &&
727 lpdiaf->rgoAction[i].dwHow != DIAH_UNMAPPED)
728 {
730 RegSetValueExW(hkey, label, 0, REG_DWORD, (const BYTE*) &lpdiaf->rgoAction[i].dwObjID, sizeof(DWORD));
731 }
732 }
733
734 RegCloseKey(hkey);
735 CoTaskMemFree(guid_str);
736
737 return DI_OK;
738}
#define DI_SETTINGSNOTSAVED
Definition: dinput.h:137
static void del_mapping_key(const WCHAR *device, const WCHAR *username, const WCHAR *guid)
Definition: device.c:647
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
#define REG_DWORD
Definition: sdbapi.c:596
unsigned char BYTE
Definition: xxhash.c:193

Referenced by _set_action_map(), and save_actions().

Variable Documentation

◆ DECLSPEC_HIDDEN

const GUID DInput_PIDVID_Product_GUID DECLSPEC_HIDDEN
extern

Definition at line 289 of file d3dcompiler_private.h.