0

I'm using winapi SendInput with scancodes to simulate keyboard input to a game, and at the same time I want to measure the timing of the input being received, but unfortunately I've no access to that data from the game itself.

I know it uses listens to raw input, using the RegisterRawInputDevices, so I've my program take two measurements, timing right before calling sendinput and listing to the rawinput itself, the timing that my program received the input sent by RegisterRawInputDevices, by subtracting the two, I can have a rough estimation of the latency of the input stack.

Is my assumption correct, and the time at which I received the raw input, will probably be a better approximation to the time the game received it, that the time at which I called sendInput, and is there a better way of measuring that?

4
  • What's the specific problem you are trying to solve? Commented Oct 8, 2022 at 8:53
  • SendInput() is incapable of generating raw input, so safe to assume the latency is infinite. Commented Oct 8, 2022 at 12:58
  • @HansPassant SendInput() posts its events into the same input queue that hardware devices post their events to. Thus, the Raw Input API can pick up SendInput() events. Commented Oct 8, 2022 at 15:48
  • @HansPassant exactly what Remy Lebeau said, and I'm using scan codes in case that makes a difference Commented Oct 12, 2022 at 18:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.