Supersedes https://gitlab.winehq.org/wine/wine/-/merge_requests/8338
The header cannot seem to be generated easily from an IDL, gameinput has some unfortunate versioning which reuses the same identifiers across versions, in an incompatible way and sometimes sharing only a subset of them (for instance enum values), and uses C++ namespaces to separate versions.
The implementation needs to support every interface version at the same time, which is implemented by wrapping identifiers and adding version suffixes whenever it is included by the implementing code. The tests are also using that so we can tests multiple versions in the same file.
From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58574 --- include/Makefile.in | 1 + include/gameinput.h | 1706 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1707 insertions(+) create mode 100644 include/gameinput.h
diff --git a/include/Makefile.in b/include/Makefile.in index b03d15993be..76e17b4ea90 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -342,6 +342,7 @@ SOURCES = \ fltdefs.h \ fontsub.h \ fusion.idl \ + gameinput.h \ gameux.idl \ gamingtcui.h \ gdiplus.h \ diff --git a/include/gameinput.h b/include/gameinput.h new file mode 100644 index 00000000000..3186c94a9dd --- /dev/null +++ b/include/gameinput.h @@ -0,0 +1,1706 @@ +/* + * Copyright 2025 Rémi Bernon for CodeWeavers + * + * 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 + */ + +#if !defined(__WINE_GAMEINPUT_H) || defined(_GAMEINPUT_) +#define __WINE_GAMEINPUT_H + +#include "stdint.h" +#include "unknwn.h" + +#ifndef GAMEINPUT_API_VERSION +#define GAMEINPUT_API_VERSION 1 +#endif /* GAMEINPUT_API_VERSION */ + +#ifdef __cplusplus +extern "C" { +#if GAMEINPUT_API_VERSION == 1 +namespace GameInput { namespace v1 { +#endif /* GAMEINPUT_API_VERSION */ +#endif /* __cplusplus */ + +#ifndef _GAMEINPUT_ +#define GI(x) x +#elif GAMEINPUT_API_VERSION == 0 +#define GI(x) x ## 0 +#elif GAMEINPUT_API_VERSION == 1 +#define GI(x) x ## 1 +#else /* GAMEINPUT_API_VERSION */ +#define GI(x) x +#endif /* _GAMEINPUT_ */ + +#if GAMEINPUT_API_VERSION == 0 +typedef enum GI(GameInputBatteryStatus) GI(GameInputBatteryStatus); +typedef enum GI(GameInputDeviceCapabilities) GI(GameInputDeviceCapabilities); +typedef enum GI(GameInputLocation) GI(GameInputLocation); +typedef enum GI(GameInputMotionAccuracy) GI(GameInputMotionAccuracy); +typedef enum GI(GameInputRawDeviceItemCollectionKind) GI(GameInputRawDeviceItemCollectionKind); +typedef enum GI(GameInputRawDevicePhysicalUnitKind) GI(GameInputRawDevicePhysicalUnitKind); +typedef enum GI(GameInputRawDeviceReportItemFlags) GI(GameInputRawDeviceReportItemFlags); +typedef enum GI(GameInputRawDeviceReportKind) GI(GameInputRawDeviceReportKind); +typedef enum GI(GameInputTouchShape) GI(GameInputTouchShape); +#endif /* GAMEINPUT_API_VERSION */ +typedef enum GI(GameInputArcadeStickButtons) GI(GameInputArcadeStickButtons); +typedef enum GI(GameInputDeviceFamily) GI(GameInputDeviceFamily); +typedef enum GI(GameInputDeviceStatus) GI(GameInputDeviceStatus); +typedef enum GI(GameInputEnumerationKind) GI(GameInputEnumerationKind); +typedef enum GI(GameInputFeedbackAxes) GI(GameInputFeedbackAxes); +typedef enum GI(GameInputFeedbackEffectState) GI(GameInputFeedbackEffectState); +typedef enum GI(GameInputFlightStickButtons) GI(GameInputFlightStickButtons); +typedef enum GI(GameInputFocusPolicy) GI(GameInputFocusPolicy); +typedef enum GI(GameInputForceFeedbackEffectKind) GI(GameInputForceFeedbackEffectKind); +typedef enum GI(GameInputGamepadButtons) GI(GameInputGamepadButtons); +typedef enum GI(GameInputKeyboardKind) GI(GameInputKeyboardKind); +typedef enum GI(GameInputKind) GI(GameInputKind); +typedef enum GI(GameInputLabel) GI(GameInputLabel); +typedef enum GI(GameInputMouseButtons) GI(GameInputMouseButtons); +typedef enum GI(GameInputMousePositions) GI(GameInputMousePositions); +typedef enum GI(GameInputRacingWheelButtons) GI(GameInputRacingWheelButtons); +typedef enum GI(GameInputRumbleMotors) GI(GameInputRumbleMotors); +typedef enum GI(GameInputSwitchKind) GI(GameInputSwitchKind); +typedef enum GI(GameInputSwitchPosition) GI(GameInputSwitchPosition); +typedef enum GI(GameInputSystemButtons) GI(GameInputSystemButtons); +typedef enum GI(GameInputUiNavigationButtons) GI(GameInputUiNavigationButtons); + +typedef struct GI(GameInputUsage) GI(GameInputUsage); +#if GAMEINPUT_API_VERSION == 0 +typedef struct GI(GameInputBatteryState) GI(GameInputBatteryState); +typedef struct GI(GameInputHapticFeedbackMotorInfo) GI(GameInputHapticFeedbackMotorInfo); +typedef struct GI(GameInputHapticFeedbackParams) GI(GameInputHapticFeedbackParams); +typedef struct GI(GameInputHapticWaveformInfo) GI(GameInputHapticWaveformInfo); +typedef struct GI(GameInputMotionInfo) GI(GameInputMotionInfo); +typedef struct GI(GameInputMotionState) GI(GameInputMotionState); +typedef struct GI(GameInputRawDeviceItemCollectionInfo) GI(GameInputRawDeviceItemCollectionInfo); +typedef struct GI(GameInputRawDeviceReportInfo) GI(GameInputRawDeviceReportInfo); +typedef struct GI(GameInputRawDeviceReportItemInfo) GI(GameInputRawDeviceReportItemInfo); +typedef struct GI(GameInputString) GI(GameInputString); +typedef struct GI(GameInputTouchSensorInfo) GI(GameInputTouchSensorInfo); +typedef struct GI(GameInputTouchState) GI(GameInputTouchState); +typedef struct GI(GameInputVersion) GI(GameInputVersion); +#endif /* GAMEINPUT_API_VERSION */ +typedef struct GI(GameInputForceFeedbackMagnitude) GI(GameInputForceFeedbackMagnitude); +typedef struct GI(GameInputForceFeedbackEnvelope) GI(GameInputForceFeedbackEnvelope); +typedef struct GI(GameInputForceFeedbackConditionParams) GI(GameInputForceFeedbackConditionParams); +typedef struct GI(GameInputForceFeedbackConstantParams) GI(GameInputForceFeedbackConstantParams); +typedef struct GI(GameInputForceFeedbackPeriodicParams) GI(GameInputForceFeedbackPeriodicParams); +typedef struct GI(GameInputForceFeedbackRampParams) GI(GameInputForceFeedbackRampParams); +typedef struct GI(GameInputArcadeStickInfo) GI(GameInputArcadeStickInfo); +typedef struct GI(GameInputArcadeStickState) GI(GameInputArcadeStickState); +typedef struct GI(GameInputControllerAxisInfo) GI(GameInputControllerAxisInfo); +typedef struct GI(GameInputControllerButtonInfo) GI(GameInputControllerButtonInfo); +typedef struct GI(GameInputControllerSwitchInfo) GI(GameInputControllerSwitchInfo); +typedef struct GI(GameInputDeviceInfo) GI(GameInputDeviceInfo); +typedef struct GI(GameInputFlightStickInfo) GI(GameInputFlightStickInfo); +typedef struct GI(GameInputFlightStickState) GI(GameInputFlightStickState); +typedef struct GI(GameInputForceFeedbackMotorInfo) GI(GameInputForceFeedbackMotorInfo); +typedef struct GI(GameInputForceFeedbackParams) GI(GameInputForceFeedbackParams); +typedef struct GI(GameInputGamepadInfo) GI(GameInputGamepadInfo); +typedef struct GI(GameInputGamepadState) GI(GameInputGamepadState); +typedef struct GI(GameInputKeyboardInfo) GI(GameInputKeyboardInfo); +typedef struct GI(GameInputKeyState) GI(GameInputKeyState); +typedef struct GI(GameInputMouseInfo) GI(GameInputMouseInfo); +typedef struct GI(GameInputMouseState) GI(GameInputMouseState); +typedef struct GI(GameInputRacingWheelInfo) GI(GameInputRacingWheelInfo); +typedef struct GI(GameInputRacingWheelState) GI(GameInputRacingWheelState); +typedef struct GI(GameInputRumbleParams) GI(GameInputRumbleParams); +typedef struct GI(GameInputUiNavigationInfo) GI(GameInputUiNavigationInfo); +typedef struct GI(GameInputUiNavigationState) GI(GameInputUiNavigationState); + +#if GAMEINPUT_API_VERSION == 0 +interface GI(IGameInputRawDeviceReport); +#endif +interface GI(IGameInput); +interface GI(IGameInputReading); +interface GI(IGameInputDevice); +interface GI(IGameInputDispatcher); +interface GI(IGameInputForceFeedbackEffect); + +typedef UINT64 GI(GameInputCallbackToken); +#define GAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUE ((UINT64)-1) +#define GAMEINPUT_INVALID_CALLBACK_TOKEN_VALUE ((UINT64)0) + +#if GAMEINPUT_API_VERSION == 0 +typedef void (CALLBACK *GI(GameInputReadingCallback))( GI(GameInputCallbackToken) token, void *context, struct GI(IGameInputReading) *reading, BOOLEAN overrun ); +typedef void (CALLBACK *GI(GameInputGuideButtonCallback))( GI(GameInputCallbackToken) token, void *context, struct GI(IGameInputDevice) *device, UINT64 timestamp, + BOOLEAN pressed ); +#elif GAMEINPUT_API_VERSION == 1 +typedef void (CALLBACK *GI(GameInputReadingCallback))( GI(GameInputCallbackToken) token, void *context, struct GI(IGameInputReading) *reading ); +typedef void (CALLBACK *GI(GameInputSystemButtonCallback))( GI(GameInputCallbackToken) token, void *context, struct GI(IGameInputDevice) *device, UINT64 timestamp, + GI(GameInputSystemButtons) current_buttons, GI(GameInputSystemButtons) previous_buttons ); +#endif /* GAMEINPUT_API_VERSION */ +typedef void (CALLBACK *GI(GameInputDeviceCallback))( GI(GameInputCallbackToken) token, void *context, struct GI(IGameInputDevice) *device, UINT64 timestamp, + GI(GameInputDeviceStatus) current_status, GI(GameInputDeviceStatus) previous_status ); +typedef void (CALLBACK *GI(GameInputKeyboardLayoutCallback))( GI(GameInputCallbackToken) token, void *context, struct GI(IGameInputDevice) *device, UINT64 timestamp, + UINT32 current_layout, UINT32 previous_layout ); + +#if GAMEINPUT_API_VERSION == 0 +enum GI(GameInputBatteryStatus) +{ + GI(GameInputBatteryUnknown) = -1, + GI(GameInputBatteryNotPresent) = 0, + GI(GameInputBatteryDischarging) = 1, + GI(GameInputBatteryIdle) = 2, + GI(GameInputBatteryCharging) = 3, +}; + +enum GI(GameInputDeviceCapabilities) +{ + GI(GameInputDeviceCapabilityNone) = 0x00000000, + GI(GameInputDeviceCapabilityAudio) = 0x00000001, + GI(GameInputDeviceCapabilityPluginModule) = 0x00000002, + GI(GameInputDeviceCapabilityPowerOff) = 0x00000004, + GI(GameInputDeviceCapabilitySynchronization) = 0x00000008, + GI(GameInputDeviceCapabilityWireless) = 0x00000010, +}; + +enum GI(GameInputLocation) +{ + GI(GameInputLocationUnknown) = -1, + GI(GameInputLocationChassis) = 0, + GI(GameInputLocationDisplay) = 1, + GI(GameInputLocationAxis) = 2, + GI(GameInputLocationButton) = 3, + GI(GameInputLocationSwitch) = 4, + GI(GameInputLocationKey) = 5, + GI(GameInputLocationTouchPad) = 6, +}; + +enum GI(GameInputMotionAccuracy) +{ + GI(GameInputMotionAccuracyUnknown) = -1, + GI(GameInputMotionUnavailable) = 0, + GI(GameInputMotionUnreliable) = 1, + GI(GameInputMotionApproximate) = 2, + GI(GameInputMotionAccurate) = 3, +}; + +enum GI(GameInputRawDeviceItemCollectionKind) +{ + GI(GameInputUnknownItemCollection) = -1, + GI(GameInputPhysicalItemCollection) = 0, + GI(GameInputApplicationItemCollection) = 1, + GI(GameInputLogicalItemCollection) = 2, + GI(GameInputReportItemCollection) = 3, + GI(GameInputNamedArrayItemCollection) = 4, + GI(GameInputUsageSwitchItemCollection) = 5, + GI(GameInputUsageModifierItemCollection) = 6, +}; + +enum GI(GameInputRawDevicePhysicalUnitKind) +{ + GI(GameInputPhysicalUnitUnknown) = -1, + GI(GameInputPhysicalUnitNone) = 0, + GI(GameInputPhysicalUnitTime) = 1, + GI(GameInputPhysicalUnitFrequency) = 2, + GI(GameInputPhysicalUnitLength) = 3, + GI(GameInputPhysicalUnitVelocity) = 4, + GI(GameInputPhysicalUnitAcceleration) = 5, + GI(GameInputPhysicalUnitMass) = 6, + GI(GameInputPhysicalUnitMomentum) = 7, + GI(GameInputPhysicalUnitForce) = 8, + GI(GameInputPhysicalUnitPressure) = 9, + GI(GameInputPhysicalUnitAngle) = 10, + GI(GameInputPhysicalUnitAngularVelocity) = 11, + GI(GameInputPhysicalUnitAngularAcceleration) = 12, + GI(GameInputPhysicalUnitAngularMass) = 13, + GI(GameInputPhysicalUnitAngularMomentum) = 14, + GI(GameInputPhysicalUnitAngularTorque) = 15, + GI(GameInputPhysicalUnitElectricCurrent) = 16, + GI(GameInputPhysicalUnitElectricCharge) = 17, + GI(GameInputPhysicalUnitElectricPotential) = 18, + GI(GameInputPhysicalUnitEnergy) = 19, + GI(GameInputPhysicalUnitPower) = 20, + GI(GameInputPhysicalUnitTemperature) = 21, + GI(GameInputPhysicalUnitLuminousIntensity) = 22, + GI(GameInputPhysicalUnitLuminousFlux) = 23, + GI(GameInputPhysicalUnitIlluminance) = 24, +}; + +enum GI(GameInputRawDeviceReportItemFlags) +{ + GI(GameInputDefaultItem) = 0x00000000, + GI(GameInputConstantItem) = 0x00000001, + GI(GameInputArrayItem) = 0x00000002, + GI(GameInputRelativeItem) = 0x00000004, + GI(GameInputWraparoundItem) = 0x00000008, + GI(GameInputNonlinearItem) = 0x00000010, + GI(GameInputStableItem) = 0x00000020, + GI(GameInputNullableItem) = 0x00000040, + GI(GameInputVolatileItem) = 0x00000080, + GI(GameInputBufferedItem) = 0x00000100, +}; + +enum GI(GameInputRawDeviceReportKind) +{ + GI(GameInputRawInputReport) = 0, + GI(GameInputRawOutputReport) = 1, + GI(GameInputRawFeatureReport) = 2, +}; + +enum GI(GameInputTouchShape) +{ + GI(GameInputTouchShapeUnknown) = -1, + GI(GameInputTouchShapePoint) = 0, + GI(GameInputTouchShape1DLinear) = 1, + GI(GameInputTouchShape1DRadial) = 2, + GI(GameInputTouchShape1DIrregular) = 3, + GI(GameInputTouchShape2DRectangular) = 4, + GI(GameInputTouchShape2DElliptical) = 5, + GI(GameInputTouchShape2DIrregular) = 6, +}; +#endif /* GAMEINPUT_API_VERSION */ + +enum GI(GameInputArcadeStickButtons) +{ + GI(GameInputArcadeStickNone) = 0x00000000, + GI(GameInputArcadeStickMenu) = 0x00000001, + GI(GameInputArcadeStickView) = 0x00000002, + GI(GameInputArcadeStickUp) = 0x00000004, + GI(GameInputArcadeStickDown) = 0x00000008, + GI(GameInputArcadeStickLeft) = 0x00000010, + GI(GameInputArcadeStickRight) = 0x00000020, + GI(GameInputArcadeStickAction1) = 0x00000040, + GI(GameInputArcadeStickAction2) = 0x00000080, + GI(GameInputArcadeStickAction3) = 0x00000100, + GI(GameInputArcadeStickAction4) = 0x00000200, + GI(GameInputArcadeStickAction5) = 0x00000400, + GI(GameInputArcadeStickAction6) = 0x00000800, + GI(GameInputArcadeStickSpecial1) = 0x00001000, + GI(GameInputArcadeStickSpecial2) = 0x00002000, +}; + +enum GI(GameInputDeviceFamily) +{ + GI(GameInputFamilyVirtual) = -1, + GI(GameInputFamilyAggregate) = 0, + GI(GameInputFamilyXboxOne) = 1, + GI(GameInputFamilyXbox36) = 2, + GI(GameInputFamilyHid) = 3, + GI(GameInputFamilyI8042) = 4, +}; + +enum GI(GameInputDeviceStatus) +{ + GI(GameInputDeviceNoStatus) = 0x00000000, + GI(GameInputDeviceConnected) = 0x00000001, +#if GAMEINPUT_API_VERSION == 0 + GI(GameInputDeviceInputEnabled) = 0x00000002, + GI(GameInputDeviceOutputEnabled) = 0x00000004, + GI(GameInputDeviceRawIoEnabled) = 0x00000008, + GI(GameInputDeviceAudioCapture) = 0x00000010, + GI(GameInputDeviceAudioRender) = 0x00000020, + GI(GameInputDeviceSynchronized) = 0x00000040, + GI(GameInputDeviceWireless) = 0x00000080, + GI(GameInputDeviceUserIdle) = 0x00100000, + GI(GameInputDeviceAnyStatus) = 0x00ffffff, +#elif GAMEINPUT_API_VERSION == 1 + GI(GameInputDeviceAnyStatus) = 0xffffffff, +#endif /* GAMEINPUT_API_VERSION */ +}; + +enum GI(GameInputEnumerationKind) +{ + GI(GameInputNoEnumeration) = 0, + GI(GameInputAsyncEnumeration) = 1, + GI(GameInputBlockingEnumeration) = 2, +}; + +enum GI(GameInputFeedbackAxes) +{ + GI(GameInputFeedbackAxisNone) = 0x00000000, + GI(GameInputFeedbackAxisLinearX) = 0x00000001, + GI(GameInputFeedbackAxisLinearY) = 0x00000002, + GI(GameInputFeedbackAxisLinearZ) = 0x00000004, + GI(GameInputFeedbackAxisAngularX) = 0x00000008, + GI(GameInputFeedbackAxisAngularY) = 0x00000010, + GI(GameInputFeedbackAxisAngularZ) = 0x00000020, + GI(GameInputFeedbackAxisNormal) = 0x00000040, +}; + +enum GI(GameInputFeedbackEffectState) +{ + GI(GameInputFeedbackStopped) = 0, + GI(GameInputFeedbackRunning) = 1, + GI(GameInputFeedbackPaused) = 2, +}; + +enum GI(GameInputFlightStickButtons) +{ + GI(GameInputFlightStickNone) = 0x00000000, + GI(GameInputFlightStickMenu) = 0x00000001, + GI(GameInputFlightStickView) = 0x00000002, + GI(GameInputFlightStickFirePrimary) = 0x00000004, + GI(GameInputFlightStickFireSecondary) = 0x00000008, +}; + +enum GI(GameInputFocusPolicy) +{ + GI(GameInputDefaultFocusPolicy) = 0x00000000, + GI(GameInputDisableBackgroundInput) = 0x00000001, + GI(GameInputExclusiveForegroundInput) = 0x00000002, +#if GAMEINPUT_API_VERSION == 1 + GI(GameInputDisableBackgroundGuideButton) = 0x00000004, + GI(GameInputExclusiveForegroundGuideButton) = 0x00000008, + GI(GameInputDisableBackgroundShareButton) = 0x00000010, + GI(GameInputExclusiveForegroundShareButton) = 0x00000020, +#endif /* GAMEINPUT_API_VERSION */ +}; + +enum GI(GameInputForceFeedbackEffectKind) +{ + GI(GameInputForceFeedbackConstant) = 0, + GI(GameInputForceFeedbackRamp) = 1, + GI(GameInputForceFeedbackSineWave) = 2, + GI(GameInputForceFeedbackSquareWave) = 3, + GI(GameInputForceFeedbackTriangleWave) = 4, + GI(GameInputForceFeedbackSawtoothUpWave) = 5, + GI(GameInputForceFeedbackSawtoothDownWave) = 6, + GI(GameInputForceFeedbackSpring) = 7, + GI(GameInputForceFeedbackFriction) = 8, + GI(GameInputForceFeedbackDamper) = 9, + GI(GameInputForceFeedbackInertia) = 10, +}; + +enum GI(GameInputGamepadButtons) +{ + GI(GameInputGamepadNone) = 0x00000000, + GI(GameInputGamepadMenu) = 0x00000001, + GI(GameInputGamepadView) = 0x00000002, + GI(GameInputGamepadA) = 0x00000004, + GI(GameInputGamepadB) = 0x00000008, + GI(GameInputGamepadX) = 0x00000010, + GI(GameInputGamepadY) = 0x00000020, + GI(GameInputGamepadDPadUp) = 0x00000040, + GI(GameInputGamepadDPadDown) = 0x00000080, + GI(GameInputGamepadDPadLeft) = 0x00000100, + GI(GameInputGamepadDPadRight) = 0x00000200, + GI(GameInputGamepadLeftShoulder) = 0x00000400, + GI(GameInputGamepadRightShoulder) = 0x00000800, + GI(GameInputGamepadLeftThumbstick) = 0x00001000, + GI(GameInputGamepadRightThumbstick) = 0x00002000, +}; + +enum GI(GameInputKeyboardKind) +{ + GI(GameInputUnknownKeyboard) = -1, + GI(GameInputAnsiKeyboard) = 0, + GI(GameInputIsoKeyboard) = 1, + GI(GameInputKsKeyboard) = 2, + GI(GameInputAbntKeyboard) = 3, + GI(GameInputJisKeyboard) = 4, +}; + +enum GI(GameInputKind) +{ + GI(GameInputKindUnknown) = 0x00000000, +#if GAMEINPUT_API_VERSION == 0 + GI(GameInputKindRawDeviceReport) = 0x00000001, +#endif /* GAMEINPUT_API_VERSION */ + GI(GameInputKindControllerAxis) = 0x00000002, + GI(GameInputKindControllerButton) = 0x00000004, + GI(GameInputKindControllerSwitch) = 0x00000008, + GI(GameInputKindController) = 0x0000000e, + GI(GameInputKindKeyboard) = 0x00000010, + GI(GameInputKindMouse) = 0x00000020, +#if GAMEINPUT_API_VERSION == 0 + GI(GameInputKindTouch) = 0x00000100, + GI(GameInputKindMotion) = 0x00001000, +#endif /* GAMEINPUT_API_VERSION */ + GI(GameInputKindArcadeStick) = 0x00010000, + GI(GameInputKindFlightStick) = 0x00020000, + GI(GameInputKindGamepad) = 0x00040000, + GI(GameInputKindRacingWheel) = 0x00080000, + GI(GameInputKindUiNavigation) = 0x01000000, +}; + +enum GI(GameInputLabel) +{ + GI(GameInputLabelUnknown) = -1, + GI(GameInputLabelNone) = 0, + GI(GameInputLabelXboxGuide) = 1, + GI(GameInputLabelXboxBack) = 2, + GI(GameInputLabelXboxStart) = 3, + GI(GameInputLabelXboxMenu) = 4, + GI(GameInputLabelXboxView) = 5, + GI(GameInputLabelXboxA) = 7, + GI(GameInputLabelXboxB) = 8, + GI(GameInputLabelXboxX) = 9, + GI(GameInputLabelXboxY) = 10, + GI(GameInputLabelXboxDPadUp) = 11, + GI(GameInputLabelXboxDPadDown) = 12, + GI(GameInputLabelXboxDPadLeft) = 13, + GI(GameInputLabelXboxDPadRight) = 14, + GI(GameInputLabelXboxLeftShoulder) = 15, + GI(GameInputLabelXboxLeftTrigger) = 16, + GI(GameInputLabelXboxLeftStickButton) = 17, + GI(GameInputLabelXboxRightShoulder) = 18, + GI(GameInputLabelXboxRightTrigger) = 19, + GI(GameInputLabelXboxRightStickButton) = 20, + GI(GameInputLabelXboxPaddle1) = 21, + GI(GameInputLabelXboxPaddle2) = 22, + GI(GameInputLabelXboxPaddle3) = 23, + GI(GameInputLabelXboxPaddle4) = 24, + GI(GameInputLabelLetterA) = 25, + GI(GameInputLabelLetterB) = 26, + GI(GameInputLabelLetterC) = 27, + GI(GameInputLabelLetterD) = 28, + GI(GameInputLabelLetterE) = 29, + GI(GameInputLabelLetterF) = 30, + GI(GameInputLabelLetterG) = 31, + GI(GameInputLabelLetterH) = 32, + GI(GameInputLabelLetterI) = 33, + GI(GameInputLabelLetterJ) = 34, + GI(GameInputLabelLetterK) = 35, + GI(GameInputLabelLetterL) = 36, + GI(GameInputLabelLetterM) = 37, + GI(GameInputLabelLetterN) = 38, + GI(GameInputLabelLetterO) = 39, + GI(GameInputLabelLetterP) = 40, + GI(GameInputLabelLetterQ) = 41, + GI(GameInputLabelLetterR) = 42, + GI(GameInputLabelLetterS) = 43, + GI(GameInputLabelLetterT) = 44, + GI(GameInputLabelLetterU) = 45, + GI(GameInputLabelLetterV) = 46, + GI(GameInputLabelLetterW) = 47, + GI(GameInputLabelLetterX) = 48, + GI(GameInputLabelLetterY) = 49, + GI(GameInputLabelLetterZ) = 50, + GI(GameInputLabelNumber) = 51, + GI(GameInputLabelNumber1) = 52, + GI(GameInputLabelNumber2) = 53, + GI(GameInputLabelNumber3) = 54, + GI(GameInputLabelNumber4) = 55, + GI(GameInputLabelNumber5) = 56, + GI(GameInputLabelNumber6) = 57, + GI(GameInputLabelNumber7) = 58, + GI(GameInputLabelNumber8) = 59, + GI(GameInputLabelNumber9) = 60, + GI(GameInputLabelArrowUp) = 61, + GI(GameInputLabelArrowUpRight) = 62, + GI(GameInputLabelArrowRight) = 63, + GI(GameInputLabelArrowDownRight) = 64, + GI(GameInputLabelArrowDown) = 65, + GI(GameInputLabelArrowDownLLeft) = 66, + GI(GameInputLabelArrowLeft) = 67, + GI(GameInputLabelArrowUpLeft) = 68, + GI(GameInputLabelArrowUpDown) = 69, + GI(GameInputLabelArrowLeftRight) = 70, + GI(GameInputLabelArrowUpDownLeftRight) = 71, + GI(GameInputLabelArrowClockwise) = 72, + GI(GameInputLabelArrowCounterClockwise) = 73, + GI(GameInputLabelArrowReturn) = 74, + GI(GameInputLabelIconBranding) = 75, + GI(GameInputLabelIconHome) = 76, + GI(GameInputLabelIconMenu) = 77, + GI(GameInputLabelIconCross) = 78, + GI(GameInputLabelIconCircle) = 79, + GI(GameInputLabelIconSquare) = 80, + GI(GameInputLabelIconTriangle) = 81, + GI(GameInputLabelIconStar) = 82, + GI(GameInputLabelIconDPadUp) = 83, + GI(GameInputLabelIconDPadDown) = 84, + GI(GameInputLabelIconDPadLeft) = 85, + GI(GameInputLabelIconDPadRight) = 86, + GI(GameInputLabelIconDialClockwise) = 87, + GI(GameInputLabelIconDialCounterClockwise) = 88, + GI(GameInputLabelIconSliderLeftRight) = 89, + GI(GameInputLabelIconSliderUpDown) = 90, + GI(GameInputLabelIconWheelUpDown) = 91, + GI(GameInputLabelIconPlus) = 92, + GI(GameInputLabelIconMinus) = 93, + GI(GameInputLabelIconSuspension) = 94, + GI(GameInputLabelHome) = 95, + GI(GameInputLabelGuide) = 96, + GI(GameInputLabelMode) = 97, + GI(GameInputLabelSelect) = 98, + GI(GameInputLabelMenu) = 99, + GI(GameInputLabelView) = 100, + GI(GameInputLabelBack) = 101, + GI(GameInputLabelStart) = 102, + GI(GameInputLabelOptions) = 103, + GI(GameInputLabelShare) = 104, + GI(GameInputLabelUp) = 105, + GI(GameInputLabelDown) = 106, + GI(GameInputLabelLeft) = 107, + GI(GameInputLabelRight) = 108, + GI(GameInputLabelLB) = 109, + GI(GameInputLabelLT) = 110, + GI(GameInputLabelLSB) = 111, + GI(GameInputLabelL1) = 112, + GI(GameInputLabelL2) = 113, + GI(GameInputLabelL3) = 114, + GI(GameInputLabelRB) = 115, + GI(GameInputLabelRT) = 116, + GI(GameInputLabelRSB) = 117, + GI(GameInputLabelR1) = 118, + GI(GameInputLabelR2) = 119, + GI(GameInputLabelR3) = 120, + GI(GameInputLabelP1) = 121, + GI(GameInputLabelP2) = 122, + GI(GameInputLabelP3) = 123, + GI(GameInputLabelP4) = 124, +}; + +enum GI(GameInputMouseButtons) +{ + GI(GameInputMouseNone) = 0x00000000, + GI(GameInputMouseLeftButton) = 0x00000001, + GI(GameInputMouseRightButton) = 0x00000002, + GI(GameInputMouseMiddleButton) = 0x00000004, + GI(GameInputMouseButton4) = 0x00000008, + GI(GameInputMouseButton5) = 0x00000010, + GI(GameInputMouseWheelTiltLeft) = 0x00000020, + GI(GameInputMouseWheelTiltRight) = 0x00000040, +}; + +enum GI(GameInputMousePositions) +{ + GI(GameInputMouseNoPosition) = 0x00000000, + GI(GameInputMouseAbsolutePosition) = 0x00000001, + GI(GameInputMouseRelativePosition) = 0x00000002, +}; + +enum GI(GameInputRacingWheelButtons) +{ + GI(GameInputRacingWheelNone) = 0x00000000, + GI(GameInputRacingWheelMenu) = 0x00000001, + GI(GameInputRacingWheelView) = 0x00000002, + GI(GameInputRacingWheelPreviousGear) = 0x00000004, + GI(GameInputRacingWheelNextGear) = 0x00000008, + GI(GameInputRacingWheelDpadUp) = 0x00000010, + GI(GameInputRacingWheelDpadDown) = 0x00000020, + GI(GameInputRacingWheelDpadLeft) = 0x00000040, + GI(GameInputRacingWheelDpadRight) = 0x00000080, +}; + +enum GI(GameInputRumbleMotors) +{ + GI(GameInputRumbleNone) = 0x00000000, + GI(GameInputRumbleLowFrequency) = 0x00000001, + GI(GameInputRumbleHighFrequency) = 0x00000002, + GI(GameInputRumbleLeftTrigger) = 0x00000004, + GI(GameInputRumbleRightTrigger) = 0x00000008, +}; + +enum GI(GameInputSwitchKind) +{ + GI(GameInputUnknownSwitchKind) = -1, + GI(GameInput2WaySwitch) = 0, + GI(GameInput4WaySwitch) = 1, + GI(GameInput8WaySwitch) = 2, +}; + +enum GI(GameInputSwitchPosition) +{ + GI(GameInputSwitchCenter) = 0, + GI(GameInputSwitchUp) = 1, + GI(GameInputSwitchUpRight) = 2, + GI(GameInputSwitchRight) = 3, + GI(GameInputSwitchDownRight) = 4, + GI(GameInputSwitchDown) = 5, + GI(GameInputSwitchDownLeft) = 6, + GI(GameInputSwitchLeft) = 7, + GI(GameInputSwitchUpLeft) = 8, +}; + +enum GI(GameInputSystemButtons) +{ + GI(GameInputSystemButtonNone) = 0x00000000, + GI(GameInputSystemButtonGuide) = 0x00000001, + GI(GameInputSystemButtonShare) = 0x00000002, +}; + +enum GI(GameInputUiNavigationButtons) +{ + GI(GameInputUiNavigationNone) = 0x00000000, + GI(GameInputUiNavigationMenu) = 0x00000001, + GI(GameInputUiNavigationView) = 0x00000002, + GI(GameInputUiNavigationAccept) = 0x00000004, + GI(GameInputUiNavigationCancel) = 0x00000008, + GI(GameInputUiNavigationUp) = 0x00000010, + GI(GameInputUiNavigationDown) = 0x00000020, + GI(GameInputUiNavigationLeft) = 0x00000040, + GI(GameInputUiNavigationRight) = 0x00000080, + GI(GameInputUiNavigationContext1) = 0x00000100, + GI(GameInputUiNavigationContext2) = 0x00000200, + GI(GameInputUiNavigationContext3) = 0x00000400, + GI(GameInputUiNavigationContext4) = 0x00000800, + GI(GameInputUiNavigationPageUp) = 0x00001000, + GI(GameInputUiNavigationPageDown) = 0x00002000, + GI(GameInputUiNavigationPageLeft) = 0x00004000, + GI(GameInputUiNavigationPageRight) = 0x00008000, + GI(GameInputUiNavigationScrollUp) = 0x00010000, + GI(GameInputUiNavigationScrollDown) = 0x00020000, + GI(GameInputUiNavigationScrollLeft) = 0x00040000, + GI(GameInputUiNavigationScrollRight) = 0x00080000, +}; + +struct GI(GameInputUsage) +{ + UINT16 page; + UINT16 id; +}; + +#if GAMEINPUT_API_VERSION == 0 +struct GI(GameInputBatteryState) +{ + float chargeRate; + float maxChargeRate; + float remainingCapacity; + float fullChargeCapacity; + GI(GameInputBatteryStatus) status; +}; + +struct GI(GameInputHapticFeedbackMotorInfo) +{ + GI(GameInputRumbleMotors) mappedRumbleMotors; + GI(GameInputLocation) location; + UINT32 locationId; + UINT32 waveformCount; + GI(GameInputHapticWaveformInfo) const *waveformInfo; +}; + +struct GI(GameInputHapticFeedbackParams) +{ + UINT32 waveformIndex; + UINT64 duration; + float intensity; + UINT32 playCount; + UINT64 repeatDelay; +}; + +struct GI(GameInputHapticWaveformInfo) +{ + GI(GameInputUsage) usage; + BOOLEAN isDurationSupported; + BOOLEAN isIntensitySupported; + BOOLEAN isRepeatSupported; + BOOLEAN isRepeatDelaySupported; + UINT64 defaultDuration; +}; + +struct GI(GameInputMotionInfo) +{ + float maxAcceleration; + float maxAngularVelocity; + float maxMagneticFieldStrength; +}; + +struct GI(GameInputMotionState) +{ + float accelerationX; + float accelerationY; + float accelerationZ; + float angularVelocityX; + float angularVelocityY; + float angularVelocityZ; + float magneticFieldX; + float magneticFieldY; + float magneticFieldZ; + float orientationW; + float orientationX; + float orientationY; + float orientationZ; + GI(GameInputMotionAccuracy) accelerometerAccuracy; + GI(GameInputMotionAccuracy) gyroscopeAccuracy; + GI(GameInputMotionAccuracy) magnetometerAccuracy; + GI(GameInputMotionAccuracy) orientationAccuracy; +}; + +struct GI(GameInputRawDeviceItemCollectionInfo) +{ + GI(GameInputRawDeviceItemCollectionKind) kind; + UINT32 childCount; + UINT32 siblingCount; + UINT32 usageCount; + GI(GameInputUsage) const *usages; + struct GI(GameInputRawDeviceItemCollectionInfo) const *parent; + struct GI(GameInputRawDeviceItemCollectionInfo) const *firstSibling; + struct GI(GameInputRawDeviceItemCollectionInfo) const *previousSibling; + struct GI(GameInputRawDeviceItemCollectionInfo) const *nextSibling; + struct GI(GameInputRawDeviceItemCollectionInfo) const *lastSibling; + struct GI(GameInputRawDeviceItemCollectionInfo) const *firstChild; + struct GI(GameInputRawDeviceItemCollectionInfo) const *lastChild; +}; + +struct GI(GameInputRawDeviceReportInfo) +{ + GI(GameInputRawDeviceReportKind) kind; + UINT32 id; + UINT32 size; + UINT32 itemCount; + GI(GameInputRawDeviceReportItemInfo) const *items; +}; + +struct GI(GameInputRawDeviceReportItemInfo) +{ + UINT32 bitOffset; + UINT32 bitSize; + INT64 logicalMin; + INT64 logicalMax; + double physicalMin; + double physicalMax; + GI(GameInputRawDevicePhysicalUnitKind) physicalUnits; + UINT32 rawPhysicalUnits; + INT32 rawPhysicalUnitsExponent; + GI(GameInputRawDeviceReportItemFlags) flags; + UINT32 usageCount; + GI(GameInputUsage) const *usages; + GI(GameInputRawDeviceItemCollectionInfo) const *collection; + GI(GameInputString) const *itemString; +}; + +struct GI(GameInputString) +{ + UINT32 sizeInBytes; + UINT32 codePointCount; + char const *data; +}; + +struct GI(GameInputTouchSensorInfo) +{ + GI(GameInputKind) mappedInputKinds; + GI(GameInputLabel) label; + GI(GameInputLocation) location; + UINT32 locationId; + UINT64 resolutionX; + UINT64 resolutionY; + GI(GameInputTouchShape) shape; + float aspectRatio; + float orientation; + float physicalWidth; + float physicalHeight; + float maxPressure; + float maxProximity; + UINT32 maxTouchPoints; +}; + +struct GI(GameInputTouchState) +{ + UINT64 touchId; + UINT32 sensorIndex; + float positionX; + float positionY; + float pressure; + float proximity; + float contactRectTop; + float contactRectLeft; + float contactRectRight; + float contactRectBottom; +}; + +struct GI(GameInputVersion) +{ + UINT16 major; + UINT16 minor; + UINT16 build; + UINT16 revision; +}; +#endif /* GAMEINPUT_API_VERSION */ + +struct GI(GameInputForceFeedbackMagnitude) +{ + float linearX; + float linearY; + float linearZ; + float angularX; + float angularY; + float angularZ; + float normal; +}; + +struct GI(GameInputForceFeedbackEnvelope) +{ + UINT64 attackDuration; + UINT64 sustainDuration; + UINT64 releaseDuration; + float attackGain; + float sustainGain; + float releaseGain; + UINT32 playCount; + UINT64 repeatDelay; +}; + +struct GI(GameInputForceFeedbackConditionParams) +{ + GI(GameInputForceFeedbackMagnitude) magnitude; + float positiveCoefficient; + float negativeCoefficient; + float maxPositiveMagnitude; + float maxNegativeMagnitude; + float deadZone; + float bias; +}; + +struct GI(GameInputForceFeedbackConstantParams) +{ + GI(GameInputForceFeedbackEnvelope) envelope; + GI(GameInputForceFeedbackMagnitude) magnitude; +}; + +struct GI(GameInputForceFeedbackPeriodicParams) +{ + GI(GameInputForceFeedbackEnvelope) envelope; + GI(GameInputForceFeedbackMagnitude) magnitude; + float frequency; + float phase; + float bias; +}; + +struct GI(GameInputForceFeedbackRampParams) +{ + GI(GameInputForceFeedbackEnvelope) envelope; + GI(GameInputForceFeedbackMagnitude) startMagnitude; + GI(GameInputForceFeedbackMagnitude) endMagnitude; +}; + +struct GI(GameInputArcadeStickInfo) +{ + GI(GameInputLabel) menuButtonLabel; + GI(GameInputLabel) viewButtonLabel; + GI(GameInputLabel) stickUpLabel; + GI(GameInputLabel) stickDownLabel; + GI(GameInputLabel) stickLeftLabel; + GI(GameInputLabel) stickRightLabel; + GI(GameInputLabel) actionButton1Label; + GI(GameInputLabel) actionButton2Label; + GI(GameInputLabel) actionButton3Label; + GI(GameInputLabel) actionButton4Label; + GI(GameInputLabel) actionButton5Label; + GI(GameInputLabel) actionButton6Label; + GI(GameInputLabel) specialButton1Label; + GI(GameInputLabel) specialButton2Label; +}; + +struct GI(GameInputArcadeStickState) +{ + GI(GameInputArcadeStickButtons) buttons; +}; + +struct GI(GameInputControllerAxisInfo) +{ + GI(GameInputKind) mappedInputKinds; + GI(GameInputLabel) label; +#if GAMEINPUT_API_VERSION == 0 + BOOLEAN isContinuous; + BOOLEAN isNonlinear; + BOOLEAN isQuantized; + BOOLEAN hasRestValue; + float restValue; + UINT64 resolution; + UINT16 legacyDInputIndex; + UINT16 legacyHidIndex; + UINT32 rawReportIndex; + GI(GameInputRawDeviceReportInfo) const *inputReport; + GI(GameInputRawDeviceReportItemInfo) const *inputReportItem; +#endif /* GAMEINPUT_API_VERSION */ +}; + +struct GI(GameInputControllerButtonInfo) +{ + GI(GameInputKind) mappedInputKinds; + GI(GameInputLabel) label; +#if GAMEINPUT_API_VERSION == 0 + UINT16 legacyDInputIndex; + UINT16 legacyHidIndex; + UINT32 rawReportIndex; + GI(GameInputRawDeviceReportInfo) const *inputReport; + GI(GameInputRawDeviceReportItemInfo) const *inputReportItem; +#endif /* GAMEINPUT_API_VERSION */ +}; + +struct GI(GameInputControllerSwitchInfo) +{ + GI(GameInputKind) mappedInputKinds; + GI(GameInputLabel) label; +#if GAMEINPUT_API_VERSION == 0 + GI(GameInputLabel) positionLabels[9]; +#endif /* GAMEINPUT_API_VERSION */ + GI(GameInputSwitchKind) kind; +#if GAMEINPUT_API_VERSION == 0 + UINT16 legacyDInputIndex; + UINT16 legacyHidIndex; + UINT32 rawReportIndex; + GI(GameInputRawDeviceReportInfo) const *inputReport; + GI(GameInputRawDeviceReportItemInfo) const *inputReportItem; +#endif /* GAMEINPUT_API_VERSION */ +}; + +struct GI(GameInputDeviceInfo) +{ +#if GAMEINPUT_API_VERSION == 0 + UINT32 infoSize; + UINT16 vendorId; + UINT16 productId; + UINT16 revisionNumber; + UINT8 interfaceNumber; + UINT8 collectionNumber; + GI(GameInputUsage) usage; + GI(GameInputVersion) hardwareVersion; + GI(GameInputVersion) firmwareVersion; + APP_LOCAL_DEVICE_ID deviceId; + APP_LOCAL_DEVICE_ID deviceRootId; + GI(GameInputDeviceFamily) deviceFamily; + GI(GameInputDeviceCapabilities) capabilities; + GI(GameInputKind) supportedInput; + GI(GameInputRumbleMotors) supportedRumbleMotors; + UINT32 inputReportCount; + UINT32 outputReportCount; + UINT32 featureReportCount; + UINT32 controllerAxisCount; + UINT32 controllerButtonCount; + UINT32 controllerSwitchCount; + UINT32 touchPointCount; + UINT32 touchSensorCount; + UINT32 forceFeedbackMotorCount; + UINT32 hapticFeedbackMotorCount; + UINT32 deviceStringCount; + UINT32 deviceDescriptorSize; + GI(GameInputRawDeviceReportInfo) const *inputReportInfo; + GI(GameInputRawDeviceReportInfo) const *outputReportInfo; + GI(GameInputRawDeviceReportInfo) const *featureReportInfo; + GI(GameInputControllerAxisInfo) const *controllerAxisInfo; + GI(GameInputControllerButtonInfo) const *controllerButtonInfo; + GI(GameInputControllerSwitchInfo) const *controllerSwitchInfo; + GI(GameInputKeyboardInfo) const *keyboardInfo; + GI(GameInputMouseInfo) const *mouseInfo; + GI(GameInputTouchSensorInfo) const *touchSensorInfo; + GI(GameInputMotionInfo) const *motionInfo; + GI(GameInputArcadeStickInfo) const *arcadeStickInfo; + GI(GameInputFlightStickInfo) const *flightStickInfo; + GI(GameInputGamepadInfo) const *gamepadInfo; + GI(GameInputRacingWheelInfo) const *racingWheelInfo; + GI(GameInputUiNavigationInfo) const *uiNavigationInfo; + GI(GameInputForceFeedbackMotorInfo) const *forceFeedbackMotorInfo; + GI(GameInputHapticFeedbackMotorInfo) const *hapticFeedbackMotorInfo; + GI(GameInputString) const *displayName; + GI(GameInputString) const *deviceStrings; + void const *deviceDescriptorData; + GI(GameInputSystemButtons) supportedSystemButtons; +#elif GAMEINPUT_API_VERSION == 1 + UINT16 vendorId; + UINT16 productId; + GI(GameInputUsage) usage; + APP_LOCAL_DEVICE_ID deviceId; + APP_LOCAL_DEVICE_ID deviceRootId; + GI(GameInputDeviceFamily) deviceFamily; + GI(GameInputKind) supportedInput; + GI(GameInputRumbleMotors) supportedRumbleMotors; + GI(GameInputSystemButtons) supportedSystemButtons; + const char *displayName; + const char *pnpPath; + const GI(GameInputKeyboardInfo) *keyboardInfo; + const GI(GameInputMouseInfo) *mouseInfo; + const GI(GameInputArcadeStickInfo) *arcadeStickInfo; + const GI(GameInputFlightStickInfo) *flightStickInfo; + const GI(GameInputGamepadInfo) *gamepadInfo; + const GI(GameInputRacingWheelInfo) *racingWheelInfo; + const GI(GameInputUiNavigationInfo)*uiNavigationInfo; + UINT32 controllerAxisCount; + const GI(GameInputControllerAxisInfo) *controllerAxisInfo; + UINT32 controllerButtonCount; + const GI(GameInputControllerButtonInfo) *controllerButtonInfo; + UINT32 controllerSwitchCount; + const GI(GameInputControllerSwitchInfo) *controllerSwitchInfo; + UINT32 forceFeedbackMotorCount; + const GI(GameInputForceFeedbackMotorInfo) *forceFeedbackMotorInfo; +#endif /* GAMEINPUT_API_VERSION */ +}; + +struct GI(GameInputFlightStickInfo) +{ + GI(GameInputLabel) menuButtonLabel; + GI(GameInputLabel) viewButtonLabel; + GI(GameInputLabel) firePrimaryButtonLabel; + GI(GameInputLabel) fireSecondaryButtonLabel; + GI(GameInputSwitchKind) hatSwitchKind; +}; + +struct GI(GameInputFlightStickState) +{ + GI(GameInputFlightStickButtons) buttons; + GI(GameInputSwitchPosition) hatSwitch; + float roll; + float pitch; + float yaw; + float throttle; +}; + +struct GI(GameInputForceFeedbackMotorInfo) +{ + GI(GameInputFeedbackAxes) supportedAxes; +#if GAMEINPUT_API_VERSION == 0 + GI(GameInputLocation) location; + UINT32 locationId; + UINT32 maxSimultaneousEffects; +#endif /* GAMEINPUT_API_VERSION */ + BOOLEAN isConstantEffectSupported; + BOOLEAN isRampEffectSupported; + BOOLEAN isSineWaveEffectSupported; + BOOLEAN isSquareWaveEffectSupported; + BOOLEAN isTriangleWaveEffectSupported; + BOOLEAN isSawtoothUpWaveEffectSupported; + BOOLEAN isSawtoothDownWaveEffectSupported; + BOOLEAN isSpringEffectSupported; + BOOLEAN isFrictionEffectSupported; + BOOLEAN isDamperEffectSupported; + BOOLEAN isInertiaEffectSupported; +}; + +struct GI(GameInputForceFeedbackParams) +{ + GI(GameInputForceFeedbackEffectKind) kind; + union + { + GI(GameInputForceFeedbackConstantParams) constant; + GI(GameInputForceFeedbackRampParams) ramp; + GI(GameInputForceFeedbackPeriodicParams) sineWave; + GI(GameInputForceFeedbackPeriodicParams) squareWave; + GI(GameInputForceFeedbackPeriodicParams) triangleWave; + GI(GameInputForceFeedbackPeriodicParams) sawtoothUpWave; + GI(GameInputForceFeedbackPeriodicParams) sawtoothDownWave; + GI(GameInputForceFeedbackConditionParams) spring; + GI(GameInputForceFeedbackConditionParams) friction; + GI(GameInputForceFeedbackConditionParams) damper; + GI(GameInputForceFeedbackConditionParams) inertia; + } data; +}; + +struct GI(GameInputGamepadInfo) +{ + GI(GameInputLabel) menuButtonLabel; + GI(GameInputLabel) viewButtonLabel; + GI(GameInputLabel) aButtonLabel; + GI(GameInputLabel) bButtonLabel; + GI(GameInputLabel) xButtonLabel; + GI(GameInputLabel) yButtonLabel; + GI(GameInputLabel) dpadUpLabel; + GI(GameInputLabel) dpadDownLabel; + GI(GameInputLabel) dpadLeftLabel; + GI(GameInputLabel) dpadRightLabel; + GI(GameInputLabel) leftShoulderButtonLabel; + GI(GameInputLabel) rightShoulderButtonLabel; + GI(GameInputLabel) leftThumbstickButtonLabel; + GI(GameInputLabel) rightThumbstickButtonLabel; +}; + +struct GI(GameInputGamepadState) +{ + GI(GameInputGamepadButtons) buttons; + float leftTrigger; + float rightTrigger; + float leftThumbstickX; + float leftThumbstickY; + float rightThumbstickX; + float rightThumbstickY; +}; + +struct GI(GameInputKeyboardInfo) +{ + GI(GameInputKeyboardKind) kind; + UINT32 layout; + UINT32 keyCount; + UINT32 functionKeyCount; + UINT32 maxSimultaneousKeys; + UINT32 platformType; + UINT32 platformSubtype; +#if GAMEINPUT_API_VERSION == 0 + GI(GameInputString) const *nativeLanguage; +#endif /* GAMEINPUT_API_VERSION */ +}; + +struct GI(GameInputKeyState) +{ + UINT32 scanCode; + UINT32 codePoint; + UINT8 virtualKey; + BOOLEAN isDeadKey; +}; + +struct GI(GameInputMouseInfo) +{ + GI(GameInputMouseButtons) supportedButtons; +#if GAMEINPUT_API_VERSION == 0 + UINT32 sampleRate; +#endif /* GAMEINPUT_API_VERSION */ + UINT32 sensorDpi; + BOOLEAN hasWheelX; + BOOLEAN hasWheelY; +}; + +struct GI(GameInputMouseState) +{ + GI(GameInputMouseButtons) buttons; +#if GAMEINPUT_API_VERSION == 1 + GI(GameInputMousePositions) positions; +#endif /* GAMEINPUT_API_VERSION */ + INT64 positionX; + INT64 positionY; +#if GAMEINPUT_API_VERSION == 1 + INT64 absolutePositionX; + INT64 absolutePositionY; +#endif /* GAMEINPUT_API_VERSION */ + INT64 wheelX; + INT64 wheelY; +}; + +struct GI(GameInputRacingWheelInfo) +{ + GI(GameInputLabel) menuButtonLabel; + GI(GameInputLabel) viewButtonLabel; + GI(GameInputLabel) previousGearButtonLabel; + GI(GameInputLabel) nextGearButtonLabel; + GI(GameInputLabel) dpadUpLabel; + GI(GameInputLabel) dpadDownLabel; + GI(GameInputLabel) dpadLeftLabel; + GI(GameInputLabel) dpadRightLabel; + BOOLEAN hasClutch; + BOOLEAN hasHandbrake; + BOOLEAN hasPatternShifter; + INT32 minPatternShifterGear; + INT32 maxPatternShifterGear; + float maxWheelAngle; +}; + +struct GI(GameInputRacingWheelState) +{ + GI(GameInputRacingWheelButtons) buttons; + INT32 patternShifterGear; + float wheel; + float throttle; + float brake; + float clutch; + float handbrake; +}; + +struct GI(GameInputRumbleParams) +{ + float lowFrequency; + float highFrequency; + float leftTrigger; + float rightTrigger; +}; + +struct GI(GameInputUiNavigationInfo) +{ + GI(GameInputLabel) menuButtonLabel; + GI(GameInputLabel) viewButtonLabel; + GI(GameInputLabel) acceptButtonLabel; + GI(GameInputLabel) cancelButtonLabel; + GI(GameInputLabel) upButtonLabel; + GI(GameInputLabel) downButtonLabel; + GI(GameInputLabel) leftButtonLabel; + GI(GameInputLabel) rightButtonLabel; + GI(GameInputLabel) contextButton1Label; + GI(GameInputLabel) contextButton2Label; + GI(GameInputLabel) contextButton3Label; + GI(GameInputLabel) contextButton4Label; + GI(GameInputLabel) pageUpButtonLabel; + GI(GameInputLabel) pageDownButtonLabel; + GI(GameInputLabel) pageLeftButtonLabel; + GI(GameInputLabel) pageRightButtonLabel; + GI(GameInputLabel) scrollUpButtonLabel; + GI(GameInputLabel) scrollDownButtonLabel; + GI(GameInputLabel) scrollLeftButtonLabel; + GI(GameInputLabel) scrollRightButtonLabel; + GI(GameInputLabel) guideButtonLabel; +}; + +struct GI(GameInputUiNavigationState) +{ + GI(GameInputUiNavigationButtons) buttons; +}; + +#if GAMEINPUT_API_VERSION == 0 + +#define INTERFACE GI(IGameInputRawDeviceReport) +DEFINE_GUID(GI(IID_IGameInputRawDeviceReport),0x61f08cf1,0x1ffc,0x40ca,0xa2,0xb8,0xe1,0xab,0x8b,0xc5,0xb6,0xdc); +DECLARE_INTERFACE_IID_(INTERFACE,IUnknown,"61f08cf1-1ffc-40ca-a2b8-e1ab8bc5b6dc") +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)( THIS_ REFIID riid,void **out ) PURE; + STDMETHOD_(ULONG,AddRef)( THIS ) PURE; + STDMETHOD_(ULONG,Release)( THIS ) PURE; + + STDMETHOD_(void,GetDevice)(THIS_ struct GI(IGameInputDevice) **device ) PURE; + STDMETHOD_(GI(GameInputRawDeviceReportInfo) const*,GetReportInfo)( THIS ) PURE; + STDMETHOD_(SIZE_T,GetRawDataSize)( THIS ) PURE; + STDMETHOD_(SIZE_T,GetRawData)( THIS_ SIZE_T buffer_size, void *buffer ) PURE; + STDMETHOD_(BOOLEAN,SetRawData)( THIS_ SIZE_T buffer_size, void const *buffer ) PURE; + STDMETHOD_(BOOLEAN,GetItemValue)( THIS_ UINT32 index, INT64 *value ) PURE; + STDMETHOD_(BOOLEAN,SetItemValue)( THIS_ UINT32 index, INT64 value ) PURE; + STDMETHOD_(BOOLEAN,ResetItemValue)( THIS_ UINT32 index ) PURE; + STDMETHOD_(BOOLEAN,ResetAllItems)( THIS ) PURE; +}; +#undef INTERFACE + +#ifdef _GAMEINPUT_ +#define IGameInputRawDeviceReport0_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IGameInputRawDeviceReport0_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IGameInputRawDeviceReport0_Release(p) (p)->lpVtbl->Release(p) +#define IGameInputRawDeviceReport0_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IGameInputRawDeviceReport0_GetReportInfo(p) (p)->lpVtbl->GetReportInfo(p) +#define IGameInputRawDeviceReport0_GetRawDataSize(p) (p)->lpVtbl->GetRawDataSize(p) +#define IGameInputRawDeviceReport0_GetRawData(p,a,b) (p)->lpVtbl->GetRawData(p,a,b) +#define IGameInputRawDeviceReport0_SetRawData(p,a,b) (p)->lpVtbl->SetRawData(p,a,b) +#define IGameInputRawDeviceReport0_GetItemValue(p,a,b) (p)->lpVtbl->GetItemValue(p,a,b) +#define IGameInputRawDeviceReport0_SetItemValue(p,a,b) (p)->lpVtbl->SetItemValue(p,a,b) +#define IGameInputRawDeviceReport0_ResetItemValue(p,a) (p)->lpVtbl->ResetItemValue(p,a) +#define IGameInputRawDeviceReport0_ResetAllItems(p) (p)->lpVtbl->ResetAllItems(p) +#endif /* _GAMEINPUT_ */ + +#define INTERFACE GI(IGameInput) +DEFINE_GUID(GI(IID_IGameInput),0x11be2a7e,0x4254,0x445a,0x9c,0x09,0xff,0xc4,0x0f,0x00,0x69,0x18); +DECLARE_INTERFACE_IID_(INTERFACE,IUnknown,"11be2a7e-4254-445a-9c09-ffc40f006918") +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)( THIS_ REFIID riid,void **out ) PURE; + STDMETHOD_(ULONG,AddRef)( THIS ) PURE; + STDMETHOD_(ULONG,Release)( THIS ) PURE; + + STDMETHOD_(UINT64,GetCurrentTimestamp)( THIS ) PURE; + STDMETHOD(GetCurrentReading)( THIS_ GI(GameInputKind) input_kind, struct GI(IGameInputDevice) *device, struct GI(IGameInputReading) **reading ) PURE; + STDMETHOD(GetNextReading)( THIS_ struct GI(IGameInputReading) *reference_reading, GI(GameInputKind) input_kind, + struct GI(IGameInputDevice) *device, struct GI(IGameInputReading) **reading ) PURE; + STDMETHOD(GetPreviousReading)( THIS_ struct GI(IGameInputReading) *reference_reading, GI(GameInputKind) input_kind, + struct GI(IGameInputDevice) *device, struct GI(IGameInputReading) **reading ) PURE; + STDMETHOD(GetTemporalReading)( THIS_ UINT64 timestamp, struct GI(IGameInputDevice) *device, struct GI(IGameInputReading) **reading ) PURE; + STDMETHOD(RegisterReadingCallback)( THIS_ struct GI(IGameInputDevice) *device, GI(GameInputKind) input_kind, float analog_threshold, + void *context, GI(GameInputReadingCallback) callback, GI(GameInputCallbackToken) *token ) PURE; + STDMETHOD(RegisterDeviceCallback)( THIS_ struct GI(IGameInputDevice) *device, GI(GameInputKind) input_kind, GI(GameInputDeviceStatus) status_filter, + GI(GameInputEnumerationKind) enumeration_kind, void *context, GI(GameInputDeviceCallback) callback, + GI(GameInputCallbackToken) *token ) PURE; + STDMETHOD(RegisterGuideButtonCallback)( THIS_ struct GI(IGameInputDevice) *device, void *context, GI(GameInputGuideButtonCallback) callback, + GI(GameInputCallbackToken) *token ) PURE; + STDMETHOD(RegisterKeyboardLayoutCallback)( THIS_ struct GI(IGameInputDevice) *device, void *context, GI(GameInputKeyboardLayoutCallback) callback, + GI(GameInputCallbackToken) *token ) PURE; + STDMETHOD_(void,StopCallback)( THIS_ GI(GameInputCallbackToken) token ) PURE; + STDMETHOD_(BOOLEAN,UnregisterCallback)( THIS_ GI(GameInputCallbackToken) token, UINT64 timeout_us ) PURE; + STDMETHOD(CreateDispatcher)( THIS_ struct GI(IGameInputDispatcher) **dispatcher ) PURE; + STDMETHOD(CreateAggregateDevice)( THIS_ GI(GameInputKind) input_kind, struct GI(IGameInputDevice) **device ) PURE; + STDMETHOD(FindDeviceFromId)( THIS_ APP_LOCAL_DEVICE_ID const *value, struct GI(IGameInputDevice) **device ) PURE; + STDMETHOD(FindDeviceFromObject)( THIS_ IUnknown *value, struct GI(IGameInputDevice) **device ) PURE; + STDMETHOD(FindDeviceFromPlatformHandle)( THIS_ HANDLE value, struct GI(IGameInputDevice) **device ) PURE; + STDMETHOD(FindDeviceFromPlatformString)( THIS_ LPCWSTR value, struct GI(IGameInputDevice) **device ) PURE; + STDMETHOD(EnableOemDeviceSupport)( THIS_ UINT16 vendor_id, UINT16 product_id, UINT8 interface_number, UINT8 collection_number ) PURE; + STDMETHOD_(void,SetFocusPolicy)( THIS_ GI(GameInputFocusPolicy) policy ) PURE; +}; +#undef INTERFACE + +#ifdef _GAMEINPUT_ +#define IGameInput0_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IGameInput0_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IGameInput0_Release(p) (p)->lpVtbl->Release(p) +#define IGameInput0_GetCurrentTimestamp(p) (p)->lpVtbl->GetCurrentTimestamp(p) +#define IGameInput0_GetCurrentReading(p,a,b,c) (p)->lpVtbl->GetCurrentReading(p,a,b,c) +#define IGameInput0_GetNextReading(p,a,b,c,d) (p)->lpVtbl->GetNextReading(p,a,b,c,d) +#define IGameInput0_GetPreviousReading(p,a,b,c,d) (p)->lpVtbl->GetPreviousReading(p,a,b,c,d) +#define IGameInput0_GetTemporalReading(p,a,b,c) (p)->lpVtbl->GetTemporalReading(p,a,b,c) +#define IGameInput0_RegisterReadingCallback(p,a,b,c,d,e,f) (p)->lpVtbl->RegisterReadingCallback(p,a,b,c,d,e,f) +#define IGameInput0_RegisterDeviceCallback(p,a,b,c,d,e,f,g) (p)->lpVtbl->RegisterDeviceCallback(p,a,b,c,d,e,f,g) +#define IGameInput0_RegisterGuideButtonCallback(p,a,b,c,d) (p)->lpVtbl->RegisterGuideButtonCallback(p,a,b,c,d) +#define IGameInput0_RegisterKeyboardLayoutCallback(p,a,b,c,d) (p)->lpVtbl->RegisterKeyboardLayoutCallback(p,a,b,c,d) +#define IGameInput0_StopCallback(p,a) (p)->lpVtbl->StopCallback(p,a) +#define IGameInput0_UnregisterCallback(p,a,b) (p)->lpVtbl->UnregisterCallback(p,a,b) +#define IGameInput0_CreateDispatcher(p,a) (p)->lpVtbl->CreateDispatcher(p,a) +#define IGameInput0_CreateAggregateDevice(p,a,b) (p)->lpVtbl->CreateAggregateDevice(p,a,b) +#define IGameInput0_FindDeviceFromId(p,a,b) (p)->lpVtbl->FindDeviceFromId(p,a,b) +#define IGameInput0_FindDeviceFromObject(p,a,b) (p)->lpVtbl->FindDeviceFromObject(p,a,b) +#define IGameInput0_FindDeviceFromPlatformHandle(p,a,b) (p)->lpVtbl->FindDeviceFromPlatformHandle(p,a,b) +#define IGameInput0_FindDeviceFromPlatformString(p,a,b) (p)->lpVtbl->FindDeviceFromPlatformString(p,a,b) +#define IGameInput0_EnableOemDeviceSupport(p,a,b,c,d) (p)->lpVtbl->EnableOemDeviceSupport(p,a,b,c,d) +#define IGameInput0_SetFocusPolicy(p,a) (p)->lpVtbl->SetFocusPolicy(p,a) +#endif /* _GAMEINPUT_ */ + +#define INTERFACE GI(IGameInputReading) +DEFINE_GUID(GI(IID_IGameInputReading),0x2156947a,0xe1fa,0x4de0,0xa3,0x0b,0xd8,0x12,0x93,0x1d,0xbd,0x8d); +DECLARE_INTERFACE_IID_(INTERFACE,IUnknown,"2156947a-e1fa-4de0-a30b-d812931dbd8d") +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)( THIS_ REFIID riid,void **out ) PURE; + STDMETHOD_(ULONG,AddRef)( THIS ) PURE; + STDMETHOD_(ULONG,Release)( THIS ) PURE; + + STDMETHOD_(GI(GameInputKind),GetInputKind)( THIS ) PURE; + STDMETHOD_(UINT64,GetSequenceNumber)( THIS_ GI(GameInputKind) input_kind ) PURE; + STDMETHOD_(UINT64,GetTimestamp)( THIS ) PURE; + STDMETHOD_(void,GetDevice)( THIS_ struct GI(IGameInputDevice) **device ) PURE; + STDMETHOD_(BOOLEAN,GetRawReport)( THIS_ GI(IGameInputRawDeviceReport) **report ) PURE; + STDMETHOD_(UINT32,GetControllerAxisCount)( THIS ) PURE; + STDMETHOD_(UINT32,GetControllerAxisState)( THIS_ UINT32 count, float *state ) PURE; + STDMETHOD_(UINT32,GetControllerButtonCount)( THIS ) PURE; + STDMETHOD_(UINT32,GetControllerButtonState)( THIS_ UINT32 count, BOOLEAN *state ) PURE; + STDMETHOD_(UINT32,GetControllerSwitchCount)( THIS ) PURE; + STDMETHOD_(UINT32,GetControllerSwitchState)( THIS_ UINT32 count, GI(GameInputSwitchPosition) *state ) PURE; + STDMETHOD_(UINT32,GetKeyCount)( THIS ) PURE; + STDMETHOD_(UINT32,GetKeyState)( THIS_ UINT32 count, GI(GameInputKeyState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetMouseState)( THIS_ GI(GameInputMouseState) *state ) PURE; + STDMETHOD_(UINT32,GetTouchCount)( THIS ) PURE; + STDMETHOD_(UINT32,GetTouchState)( THIS_ UINT32 count, GI(GameInputTouchState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetMotionState)( THIS_ GI(GameInputMotionState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetArcadeStickState)( THIS_ GI(GameInputArcadeStickState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetFlightStickState)( THIS_ GI(GameInputFlightStickState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetGamepadState)( THIS_ GI(GameInputGamepadState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetRacingWheelState)( THIS_ GI(GameInputRacingWheelState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetUiNavigationState)( THIS_ GI(GameInputUiNavigationState) *state ) PURE; +}; +#undef INTERFACE + +#ifdef _GAMEINPUT_ +#define IGameInputReading0_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IGameInputReading0_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IGameInputReading0_Release(p) (p)->lpVtbl->Release(p) +#define IGameInputReading0_GetInputKind(p) (p)->lpVtbl->GetInputKind(p) +#define IGameInputReading0_GetSequenceNumber(p,a) (p)->lpVtbl->GetSequenceNumber(p,a) +#define IGameInputReading0_GetTimestamp(p) (p)->lpVtbl->GetTimestamp(p) +#define IGameInputReading0_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IGameInputReading0_GetRawReport(p,a) (p)->lpVtbl->GetRawReport(p,a) +#define IGameInputReading0_GetControllerAxisCount(p) (p)->lpVtbl->GetControllerAxisCount(p) +#define IGameInputReading0_GetControllerAxisState(p,a,b) (p)->lpVtbl->GetControllerAxisState(p,a,b) +#define IGameInputReading0_GetControllerButtonCount(p) (p)->lpVtbl->GetControllerButtonCount(p) +#define IGameInputReading0_GetControllerButtonState(p,a,b) (p)->lpVtbl->GetControllerButtonState(p,a,b) +#define IGameInputReading0_GetControllerSwitchCount(p) (p)->lpVtbl->GetControllerSwitchCount(p) +#define IGameInputReading0_GetControllerSwitchState(p,a,b) (p)->lpVtbl->GetControllerSwitchState(p,a,b) +#define IGameInputReading0_GetKeyCount(p) (p)->lpVtbl->GetKeyCount(p) +#define IGameInputReading0_GetKeyState(p,a,b) (p)->lpVtbl->GetKeyState(p,a,b) +#define IGameInputReading0_GetMouseState(p,a) (p)->lpVtbl->GetMouseState(p,a) +#define IGameInputReading0_GetTouchCount(p) (p)->lpVtbl->GetTouchCount(p) +#define IGameInputReading0_GetTouchState(p,a,b) (p)->lpVtbl->GetTouchState(p,a,b) +#define IGameInputReading0_GetMotionState(p,a) (p)->lpVtbl->GetMotionState(p,a) +#define IGameInputReading0_GetArcadeStickState(p,a) (p)->lpVtbl->GetArcadeStickState(p,a) +#define IGameInputReading0_GetFlightStickState(p,a) (p)->lpVtbl->GetFlightStickState(p,a) +#define IGameInputReading0_GetGamepadState(p,a) (p)->lpVtbl->GetGamepadState(p,a) +#define IGameInputReading0_GetRacingWheelState(p,a) (p)->lpVtbl->GetRacingWheelState(p,a) +#define IGameInputReading0_GetUiNavigationState(p,a) (p)->lpVtbl->GetUiNavigationState(p,a) +#endif /* _GAMEINPUT_ */ + +#define INTERFACE GI(IGameInputDevice) +DEFINE_GUID(GI(IID_IGameInputDevice),0x31dd86fb,0x4c1b,0x408a,0x86,0x8f,0x43,0x9b,0x3c,0xd4,0x71,0x25); +DECLARE_INTERFACE_IID_(INTERFACE,IUnknown,"31dd86fb-4c1b-408a-868f-439b3cd47125") +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)( THIS_ REFIID riid,void **out ) PURE; + STDMETHOD_(ULONG,AddRef)( THIS ) PURE; + STDMETHOD_(ULONG,Release)( THIS ) PURE; + + STDMETHOD_(GI(GameInputDeviceInfo) const *,GetDeviceInfo)( THIS ) PURE; + STDMETHOD_(GI(GameInputDeviceStatus),GetDeviceStatus)( THIS ) PURE; + STDMETHOD_(void,GetBatteryState)( THIS_ GI(GameInputBatteryState) *state ) PURE; + STDMETHOD(CreateForceFeedbackEffect)( THIS_ UINT32 index, GI(GameInputForceFeedbackParams) const *params, + struct GI(IGameInputForceFeedbackEffect) **effect ) PURE; + STDMETHOD_(BOOLEAN,IsForceFeedbackMotorPoweredOn)( THIS_ UINT32 index ) PURE; + STDMETHOD_(void,SetForceFeedbackMotorGain)( THIS_ UINT32 index, float gain ) PURE; + STDMETHOD(SetHapticMotorState)( THIS_ UINT32 index, GI(GameInputHapticFeedbackParams) const *params ) PURE; + STDMETHOD_(void,SetRumbleState)( THIS_ GI(GameInputRumbleParams) const *params ) PURE; + STDMETHOD_(void,SetInputSynchronizationState)( THIS_ BOOLEAN enabled ) PURE; + STDMETHOD_(void,SendInputSynchronizationHint)( THIS ) PURE; + STDMETHOD_(void,PowerOff)( THIS ) PURE; + STDMETHOD(CreateRawDeviceReport)( THIS_ UINT32 report_id, GI(GameInputRawDeviceReportKind) report_kind, + GI(IGameInputRawDeviceReport) **report ) PURE; + STDMETHOD(GetRawDeviceFeature)( THIS_ UINT32 report_id, GI(IGameInputRawDeviceReport) **report ) PURE; + STDMETHOD(SetRawDeviceFeature)( THIS_ GI(IGameInputRawDeviceReport) *report ) PURE; + STDMETHOD(SendRawDeviceOutput)( THIS_ GI(IGameInputRawDeviceReport) *report ) PURE; + STDMETHOD(SendRawDeviceOutputWithResponse)( THIS_ GI(IGameInputRawDeviceReport) *request_report, GI(IGameInputRawDeviceReport) **response_report ) PURE; + STDMETHOD(ExecuteRawDeviceIoControl)( THIS_ UINT32 control_code, SIZE_T input_buffer_size, void const *input_buffer, + SIZE_T output_buffer_size, void *output_buffer, SIZE_T *output_size ) PURE; + STDMETHOD_(BOOLEAN,AcquireExclusiveRawDeviceAccess)( THIS_ UINT64 timeout_us ) PURE; + STDMETHOD_(void,ReleaseExclusiveRawDeviceAccess)( THIS ) PURE; +}; +#undef INTERFACE + +#ifdef _GAMEINPUT_ +#define IGameInputDevice0_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IGameInputDevice0_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IGameInputDevice0_Release(p) (p)->lpVtbl->Release(p) +#define IGameInputDevice0_GetDeviceInfo(p) (p)->lpVtbl->GetDeviceInfo(p) +#define IGameInputDevice0_GetDeviceStatus(p) (p)->lpVtbl->GetDeviceStatus(p) +#define IGameInputDevice0_GetBatteryState(p,a) (p)->lpVtbl->GetBatteryState(p,a) +#define IGameInputDevice0_CreateForceFeedbackEffect(p,a,b,c) (p)->lpVtbl->CreateForceFeedbackEffect(p,a,b,c) +#define IGameInputDevice0_IsForceFeedbackMotorPoweredOn(p,a) (p)->lpVtbl->IsForceFeedbackMotorPoweredOn(p,a) +#define IGameInputDevice0_SetForceFeedbackMotorGain(p,a,b) (p)->lpVtbl->SetForceFeedbackMotorGain(p,a,b) +#define IGameInputDevice0_SetHapticMotorState(p,a,b) (p)->lpVtbl->SetHapticMotorState(p,a,b) +#define IGameInputDevice0_SetRumbleState(p,a) (p)->lpVtbl->SetRumbleState(p,a) +#define IGameInputDevice0_SetInputSynchronizationState(p,a) (p)->lpVtbl->SetInputSynchronizationState(p,a) +#define IGameInputDevice0_SendInputSynchronizationHint(p) (p)->lpVtbl->SendInputSynchronizationHint(p) +#define IGameInputDevice0_PowerOff(p) (p)->lpVtbl->PowerOff(p) +#define IGameInputDevice0_CreateRawDeviceReport(p,a,b,c) (p)->lpVtbl->CreateRawDeviceReport(p,a,b,c) +#define IGameInputDevice0_GetRawDeviceFeature(p,a,b) (p)->lpVtbl->GetRawDeviceFeature(p,a,b) +#define IGameInputDevice0_SetRawDeviceFeature(p,a) (p)->lpVtbl->SetRawDeviceFeature(p,a) +#define IGameInputDevice0_SendRawDeviceOutput(p,a) (p)->lpVtbl->SendRawDeviceOutput(p,a) +#define IGameInputDevice0_SendRawDeviceOutputWithResponse(p,a,b) (p)->lpVtbl->SendRawDeviceOutputWithResponse(p,a,b) +#define IGameInputDevice0_ExecuteRawDeviceIoControl(p,a,b,c,d,e,f) (p)->lpVtbl->ExecuteRawDeviceIoControl(p,a,b,c,d,e,f) +#define IGameInputDevice0_AcquireExclusiveRawDeviceAccess(p,a) (p)->lpVtbl->AcquireExclusiveRawDeviceAccess(p,a) +#define IGameInputDevice0_ReleaseExclusiveRawDeviceAccess(p) (p)->lpVtbl->ReleaseExclusiveRawDeviceAccess(p) +#endif /* _GAMEINPUT_ */ + +#elif GAMEINPUT_API_VERSION == 1 + +#define INTERFACE GI(IGameInput) +DEFINE_GUID(GI(IID_IGameInput),0x40ffb7e4,0x6150,0x407a,0xb4,0x39,0x13,0x2b,0xad,0xc0,0x8d,0x2d); +DECLARE_INTERFACE_IID_(INTERFACE,IUnknown,"40ffb7e4-6150-407a-b439-132badc08d2d") +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)( THIS_ REFIID riid,void **out ) PURE; + STDMETHOD_(ULONG,AddRef)( THIS ) PURE; + STDMETHOD_(ULONG,Release)( THIS ) PURE; + + STDMETHOD_(UINT64,GetCurrentTimestamp)( THIS ) PURE; + STDMETHOD(GetCurrentReading)( THIS_ GI(GameInputKind) input_kind, struct GI(IGameInputDevice) *device, struct GI(IGameInputReading) **reading ) PURE; + STDMETHOD(GetNextReading)( THIS_ struct GI(IGameInputReading) *reference_reading, GI(GameInputKind) input_kind, + struct GI(IGameInputDevice) *device, struct GI(IGameInputReading) **reading ) PURE; + STDMETHOD(GetPreviousReading)( THIS_ struct GI(IGameInputReading) *reference_reading, GI(GameInputKind) input_kind, + struct GI(IGameInputDevice) *device, struct GI(IGameInputReading) **reading ) PURE; + STDMETHOD(RegisterReadingCallback)( THIS_ struct GI(IGameInputDevice) *device, GI(GameInputKind) input_kind, void *context, + GI(GameInputReadingCallback) callback, GI(GameInputCallbackToken) *token ) PURE; + STDMETHOD(RegisterDeviceCallback)( THIS_ struct GI(IGameInputDevice) *device, GI(GameInputKind) input_kind, GI(GameInputDeviceStatus) status_filter, + GI(GameInputEnumerationKind) enumeration_kind, void *context, GI(GameInputDeviceCallback) callback, + GI(GameInputCallbackToken) *token ) PURE; + STDMETHOD(RegisterSystemButtonCallback)( THIS_ struct GI(IGameInputDevice) *device, GI(GameInputSystemButtons) button_filter, void *context, + GI(GameInputSystemButtonCallback) callback, GI(GameInputCallbackToken) *token ) PURE; + STDMETHOD(RegisterKeyboardLayoutCallback)( THIS_ struct GI(IGameInputDevice) *device, void *context, GI(GameInputKeyboardLayoutCallback) callback, + GI(GameInputCallbackToken) *token ) PURE; + STDMETHOD_(void,StopCallback)( THIS_ GI(GameInputCallbackToken) token ) PURE; + STDMETHOD_(BOOLEAN,UnregisterCallback)( THIS_ GI(GameInputCallbackToken) token ) PURE; + STDMETHOD(CreateDispatcher)( THIS_ struct GI(IGameInputDispatcher) **dispatcher ) PURE; + STDMETHOD(FindDeviceFromId)( THIS_ const APP_LOCAL_DEVICE_ID *value, struct GI(IGameInputDevice) **device ) PURE; + STDMETHOD(FindDeviceFromPlatformString)( THIS_ LPCWSTR value, struct GI(IGameInputDevice) **device ) PURE; + STDMETHOD_(void,SetFocusPolicy)( THIS_ GI(GameInputFocusPolicy) policy ) PURE; +}; +#undef INTERFACE + +#ifdef _GAMEINPUT_ +#define IGameInput1_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IGameInput1_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IGameInput1_Release(p) (p)->lpVtbl->Release(p) +#define IGameInput1_GetCurrentTimestamp(p) (p)->lpVtbl->GetCurrentTimestamp(p) +#define IGameInput1_GetCurrentReading(p,a,b,c) (p)->lpVtbl->GetCurrentReading(p,a,b,c) +#define IGameInput1_GetNextReading(p,a,b,c,d) (p)->lpVtbl->GetNextReading(p,a,b,c,d) +#define IGameInput1_GetPreviousReading(p,a,b,c,d) (p)->lpVtbl->GetPreviousReading(p,a,b,c,d) +#define IGameInput1_RegisterReadingCallback(p,a,b,c,d,e) (p)->lpVtbl->RegisterReadingCallback(p,a,b,c,d,e) +#define IGameInput1_RegisterDeviceCallback(p,a,b,c,d,e,f,g) (p)->lpVtbl->RegisterDeviceCallback(p,a,b,c,d,e,f,g) +#define IGameInput1_RegisterSystemButtonCallback(p,a,b,c,d,e) (p)->lpVtbl->RegisterSystemButtonCallback(p,a,b,c,d,e) +#define IGameInput1_RegisterKeyboardLayoutCallback(p,a,b,c,d) (p)->lpVtbl->RegisterKeyboardLayoutCallback(p,a,b,c,d) +#define IGameInput1_StopCallback(p,a) (p)->lpVtbl->StopCallback(p,a) +#define IGameInput1_UnregisterCallback(p,a) (p)->lpVtbl->UnregisterCallback(p,a) +#define IGameInput1_CreateDispatcher(p,a) (p)->lpVtbl->CreateDispatcher(p,a) +#define IGameInput1_FindDeviceFromId(p,a,b) (p)->lpVtbl->FindDeviceFromId(p,a,b) +#define IGameInput1_FindDeviceFromPlatformString(p,a,b) (p)->lpVtbl->FindDeviceFromPlatformString(p,a,b) +#define IGameInput1_SetFocusPolicy(p,a) (p)->lpVtbl->SetFocusPolicy(p,a) +#endif /* _GAMEINPUT_ */ + +#define INTERFACE GI(IGameInputReading) +DEFINE_GUID(GI(IID_IGameInputReading),0x86318e60,0x0b3c,0x40d6,0xbe,0xfa,0xc6,0x2f,0x2d,0x95,0x27,0x24); +DECLARE_INTERFACE_IID_(INTERFACE,IUnknown,"86318e60-0b3c-40d6-befa-c62f2d952724") +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)( THIS_ REFIID riid,void **out ) PURE; + STDMETHOD_(ULONG,AddRef)( THIS ) PURE; + STDMETHOD_(ULONG,Release)( THIS ) PURE; + + STDMETHOD_(GI(GameInputKind),GetInputKind)( THIS ) PURE; + STDMETHOD_(UINT64,GetTimestamp)( THIS ) PURE; + STDMETHOD_(void,GetDevice)( THIS_ struct GI(IGameInputDevice) **device ) PURE; + STDMETHOD_(UINT32,GetControllerAxisCount)( THIS ) PURE; + STDMETHOD_(UINT32,GetControllerAxisState)( THIS_ UINT32 count, float *state ) PURE; + STDMETHOD_(UINT32,GetControllerButtonCount)( THIS ) PURE; + STDMETHOD_(UINT32,GetControllerButtonState)( THIS_ UINT32 count, BOOLEAN *state ) PURE; + STDMETHOD_(UINT32,GetControllerSwitchCount)( THIS ) PURE; + STDMETHOD_(UINT32,GetControllerSwitchState)( THIS_ UINT32 count, GI(GameInputSwitchPosition) *state ) PURE; + STDMETHOD_(UINT32,GetKeyCount)( THIS ) PURE; + STDMETHOD_(UINT32,GetKeyState)( THIS_ UINT32 count, GI(GameInputKeyState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetMouseState)( THIS_ GI(GameInputMouseState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetArcadeStickState)( THIS_ GI(GameInputArcadeStickState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetFlightStickState)( THIS_ GI(GameInputFlightStickState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetGamepadState)( THIS_ GI(GameInputGamepadState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetRacingWheelState)( THIS_ GI(GameInputRacingWheelState) *state ) PURE; + STDMETHOD_(BOOLEAN,GetUiNavigationState)( THIS_ GI(GameInputUiNavigationState) *state ) PURE; +}; +#undef INTERFACE + +#ifdef _GAMEINPUT_ +#define IGameInputReading1_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IGameInputReading1_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IGameInputReading1_Release(p) (p)->lpVtbl->Release(p) +#define IGameInputReading1_GetInputKind(p) (p)->lpVtbl->GetInputKind(p) +#define IGameInputReading1_GetTimestamp(p) (p)->lpVtbl->GetTimestamp(p) +#define IGameInputReading1_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IGameInputReading1_GetControllerAxisCount(p) (p)->lpVtbl->GetControllerAxisCount(p) +#define IGameInputReading1_GetControllerAxisState(p,a,b) (p)->lpVtbl->GetControllerAxisState(p,a,b) +#define IGameInputReading1_GetControllerButtonCount(p) (p)->lpVtbl->GetControllerButtonCount(p) +#define IGameInputReading1_GetControllerButtonState(p,a,b) (p)->lpVtbl->GetControllerButtonState(p,a,b) +#define IGameInputReading1_GetControllerSwitchCount(p) (p)->lpVtbl->GetControllerSwitchCount(p) +#define IGameInputReading1_GetControllerSwitchState(p,a,b) (p)->lpVtbl->GetControllerSwitchState(p,a,b) +#define IGameInputReading1_GetKeyCount(p) (p)->lpVtbl->GetKeyCount(p) +#define IGameInputReading1_GetKeyState(p,a,b) (p)->lpVtbl->GetKeyState(p,a,b) +#define IGameInputReading1_GetMouseState(p,a) (p)->lpVtbl->GetMouseState(p,a) +#define IGameInputReading1_GetArcadeStickState(p,a) (p)->lpVtbl->GetArcadeStickState(p,a) +#define IGameInputReading1_GetFlightStickState(p,a) (p)->lpVtbl->GetFlightStickState(p,a) +#define IGameInputReading1_GetGamepadState(p,a) (p)->lpVtbl->GetGamepadState(p,a) +#define IGameInputReading1_GetRacingWheelState(p,a) (p)->lpVtbl->GetRacingWheelState(p,a) +#define IGameInputReading1_GetUiNavigationState(p,a) (p)->lpVtbl->GetUiNavigationState(p,a) +#endif /* _GAMEINPUT_ */ + +#define INTERFACE GI(IGameInputDevice) +DEFINE_GUID(GI(IID_IGameInputDevice),0xb169652a,0x4a32,0x40d7,0x9f,0xa9,0x90,0x59,0x97,0x95,0x25,0x16); +DECLARE_INTERFACE_IID_(INTERFACE,IUnknown,"b169652a-4a32-40d7-9fa9-905997952516") +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)( THIS_ REFIID riid,void **out ) PURE; + STDMETHOD_(ULONG,AddRef)( THIS ) PURE; + STDMETHOD_(ULONG,Release)( THIS ) PURE; + + STDMETHOD(GetDeviceInfo)( THIS_ const GI(GameInputDeviceInfo) **info ) PURE; + STDMETHOD_(GI(GameInputDeviceStatus),GetDeviceStatus)( THIS ) PURE; + STDMETHOD(CreateForceFeedbackEffect)( THIS_ UINT32 index, GI(GameInputForceFeedbackParams) const *params, + struct GI(IGameInputForceFeedbackEffect) **effect ) PURE; + STDMETHOD_(BOOLEAN,IsForceFeedbackMotorPoweredOn)( THIS_ UINT32 index ) PURE; + STDMETHOD_(void,SetForceFeedbackMotorGain)( THIS_ UINT32 index, float gain ) PURE; + STDMETHOD_(void,SetRumbleState)( THIS_ const GI(GameInputRumbleParams) *params ) PURE; +}; +#undef INTERFACE + +#ifdef _GAMEINPUT_ +#define IGameInputDevice1_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IGameInputDevice1_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IGameInputDevice1_Release(p) (p)->lpVtbl->Release(p) +#define IGameInputDevice1_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IGameInputDevice1_GetDeviceStatus(p) (p)->lpVtbl->GetDeviceStatus(p) +#define IGameInputDevice1_CreateForceFeedbackEffect(p,a,b,c) (p)->lpVtbl->CreateForceFeedbackEffect(p,a,b,c) +#define IGameInputDevice1_IsForceFeedbackMotorPoweredOn(p,a) (p)->lpVtbl->IsForceFeedbackMotorPoweredOn(p,a) +#define IGameInputDevice1_SetForceFeedbackMotorGain(p,a,b) (p)->lpVtbl->SetForceFeedbackMotorGain(p,a,b) +#define IGameInputDevice1_SetRumbleState(p,a) (p)->lpVtbl->SetRumbleState(p,a) +#endif /* _GAMEINPUT_ */ + +#endif /* GAMEINPUT_API_VERSION */ + +#define INTERFACE GI(IGameInputDispatcher) +DEFINE_GUID(GI(IID_IGameInputDispatcher),0x415eed2e,0x98cb,0x42c2,0x8f,0x28,0xb9,0x46,0x01,0x07,0x4e,0x31); +DECLARE_INTERFACE_IID_(INTERFACE,IUnknown,"415eed2e-98cb-42c2-8f28-b94601074e31") +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)( THIS_ REFIID riid,void **out ) PURE; + STDMETHOD_(ULONG,AddRef)( THIS ) PURE; + STDMETHOD_(ULONG,Release)( THIS ) PURE; + + STDMETHOD_(BOOLEAN,Dispatch)( THIS_ UINT64 quota_us ) PURE; + STDMETHOD(OpenWaitHandle)( THIS_ HANDLE *handle ) PURE; +}; +#undef INTERFACE + +#ifdef _GAMEINPUT_ +#define IGameInputDispatcher0_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IGameInputDispatcher0_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IGameInputDispatcher0_Release(p) (p)->lpVtbl->Release(p) +#define IGameInputDispatcher0_Dispatch(p,a) (p)->lpVtbl->Dispatch(p,a) +#define IGameInputDispatcher0_OpenWaitHandle(p,a) (p)->lpVtbl->OpenWaitHandle(p,a) + +#define IGameInputDispatcher1_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IGameInputDispatcher1_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IGameInputDispatcher1_Release(p) (p)->lpVtbl->Release(p) +#define IGameInputDispatcher1_Dispatch(p,a) (p)->lpVtbl->Dispatch(p,a) +#define IGameInputDispatcher1_OpenWaitHandle(p,a) (p)->lpVtbl->OpenWaitHandle(p,a) +#endif /* _GAMEINPUT_ */ + +#define INTERFACE GI(IGameInputForceFeedbackEffect) +DEFINE_GUID(GI(IID_IGameInputForceFeedbackEffect),0x51bda05e,0xf742,0x45d9,0xb0,0x85,0x94,0x44,0xae,0x48,0x38,0x1d); +DECLARE_INTERFACE_IID_(INTERFACE,IUnknown,"51bda05e-f742-45d9-b085-9444ae48381d") +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)( THIS_ REFIID riid,void **out ) PURE; + STDMETHOD_(ULONG,AddRef)( THIS ) PURE; + STDMETHOD_(ULONG,Release)( THIS ) PURE; + + STDMETHOD_(void,GetDevice)( THIS_ GI(IGameInputDevice) **device ) PURE; + STDMETHOD_(UINT32,GetMotorIndex)( THIS ) PURE; + STDMETHOD_(float,GetGain)( THIS ) PURE; + STDMETHOD_(void,SetGain)( THIS_ float gain ) PURE; + STDMETHOD_(void,GetParams)( THIS_ GI(GameInputForceFeedbackParams) *params ) PURE; + STDMETHOD_(BOOLEAN,SetParams)( THIS_ GI(GameInputForceFeedbackParams) const *params ) PURE; + STDMETHOD_(GI(GameInputFeedbackEffectState),GetState)( THIS ) PURE; + STDMETHOD_(void,SetState)( THIS_ GI(GameInputFeedbackEffectState) state ) PURE; +}; +#undef INTERFACE + +#ifdef _GAMEINPUT_ +#define IGameInputForceFeedbackEffect0_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IGameInputForceFeedbackEffect0_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IGameInputForceFeedbackEffect0_Release(p) (p)->lpVtbl->Release(p) +#define IGameInputForceFeedbackEffect0_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IGameInputForceFeedbackEffect0_GetMotorIndex(p) (p)->lpVtbl->GetMotorIndex(p) +#define IGameInputForceFeedbackEffect0_GetGain(p) (p)->lpVtbl->GetGain(p) +#define IGameInputForceFeedbackEffect0_SetGain(p,a) (p)->lpVtbl->SetGain(p,a) +#define IGameInputForceFeedbackEffect0_GetParams(p,a) (p)->lpVtbl->GetParams(p,a) +#define IGameInputForceFeedbackEffect0_SetParams(p,a) (p)->lpVtbl->SetParams(p,a) +#define IGameInputForceFeedbackEffect0_GetState(p) (p)->lpVtbl->GetState(p) +#define IGameInputForceFeedbackEffect0_SetState(p,a) (p)->lpVtbl->SetState(p,a) + +#define IGameInputForceFeedbackEffect1_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IGameInputForceFeedbackEffect1_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IGameInputForceFeedbackEffect1_Release(p) (p)->lpVtbl->Release(p) +#define IGameInputForceFeedbackEffect1_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IGameInputForceFeedbackEffect1_GetMotorIndex(p) (p)->lpVtbl->GetMotorIndex(p) +#define IGameInputForceFeedbackEffect1_GetGain(p) (p)->lpVtbl->GetGain(p) +#define IGameInputForceFeedbackEffect1_SetGain(p,a) (p)->lpVtbl->SetGain(p,a) +#define IGameInputForceFeedbackEffect1_GetParams(p,a) (p)->lpVtbl->GetParams(p,a) +#define IGameInputForceFeedbackEffect1_SetParams(p,a) (p)->lpVtbl->SetParams(p,a) +#define IGameInputForceFeedbackEffect1_GetState(p) (p)->lpVtbl->GetState(p) +#define IGameInputForceFeedbackEffect1_SetState(p,a) (p)->lpVtbl->SetState(p,a) +#endif /* _GAMEINPUT_ */ + +#if GAMEINPUT_API_VERSION == 0 +HRESULT WINAPI GameInputCreate( GI(IGameInput) **out ); +#elif defined(__cplusplus) +static inline HRESULT GameInputCreate( IGameInput **out ) +{ + IUnknown *unk; + HRESULT hr; + + *out = NULL; + if (SUCCEEDED(hr = GameInputCreate( (struct GameInputLegacy **)&unk ))) + { + hr = IUnknown_QueryInterface( unk, &IID_IGameInput, (void **)out ); + IUnknown_Release( unk ); + } + + return hr; +} +#endif /* __cplusplus */ + +#define FACILITY_GAMEINPUT 906 +#define GAMEINPUT_E_DEVICE_DISCONNECTED 0x838a0001 +#define GAMEINPUT_E_DEVICE_NOT_FOUND 0x838a0002 +#define GAMEINPUT_E_READING_NOT_FOUND 0x838a0003 +#define GAMEINPUT_E_REFERENCE_READING_TOO_OLD 0x838a0004 +#define GAMEINPUT_E_TIMESTAMP_OUT_OF_RANGE 0x838a0005 +#define GAMEINPUT_E_INSUFFICIENT_FORCE_FEEDBACK_RESOURCES 0x838a0006 +#if GAMEINPUT_API_VERSION == 1 +#define GAMEINPUT_E_FEEDBACK_NOT_SUPPORTED 0x838a0007 +#define GAMEINPUT_E_OBJECT_NO_LONGER_EXISTS 0x838a0008 +#define GAMEINPUT_E_CALLBACK_NOT_FOUND 0x838a0009 +#endif /* GAMEINPUT_API_VERSION */ + +#undef GI + +#ifdef __cplusplus +#if GAMEINPUT_API_VERSION == 1 +}} /* namespace GameInput { namespace v1 { */ +#endif /* GAMEINPUT_API_VERSION */ +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* __WINE_GAMEINPUT_H */
From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58574 --- MAINTAINERS | 1 + configure.ac | 1 + dlls/gameinput/Makefile.in | 7 +++++ dlls/gameinput/gameinput.c | 48 +++++++++++++++++++++++++++++++++++ dlls/gameinput/gameinput.spec | 3 +++ 5 files changed, 60 insertions(+) create mode 100644 dlls/gameinput/Makefile.in create mode 100644 dlls/gameinput/gameinput.c create mode 100644 dlls/gameinput/gameinput.spec
diff --git a/MAINTAINERS b/MAINTAINERS index f5a367650b0..d87f03b1335 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -203,6 +203,7 @@ F: dlls/jscript/ Joystick input M: Rémi Bernon rbernon@codeweavers.com F: dlls/dinput*/ +F: dlls/gameinput*/ F: dlls/joy.cpl/ F: dlls/windows.gaming.input/ F: dlls/winebus.sys/ diff --git a/configure.ac b/configure.ac index 33c5f0aee8d..7d680a949d7 100644 --- a/configure.ac +++ b/configure.ac @@ -2726,6 +2726,7 @@ WINE_CONFIG_MAKEFILE(dlls/fontsub) WINE_CONFIG_MAKEFILE(dlls/fusion) WINE_CONFIG_MAKEFILE(dlls/fusion/tests) WINE_CONFIG_MAKEFILE(dlls/fwpuclnt) +WINE_CONFIG_MAKEFILE(dlls/gameinput) WINE_CONFIG_MAKEFILE(dlls/gameux) WINE_CONFIG_MAKEFILE(dlls/gameux/tests) WINE_CONFIG_MAKEFILE(dlls/gamingtcui) diff --git a/dlls/gameinput/Makefile.in b/dlls/gameinput/Makefile.in new file mode 100644 index 00000000000..7b239def911 --- /dev/null +++ b/dlls/gameinput/Makefile.in @@ -0,0 +1,7 @@ +MODULE = gameinput.dll +EXTRADEFS = -D_GAMEINPUT_ + +EXTRADLLFLAGS = -Wb,--prefer-native + +SOURCES = \ + gameinput.c diff --git a/dlls/gameinput/gameinput.c b/dlls/gameinput/gameinput.c new file mode 100644 index 00000000000..0e76a4346fd --- /dev/null +++ b/dlls/gameinput/gameinput.c @@ -0,0 +1,48 @@ +/* + * Copyright 2024 Rémi Bernon for CodeWeavers + * + * 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 + */ + +#include <stddef.h> +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" + +#define GAMEINPUT_API_VERSION 0 +#include "gameinput.h" +#undef GAMEINPUT_API_VERSION + +#define GAMEINPUT_API_VERSION 1 +#include "gameinput.h" +#undef GAMEINPUT_API_VERSION + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ginput); + +HRESULT WINAPI GameInputCreate( IGameInput0 **out ) +{ + FIXME( "out %p, stub!\n", out ); + return E_NOTIMPL; +} + +HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID riid, void **out ) +{ + FIXME( "clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out ); + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dlls/gameinput/gameinput.spec b/dlls/gameinput/gameinput.spec new file mode 100644 index 00000000000..398594120b4 --- /dev/null +++ b/dlls/gameinput/gameinput.spec @@ -0,0 +1,3 @@ +@ stdcall GameInputCreate(ptr) +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr)
From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58574 --- dlls/dinput/tests/dinput_test.h | 29 +++++++++++++++++++++++++++++ dlls/dinput/tests/hid.c | 1 + dlls/dinput/tests/joystick8.c | 26 ++++++++++++++++++++++++++ 3 files changed, 56 insertions(+)
diff --git a/dlls/dinput/tests/dinput_test.h b/dlls/dinput/tests/dinput_test.h index e2438d6d2d1..d19e1868d76 100644 --- a/dlls/dinput/tests/dinput_test.h +++ b/dlls/dinput/tests/dinput_test.h @@ -119,4 +119,33 @@ DWORD msg_wait_for_events_( const char *file, int line, DWORD count, HANDLE *eve #define create_foreground_window( a ) create_foreground_window_( __FILE__, __LINE__, a, 5 ) HWND create_foreground_window_( const char *file, int line, BOOL fullscreen, UINT retries );
+static inline const char *debugstr_ok( const char *cond ) +{ + int c, n = 0; + /* skip possible casts */ + while ((c = *cond++)) + { + if (c == '(') n++; + if (!n) break; + if (c == ')') n--; + } + if (!strchr( cond - 1, '(' )) return wine_dbg_sprintf( "got %s", cond - 1 ); + return wine_dbg_sprintf( "%.*s returned", (int)strcspn( cond - 1, "( " ), cond - 1 ); +} + +#define ok_eq( e, r, t, f, ... ) \ + do \ + { \ + t v = (r); \ + ok( v == (e), "%s " f "\n", debugstr_ok( #r ), v, ##__VA_ARGS__ ); \ + } while (0) +#define ok_ne( e, r, t, f, ... ) \ + do \ + { \ + t v = (r); \ + ok( v != (e), "%s " f "\n", debugstr_ok( #r ), v, ##__VA_ARGS__ ); \ + } while (0) +#define ok_ret( e, r ) ok_eq( e, r, UINT_PTR, "%Iu, error %ld", GetLastError() ) +#define ok_hr( e, r ) ok_eq( e, r, HRESULT, "%#lx" ) + #endif /* __WINE_DINPUT_TEST_H */ diff --git a/dlls/dinput/tests/hid.c b/dlls/dinput/tests/hid.c index 5e48050738b..7ec8482aeed 100644 --- a/dlls/dinput/tests/hid.c +++ b/dlls/dinput/tests/hid.c @@ -55,6 +55,7 @@ #include "dinput.h" #include "dinputd.h" #include "hidusage.h" +#include "gameinput.h"
#include "wine/mssign.h"
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index e381ad7b6f5..c5143623aa8 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -49,6 +49,14 @@
#include "initguid.h"
+#define _GAMEINPUT_ +#define GAMEINPUT_API_VERSION 0 +#include "gameinput.h" +#undef GAMEINPUT_API_VERSION +#define GAMEINPUT_API_VERSION 1 +#include "gameinput.h" +#undef GAMEINPUT_API_VERSION + #define DESKTOP_ALL_ACCESS 0x01ff
DEFINE_GUID(GUID_action_mapping_1,0x00000001,0x0002,0x0003,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b); @@ -5318,6 +5326,23 @@ done: cleanup_registry_keys(); }
+static void test_game_input(void) +{ + HMODULE gameinput = LoadLibraryW( L"gameinput.dll" ); + HRESULT (WINAPI *pGameInputCreate)( IGameInput0 **out ); + IGameInput0 *gi0; + + if (!gameinput || !(pGameInputCreate = (void *)GetProcAddress( gameinput, "GameInputCreate" ))) + { + win_skip( "GameInputCreate not found, skipping tests.\n" ); + return; + } + + gi0 = (void *)0xdeadbeef; + todo_wine ok_hr( S_OK, pGameInputCreate( &gi0 ) ); + if (gi0 != (void *)0xdeadbeef) ok_ret( 0, IGameInput0_Release( gi0 ) ); +} + static HANDLE rawinput_device_added, rawinput_device_removed, rawinput_event; static UINT rawinput_len[64], rawbuffer_count[64], rawbuffer_size, rawinput_calls; static char rawbuffer[1024]; @@ -5997,6 +6022,7 @@ START_TEST( joystick8 ) test_driving_wheel_axes(); test_rawinput( argv ); test_windows_gaming_input(); + test_game_input(); }
done: