Skip to content

Add native macOS gamepad support with DualSense controls - #1047

Closed
coolzi wants to merge 2 commits into
Try:masterfrom
coolzi:codex/macos-dualsense-support
Closed

coolzi wants to merge 2 commits into
Try:masterfrom
coolzi:codex/macos-dualsense-support

Conversation

@coolzi

@coolzi coolzi commented Oct 25, 2026 •

Copy link
Copy Markdown

Summary

Add controller-driven gameplay and UI on macOS through Tempest's native GameController backend. A DualSense can drive the menus, original Gothic movement, camera, combat, inventory/trade, and save/load while keyboard and mouse remain usable.

  • Route input by screen context, preserve independent source ownership and shared-button deduplication, and cancel/rearm held input across focus, disconnect, loading, and screen changes.
  • Support melee/block/side attacks, ranged weapons, assigned-spell cycling, sneak, swimming, ladders, and lockpicking while preserving G1-style keyboard combinations and the original movement model.
  • Add fixed UI navigation, quantity and spell-slot dialogs, remappable gameplay buttons, dead zones/sensitivity/inversion, hints, and an English/Russian save-name keyboard with explicit confirm/cancel.
  • Preserve upstream safe-area layouts and separate equipped-item slots. Keep controller dialogs, keyboard cells, quantity overlays, and hints inside the visible client area across inset changes and window shrink; retain bounded inventory scrolling on tiny viewports.
  • Fix issues exposed by the integration: an InstanceStorage lost wakeup, long C-string formatting, nested-dialog redraw/save-row routing, and scoped Cyrillic save-name glyph fallback.
  • Add opt-in diagnostic/regression targets through OPENGOTHIC_GAMEPAD_TOOLS (default OFF), reusing vendored GoogleTest. Production-method fixtures cover mixed input, bow readiness/reload, inventory iteration/selection, and scrolling.

Dependency and upstream synchronization

Depends on Try/Tempest#137. The lib/Tempest pin is 19920f9fbf2091f90cc75f41889e8cdc6b617855, combining the Gamepad/event-loop additions with upstream Tempest 28d26146486ff879b4a04af5f3d541c377eb9038. The configured URL remains https://github.com/Try/Tempest.git. Please merge the Tempest change before this integration.

This branch includes OpenGothic master 05486efb9259f96c592b878ad822c8c9bbd465bf through an ordinary merge, preserving published feature history. The event-loop signal remains a function accessor for Windows DLL consumers. Save serialization and terminal confirm/cancel handlers are unchanged by the synchronization.

The exact merged Tempest SHA was fetched from the canonical URL into a new empty Git checkout; all 25 changed source/test files matched the local reviewed commit.

Validation

  • Fresh macOS arm64 RelWithDebInfo configure/build: Gothic2Notr, Spacer, and all 10 diagnostic/test executables, with normal project warning flags.
  • Complete native CTest: 9/9 passed, including real AppKit/modal-loop/redraw/lifecycle, backend ASan lifetime, input ownership, bow, InstanceStorage, and inventory merge targets.
  • New inventory fixture: 6/6 passed, also independently under ASan/UBSan. Exact old iterator and row-count bodies fail targeted negative controls; restored production bodies pass.
  • Focused Tempest state fixture: 15/15 passed under ASan/UBSan. Native dialog regressions cover asymmetric insets, owner shrink, keyboard-cell bounds, and a stale pressed Save cell after a metrics change.
  • Earlier physical DualSense/Bluetooth route on Gothic II: Night of the Raven with G1-style controls covered menus, movement/camera, melee/bow/magic, sneak, ladder, swimming/diving, lockpicking, inventory/trade, save cancel/confirm/load, mixed input, focus loss/reconnect, and normal exit. Original saves were preserved in isolated-profile checks.

The physical observations belong to the earlier feature build. The merged revision has fresh automated build/regression coverage; no new physical controller session is claimed. Earlier camera observations were qualitative around 30 and 42–45 engine FPS; automated formula checks at 30/60/120 FPS and stalled-frame clamping remain enabled. Targeted sanitizer fixtures are not a full-engine sanitizer result.

Scope

Physical USB and sustained actual 60/120 FPS checks are excluded from acceptance and remain unverified. Other controller models, G2-style controls, crossbows, and every item/NPC UI variant were not physically exercised. Non-macOS gamepad backends remain empty; non-macOS builds were not run locally. Rumble and free 360-degree movement are outside this change.

See gamepad support and validation for controls, settings, build commands, and scope. No game assets, saves, binaries, or private runtime journals are included.

@Try

Try commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Hi, @coolzi !

Sorry, but current PR is an ai-slop: there is definitely no reason to touch string-formatter or gpu-memory management.
Lets slow down, and cleanup Tempest pr first, to begin with.

@Try Try closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants