Skip to content Skip to sidebar Skip to footer

Steam Mac Get Steam Controller Driver Prompt Again

Steam Input is a service assuasive Steam users to play any controller-supported game with the device of their pick. Steam Input will translates the user's input into something the game understands through either Gamepad Emulation, Mouse and Keyboard Emulation, or Steam Input API. Hither nosotros will focus on how to best use Steam Input Gamepad Emulation to extend your game's existing controller back up.

What's Gamepad Emulation?

  • On Windows the Steam Overlay will claw traditional gamepad input APIs such as XInput, DirectInput, RawInput, and Windows.Gaming.Input and inject an emulated Xbox controller device. On macOS and Linux emulated controller input is provided by a driver.
  • The controller will show up in your game equally an Xbox controller which ways that controllers with extra inputs will have some of them duplicated, ex: PlayStation trackpad click and the options button both mapping to XInput's Get-go push.
  • In addition to normal gamepad input it'south possible to demark Switch, PlayStation, and Steam Controller gyro inputs to mouse emulation and provide motion controls. This only works in games with a single local player because there is but i mouse input and as well relies on the game accepting simultaneous mouse and gamepad input. If you lot're interested in these features without those caveats please consider adding Steam Input API
  • You can query the type of controller currently from Steam in order to testify device specific glyphs merely y'all are limited to the types supported by your electric current Steamworks SDK. If you're interested in futurity-proof glyph back up please integrate Steam Input API
  • You may take users playing via Steam Input even for controllers you already support because Steam Remote Play uses it to provide input while streaming and a sizable portion of users have too enabled Steam Input for reconfiguring their controllers across the Steam library. Overall roughly a quarter of all controller sessions on Steam in 2020 used Steam Input, including almost half of all PlayStation controller sessions.

Over 2000 games on Steam use Gamepad Emulation for at least one controller blazon, including notable games such equally Monster Hunter: World, Ace Gainsay seven, Dragon Quest Eleven, Into the Breach, and Center Earth: Shadow of War though non all of them are post-obit the total list of best practices. Hither we'll highlight Into the Breach because they are doing a great job of following each of these best practices.

Showing device specific art

We support a few means to get device specific glyphs with Steam Input Gamepad Emulation – one for games that tin can load images at run-fourth dimension that is futurity-proofed (pregnant that when Steam updates Steam Input it will piece of work without any game updates) and two for games which need to bake the images into their assets or want to use the same stylized art from the console ports of their game. Into the Breach uses their own art for Xbox/Steam Controllers:

intothebreach_xbox.PNG

PlayStation:

intothebreach_ps4.PNG

and Nintendo Switch controllers:

intothebreach_switchpro.PNG

Notation: Even when using your own art we suggest yous fallback to Steam'due south fine art when you don't recognize a controller or call our helper function to observe the closest option that existed when your game was released so when time to come devices are added they have reasonable glyphs.

Showing Steam'southward Future-Proofed Glyphs

Yous'll need to brand utilize of the following functions:

  • ISteamInput::GetControllerForGamepadIndex
  • ISteamInput::GetAnalogActionOriginFromXboxOrigin
  • ISteamInput::GetGlyphForActionOrigin

Example code:

// Initialize the interface before using individual functions - this simply needs to be called one time! SteamInput()->Init() // ... // SteamAPI_RunCallbacks() will call the RunFrame functions for any initialized interfaces and nearly // games volition already be calling this periodically. If you aren't doing that yous'll demand to manually update // the Steam Input interface SteamInput()->RunFrame(); // ... // Replace with the XInputslot y'all are querying for. This number is betwixt 0 and three // If y'all're using RawInput for device detection before deciding which API to employ, please // run into the "Using RawInput For Device Detection" section. int nXinputSlot = 0; // Replace with the push button you are querying for EXboxOrigin eXboxButtonToGetGlyphFor = k_EXboxOrigin_A; EInputActionOrigin buttonOrigin = k_EInputActionOrigin_XBoxOne_A; // If the controller is configured through Steam Input - translate the button InputHandle_t controller1Handle = SteamInput()->GetControllerForGamepadIndex( nXinputSlot ); if ( controller1Handle > 0 ) { // Valid handles are non-zilch, this is a controller configured through Steam Input // Notation: controllers that are using Steam Input API will not render a handle through GetControllerForGamepadIndex() buttonOrigin = SteamInput()->GetActionOriginFromXboxOrigin( controller1Handle, k_EXboxOrigin_A ); } else { // Valid handles are non-zero, this is a normal Xbox controller // Continue using the original push } // The EInputActionOrigin values will go on to grow as Steam adds back up, but that is OK because // in this example nosotros will get the device images from Steam which can too provide a new glyph paradigm // Get the image from the Steam client const char *localGlyphPath = SteamInput()->GetGlyphForActionOrigin( buttonOrigin ); printf( "path = %southward\n", localGlyphPath ); // "path = C:\Program Files (x86)\Steam\tenfoot\resource\images\library\controller\api\ps4_button_x.png" // Replace this with a function from the game that turns a file path into a usable game texture glyphTextureID = loadButtonGlyphTextureFromLocalPath( localGlyphPath );

