mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-11-27 00:05:11 +00:00
Avoid potential overflow in gamepad sensor report rate period
This commit is contained in:
1 parent
136610d5fd
commit
dab3e23cc4
2 files changed
+3
-3
No files matched your search
@@ -931,7 +931,7 @@ void SdlInputHandler::setMotionEventState(uint16_t controllerNumber, uint8_t mot
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 14)
|
||||
if (m_GamepadState[controllerNumber].controller != nullptr) {
|
||||
uint8_t reportPeriodMs = reportRateHz ? (1000 / reportRateHz) : 0;
|
||||
uint32_t reportPeriodMs = reportRateHz ? SDL_max(1000U / reportRateHz, 1U) : 0;
|
||||
|
||||
switch (motionType) {
|
||||
case LI_MOTION_TYPE_ACCEL:
|
||||
|
||||
@@ -23,11 +23,11 @@ struct GamepadState {
|
||||
bool emulatedClickpadButtonDown;
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 14)
|
||||
uint8_t gyroReportPeriodMs;
|
||||
uint16_t gyroReportPeriodMs;
|
||||
float lastGyroEventData[SDL_arraysize(SDL_ControllerSensorEvent::data)];
|
||||
uint32_t lastGyroEventTime;
|
||||
|
||||
uint8_t accelReportPeriodMs;
|
||||
uint16_t accelReportPeriodMs;
|
||||
float lastAccelEventData[SDL_arraysize(SDL_ControllerSensorEvent::data)];
|
||||
uint32_t lastAccelEventTime;
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user