Fix segfault when connecting multiple controllers at the same ttime

This commit is contained in:
loki 2021-09-13 20:24:04 +02:00
parent fbc3735f44
commit 91a6e55f74
3 changed files with 4 additions and 4 deletions

View File

@ -460,7 +460,7 @@ void passthrough(PNV_SCROLL_PACKET packet) {
platf::scroll(platf_input, util::endian::big(packet->scrollAmt1));
}
int updateGamepads(std::vector<gamepad_t> &gamepads, std::int16_t old_state, std::int16_t new_state, platf::rumble_queue_t rumble_queue) {
int updateGamepads(std::vector<gamepad_t> &gamepads, std::int16_t old_state, std::int16_t new_state, const platf::rumble_queue_t &rumble_queue) {
auto xorGamepadMask = old_state ^ new_state;
if(!xorGamepadMask) {
return 0;
@ -486,7 +486,7 @@ int updateGamepads(std::vector<gamepad_t> &gamepads, std::int16_t old_state, std
return -1;
}
if(platf::alloc_gamepad(platf_input, id, std::move(rumble_queue))) {
if(platf::alloc_gamepad(platf_input, id, rumble_queue)) {
free_id(gamepadMask, id);
// allocating a gamepad failed: solution: ignore gamepads
// The implementations of platf::alloc_gamepad already has logging

View File

@ -290,7 +290,7 @@ void scroll(input_t &input, int distance);
void keyboard(input_t &input, uint16_t modcode, bool release);
void gamepad(input_t &input, int nr, const gamepad_state_t &gamepad_state);
int alloc_gamepad(input_t &input, int nr, rumble_queue_t &&rumble_queue);
int alloc_gamepad(input_t &input, int nr, rumble_queue_t rumble_queue);
void free_gamepad(input_t &input, int nr);
#define SERVICE_NAME "Sunshine"

View File

@ -326,7 +326,7 @@ void keyboard(input_t &input, uint16_t modcode, bool release) {
send_input(i);
}
int alloc_gamepad(input_t &input, int nr, rumble_queue_t &&rumble_queue) {
int alloc_gamepad(input_t &input, int nr, rumble_queue_t rumble_queue) {
if(!input) {
return 0;
}