source-sdk-2013 icon indicating copy to clipboard operation
source-sdk-2013 copied to clipboard

IsKeypad function logic is incorrect

Open Rainyan opened this issue 2 weeks ago • 0 comments

Currently, the IsKeypad function in inputsystem is implemented as:

https://github.com/ValveSoftware/source-sdk-2013/blob/2d3a6efb50bba856a44e73d4f0098ed4a726699c/src/public/inputsystem/ButtonCode.h#L311-L314

This code doesn't work, because the MOUSE_FIRST enum value checked for the lower bound is larger than the KEY_PAD_DECIMAL value that is checked for the upper bound. Therefore, this function currently returns false for all inputs.

This is probably a typo, and the lower bound should be checked against KEY_PAD_0 instead of MOUSE_FIRST:

return ( code >= KEY_PAD_0 ) && ( code <= KEY_PAD_DECIMAL );

Rainyan avatar Dec 15 '25 02:12 Rainyan