Sunshine master
Self-hosted game stream host for Moonlight.
inputtino_gamepad.cpp File Reference

Definitions for inputtino gamepad input handling. More...

#include <boost/locale.hpp>
#include <inputtino/input.hpp>
#include <libevdev/libevdev.h>
#include "inputtino_common.h"
#include "inputtino_gamepad.h"
#include "inputtino_seat.h"
#include "src/config.h"
#include "src/logging.h"
#include "src/platform/common.h"
#include "src/utility.h"
Include dependency graph for inputtino_gamepad.cpp:

Enumerations

enum  platf::gamepad::GamepadStatus { platf::gamepad::UHID_NOT_AVAILABLE = 0 , platf::gamepad::UINPUT_NOT_AVAILABLE , platf::gamepad::XINPUT_NOT_AVAILABLE , platf::gamepad::GAMEPAD_STATUS }
 Enumerates supported gamepad status options. More...
 

Functions

int platf::gamepad::alloc (input_raw_t *raw, const gamepad_id_t &id, const gamepad_arrival_t &metadata, feedback_queue_t feedback_queue)
 Allocate and initialize platform input state for a stream.
 
void platf::gamepad::battery (input_raw_t *raw, const gamepad_battery_t &battery)
 Apply controller battery status to the backend device.
 
auto platf::gamepad::create_ds5 (int globalIndex)
 Create an inputtino DualSense controller.
 
auto platf::gamepad::create_switch ()
 Create an inputtino Nintendo Switch Pro controller.
 
auto platf::gamepad::create_xbox_one ()
 Create xbox one.
 
void platf::gamepad::free (input_raw_t *raw, int nr)
 Release backend resources for the indexed gamepad.
 
void platf::gamepad::motion (input_raw_t *raw, const gamepad_motion_t &motion)
 Apply controller motion sensor data to the backend device.
 
std::vector< supported_gamepad_t > & platf::gamepad::supported_gamepads (input_t *input)
 Return the virtual gamepad types supported by inputtino.
 
void platf::gamepad::touch (input_raw_t *raw, const gamepad_touch_t &touch)
 Apply controller touchpad data to the backend device.
 
void platf::gamepad::update (input_raw_t *raw, int nr, const gamepad_state_t &gamepad_state)
 Apply the supplied state update to the platform backend.
 

Detailed Description

Definitions for inputtino gamepad input handling.

Enumeration Type Documentation

◆ GamepadStatus

Enumerates supported gamepad status options.

Enumerator
UHID_NOT_AVAILABLE 

UHID is not available.

UINPUT_NOT_AVAILABLE 

UINPUT is not available.

XINPUT_NOT_AVAILABLE 

XINPUT is not available.

GAMEPAD_STATUS 

Helper to indicate the number of status.

Function Documentation

◆ alloc()

int platf::gamepad::alloc ( input_raw_t * raw,
const gamepad_id_t & id,
const gamepad_arrival_t & metadata,
feedback_queue_t feedback_queue )

Allocate and initialize platform input state for a stream.

Parameters
rawPlatform-specific input backend state.
idIdentifier for the controller, session, display, or resource.
metadataOutput structure populated with HDR metadata.
feedback_queueFeedback queue.
Returns
Allocated object or identifier, or an error value on failure.

◆ battery()

void platf::gamepad::battery ( input_raw_t * raw,
const gamepad_battery_t & battery )

Apply controller battery status to the backend device.

Parameters
rawPlatform-specific input backend state.
batteryBattery status data reported by the virtual device.

◆ create_ds5()

auto platf::gamepad::create_ds5 ( int globalIndex)

Create an inputtino DualSense controller.

Parameters
globalIndexGlobal index.
Returns
Created DS5 object or status.

◆ create_switch()

auto platf::gamepad::create_switch ( )

Create an inputtino Nintendo Switch Pro controller.

Returns
Created switch object or status.

◆ create_xbox_one()

auto platf::gamepad::create_xbox_one ( )

Create xbox one.

Returns
Created xbox one object or status.

◆ free()

void platf::gamepad::free ( input_raw_t * raw,
int nr )

Release backend resources for the indexed gamepad.

Parameters
rawPlatform-specific input backend state.
nrController index assigned by the client.

◆ motion()

void platf::gamepad::motion ( input_raw_t * raw,
const gamepad_motion_t & motion )

Apply controller motion sensor data to the backend device.

Parameters
rawPlatform-specific input backend state.
motionMotion sensor data to apply to the virtual device.

◆ supported_gamepads()

std::vector< supported_gamepad_t > & platf::gamepad::supported_gamepads ( input_t * input)

Return the virtual gamepad types supported by inputtino.

Return gamepad slots supported by the inputtino backend.

Parameters
inputPlatform input backend that receives the event.
Returns
Mutable list of supported virtual gamepads for the input backend.

◆ touch()

void platf::gamepad::touch ( input_raw_t * raw,
const gamepad_touch_t & touch )

Apply controller touchpad data to the backend device.

Parameters
rawPlatform-specific input backend state.
touchTouch event data to apply to the virtual device.

◆ update()

void platf::gamepad::update ( input_raw_t * raw,
int nr,
const gamepad_state_t & gamepad_state )

Apply the supplied state update to the platform backend.

Parameters
rawPlatform-specific input backend state.
nrController index assigned by the client.
gamepad_stateGamepad state.