On Thu Dec 18 08:39:06 2025 +0000, Tomasz Pakuła wrote:
Axes can have unsigned values and this doesn't take this into consideration. ```suggestion:-5+0 static BYTE hid_device_determine_axis_size(LONG min, ULONG max) { if (min >= -128 && max <= 255) return 8; if (min >= -32768 && max <= 65535) return 16; return 32; } ``` I originally wrote the predicate as `(min >= -128 && max <= 127) || (min >= 0 && max <= 255)` .
But I wasn't sure about how the signed and unsigned integer conversions would be handled between the C language, Wine, SDL, evdev, and games, so I've let the next biggest size cover them. It would use a smaller size if the range is -32768-32767, and it would behave the same as before if the range is 0-65535. It's not perfect, but it's better than before in some cases without potentially breaking something:stuck_out_tongue_winking_eye:. SDL always provides signed 16-bit range (-32768, 32767) axes, `struct input_value` in `evdev` has a `__s32 value` field, and the HID spec says, "Otherwise, all integer values are signed values represented in 2’s complement format," so I assumed they're normally signed values. But I'm not sure how to interpret "If Logical Minimum and Logical Maximum are both positive values then a sign bit is unnecessary in the report field and the contents of a field can be assumed to be an unsigned value." in the HID spec. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9789#note_125781