mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-10 03:21:30 -10:00
The snapshot bridge copied each pad out of its joypad driver at the first read after a poll: the buttons, then each axis and hat a reader had asked for, a call into the driver for each. A driver whose state changes only in its own poll needs no copy: what it holds is the same until the next one. Such a driver now lends it. The pad's state - buttons, the first sixteen axes as the reads answer them, four hats' directions - is kept by the driver in one layout, input_pad_view_t, as its events and reports arrive, and a new view() hands the bridge a pointer to it once a poll; the readers read it in place. udev keeps it with each event; winraw keeps its pads in it outright, and lends them where its reports are read in the poll. Other drivers are copied as before, and the copy now walks only the axes and hats in it, not all twenty: under callgrind that halved what taking it costs. frontend_overhead's core-view lane runs its scenarios a third time with the pad lent, and must give the same digests while asking the driver for nothing but the view; joypad_bridge_checked holds udev's lent state to its reads, winraw_joypad_newest winraw's.