Crash when starting Steam Remote Play Together session on Windows
If you host a Steam Remote Play Together session on Windows, as soon as a friend joins gilrs crashes on an unwrapped Windows API call
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: HRESULT(0x80004001), message: "Not implemented" }', /Users/caylebray/.cargo/registry/src/github.com-1ecc6299db9ec823/gilrs-core-0.5.2/src/platform/windows_wgi/gamepad.rs:463:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/caylebray/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:273:45
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: HRESULT(0x80004001), message: "Not implemented" }', /Users/caylebray/.cargo/registry/src/github.com-1ecc6299db9ec823/gilrs-core-0.5.2/src/platform/windows_wgi/gamepad.rs:152:66
The line it is pointing to is
let id: HSTRING = controller.NonRoamableId().unwrap();
I was the one that wrote this, at the time, I figured if calling one of these errored it would likely only happen on a broken Windows install since the Windows API doesn't show a reason these calls would fail. Since it is in the background thread and harder to return these errors as results I didn't think the effort would be worth it to remove those unwraps. Now that I'm aware that Steam commonly injects and messes with DLLs like they do, I would like to take a stab at removing unwraps like these and make this code more resilient.
I'm thinking that for controller specific errors I will log an error once and ignore that controller, perhaps trying again a couple times after a timeout in case it only happens during the initial DLL injection. For non-controller specific errors, perhaps log a warning, reset the state of the background thread and sleep for a bit before retrying, with a max tries before logging an error.
Opening this issue to make users aware of this if they run into similar errors and to get early feedback if anyone has thoughts on how this should be addressed (I think it should be mostly straight forward though).