ReactOS  0.4.15-dev-1197-g8081ba9
xinput1_3_main.c
Go to the documentation of this file.
1 /*
2  * The Wine project - Xinput Joystick Library
3  * Copyright 2008 Andrew Fenn
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19 
20 #include <config.h>
21 //#include <assert.h>
22 //#include <stdarg.h>
23 //#include <string.h>
24 
25 #include <wine/debug.h>
26 //#include "windef.h"
27 #include <winbase.h>
28 //#include "winerror.h"
29 
30 #include <xinput.h>
31 
32 /* Not defined in the headers, used only by XInputGetStateEx */
33 #define XINPUT_GAMEPAD_GUIDE 0x0400
34 
36 
37 struct
38 {
41 
43 {
44  switch(reason)
45  {
46  case DLL_PROCESS_ATTACH:
48  break;
49  }
50  return TRUE;
51 }
52 
54 {
55  /* Setting to false will stop messages from XInputSetState being sent
56  to the controllers. Setting to true will send the last vibration
57  value (sent to XInputSetState) to the controller and allow messages to
58  be sent */
59  FIXME("(enable %d) Stub!\n", enable);
60 }
61 
63 {
64  FIXME("(index %u, vibration %p) Stub!\n", index, vibration);
65 
66  if (index >= XUSER_MAX_COUNT)
67  return ERROR_BAD_ARGUMENTS;
70 
71  return ERROR_NOT_SUPPORTED;
72 }
73 
75 {
76  union
77  {
79  XINPUT_STATE_EX state_ex;
80  } xinput;
81  DWORD ret;
82  static int warn_once;
83 
84  if (!warn_once++)
85  FIXME("(index %u, state %p) Stub!\n", index, state);
86 
87  ret = XInputGetStateEx(index, &xinput.state_ex);
88  if (ret != ERROR_SUCCESS)
89  return ret;
90 
91  /* The main difference between this and the Ex version is the media guide button */
92  xinput.state.Gamepad.wButtons &= ~XINPUT_GAMEPAD_GUIDE;
93  *state = xinput.state;
94 
95  return ERROR_SUCCESS;
96 }
97 
99 {
100  static int warn_once;
101 
102  if (!warn_once++)
103  FIXME("(index %u, state %p) Stub!\n", index, state_ex);
104 
105  if (index >= XUSER_MAX_COUNT)
106  return ERROR_BAD_ARGUMENTS;
109 
110  return ERROR_NOT_SUPPORTED;
111 }
112 
114 {
115  static int warn_once;
116 
117  if (!warn_once++)
118  FIXME("(index %u, reserved %u, keystroke %p) Stub!\n", index, reserved, keystroke);
119 
120  if (index >= XUSER_MAX_COUNT)
121  return ERROR_BAD_ARGUMENTS;
124 
125  return ERROR_NOT_SUPPORTED;
126 }
127 
129 {
130  static int warn_once;
131 
132  if (!warn_once++)
133  FIXME("(index %u, flags 0x%x, capabilities %p) Stub!\n", index, flags, capabilities);
134 
135  if (index >= XUSER_MAX_COUNT)
136  return ERROR_BAD_ARGUMENTS;
139 
140  return ERROR_NOT_SUPPORTED;
141 }
142 
144 {
145  FIXME("(index %u, render guid %p, capture guid %p) Stub!\n", index, render_guid, capture_guid);
146 
147  if (index >= XUSER_MAX_COUNT)
148  return ERROR_BAD_ARGUMENTS;
151 
152  return ERROR_NOT_SUPPORTED;
153 }
154 
156 {
157  FIXME("(index %u, type %u, battery %p) Stub!\n", index, type, battery);
158 
159  if (index >= XUSER_MAX_COUNT)
160  return ERROR_BAD_ARGUMENTS;
163 
164  return ERROR_NOT_SUPPORTED;
165 }
#define XUSER_MAX_COUNT
Definition: xinput.h:156
#define XINPUT_GAMEPAD_GUIDE
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
DWORD WINAPI XInputGetBatteryInformation(DWORD index, BYTE type, XINPUT_BATTERY_INFORMATION *battery)
#define ERROR_BAD_ARGUMENTS
Definition: winerror.h:232
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD WINAPI XInputSetState(DWORD index, XINPUT_VIBRATION *vibration)
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD index, GUID *render_guid, GUID *capture_guid)
#define ERROR_DEVICE_NOT_CONNECTED
Definition: winerror.h:689
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI XInputGetCapabilities(DWORD index, DWORD flags, XINPUT_CAPABILITIES *capabilities)
#define FIXME(fmt,...)
Definition: debug.h:111
r reserved
Definition: btrfs.c:2940
GLuint index
Definition: glext.h:6031
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:246
void WINAPI DECLSPEC_HOTPATCH XInputEnable(BOOL enable)
struct @594 controllers[XUSER_MAX_COUNT]
WINE_DEFAULT_DEBUG_CHANNEL(xinput)
DWORD WINAPI DECLSPEC_HOTPATCH XInputGetState(DWORD index, XINPUT_STATE *state)
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
int ret
static int state
Definition: maze.c:121
unsigned char BYTE
Definition: xxhash.c:193
GLboolean enable
Definition: glext.h:11120
DWORD WINAPI XInputGetKeystroke(DWORD index, DWORD reserved, PXINPUT_KEYSTROKE keystroke)
DWORD WINAPI DECLSPEC_HOTPATCH XInputGetStateEx(DWORD index, XINPUT_STATE_EX *state_ex)
#define ERROR_NOT_SUPPORTED
Definition: compat.h:100
BOOL connected