Showing Your Own Fine art - Glyph Palette

If you are using multiple glyph palettes and cull which 1 to employ based on controller type, you tin inquire Steam for this info past XInput slot using:

  • ISteamInput::GetControllerForGamepadIndex
  • ISteamInput::GetInputTypeForHandle

Example code:

// Initialize the interface earlier using individual functions - this only needs to be called once! SteamInput()->Init() // ... // SteamAPI_RunCallbacks() will call the RunFrame functions for any initialized interfaces and about // games will already be calling this periodically. If you aren't doing that you'll need to manually update // the Steam Input interface SteamInput()->RunFrame(); // ... // Replace with the XInput slot yous are querying for. This number is between 0 and 3 // If you're using RawInput for device detection before deciding which API to utilise, delight // see the "Using RawInput For Device Detection" section. int nXinputSlotIndex = 0; InputHandle_t inputHandle = SteamInput()->GetControllerForGamepadIndex( nXinputSlotIndex ); if ( inputHandle == 0 ) { // Valid Input handles are non-zippo, this is a normal Xbox controller. } else { // Steam will always return an enum value that was valid for your SDK version. ESteamInputType inputType = SteamInput()->GetInputTypeForHandle( inputHandle ); switch( inputType ) { case k_ESteamInputType_Unknown: printf( "unknown!\n" ); pause; case k_ESteamInputType_SteamController: printf( "Steam controller!\n" ); break; case k_ESteamInputType_XBox360Controller: printf( "XBox 360 controller!\n" ); pause; case k_ESteamInputType_XBoxOneController: printf( "XBox One controller!\north" ); break; case k_ESteamInputType_GenericXInput: printf( "Generic XInput!\northward" ); break; instance k_ESteamInputType_PS4Controller: printf( "PS4 controller!\north" ); suspension; } }

Showing Your Own Art - Per Button Art

If you're using a single expect up table indexed past activeness origins you tin utilize these functions to implement device specific glyphs and translate any unrecognized controllers to their closest equivalents.

  • ISteamInput::GetControllerForGamepadIndex
  • ISteamInput::GetAnalogActionOriginFromXboxOrigin
  • ISteamInput::TranslateActionOrigin

Example code:

// Initialize the interface before using private functions - this only needs to be chosen once! SteamInput()->Init() // ... // SteamAPI_RunCallbacks() will call the RunFrame functions for any initialized interfaces and almost // games will already be calling this periodically. If you aren't doing that you'll need to manually update // the Steam Input interface SteamInput()->RunFrame(); // ... // Supercede with the XInput slot you lot are querying for. This number is between 0 and three // If you're using RawInput for device detection before deciding which API to use, please // see the "Using RawInput For Device Detection" section. int nXinputSlot = 0; // Supplant with the push you are querying for EXboxOrigin eXboxButtonToGetGlyphFor = k_EXboxOrigin_A; EInputActionOrigin buttonOrigin = k_EInputActionOrigin_XBoxOne_A; // If the controller is configured through Steam Input - translate the button InputHandle_t controller1Handle = SteamInput()->GetControllerForGamepadIndex( nXinputSlot ); if ( controller1Handle > 0 ) { // Valid handles are non-zero, this is a controller configured through Steam Input // Notation: controllers that are using Steam Input API will not return a handle through GetControllerForGamepadIndex() buttonOrigin = SteamInput()->GetActionOriginFromXboxOrigin( controller1Handle, k_EXboxOrigin_A ); //i.eastward, k_EInputActionOrigin_PS4_X } else { // Valid handles are non-zilch, this is a normal Xbox controller // Keep using the original button } // Steam will continue to add together action origins and future controllers will exceed the electric current range // If you want to exam you could fake that Switch/PS5 controllers don't exist and change this to: // if ( buttonOrigin >= k_EInputActionOrigin_XBox360_Reserved10 ) if ( buttonOrigin >= k_EInputActionOrigin_Count ) { // Nosotros didn't transport whatever fine art in our game for this origin! I guess Steam has added support for // a new controller. Let's become the closest value that was supported past the SDK we built against buttonOrigin = SteamInput()->TranslateActionOrigin( k_ESteamInputType_Unknown, buttonOrigin ); } // Replace this with a part from the game that returns your art for a button int glyphTextureID = getHardCodedButtonGlyphTexture( buttonOrigin );

