cellPad: fix out of bounds warning

This commit is contained in:
Megamouse 2019-09-20 09:44:32 +02:00
parent 8a63ac033e
commit 571bb914f5

View File

@ -301,7 +301,7 @@ error_code cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
{ {
// report back new data every ~10 ms even if the input doesn't change // report back new data every ~10 ms even if the input doesn't change
// this is observed behaviour when using a Dualshock 3 controller // this is observed behaviour when using a Dualshock 3 controller
static std::chrono::time_point<steady_clock> last_update[CELL_PAD_MAX_PORT_NUM] = { }; static std::array<std::chrono::time_point<steady_clock>, CELL_PAD_MAX_PORT_NUM> last_update = { };
const std::chrono::time_point<steady_clock> now = steady_clock::now(); const std::chrono::time_point<steady_clock> now = steady_clock::now();
if (btnChanged || pad->m_buffer_cleared || (std::chrono::duration_cast<std::chrono::milliseconds>(now - last_update[port_no]).count() >= 10)) if (btnChanged || pad->m_buffer_cleared || (std::chrono::duration_cast<std::chrono::milliseconds>(now - last_update[port_no]).count() >= 10))