Fix segfault when connecting multiple controllers at the same ttime
This commit is contained in:
+2
-2
@@ -460,7 +460,7 @@ void passthrough(PNV_SCROLL_PACKET packet) {
|
|||||||
platf::scroll(platf_input, util::endian::big(packet->scrollAmt1));
|
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;
|
auto xorGamepadMask = old_state ^ new_state;
|
||||||
if(!xorGamepadMask) {
|
if(!xorGamepadMask) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -486,7 +486,7 @@ int updateGamepads(std::vector<gamepad_t> &gamepads, std::int16_t old_state, std
|
|||||||
return -1;
|
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);
|
free_id(gamepadMask, id);
|
||||||
// allocating a gamepad failed: solution: ignore gamepads
|
// allocating a gamepad failed: solution: ignore gamepads
|
||||||
// The implementations of platf::alloc_gamepad already has logging
|
// The implementations of platf::alloc_gamepad already has logging
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ void scroll(input_t &input, int distance);
|
|||||||
void keyboard(input_t &input, uint16_t modcode, bool release);
|
void keyboard(input_t &input, uint16_t modcode, bool release);
|
||||||
void gamepad(input_t &input, int nr, const gamepad_state_t &gamepad_state);
|
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);
|
void free_gamepad(input_t &input, int nr);
|
||||||
|
|
||||||
#define SERVICE_NAME "Sunshine"
|
#define SERVICE_NAME "Sunshine"
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ void keyboard(input_t &input, uint16_t modcode, bool release) {
|
|||||||
send_input(i);
|
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) {
|
if(!input) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user