Trouble with keyboard ghosting / keyboard rollover

Hi, I'm doing Handmade Hero in Rust, and I've got a mostly working day 44 version going. The one problem at the moment is keyboard input.

If you mash enough buttons while holding a direction and then release the keys in a random order, the key state as viewed by the virtual controllers and the key state of the actual keyboard seems to get out of wack. The hero ends up stuck walking in some direction. I think this has to do with the key rollover limitations of USB keyboards, and Casey just didn't hit this bug on stream because he's said he has some form of mechanical keyboard (which almost always has n-key rollover).

Is this a normal issue to have on day 44 or have I missed some detail somewhere?

Code Link (the Rust is as close as possible to the C++, non-rust folks should be able to read it):
https://github.com/Lokathor/handmade-rust
(the repo is private but anyone in the handmade hero github organization should be able to see it, I think)

Edited by Lokathor on Reason: Initial post
Got around to fixing this. I'll give the explanation in case anyone else hits this some day.

In some circumstances Windows will occasionally send messages that keys are being lifted that it hadn't previously reported as being held down. Not sure if this is really a keyboard ghosting issue or what, but it happens.

In `Win32ProcessPendingMessages` I just changed the if statement that guards when to process a message and made it a little more permissive:

1
if WasDown != IsDown || (WasDown == false && IsDown == false) {


The `HalfTransitionCount` could maybe become messed up by this, but the game doesn't actually use it anyway.