mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-11-30 17:18:42 +00:00
docs(doxygen): enforce warn if undocumented (#5337)
This commit is contained in:
1 parent
be7c1bcdfb
commit
a991a9622c
141 files changed
+11804
-1524
No files matched your search
+229
-33
@@ -30,33 +30,50 @@ extern "C" {
|
||||
|
||||
// Win32 WHEEL_DELTA constant
|
||||
#ifndef WHEEL_DELTA
|
||||
constexpr int WHEEL_DELTA = 120;
|
||||
constexpr int WHEEL_DELTA = 120; ///< Standard Windows wheel delta used to normalize scroll events.
|
||||
#endif
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
namespace input {
|
||||
|
||||
constexpr auto MAX_GAMEPADS = std::min((std::size_t) platf::MAX_GAMEPADS, sizeof(std::int16_t) * 8);
|
||||
constexpr auto MAX_GAMEPADS = std::min((std::size_t) platf::MAX_GAMEPADS, sizeof(std::int16_t) * 8); ///< Maximum gamepads representable by the active gamepad mask.
|
||||
/**
|
||||
* @def DISABLE_LEFT_BUTTON_DELAY
|
||||
* @brief Macro for DISABLE LEFT BUTTON DELAY.
|
||||
*/
|
||||
#define DISABLE_LEFT_BUTTON_DELAY ((thread_pool_util::ThreadPool::task_id_t) 0x01)
|
||||
/**
|
||||
* @def ENABLE_LEFT_BUTTON_DELAY
|
||||
* @brief Macro for ENABLE LEFT BUTTON DELAY.
|
||||
*/
|
||||
#define ENABLE_LEFT_BUTTON_DELAY nullptr
|
||||
|
||||
constexpr auto VKEY_SHIFT = 0x10;
|
||||
constexpr auto VKEY_LSHIFT = 0xA0;
|
||||
constexpr auto VKEY_RSHIFT = 0xA1;
|
||||
constexpr auto VKEY_CONTROL = 0x11;
|
||||
constexpr auto VKEY_LCONTROL = 0xA2;
|
||||
constexpr auto VKEY_RCONTROL = 0xA3;
|
||||
constexpr auto VKEY_MENU = 0x12;
|
||||
constexpr auto VKEY_LMENU = 0xA4;
|
||||
constexpr auto VKEY_RMENU = 0xA5;
|
||||
constexpr auto VKEY_SHIFT = 0x10; ///< Windows virtual-key code for shift.
|
||||
constexpr auto VKEY_LSHIFT = 0xA0; ///< Windows virtual-key code for lshift.
|
||||
constexpr auto VKEY_RSHIFT = 0xA1; ///< Windows virtual-key code for rshift.
|
||||
constexpr auto VKEY_CONTROL = 0x11; ///< Windows virtual-key code for control.
|
||||
constexpr auto VKEY_LCONTROL = 0xA2; ///< Windows virtual-key code for lcontrol.
|
||||
constexpr auto VKEY_RCONTROL = 0xA3; ///< Windows virtual-key code for rcontrol.
|
||||
constexpr auto VKEY_MENU = 0x12; ///< Windows virtual-key code for menu.
|
||||
constexpr auto VKEY_LMENU = 0xA4; ///< Windows virtual-key code for lmenu.
|
||||
constexpr auto VKEY_RMENU = 0xA5; ///< Windows virtual-key code for rmenu.
|
||||
|
||||
/**
|
||||
* @brief Enumerates supported button state options.
|
||||
*/
|
||||
enum class button_state_e {
|
||||
NONE, ///< No button state
|
||||
DOWN, ///< Button is down
|
||||
UP ///< Button is up
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Allocate an available input slot identifier.
|
||||
*
|
||||
* @param gamepad_mask Gamepad mask.
|
||||
* @return Allocated ID object, or null when unavailable.
|
||||
*/
|
||||
template<std::size_t N>
|
||||
int alloc_id(std::bitset<N> &gamepad_mask) {
|
||||
for (int x = 0; x < gamepad_mask.size(); ++x) {
|
||||
@@ -69,40 +86,68 @@ namespace input {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Release ID resources.
|
||||
*
|
||||
* @param gamepad_mask Gamepad mask.
|
||||
* @param id Identifier for the controller, session, display, or resource.
|
||||
*/
|
||||
template<std::size_t N>
|
||||
void free_id(std::bitset<N> &gamepad_mask, int id) {
|
||||
gamepad_mask[id] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Packed identifier for a pressed key and its modifier flags.
|
||||
*/
|
||||
typedef uint32_t key_press_id_t;
|
||||
|
||||
/**
|
||||
* @brief Create a key-press identifier from the virtual-key code and flags.
|
||||
*
|
||||
* @param vk Virtual-key code from the client input packet.
|
||||
* @param flags Bit flags that modify the requested operation.
|
||||
* @return Constructed kpid object.
|
||||
*/
|
||||
key_press_id_t make_kpid(uint16_t vk, uint8_t flags) {
|
||||
return (key_press_id_t) vk << 8 | flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Extract the virtual-key code from a packed key-press identifier.
|
||||
*
|
||||
* @param kpid Key-press identifier containing the virtual-key code and flags.
|
||||
* @return Virtual-key code stored in the high byte.
|
||||
*/
|
||||
uint16_t vk_from_kpid(key_press_id_t kpid) {
|
||||
return kpid >> 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Extract the modifier flags from a packed key-press identifier.
|
||||
*
|
||||
* @param kpid Key-press identifier containing the virtual-key code and flags.
|
||||
* @return Modifier flags stored in the low byte.
|
||||
*/
|
||||
uint8_t flags_from_kpid(key_press_id_t kpid) {
|
||||
return kpid & 0xFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert a little-endian netfloat to a native endianness float.
|
||||
* @param f Netfloat value.
|
||||
* @return The native endianness float value.
|
||||
* @param f Little-endian network float bytes.
|
||||
* @return Floating-point value decoded for the host CPU.
|
||||
*/
|
||||
float from_netfloat(netfloat f) {
|
||||
return boost::endian::endian_load<float, sizeof(float), boost::endian::order::little>(f);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert a little-endian netfloat to a native endianness float and clamps it.
|
||||
* @param f Netfloat value.
|
||||
* @brief Convert a little-endian netfloat to a native float and clamp it to a range.
|
||||
* @param f Little-endian network float bytes.
|
||||
* @param min The minimium value for clamping.
|
||||
* @param max The maximum value for clamping.
|
||||
* @return Clamped native endianess float value.
|
||||
* @return Decoded floating-point value clamped between min and max.
|
||||
*/
|
||||
float from_clamped_netfloat(netfloat f, float min, float max) {
|
||||
return std::clamp(from_netfloat(f), min, max);
|
||||
@@ -115,6 +160,12 @@ namespace input {
|
||||
static platf::input_t platf_input;
|
||||
static std::bitset<platf::MAX_GAMEPADS> gamepadMask {};
|
||||
|
||||
/**
|
||||
* @brief Release all platform resources associated with a virtual gamepad.
|
||||
*
|
||||
* @param platf_input Platf input.
|
||||
* @param id Identifier for the controller, session, display, or resource.
|
||||
*/
|
||||
void free_gamepad(platf::input_t &platf_input, int id) {
|
||||
platf::gamepad_update(platf_input, id, platf::gamepad_state_t {});
|
||||
platf::free_gamepad(platf_input, id);
|
||||
@@ -122,6 +173,9 @@ namespace input {
|
||||
free_id(gamepadMask, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Per-client gamepad slot and feedback state.
|
||||
*/
|
||||
struct gamepad_t {
|
||||
gamepad_t():
|
||||
gamepad_state {},
|
||||
@@ -138,21 +192,27 @@ namespace input {
|
||||
}
|
||||
}
|
||||
|
||||
platf::gamepad_state_t gamepad_state;
|
||||
platf::gamepad_state_t gamepad_state; ///< Gamepad state.
|
||||
|
||||
thread_pool_util::ThreadPool::task_id_t back_timeout_id;
|
||||
thread_pool_util::ThreadPool::task_id_t back_timeout_id; ///< Back timeout ID.
|
||||
|
||||
int id;
|
||||
int id; ///< Global gamepad slot assigned to this client controller.
|
||||
|
||||
// When emulating the HOME button, we may need to artificially release the back button.
|
||||
// Afterwards, the gamepad state on sunshine won't match the state on Moonlight.
|
||||
// To prevent Sunshine from sending erroneous input data to the active application,
|
||||
// Sunshine forces the button to be in a specific state until the gamepad state matches that of
|
||||
// Moonlight once more.
|
||||
button_state_e back_button_state;
|
||||
button_state_e back_button_state; ///< Back button state.
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Input emulation settings loaded from configuration.
|
||||
*/
|
||||
struct input_t {
|
||||
/**
|
||||
* @brief Enumerates supported shortkey options.
|
||||
*/
|
||||
enum shortkey_e {
|
||||
CTRL = 0x1, ///< Control key
|
||||
ALT = 0x2, ///< Alt key
|
||||
@@ -160,6 +220,12 @@ namespace input {
|
||||
SHORTCUT = CTRL | ALT | SHIFT ///< Shortcut combination
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Construct input state from the mailbox and platform backend.
|
||||
*
|
||||
* @param touch_port_event Event carrying the active touch port.
|
||||
* @param feedback_queue Queue used for controller feedback.
|
||||
*/
|
||||
input_t(
|
||||
safe::mail_raw_t::event_t<input::touch_port_t> touch_port_event,
|
||||
platf::feedback_queue_t feedback_queue
|
||||
@@ -176,26 +242,26 @@ namespace input {
|
||||
}
|
||||
|
||||
// Keep track of alt+ctrl+shift key combo
|
||||
int shortcutFlags;
|
||||
int shortcutFlags; ///< Shortcut flags.
|
||||
|
||||
bool left_alt_pressed = false;
|
||||
bool right_alt_pressed = false;
|
||||
bool left_alt_pressed = false; ///< Tracks whether the left Alt key is currently pressed.
|
||||
bool right_alt_pressed = false; ///< Tracks whether the right Alt key is currently pressed.
|
||||
|
||||
std::vector<gamepad_t> gamepads;
|
||||
std::unique_ptr<platf::client_input_t> client_context;
|
||||
std::vector<gamepad_t> gamepads; ///< Virtual gamepad slots tracked for the stream.
|
||||
std::unique_ptr<platf::client_input_t> client_context; ///< Client context.
|
||||
|
||||
safe::mail_raw_t::event_t<input::touch_port_t> touch_port_event;
|
||||
platf::feedback_queue_t feedback_queue;
|
||||
safe::mail_raw_t::event_t<input::touch_port_t> touch_port_event; ///< Touch port event.
|
||||
platf::feedback_queue_t feedback_queue; ///< Queue used to deliver controller feedback to the platform backend.
|
||||
|
||||
std::list<std::vector<uint8_t>> input_queue;
|
||||
std::mutex input_queue_lock;
|
||||
std::list<std::vector<uint8_t>> input_queue; ///< Pending raw input packets waiting for processing.
|
||||
std::mutex input_queue_lock; ///< Input queue lock.
|
||||
|
||||
thread_pool_util::ThreadPool::task_id_t mouse_left_button_timeout;
|
||||
thread_pool_util::ThreadPool::task_id_t mouse_left_button_timeout; ///< Mouse left button timeout.
|
||||
|
||||
input::touch_port_t touch_port;
|
||||
input::touch_port_t touch_port; ///< Touch coordinate bounds for the current stream.
|
||||
|
||||
int32_t accumulated_vscroll_delta;
|
||||
int32_t accumulated_hscroll_delta;
|
||||
int32_t accumulated_vscroll_delta; ///< Accumulated vscroll delta.
|
||||
int32_t accumulated_hscroll_delta; ///< Accumulated hscroll delta.
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -223,6 +289,11 @@ namespace input {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write a debug log representation of the input packet.
|
||||
*
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void print(PNV_REL_MOUSE_MOVE_PACKET packet) {
|
||||
BOOST_LOG(debug)
|
||||
<< "--begin relative mouse move packet--"sv << std::endl
|
||||
@@ -231,6 +302,11 @@ namespace input {
|
||||
<< "--end relative mouse move packet--"sv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write a debug log representation of the input packet.
|
||||
*
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void print(PNV_ABS_MOUSE_MOVE_PACKET packet) {
|
||||
BOOST_LOG(debug)
|
||||
<< "--begin absolute mouse move packet--"sv << std::endl
|
||||
@@ -241,6 +317,11 @@ namespace input {
|
||||
<< "--end absolute mouse move packet--"sv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write a debug log representation of the input packet.
|
||||
*
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void print(PNV_MOUSE_BUTTON_PACKET packet) {
|
||||
BOOST_LOG(debug)
|
||||
<< "--begin mouse button packet--"sv << std::endl
|
||||
@@ -249,6 +330,11 @@ namespace input {
|
||||
<< "--end mouse button packet--"sv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write a debug log representation of the input packet.
|
||||
*
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void print(PNV_SCROLL_PACKET packet) {
|
||||
BOOST_LOG(debug)
|
||||
<< "--begin mouse scroll packet--"sv << std::endl
|
||||
@@ -256,6 +342,11 @@ namespace input {
|
||||
<< "--end mouse scroll packet--"sv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write a debug log representation of the input packet.
|
||||
*
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void print(PSS_HSCROLL_PACKET packet) {
|
||||
BOOST_LOG(debug)
|
||||
<< "--begin mouse hscroll packet--"sv << std::endl
|
||||
@@ -263,6 +354,11 @@ namespace input {
|
||||
<< "--end mouse hscroll packet--"sv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write a debug log representation of the input packet.
|
||||
*
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void print(PNV_KEYBOARD_PACKET packet) {
|
||||
BOOST_LOG(debug)
|
||||
<< "--begin keyboard packet--"sv << std::endl
|
||||
@@ -273,6 +369,11 @@ namespace input {
|
||||
<< "--end keyboard packet--"sv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write a debug log representation of the input packet.
|
||||
*
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void print(PNV_UNICODE_PACKET packet) {
|
||||
std::string text(packet->text, util::endian::big(packet->header.size) - sizeof(packet->header.magic));
|
||||
BOOST_LOG(debug)
|
||||
@@ -281,6 +382,11 @@ namespace input {
|
||||
<< "--end unicode packet--"sv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write a debug log representation of the input packet.
|
||||
*
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void print(PNV_MULTI_CONTROLLER_PACKET packet) {
|
||||
// Moonlight spams controller packet even when not necessary
|
||||
BOOST_LOG(verbose)
|
||||
@@ -393,6 +499,9 @@ namespace input {
|
||||
<< "--end controller battery packet--"sv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write a debug log representation of the input packet.
|
||||
*/
|
||||
void print(void *payload) {
|
||||
auto header = (PNV_INPUT_HEADER) payload;
|
||||
|
||||
@@ -444,6 +553,12 @@ namespace input {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Forward a client input packet directly to the platform backend.
|
||||
*
|
||||
* @param input Platform input backend that receives the event.
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void passthrough(std::shared_ptr<input_t> &input, PNV_REL_MOUSE_MOVE_PACKET packet) {
|
||||
if (!config::input.mouse) {
|
||||
return;
|
||||
@@ -541,6 +656,12 @@ namespace input {
|
||||
return {multiply_polar_by_cartesian_scalar(major, angle, scalar), multiply_polar_by_cartesian_scalar(minor, angle + (M_PI / 2), scalar)};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Forward a client input packet directly to the platform backend.
|
||||
*
|
||||
* @param input Platform input backend that receives the event.
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void passthrough(std::shared_ptr<input_t> &input, PNV_ABS_MOUSE_MOVE_PACKET packet) {
|
||||
if (!config::input.mouse) {
|
||||
return;
|
||||
@@ -591,6 +712,12 @@ namespace input {
|
||||
platf::abs_mouse(platf_input, abs_port, tpcoords->first, tpcoords->second);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Called to pass a mouse button message to the platform backend.
|
||||
*
|
||||
* @param input The input context pointer.
|
||||
* @param packet The mouse button packet.
|
||||
*/
|
||||
void passthrough(std::shared_ptr<input_t> &input, PNV_MOUSE_BUTTON_PACKET packet) {
|
||||
if (!config::input.mouse) {
|
||||
return;
|
||||
@@ -652,6 +779,12 @@ namespace input {
|
||||
platf::button_mouse(platf_input, button, release);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Apply configured keybinding remaps to a platform keycode.
|
||||
*
|
||||
* @param keycode Platform keycode being translated or emitted.
|
||||
* @return Remapped keycode when configured, otherwise the original keycode.
|
||||
*/
|
||||
short map_keycode(short keycode) {
|
||||
auto it = config::input.keybindings.find(keycode);
|
||||
if (it != std::end(config::input.keybindings)) {
|
||||
@@ -663,6 +796,10 @@ namespace input {
|
||||
|
||||
/**
|
||||
* @brief Update flags for keyboard shortcut combo's
|
||||
*
|
||||
* @param flags Bit flags that modify the requested operation.
|
||||
* @param keyCode Moonlight keyboard packet key code.
|
||||
* @param release Whether the key or button event is a release.
|
||||
*/
|
||||
inline void update_shortcutFlags(int *flags, short keyCode, bool release) {
|
||||
switch (keyCode) {
|
||||
@@ -696,6 +833,12 @@ namespace input {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check whether modifier.
|
||||
*
|
||||
* @param keyCode Moonlight keyboard packet key code.
|
||||
* @return True when the key code is a keyboard modifier.
|
||||
*/
|
||||
bool is_modifier(uint16_t keyCode) {
|
||||
switch (keyCode) {
|
||||
case VKEY_SHIFT:
|
||||
@@ -713,6 +856,14 @@ namespace input {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send key and modifiers.
|
||||
*
|
||||
* @param key_code Moonlight keyboard packet key code.
|
||||
* @param release Whether the key or button event is a release.
|
||||
* @param flags Bit flags that modify the requested operation.
|
||||
* @param synthetic_modifiers Synthetic modifiers.
|
||||
*/
|
||||
void send_key_and_modifiers(uint16_t key_code, bool release, uint8_t flags, uint8_t synthetic_modifiers) {
|
||||
if (!release) {
|
||||
// Press any synthetic modifiers required for this key
|
||||
@@ -743,6 +894,13 @@ namespace input {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Re-emit a held key until its repeat task is cancelled.
|
||||
*
|
||||
* @param key_code Moonlight keyboard packet key code.
|
||||
* @param flags Bit flags that modify the requested operation.
|
||||
* @param synthetic_modifiers Synthetic modifiers.
|
||||
*/
|
||||
void repeat_key(uint16_t key_code, uint8_t flags, uint8_t synthetic_modifiers) {
|
||||
// If key no longer pressed, stop repeating
|
||||
if (!key_press[make_kpid(key_code, flags)]) {
|
||||
@@ -755,6 +913,12 @@ namespace input {
|
||||
key_press_repeat_id = task_pool.pushDelayed(repeat_key, config::input.key_repeat_period, key_code, flags, synthetic_modifiers).task_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Forward a client input packet directly to the platform backend.
|
||||
*
|
||||
* @param input Platform input backend that receives the event.
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void passthrough(std::shared_ptr<input_t> &input, PNV_KEYBOARD_PACKET packet) {
|
||||
if (!config::input.keyboard) {
|
||||
return;
|
||||
@@ -869,6 +1033,11 @@ namespace input {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Forward a client input packet directly to the platform backend.
|
||||
*
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void passthrough(PNV_UNICODE_PACKET packet) {
|
||||
if (!config::input.keyboard) {
|
||||
return;
|
||||
@@ -1142,6 +1311,12 @@ namespace input {
|
||||
platf::gamepad_battery(platf_input, battery);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Forward a client input packet directly to the platform backend.
|
||||
*
|
||||
* @param input Platform input backend that receives the event.
|
||||
* @param packet Protocol packet being processed.
|
||||
*/
|
||||
void passthrough(std::shared_ptr<input_t> &input, PNV_MULTI_CONTROLLER_PACKET packet) {
|
||||
if (!config::input.controller) {
|
||||
return;
|
||||
@@ -1257,6 +1432,9 @@ namespace input {
|
||||
gamepad.gamepad_state = gamepad_state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enumerates supported batch result options.
|
||||
*/
|
||||
enum class batch_result_e {
|
||||
batched, ///< This entry was batched with the source entry
|
||||
not_batchable, ///< Not eligible to batch but continue attempts to batch
|
||||
@@ -1649,6 +1827,9 @@ namespace input {
|
||||
task_pool.push(passthrough_next_message, input);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset the object to its initial empty state.
|
||||
*/
|
||||
void reset(std::shared_ptr<input_t> &input) {
|
||||
task_pool.cancel(key_press_repeat_id);
|
||||
task_pool.cancel(input->mouse_left_button_timeout);
|
||||
@@ -1673,19 +1854,31 @@ namespace input {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief RAII helper that runs shutdown cleanup when destroyed.
|
||||
*/
|
||||
class deinit_t: public platf::deinit_t {
|
||||
public:
|
||||
/**
|
||||
* @brief Destroy the input subsystem deinitializer.
|
||||
*/
|
||||
~deinit_t() override {
|
||||
platf_input.reset();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Initialize the platform input backend.
|
||||
*/
|
||||
[[nodiscard]] std::unique_ptr<platf::deinit_t> init() {
|
||||
platf_input = platf::input();
|
||||
|
||||
return std::make_unique<deinit_t>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Probe connected gamepads and update input capability state.
|
||||
*/
|
||||
bool probe_gamepads() {
|
||||
auto input = static_cast<platf::input_t *>(platf_input.get());
|
||||
const auto gamepads = platf::supported_gamepads(input);
|
||||
@@ -1697,6 +1890,9 @@ namespace input {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Allocate and initialize platform input state for a stream.
|
||||
*/
|
||||
std::shared_ptr<input_t> alloc(safe::mail_t mail) {
|
||||
auto input = std::make_shared<input_t>(
|
||||
mail->event<input::touch_port_t>(mail::touch_port),
|
||||
|
||||
Reference in new issue
Block a user