2009-05-06 15:00:03 +00:00
|
|
|
/*
|
|
|
|
* The Wine project - Xinput Joystick Library
|
|
|
|
* Copyright 2008 Andrew Fenn
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <config.h>
|
|
|
|
//#include <assert.h>
|
|
|
|
//#include <stdarg.h>
|
|
|
|
//#include <string.h>
|
2009-05-06 15:00:03 +00:00
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <wine/debug.h>
|
|
|
|
//#include "windef.h"
|
|
|
|
#include <winbase.h>
|
|
|
|
//#include "winerror.h"
|
2009-05-06 15:00:03 +00:00
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <xinput.h>
|
2009-05-06 15:00:03 +00:00
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
/* Not defined in the headers, used only by XInputGetStateEx */
|
|
|
|
#define XINPUT_GAMEPAD_GUIDE 0x0400
|
|
|
|
|
2009-05-06 15:00:03 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(xinput);
|
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
BOOL connected;
|
|
|
|
} controllers[XUSER_MAX_COUNT];
|
|
|
|
|
2009-05-06 15:00:03 +00:00
|
|
|
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
|
|
|
|
{
|
|
|
|
switch(reason)
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
DisableThreadLibraryCalls(inst);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-02-26 20:37:15 +00:00
|
|
|
void WINAPI DECLSPEC_HOTPATCH XInputEnable(BOOL enable)
|
2009-05-06 15:00:03 +00:00
|
|
|
{
|
|
|
|
/* Setting to false will stop messages from XInputSetState being sent
|
|
|
|
to the controllers. Setting to true will send the last vibration
|
|
|
|
value (sent to XInputSetState) to the controller and allow messages to
|
|
|
|
be sent */
|
2016-11-17 23:28:41 +00:00
|
|
|
FIXME("(enable %d) Stub!\n", enable);
|
2009-05-06 15:00:03 +00:00
|
|
|
}
|
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
DWORD WINAPI XInputSetState(DWORD index, XINPUT_VIBRATION* vibration)
|
2009-05-06 15:00:03 +00:00
|
|
|
{
|
2016-11-17 23:28:41 +00:00
|
|
|
FIXME("(index %u, vibration %p) Stub!\n", index, vibration);
|
2009-05-06 15:00:03 +00:00
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
if (index >= XUSER_MAX_COUNT)
|
|
|
|
return ERROR_BAD_ARGUMENTS;
|
|
|
|
if (!controllers[index].connected)
|
2009-05-06 15:00:03 +00:00
|
|
|
return ERROR_DEVICE_NOT_CONNECTED;
|
2016-11-17 23:28:41 +00:00
|
|
|
|
|
|
|
return ERROR_NOT_SUPPORTED;
|
2009-05-06 15:00:03 +00:00
|
|
|
}
|
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
DWORD WINAPI DECLSPEC_HOTPATCH XInputGetState(DWORD index, XINPUT_STATE* state)
|
2009-05-06 15:00:03 +00:00
|
|
|
{
|
2016-11-17 23:28:41 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
XINPUT_STATE state;
|
|
|
|
XINPUT_STATE_EX state_ex;
|
|
|
|
} xinput;
|
|
|
|
DWORD ret;
|
Sync devenum, atl, comctl32, comdlg32, cryptdlg, cryptui, hhctrl, itss, jscript, mapi32, msacm32, mshtml, msi, msimtf, oleacc, pstorec, shdoclc, shdocvw, shlwapi, snmpapi, urlmon, usp10, uxtheme, windowscodecs, wldap32, wtsapi32, wuapi, xinput1_3
svn path=/trunk/; revision=47961
2010-07-06 23:29:26 +00:00
|
|
|
static int warn_once;
|
|
|
|
|
|
|
|
if (!warn_once++)
|
2016-11-17 23:28:41 +00:00
|
|
|
FIXME("(index %u, state %p) Stub!\n", index, state);
|
2009-05-06 15:00:03 +00:00
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
ret = XInputGetStateEx(index, &xinput.state_ex);
|
|
|
|
if (ret != ERROR_SUCCESS)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* The main difference between this and the Ex version is the media guide button */
|
|
|
|
xinput.state.Gamepad.wButtons &= ~XINPUT_GAMEPAD_GUIDE;
|
|
|
|
*state = xinput.state;
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD WINAPI DECLSPEC_HOTPATCH XInputGetStateEx(DWORD index, XINPUT_STATE_EX* state_ex)
|
|
|
|
{
|
|
|
|
static int warn_once;
|
|
|
|
|
|
|
|
if (!warn_once++)
|
|
|
|
FIXME("(index %u, state %p) Stub!\n", index, state_ex);
|
|
|
|
|
|
|
|
if (index >= XUSER_MAX_COUNT)
|
|
|
|
return ERROR_BAD_ARGUMENTS;
|
|
|
|
if (!controllers[index].connected)
|
2009-05-06 15:00:03 +00:00
|
|
|
return ERROR_DEVICE_NOT_CONNECTED;
|
2016-11-17 23:28:41 +00:00
|
|
|
|
|
|
|
return ERROR_NOT_SUPPORTED;
|
2009-05-06 15:00:03 +00:00
|
|
|
}
|
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
DWORD WINAPI XInputGetKeystroke(DWORD index, DWORD reserved, PXINPUT_KEYSTROKE keystroke)
|
2009-05-06 15:00:03 +00:00
|
|
|
{
|
2017-02-26 20:37:15 +00:00
|
|
|
static int warn_once;
|
|
|
|
|
|
|
|
if (!warn_once++)
|
|
|
|
FIXME("(index %u, reserved %u, keystroke %p) Stub!\n", index, reserved, keystroke);
|
2009-05-06 15:00:03 +00:00
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
if (index >= XUSER_MAX_COUNT)
|
|
|
|
return ERROR_BAD_ARGUMENTS;
|
|
|
|
if (!controllers[index].connected)
|
2009-05-06 15:00:03 +00:00
|
|
|
return ERROR_DEVICE_NOT_CONNECTED;
|
2016-11-17 23:28:41 +00:00
|
|
|
|
|
|
|
return ERROR_NOT_SUPPORTED;
|
2009-05-06 15:00:03 +00:00
|
|
|
}
|
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
DWORD WINAPI XInputGetCapabilities(DWORD index, DWORD flags, XINPUT_CAPABILITIES* capabilities)
|
2009-05-06 15:00:03 +00:00
|
|
|
{
|
Sync devenum, atl, comctl32, comdlg32, cryptdlg, cryptui, hhctrl, itss, jscript, mapi32, msacm32, mshtml, msi, msimtf, oleacc, pstorec, shdoclc, shdocvw, shlwapi, snmpapi, urlmon, usp10, uxtheme, windowscodecs, wldap32, wtsapi32, wuapi, xinput1_3
svn path=/trunk/; revision=47961
2010-07-06 23:29:26 +00:00
|
|
|
static int warn_once;
|
|
|
|
|
|
|
|
if (!warn_once++)
|
2016-11-17 23:28:41 +00:00
|
|
|
FIXME("(index %u, flags 0x%x, capabilities %p) Stub!\n", index, flags, capabilities);
|
2009-05-06 15:00:03 +00:00
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
if (index >= XUSER_MAX_COUNT)
|
|
|
|
return ERROR_BAD_ARGUMENTS;
|
|
|
|
if (!controllers[index].connected)
|
2009-05-06 15:00:03 +00:00
|
|
|
return ERROR_DEVICE_NOT_CONNECTED;
|
2016-11-17 23:28:41 +00:00
|
|
|
|
|
|
|
return ERROR_NOT_SUPPORTED;
|
2009-05-06 15:00:03 +00:00
|
|
|
}
|
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD index, GUID* render_guid, GUID* capture_guid)
|
2009-05-06 15:00:03 +00:00
|
|
|
{
|
2016-11-17 23:28:41 +00:00
|
|
|
FIXME("(index %u, render guid %p, capture guid %p) Stub!\n", index, render_guid, capture_guid);
|
2009-05-06 15:00:03 +00:00
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
if (index >= XUSER_MAX_COUNT)
|
|
|
|
return ERROR_BAD_ARGUMENTS;
|
|
|
|
if (!controllers[index].connected)
|
2009-05-06 15:00:03 +00:00
|
|
|
return ERROR_DEVICE_NOT_CONNECTED;
|
2016-11-17 23:28:41 +00:00
|
|
|
|
|
|
|
return ERROR_NOT_SUPPORTED;
|
2009-05-06 15:00:03 +00:00
|
|
|
}
|
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
DWORD WINAPI XInputGetBatteryInformation(DWORD index, BYTE type, XINPUT_BATTERY_INFORMATION* battery)
|
2009-05-06 15:00:03 +00:00
|
|
|
{
|
2016-11-17 23:28:41 +00:00
|
|
|
FIXME("(index %u, type %u, battery %p) Stub!\n", index, type, battery);
|
2009-05-06 15:00:03 +00:00
|
|
|
|
2016-11-17 23:28:41 +00:00
|
|
|
if (index >= XUSER_MAX_COUNT)
|
|
|
|
return ERROR_BAD_ARGUMENTS;
|
|
|
|
if (!controllers[index].connected)
|
2009-05-06 15:00:03 +00:00
|
|
|
return ERROR_DEVICE_NOT_CONNECTED;
|
2016-11-17 23:28:41 +00:00
|
|
|
|
|
|
|
return ERROR_NOT_SUPPORTED;
|
2009-05-06 15:00:03 +00:00
|
|
|
}
|