diff --git a/runtime/src/settings_overlay.cpp b/runtime/src/settings_overlay.cpp index e52926d21..2de7ac5d7 100644 --- a/runtime/src/settings_overlay.cpp +++ b/runtime/src/settings_overlay.cpp @@ -1482,6 +1482,18 @@ void DrawTopBar() { ImGui::EndMainMenuBar(); } +// Steam's desktop layout maps B to Escape on Valve controllers. +bool ValveControllerConnected() { + int count = 0; + SDL_JoystickID* ids = SDL_GetJoysticks(&count); + bool found = false; + for (int i = 0; ids != nullptr && i < count && !found; ++i) { + found = SDL_GetJoystickVendorForID(ids[i]) == 0x28DE && SDL_GetJoystickProductForID(ids[i]) != 0x11FF; + } + SDL_free(ids); + return found; +} + bool IsToggleKey(const SDL_Event& event, SDL_Scancode code) { return event.type == SDL_EVENT_KEY_DOWN && !event.key.repeat && event.key.scancode == code; } @@ -1603,7 +1615,7 @@ void HandleEvents(const AuroraEvent* events) noexcept { g_exitPromptOpen = false; } else if (g_topBarVisible) { SetTopBarVisible(false); - } else { + } else if (!ValveControllerConnected()) { g_exitPromptOpen = true; } ApplyInputBlockState();