On Thu Apr 9 11:25:41 2026 +0000, Rémi Bernon wrote:
I'm not completely sure to understand why this is needed. I was imagining something simple when enumerating devices: 1) delete local cache 2) populate it again from the registry 3) enumerate cfgmgr devices and find them in the cache or add new entries (flagging them as new if needed) 4) save the local cache to the registry (possibly just the new entries as an optimisation but doesn't matter much) There may be some logic needed to keep track of the Calibration subkey names but I think that's mostly a matter of keeping the local cache sorted by vid/pid when adding entries. Regarding sorting, I'm also not sure how stable the EnumDevices order needs to be (ie: does it sort by vid/pid? First seen time? Last plug time?). We might need to sort again the cache with a different order after the refresh. We can do it the way you describe, but I guess my concern with that is why go through the second step if we're just going to end up potentially overwriting it all in step 4. Maybe that makes sense when joystick ID is taken into account, but I'm not sure I get the logic there.
`EnumDevices()` on native sorts by the first time a particular `DeviceInstance` was created, I'm guessing it uses the registry entry creation time in `HKLM\System\CurrentControlSet\Enum`. That sorting can be done on the local list, which was my plan to do later in a separate patch. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10364#note_135671