MDX: Updated Ring Buffer Backfill Implementation (P4IO Timing Fix) (#456)

## Link to GitHub Issue, if one exists
#452  

## Description of change
- Extension of #450 
- Moved the call to `arkGetTickTime64()` outside the update function to
bring the timestamps closer to real-time
- Changed the update function to only call `getState()` if called from
`rawinput`, otherwise just fill the ring buffer entries with the last
known state
- Changed the update function to only write one ring buffer entry if
called from `rawinput`
- Moved the call to `mdxf_poll()` within `rawinput.cpp` outside the loop
that iterates over all devices

## Testing
- Logging was done to verify the span of poll history covered by each
request for 7 ring buffer entries was ~28ms, as the game expects
- Observed some improvement in timing precision since the prior
implementation
This commit is contained in:
cchike
2025-12-17 02:45:22 -08:00
committed by GitHub
parent d0f3ffd12f
commit e618a05b08
2 changed files with 40 additions and 33 deletions
+3 -3
View File
@@ -1826,10 +1826,10 @@ LRESULT CALLBACK rawinput::RawInputManager::input_wnd_proc(
// free device
device.mutex->unlock();
// update controller state ring buffers (DDR/MDXF)
mdxf_poll();
}
// update controller state ring buffers (DDR/MDXF)
mdxf_poll();
// call the default window handler for cleanup
DefWindowProc(hWnd, msg, wparam, lParam);