Using RawInput For Device Detection

Some games will apply RawInput to support more than 4 controllers or volition use it to decide if they have PlayStation controllers connected. This API will also return other non-gamepad devices and doesn't have a reliable index to directly map from Steam Input functions. Instead you can get this info by querying RIDI_DEVICENAME string from GetRawInputDeviceInfo() which is encoded with the USB VID/PID of real device, gamepad index, and Steam Input handle with the following format:
\\.\pipe\HID#VID_045E&PID_028E&IG_00#{Existent device VID}&{Real Device PID}&{Steam Input API handle}#{Steam Input Gamepad Index}#{ProcessID}
For instance, \\.\pipage\HID#VID_045E&PID_028E&IG_00#045E&0B00&00045EB00704DAF3#0#20160 for an Xbox i controller with a VID/PID of 0x45e/0x0b00.

Instance code:

#define VALVE_DIRECTINPUT_GAMEPAD_VID 0x28DE #define VALVE_DIRECTINPUT_GAMEPAD_PID 0x11FF #define STEAM_INPUT_VID_INDEX 37 #ascertain STEAM_INPUT_PID_INDEX 42 #ascertain STEAM_INPUT_SIAPI_HANDLE_INDEX 47 #define STEAM_INPUT_GAMEPAD_INDEX 64 #ascertain MAX_PATH 260 //... void YourFunction() { PRAWINPUTDEVICELIST devices = Zero; UINT i, j, device_count = 0; if ((GetRawInputDeviceList(NULL, &device_count, sizeof(RAWINPUTDEVICELIST)) == -ane) || (!device_count)) { return; /* oh well. */ } devices = (PRAWINPUTDEVICELIST)malloc(sizeof(RAWINPUTDEVICELIST) * device_count); if (devices == NULL) { return; } if (GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) { free(devices); return; /* oh well. */ } for (i = 0; i < device_count; i++) { RID_DEVICE_INFO rdi; char devName[MAX_PATH]; UINT rdiSize = sizeof(rdi); UINT nameSize = MAX_PATH; rdi.cbSize = sizeof(rdi); if ( devices[i].dwType == RIM_TYPEHID && GetRawInputDeviceInfoA( devices[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize ) != (UINT)-one && GetRawInputDeviceInfoA( devices[i].hDevice, RIDI_DEVICENAME, devName, &nameSize ) != (UINT)-1 ) { if ( rdi.hid.dwVendorId == VALVE_DIRECTINPUT_GAMEPAD_VID && rdi.hid.dwProductId == VALVE_DIRECTINPUT_GAMEPAD_PID ) { uint32 ulVID = strtoul( &devName[STEAM_INPUT_VID_INDEX], NULL, xvi ); uint32 ulPID = strtoul( &devName[STEAM_INPUT_PID_INDEX], NULL, 16 ); uint64 ulDeviceHandle = strtoull( &devName[STEAM_INPUT_SIAPI_HANDLE_INDEX], NULL, 16 ); uint32 unGamepadIndex = strtoul( &devName[STEAM_INPUT_GAMEPAD_INDEX], NULL, 16 ); Log( "Raw input device: VID = 0x%10, PID = 0x%10, handle = 0x%llx, alphabetize = 0x%x, %s\northward", ulVID, ulPID, ulDeviceHandle, unGamepadIndex, devName ); // You can at present use either the VID/PID to place the device directly or apply ulDeviceHandle with GetInputTypeForHandle ESteamInputType inputType = SteamInput()->GetInputTypeForHandle( ulDeviceHandle ); switch( inputType ) { instance k_ESteamInputType_Unknown: printf( "unknown!\n" ); break; case k_ESteamInputType_SteamController: printf( "Steam controller!\due north" ); suspension; case k_ESteamInputType_XBox360Controller: printf( "XBox 360 controller!\n" ); break; example k_ESteamInputType_XBoxOneController: printf( "XBox One controller!\due north" ); break; instance k_ESteamInputType_GenericGamepad: printf( "Generic Gamepad(DirectInput)!\north" ); interruption; example k_ESteamInputType_PS3Controller: case k_ESteamInputType_PS4Controller: instance k_ESteamInputType_PS5Controller: printf( "PlayStation controller!\n" ); break; } } else { // Device is non a controller through Steam Input - use your normal controller ID logic proceed; } } } gratuitous(devices); }

