Commit 755422a2 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

xinput: Detect and setup HID gamepads.

parent e48296c2
MODULE = xinput1_1.dll
PARENTSRC = ../xinput1_3
DELAYIMPORTS = hid setupapi
C_SRCS = \
hid.c \
xinput_main.c
RC_SRCS = version.rc
MODULE = xinput1_2.dll
PARENTSRC = ../xinput1_3
DELAYIMPORTS = hid setupapi
C_SRCS = \
hid.c \
xinput_main.c
RC_SRCS = version.rc
MODULE = xinput1_3.dll
IMPORTLIB = xinput
DELAYIMPORTS = hid setupapi
C_SRCS = \
hid.c \
xinput_main.c
RC_SRCS = version.rc
......@@ -28,24 +28,26 @@
#include "winerror.h"
#include "xinput.h"
#include "xinput_private.h"
/* Not defined in the headers, used only by XInputGetStateEx */
#define XINPUT_GAMEPAD_GUIDE 0x0400
WINE_DEFAULT_DEBUG_CHANNEL(xinput);
struct
{
BOOL connected;
} controllers[XUSER_MAX_COUNT];
xinput_controller controllers[XUSER_MAX_COUNT];
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
{
switch(reason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(inst);
break;
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(inst);
break;
case DLL_PROCESS_DETACH:
if (reserved) break;
HID_destroy_gamepads(controllers);
break;
}
return TRUE;
}
......@@ -121,17 +123,20 @@ DWORD WINAPI XInputGetKeystroke(DWORD index, DWORD reserved, PXINPUT_KEYSTROKE k
DWORD WINAPI XInputGetCapabilities(DWORD index, DWORD flags, XINPUT_CAPABILITIES* capabilities)
{
static int warn_once;
TRACE("(index %u, flags 0x%x, capabilities %p)\n", index, flags, capabilities);
if (!warn_once++)
FIXME("(index %u, flags 0x%x, capabilities %p) Stub!\n", index, flags, capabilities);
HID_find_gamepads(controllers);
if (index >= XUSER_MAX_COUNT)
return ERROR_BAD_ARGUMENTS;
if (!controllers[index].connected)
return ERROR_DEVICE_NOT_CONNECTED;
if (flags & XINPUT_FLAG_GAMEPAD && controllers[index].caps.SubType != XINPUT_DEVSUBTYPE_GAMEPAD)
return ERROR_DEVICE_NOT_CONNECTED;
return ERROR_NOT_SUPPORTED;
memcpy(capabilities, &controllers[index].caps, sizeof(*capabilities));
return ERROR_SUCCESS;
}
DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD index, GUID* render_guid, GUID* capture_guid)
......
/*
* The Wine project - Xinput Joystick Library
* Copyright 2018 Aric Stewart
*
* 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
*/
typedef struct _xinput_controller
{
BOOL connected;
XINPUT_CAPABILITIES caps;
void *platform_private;
XINPUT_STATE state;
} xinput_controller;
void HID_find_gamepads(xinput_controller *devices) DECLSPEC_HIDDEN;
void HID_destroy_gamepads(xinput_controller *devices) DECLSPEC_HIDDEN;
MODULE = xinput1_4.dll
PARENTSRC = ../xinput1_3
DELAYIMPORTS = hid setupapi
C_SRCS = \
hid.c \
xinput_main.c
RC_SRCS = version.rc
MODULE = xinput9_1_0.dll
PARENTSRC = ../xinput1_3
DELAYIMPORTS = hid setupapi
C_SRCS = \
hid.c \
xinput_main.c
RC_SRCS = version.rc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment