From 1cdb7be810f97be4192c4076bd6362cd189ae53e Mon Sep 17 00:00:00 2001 From: bicarus <202771338+bicarus-dev@users.noreply.github.com> Date: Sun, 23 Aug 2026 00:34:08 -0700 Subject: [PATCH] overlay: fix hotkey init race (#888) ## Link to GitHub Issue or related Pull Request, if one exists Regressed by #864 ## Description of change The hotkey sampler thread starts touching `games::io` the moment `enable_raw_input()` is called, and that call sat right after `RI_MGR` was constructed, a few lines before the main thread's own first `games::io` calls. Both threads then hit the unsynchronized lazy `initialize()` at once, crashing at startup with an access violation in `memcmp`. Moved the call down next to `enable_input()`, after the bindings are built. ## Testing --- src/spice2x/launcher/launcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spice2x/launcher/launcher.cpp b/src/spice2x/launcher/launcher.cpp index b7f5b58..47339ac 100644 --- a/src/spice2x/launcher/launcher.cpp +++ b/src/spice2x/launcher/launcher.cpp @@ -2483,7 +2483,6 @@ int main_implementation(int argc, char *argv[]) { // initialize raw input RI_MGR = std::make_unique(); - hotkeys::enable_raw_input(); for (const auto &device : sextet_devices) { RI_MGR->sextet_register(device); } @@ -2507,6 +2506,7 @@ int main_implementation(int argc, char *argv[]) { dump_analog_bindings(); // mappings are ready; begin screenshot and coin polling during late startup + hotkeys::enable_raw_input(); hotkeys::enable_input(); // for certain games, show cursor if no touch is available (must be called after RI_MGR is available)