Setting the Steamworks Settings

The first pace is to setup which controllers volition use Steam Input in the Opt-in section on the Steamworks settings under Application->Steam Input. For a standard game west/ Xbox controller support we recommend checking all checkboxes other than Xbox:

steamworks_steam_input_optin_settings.png

If your game has flying stick or racing wheel support yous'll want to uncheck the box for Generic/DirectInput controllers considering Steam doesn't support remapping those devices.

Selecting a configuration

You tin can choose to create your own configuration or pick from one of our premade templates. It is non necessary to create your own configuration unless yous plan tweaking the configurations abroad from our defaults or labeling individual bindings with what they do in-game. The congenital-in templates for Steam Input are localized into all Steam's languages so please brand sure you also localize your configuration to avoid English being shown to non-English language users.

Picking a template

Console controllers do not differentiate between the various gamepad template variants, but these settings are important for the Steam Controller. Here'south an explanation of the templates and which type of games they are intended for:

  • Gamepad - This emulates an Xbox controller with the correct trackpad existence turned into a raw emulated joystick. Perfect for twin-stick, platformer, or sports games.
  • Gamepad With High Precision Photographic camera/Aim - This configuration is the ideal configuration for an FPS or any game using camera controls. Be careful to test that your game supports simultaneous gamepad/mouse before selecting this, including any coincident screens such as inventory or map screens.
  • Gamepad with Camera Controls - This configuration takes mouse-style input from the trackpad and translates it into flicks of an emulated joystick. If your game tin can be configured to have very high joystick sensitivity, no deadzone, and a linear acceleration curve this configuration tin piece of work well, otherwise please consider using a mouse/keyboard config instead.

steam_input_gamepad_templates.png

Steps for setting the template live for your game in Steamworks can be found here

Creating a custom configuration

Configurations tin be automobile-converted between most controller types, but yous'll at a minimum want to make a Steam Controller and Xbox controller configuration.

Note: if yous plan on taking reward of device specific features similar motility controls yous'll want to also take i for PlayStation four or Nintendo Switch controllers.

Text Input

On-screen text input is not technically office of the ISteamInput (Steam Input), simply is found instead in ISteamUtils. This is currently only implemented when the player launches the game through Big Picture Mode.

Some quick references:

  • ShowGamepadTextInput
  • GetEnteredGamepadTextLength
  • GetEnteredGamepadTextInput

Localizing your configuration
Making a localized configuration is a little fleck more complicated when not using Steam Input API but information technology is still achievable.

  • To showtime make sure you have not edited your configuration since the terminal time it was exported. Open the configurator and brand an edit (information technology is ok to make, then revert a alter).
  • Get to your Steam\Logs\controller_ui.txt log and look for a string similar this:

    Steam Controller Saving Controller Configuration Autosave for [CONTROLLER SERIAL NUMBER]- AppID: [YOUR APPID]. Loaded Config for Local Selection Path for App ID [YOUR APPID], Controller 0: F:\ProgramFiles\Steam\client\userdata\[STEAMID]\config\controller_configs\apps\[YOUR APPID]\[CONTROLLER Series]\guest\controller_configuration.vdf

  • Insert localization tokens for the bindings you want to localize
    • Title/Description:

      "controller_mappings" { "version" "3" "revision" "5" "title" "#title" "description" "#description" ...

    • Button bindings:

      "button_a" { "activators" { "Full_Press" { "bindings" { "binding" "xinput_button A, #abutton" } } } } ...

  • And then brand corresponding values for each language in the localization block:

    "localization" { "english language" { "title" "This is a localized title" "description" "This is a localized clarification. The button diamond binding also have localized names." "abutton" "Your name hither 1" "bbutton" "Your name hither ii" "xbutton" "Your name here 3" "ybutton" "Your name here 4" } ...

  • You can now export the configuration and ready information technology in the partner site with these instructions. You will desire to gear up the "use action cake" checkbox for ane your configurations.

The example configuration can be previewed in the steam customer by entering this URL in your browser: steam://controllerconfig/681280/1744110334 or you can find the VDF file hither

sawyerlaure1962.blogspot.com

Source: https://partner.steamgames.com/doc/features/steam_controller/steam_input_gamepad_emulation_bestpractices

Post a Comment for "Steam Mac Get Steam Controller Driver Prompt Again"