Wiimotes: Actually we have two constants MAX_WIIMOTES and MAX_WIIMOTE_IR_POINTS

This commit is contained in:
Barış Hamil 2026-02-14 20:00:28 +03:00
parent 02fb9b5cef
commit f9e8fd535f
3 changed files with 4 additions and 3 deletions

View file

@ -181,7 +181,7 @@ bool wiimote_device::update()
m_state.acc_z = (buf[5] << 2) | ((buf[2] >> 6) & 1);
// Each IR point is 3 bytes in Extended report 0x33.
for (usz j = 0; j < MAX_WIIMOTES; j++)
for (usz j = 0; j < MAX_WIIMOTE_IR_POINTS; j++)
{
const u8* ir = &buf[6 + j * 3];
m_state.ir[j].x = (ir[0] | ((ir[2] & 0x30) << 4));

View file

@ -13,6 +13,7 @@
#include <array>
static constexpr usz MAX_WIIMOTES = 4;
static constexpr usz MAX_WIIMOTE_IR_POINTS = 4;
struct wiimote_ir_point
{
@ -60,7 +61,7 @@ struct wiimote_state
s16 acc_x = 0;
s16 acc_y = 0;
s16 acc_z = 0;
std::array<wiimote_ir_point, MAX_WIIMOTES> ir {};
std::array<wiimote_ir_point, MAX_WIIMOTE_IR_POINTS> ir {};
bool connected = false;
};

View file

@ -183,7 +183,7 @@ void wiimote_settings_dialog::update_state()
painter.drawLine(pixmap.width() / 2, 0, pixmap.width() / 2, pixmap.height());
painter.drawLine(0, pixmap.height() / 2, pixmap.width(), pixmap.height() / 2);
static const std::array<QColor, MAX_WIIMOTES> colors = { Qt::red, Qt::green, Qt::blue, Qt::yellow };
static const std::array<QColor, MAX_WIIMOTE_IR_POINTS> colors = { Qt::red, Qt::green, Qt::blue, Qt::yellow };
for (usz i = 0; i < state.ir.size(); ++i)
{