Multi controller support for Linux

This commit is contained in:
loki
2020-01-25 01:05:43 +01:00
parent 88281e6612
commit b4d3748d74
4 changed files with 109 additions and 69 deletions

View File

@@ -14,23 +14,30 @@ enum class button_state_e {
DOWN,
UP
};
struct input_t {
input_t();
struct gamepad_t {
gamepad_t();
platf::gamepad_state_t gamepad_state;
std::unordered_map<short, bool> key_press;
std::array<std::uint8_t, 5> mouse_press;
util::ThreadPool::task_id_t back_timeout_id;
platf::input_t input;
// 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 erronious 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::NONE };
button_state_e back_button_state;
};
struct input_t {
input_t();
std::unordered_map<short, bool> key_press;
std::array<std::uint8_t, 5> mouse_press;
platf::input_t input;
std::vector<gamepad_t> gamepads;
};
void print(void *input);