mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-01-01 03:18:32 +00:00
Merge pull request #87 from HomerSp/fix-rumble-hang
Fix rumble events causing game to freeze
This commit is contained in:
commit
e223ba53f9
@ -696,13 +696,13 @@ public:
|
||||
};
|
||||
|
||||
inline void rumbleIterate(std::vector<effect_t> &effects, std::vector<pollfd_t> &polls, std::chrono::milliseconds to) {
|
||||
std::vector<pollfd> polls_tmp;
|
||||
polls_tmp.reserve(polls.size());
|
||||
std::vector<pollfd> polls_recv;
|
||||
polls_recv.reserve(polls.size());
|
||||
for(auto &poll : polls) {
|
||||
polls_tmp.emplace_back(poll.el);
|
||||
polls_recv.emplace_back(poll.el);
|
||||
}
|
||||
|
||||
auto res = poll(polls_tmp.data(), polls.size(), to.count());
|
||||
auto res = poll(polls_recv.data(), polls_recv.size(), to.count());
|
||||
|
||||
// If timed out
|
||||
if(!res) {
|
||||
@ -725,16 +725,17 @@ inline void rumbleIterate(std::vector<effect_t> &effects, std::vector<pollfd_t>
|
||||
// TUPLE_2D_REF(dev, q, *dev_q_it);
|
||||
|
||||
// on error
|
||||
if((*poll)->revents & (POLLHUP | POLLRDHUP | POLLERR)) {
|
||||
if(polls_recv[x].revents & (POLLHUP | POLLRDHUP | POLLERR)) {
|
||||
BOOST_LOG(warning) << "Gamepad ["sv << x << "] file discriptor closed unexpectedly"sv;
|
||||
|
||||
polls.erase(poll);
|
||||
effects.erase(effect_it);
|
||||
|
||||
--x;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!((*poll)->revents & POLLIN)) {
|
||||
if(!(polls_recv[x].revents & POLLIN)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -751,6 +752,7 @@ inline void rumbleIterate(std::vector<effect_t> &effects, std::vector<pollfd_t>
|
||||
polls.erase(poll);
|
||||
effects.erase(effect_it);
|
||||
|
||||
--x;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user