opengl32: Update to the current OpenGL spec.
[wine.git] / dlls / xinput1_3 / xinput_main.c
bloba0a0877cf456601e742b12a37a4e574dc17cb83e
1 /*
2 * The Wine project - Xinput Joystick Library
3 * Copyright 2008 Andrew Fenn
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.
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.
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
20 #include "config.h"
21 #include <assert.h>
22 #include <stdarg.h>
23 #include <string.h>
25 #include "wine/debug.h"
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winerror.h"
30 #include "xinput.h"
32 /* Not defined in the headers, used only by XInputGetStateEx */
33 #define XINPUT_GAMEPAD_GUIDE 0x0400
35 WINE_DEFAULT_DEBUG_CHANNEL(xinput);
37 struct
39 BOOL connected;
40 } controllers[XUSER_MAX_COUNT];
42 BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
44 switch(reason)
46 case DLL_PROCESS_ATTACH:
47 DisableThreadLibraryCalls(inst);
48 break;
50 return TRUE;
53 void WINAPI DECLSPEC_HOTPATCH XInputEnable(BOOL enable)
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);
62 DWORD WINAPI XInputSetState(DWORD index, XINPUT_VIBRATION* vibration)
64 FIXME("(index %u, vibration %p) Stub!\n", index, vibration);
66 if (index >= XUSER_MAX_COUNT)
67 return ERROR_BAD_ARGUMENTS;
68 if (!controllers[index].connected)
69 return ERROR_DEVICE_NOT_CONNECTED;
71 return ERROR_NOT_SUPPORTED;
74 DWORD WINAPI DECLSPEC_HOTPATCH XInputGetState(DWORD index, XINPUT_STATE* state)
76 DWORD ret;
77 static int warn_once;
79 if (!warn_once++)
80 FIXME("(index %u, state %p) Stub!\n", index, state);
82 ret = XInputGetStateEx(index, state);
83 if (ret != ERROR_SUCCESS)
84 return ret;
86 /* The main difference between this and the Ex version is the media guide button */
87 state->Gamepad.wButtons &= ~XINPUT_GAMEPAD_GUIDE;
89 return ERROR_SUCCESS;
92 DWORD WINAPI DECLSPEC_HOTPATCH XInputGetStateEx(DWORD index, XINPUT_STATE* state)
94 static int warn_once;
96 if (!warn_once++)
97 FIXME("(index %u, state %p) Stub!\n", index, state);
99 if (index >= XUSER_MAX_COUNT)
100 return ERROR_BAD_ARGUMENTS;
101 if (!controllers[index].connected)
102 return ERROR_DEVICE_NOT_CONNECTED;
104 return ERROR_NOT_SUPPORTED;
107 DWORD WINAPI XInputGetKeystroke(DWORD index, DWORD reserved, PXINPUT_KEYSTROKE keystroke)
109 static int warn_once;
111 if (!warn_once++)
112 FIXME("(index %u, reserved %u, keystroke %p) Stub!\n", index, reserved, keystroke);
114 if (index >= XUSER_MAX_COUNT)
115 return ERROR_BAD_ARGUMENTS;
116 if (!controllers[index].connected)
117 return ERROR_DEVICE_NOT_CONNECTED;
119 return ERROR_NOT_SUPPORTED;
122 DWORD WINAPI XInputGetCapabilities(DWORD index, DWORD flags, XINPUT_CAPABILITIES* capabilities)
124 static int warn_once;
126 if (!warn_once++)
127 FIXME("(index %u, flags 0x%x, capabilities %p) Stub!\n", index, flags, capabilities);
129 if (index >= XUSER_MAX_COUNT)
130 return ERROR_BAD_ARGUMENTS;
131 if (!controllers[index].connected)
132 return ERROR_DEVICE_NOT_CONNECTED;
134 return ERROR_NOT_SUPPORTED;
137 DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD index, GUID* render_guid, GUID* capture_guid)
139 FIXME("(index %u, render guid %p, capture guid %p) Stub!\n", index, render_guid, capture_guid);
141 if (index >= XUSER_MAX_COUNT)
142 return ERROR_BAD_ARGUMENTS;
143 if (!controllers[index].connected)
144 return ERROR_DEVICE_NOT_CONNECTED;
146 return ERROR_NOT_SUPPORTED;
149 DWORD WINAPI XInputGetBatteryInformation(DWORD index, BYTE type, XINPUT_BATTERY_INFORMATION* battery)
151 FIXME("(index %u, type %u, battery %p) Stub!\n", index, type, battery);
153 if (index >= XUSER_MAX_COUNT)
154 return ERROR_BAD_ARGUMENTS;
155 if (!controllers[index].connected)
156 return ERROR_DEVICE_NOT_CONNECTED;
158 return ERROR_NOT_SUPPORTED;