-
Notifications
You must be signed in to change notification settings - Fork 136
Description
I think currently there’s a "race" between the main thread being unblocked by the vblank interrupt (display_get() exiting with a new buffer) and the joypad module trying to poll the controllers in background. If the main thread reaches joypad_poll() before joypad manages to finish the handshake, the inputs will be one full frame late. This probably depends on the architecture of the main loop so varies from game to gam.
With the new VI module, we now have a nice API for line interrupts.
So in theory the best solution would be to estimate the duration of joypad polling (which depends on the number of plugged-in devices) and configure a line interrupt so that inputs are refreshed just in time for vblank to trigger. This should minimize the input latency as much as possible.