ReXGlue SDK
Loading...
Searching...
No Matches
input.h File Reference

XInput structures and constants and the XAM error codes. More...

#include <string>
#include <rex/assert.h>
#include <rex/types.h>
#include <rex/result.h>
#include <rex/kernel/types/status.h>

Go to the source code of this file.

Classes

struct  rex::xam::X_INPUT_GAMEPAD
struct  rex::xam::X_INPUT_STATE
struct  rex::xam::X_INPUT_VIBRATION
struct  rex::xam::X_INPUT_CAPABILITIES
struct  rex::xam::X_INPUT_KEYSTROKE

Namespaces

namespace  rex

Enumerations

enum  rex::xam::X_INPUT_CAPS : u8 {
  rex::xam::kXInputCapsFFBSupported = 0x0001 , rex::xam::kXInputCapsWireless = 0x0002 , rex::xam::kXInputCapsVoiceSupported = 0x0004 , rex::xam::kXInputCapsPMDSupported = 0x0008 ,
  rex::xam::kXInputCapsNoNavigation = 0x0010
}
enum  rex::xam::X_INPUT_DEVTYPE : u8 { rex::xam::kXInputDevTypeGamepad = 0x00000001 , rex::xam::kXInputDevTypeKeyboard = 0x00000002 }
enum  rex::xam::X_INPUT_DEVSUBTYPE : u8 {
  rex::xam::kXInputDevSubtypeUSBKeyboard = 0x00000000 , rex::xam::kXInputDevSubtypeGamepad = 0x00000001 , kXInputDevSubtypeWheel = 0x00000002 , kXInputDevSubtypeArcadeStick = 0x00000003 ,
  kXInputDevSubtypeFlightStick = 0x00000004 , kXInputDevSubtypeDancePad = 0x00000005 , kXInputDevSubtypeGuitar = 0x00000006 , rex::xam::kXInputDevSubtypeGuitarAlternate = 0x00000007 ,
  kXInputDevSubtypeDrumKit = 0x00000008 , rex::xam::kXInputDevSubtypeGuitarBass = 0x0000000B , rex::xam::kXInputDevSubtypeArcadePad = 0x00000013
}
enum  rex::xam::X_INPUT_FLAG {
  rex::xam::kXInputFlagGamepad = 0x00000001 , rex::xam::kXInputFlagKeyboard = 0x00000002 , rex::xam::kXInputFlagUnknown = 0x00000004 , rex::xam::kXInputFlagUnknown2 = 0x00000008 ,
  rex::xam::kXInputFlagMic = 0x00000020 , rex::xam::kXInputFlagAnyDevice = 0x000000FF , rex::xam::kXInputFlagAnyUser = 1 << 30
}
enum  X_INPUT_GAMEPAD_BUTTON : u16 {
  kXInputGamepadDPadUp = 0x0001 , kXInputGamepadDPadDown = 0x0002 , kXInputGamepadDPadLeft = 0x0004 , kXInputGamepadDPadRight = 0x0008 ,
  kXInputGamepadStart = 0x0010 , kXInputGamepadBack = 0x0020 , kXInputGamepadLeftThumb = 0x0040 , kXInputGamepadRightThumb = 0x0080 ,
  kXInputGamepadLeftShoulder = 0x0100 , kXInputGamepadRightShoulder = 0x0200 , kXInputGamepadGuide = 0x0400 , kXInputGamepadA = 0x1000 ,
  kXInputGamepadB = 0x2000 , kXInputGamepadX = 0x4000 , kXInputGamepadY = 0x8000
}
enum  rex::xam::X_INPUT_KEYSTROKE_FLAGS : u16 {
  rex::xam::kXInputKeystrokeKeyDown = 0x0001 , rex::xam::kXInputKeystrokeKeyUp = 0x0002 , rex::xam::kXInputKeystrokeRepeat = 0x0004 , rex::xam::kXInputKeystrokeShift = 0x0008 ,
  rex::xam::kXInputKeystrokeCtrl = 0x0010 , rex::xam::kXInputKeystrokeAlt = 0x0020 , rex::xam::kXInputKeystrokeValidUnicode = 0x1000
}
enum class  rex::xam::HIDError : u8 { kNotConnected = 1 , kEmpty = 2 , kBadArguments = 3 , kFailed = 4 }

Functions

rex::Error rex::xam::BuildError (HIDError code, std::string message)
HIDError rex::xam::CodeOf (const rex::Error &error)
HIDError rex::xam::ToHIDError (rex::kernel::X_RESULT result)
rex::kernel::X_RESULT rex::xam::ToXResult (HIDError code)

Variables

constexpr i32 rex::xam::kXInputGamepadLeftThumbDeadzone = 7849
constexpr i32 rex::xam::kXInputGamepadRightThumbDeadzone = 8689
constexpr u8 rex::xam::kXInputGamepadTriggerThreshold = 30

