mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-14 10:50:13 +01:00
138 lines
9.6 KiB
C++
138 lines
9.6 KiB
C++
|
|
#ifndef ISTEAMCONTROLLER007_H
|
|
#define ISTEAMCONTROLLER007_H
|
|
#ifdef STEAM_WIN32
|
|
#pragma once
|
|
#endif
|
|
|
|
class ISteamController007
|
|
{
|
|
public:
|
|
|
|
// Init and Shutdown must be called when starting/ending use of this interface
|
|
virtual bool Init() = 0;
|
|
virtual bool Shutdown() = 0;
|
|
|
|
// Synchronize API state with the latest Steam Controller inputs available. This
|
|
// is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest
|
|
// possible latency, you call this directly before reading controller state. This must
|
|
// be called from somewhere before GetConnectedControllers will return any handles
|
|
virtual void RunFrame() = 0;
|
|
|
|
// Enumerate currently connected controllers
|
|
// handlesOut should point to a STEAM_CONTROLLER_MAX_COUNT sized array of ControllerHandle_t handles
|
|
// Returns the number of handles written to handlesOut
|
|
virtual int GetConnectedControllers( STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_COUNT, Receives list of connected controllers ) ControllerHandle_t *handlesOut ) = 0;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// ACTION SETS
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.
|
|
virtual ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName ) = 0;
|
|
|
|
// Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive')
|
|
// This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in
|
|
// your state loops, instead of trying to place it in all of your state transitions.
|
|
virtual void ActivateActionSet( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle ) = 0;
|
|
virtual ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle ) = 0;
|
|
|
|
// ACTION SET LAYERS
|
|
virtual void ActivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle ) = 0;
|
|
virtual void DeactivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle ) = 0;
|
|
virtual void DeactivateAllActionSetLayers( ControllerHandle_t controllerHandle ) = 0;
|
|
// Enumerate currently active layers
|
|
// handlesOut should point to a STEAM_CONTROLLER_MAX_ACTIVE_LAYERS sized array of ControllerActionSetHandle_t handles.
|
|
// Returns the number of handles written to handlesOut
|
|
virtual int GetActiveActionSetLayers( ControllerHandle_t controllerHandle, STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_ACTIVE_LAYERS, Receives list of active layers ) ControllerActionSetHandle_t *handlesOut ) = 0;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// ACTIONS
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls.
|
|
virtual ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName ) = 0;
|
|
|
|
// Returns the current state of the supplied digital game action
|
|
virtual ControllerDigitalActionData_t GetDigitalActionData( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle ) = 0;
|
|
|
|
// Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
|
|
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles. The EControllerActionOrigin enum will get extended as support for new controller controllers gets added to
|
|
// the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.
|
|
virtual int GetDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_ORIGINS, Receives list of aciton origins ) EControllerActionOrigin *originsOut ) = 0;
|
|
|
|
// Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls.
|
|
virtual ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName ) = 0;
|
|
|
|
// Returns the current state of these supplied analog game action
|
|
virtual ControllerAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle ) = 0;
|
|
|
|
// Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
|
|
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles. The EControllerActionOrigin enum will get extended as support for new controller controllers gets added to
|
|
// the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.
|
|
virtual int GetAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_ORIGINS, Receives list of action origins ) EControllerActionOrigin *originsOut ) = 0;
|
|
|
|
// Get a local path to art for on-screen glyph for a particular origin - this call is cheap
|
|
virtual const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin ) = 0;
|
|
|
|
// Returns a localized string (from Steam's language setting) for the specified origin - this call is serialized
|
|
virtual const char *GetStringForActionOrigin( EControllerActionOrigin eOrigin ) = 0;
|
|
|
|
virtual void StopAnalogActionMomentum( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction ) = 0;
|
|
|
|
// Returns raw motion data from the specified controller
|
|
virtual ControllerMotionData_t GetMotionData( ControllerHandle_t controllerHandle ) = 0;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// OUTPUTS
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Trigger a haptic pulse on a controller
|
|
virtual void TriggerHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0;
|
|
|
|
// Trigger a pulse with a duty cycle of usDurationMicroSec / usOffMicroSec, unRepeat times.
|
|
// nFlags is currently unused and reserved for future use.
|
|
virtual void TriggerRepeatedHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ) = 0;
|
|
|
|
// Trigger a vibration event on supported controllers.
|
|
virtual void TriggerVibration( ControllerHandle_t controllerHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed ) = 0;
|
|
|
|
// Set the controller LED color on supported controllers.
|
|
virtual void SetLEDColor( ControllerHandle_t controllerHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags ) = 0;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Utility functions availible without using the rest of Steam Input API
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Invokes the Steam overlay and brings up the binding screen if the user is using Big Picture Mode
|
|
// If the user is not in Big Picture Mode it will open up the binding in a new window
|
|
virtual bool ShowBindingPanel( ControllerHandle_t controllerHandle ) = 0;
|
|
|
|
// Returns the input type for a particular handle
|
|
virtual ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle ) = 0;
|
|
|
|
// Returns the associated controller handle for the specified emulated gamepad - can be used with the above 2 functions
|
|
// to identify controllers presented to your game over Xinput. Returns 0 if the Xinput index isn't associated with Steam Input
|
|
virtual ControllerHandle_t GetControllerForGamepadIndex( int nIndex ) = 0;
|
|
|
|
// Returns the associated gamepad index for the specified controller, if emulating a gamepad or -1 if not associated with an Xinput index
|
|
virtual int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle ) = 0;
|
|
|
|
// Returns a localized string (from Steam's language setting) for the specified Xbox controller origin.
|
|
virtual const char *GetStringForXboxOrigin( EXboxOrigin eOrigin ) = 0;
|
|
|
|
// Get a local path to art for on-screen glyph for a particular Xbox controller origin.
|
|
virtual const char *GetGlyphForXboxOrigin( EXboxOrigin eOrigin ) = 0;
|
|
|
|
// Get the equivalent ActionOrigin for a given Xbox controller origin this can be chained with GetGlyphForActionOrigin to provide future proof glyphs for
|
|
// non-Steam Input API action games. Note - this only translates the buttons directly and doesn't take into account any remapping a user has made in their configuration
|
|
virtual EControllerActionOrigin GetActionOriginFromXboxOrigin_( ControllerHandle_t controllerHandle, EXboxOrigin eOrigin ) = 0;
|
|
|
|
// Convert an origin to another controller type - for inputs not present on the other controller type this will return k_EControllerActionOrigin_None
|
|
virtual EControllerActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, EControllerActionOrigin eSourceOrigin ) = 0;
|
|
|
|
// Get the binding revision for a given device. Returns false if the handle was not valid or if a mapping is not yet loaded for the device
|
|
virtual bool GetControllerBindingRevision( ControllerHandle_t controllerHandle, int *pMajor, int *pMinor ) = 0;
|
|
};
|
|
|
|
#endif //ISTEAMCONTROLLER007_H
|