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
24 #include "wine/test.h"
26 static DWORD (WINAPI *pXInputGetState)(DWORD, XINPUT_STATE*);
28 static void test_get_state(void)
31 XINPUT_STATE controllerState;
35 for(controllerNum=0; controllerNum < XUSER_MAX_COUNT; controllerNum++)
37 ZeroMemory(&controllerState, sizeof(XINPUT_STATE));
39 result = pXInputGetState(controllerNum, &controllerState);
40 ok(result == ERROR_SUCCESS || result == ERROR_DEVICE_NOT_CONNECTED, "XInputGetState failed with (%d)\n", result);
42 if (ERROR_DEVICE_NOT_CONNECTED == result)
44 skip("Controller %d is not connected\n", controllerNum);
48 trace("-- Results for controller %d --\n", controllerNum);
49 trace("XInputGetState: %d\n", result);
50 trace("State->dwPacketNumber: %d\n", controllerState.dwPacketNumber);
51 trace("Gamepad Variables --\n");
52 trace("Gamepad.wButtons: %#x\n", controllerState.Gamepad.wButtons);
53 trace("Gamepad.bLeftTrigger: 0x%08x\n", controllerState.Gamepad.bLeftTrigger);
54 trace("Gamepad.bRightTrigger: 0x%08x\n", controllerState.Gamepad.bRightTrigger);
55 trace("Gamepad.sThumbLX: %d\n", controllerState.Gamepad.sThumbLX);
56 trace("Gamepad.sThumbLY: %d\n", controllerState.Gamepad.sThumbLY);
57 trace("Gamepad.sThumbRX: %d\n", controllerState.Gamepad.sThumbRX);
58 trace("Gamepad.sThumbRY: %d\n", controllerState.Gamepad.sThumbRY);
62 ZeroMemory(&controllerState, sizeof(XINPUT_STATE));
63 result = pXInputGetState(XUSER_MAX_COUNT+1, &controllerState);
64 ok(result == ERROR_BAD_ARGUMENTS, "XInputGetState returned (%d)\n", result);
70 hXinput = LoadLibraryA( "xinput1_3.dll" );
74 pXInputGetState = (void*)GetProcAddress(hXinput, "XInputGetState");
79 skip("Could not load xinput1_3.dll\n");