Detailed Description

XInput structures and constants and the XAM error codes.

Xenia : Xbox 360 Emulator Research Project *

Copyright 2015 Ben Vanik. All rights reserved. * Released under the BSD license - see LICENSE in the root for more details. *

Modified
Tom Clay, 2026 - Adapted for ReXGlue runtime

Enumeration Type Documentation

◆ HIDError

enum class rex::xam::HIDError : u8
strong
Enumerator
kNotConnected 

No device answers for the user.

kEmpty 

The device has no keystroke queued.

◆ X_INPUT_CAPS

Enumerator
kXInputCapsFFBSupported 

XINPUT_CAPS_FFB_SUPPORTED. The device supports force feedback.

kXInputCapsWireless 

XINPUT_CAPS_WIRELESS. The device is wireless.

kXInputCapsVoiceSupported 

XINPUT_CAPS_VOICE_SUPPORTED. The device has an integrated voice device.

kXInputCapsPMDSupported 

XINPUT_CAPS_PMD_SUPPORTED. The device supports plugin module devices.

kXInputCapsNoNavigation 

Capability bit of X_INPUT_CAPABILITIES::flags. No code reads it.

◆ X_INPUT_DEVSUBTYPE

Enumerator
kXInputDevSubtypeUSBKeyboard 

Keyboard subtype. The keyboard driver reports it for the keyboard device.

kXInputDevSubtypeGamepad 

XDK gamepad subtype. Titles treat unrecognized subtypes as this one.

kXInputDevSubtypeGuitarAlternate 

Alternate guitar controller subtype. Not in the XDK.

kXInputDevSubtypeGuitarBass 

Bass guitar controller subtype. Not in the XDK.

kXInputDevSubtypeArcadePad 

Arcade pad subtype. Not in the XDK.

◆ X_INPUT_DEVTYPE

Enumerator
kXInputDevTypeGamepad 

The device is a game controller. The HID drivers report it in X_INPUT_CAPABILITIES::type.

kXInputDevTypeKeyboard 

The device is a keyboard. The keyboard driver reports it in X_INPUT_CAPABILITIES::type.

◆ X_INPUT_FLAG

Enumerator
kXInputFlagGamepad 

XINPUT_FLAG_GAMEPAD. Limits a query to the gamepad.

kXInputFlagKeyboard 

XINPUT_FLAG_KEYBOARD. Limits a query to the keyboard.

kXInputFlagUnknown 

Query flag bit 2. No code reads it.

kXInputFlagUnknown2 

Query flag bit 3. No code reads it.

kXInputFlagMic 

Query flag bit 5. No code reads it.

kXInputFlagAnyDevice 

Mask of every device type bit in the low byte.

kXInputFlagAnyUser 

Query flag bit 30. Selects any user.

◆ X_INPUT_KEYSTROKE_FLAGS

Enumerator
kXInputKeystrokeKeyDown 

XINPUT_KEYSTROKE_KEYDOWN. The key was pressed.

kXInputKeystrokeKeyUp 

XINPUT_KEYSTROKE_KEYUP. The key was released.

kXInputKeystrokeRepeat 

XINPUT_KEYSTROKE_REPEAT. A repeat of a held key.

kXInputKeystrokeShift 

XINPUT_KEYSTROKE_SHIFT. A SHIFT key is down.

kXInputKeystrokeCtrl 

XINPUT_KEYSTROKE_CTRL. A CTRL key is down.

kXInputKeystrokeAlt 

XINPUT_KEYSTROKE_ALT. An ALT key is down.

kXInputKeystrokeValidUnicode 

Set by the keyboard driver when unicode holds a valid character.

Function Documentation

◆ BuildError()

rex::Error rex::xam::BuildError ( HIDError code,
std::string message )
inlinenodiscard

Builds a rex::Error that carries a HID code.

Returns
The error, in category Platform.

◆ CodeOf()

HIDError rex::xam::CodeOf ( const rex::Error & error)
inlinenodiscard

Returns the HID code of an error.

Parameters
errorAn error built by BuildError.

◆ ToHIDError()

HIDError rex::xam::ToHIDError ( rex::kernel::X_RESULT result)
inlinenodiscard

Returns the HID code a Win32 input result stands for. NotConnected, Empty and BadArguments map to their codes and any other result gives Failed.

Parameters
resultA failing Win32 code.

◆ ToXResult()

rex::kernel::X_RESULT rex::xam::ToXResult ( HIDError code)
inlinenodiscard

Returns the Win32 code the XAM input exports report for a HID code.

Variable Documentation

◆ kXInputGamepadLeftThumbDeadzone

i32 rex::xam::kXInputGamepadLeftThumbDeadzone = 7849
constexpr

XInput's published thresholds.