Repository navigation
host/input: the player's controls file (button map, keyboard map, mouse as a stick) - #3141
Eriksrevenge1 wants to merge 3 commits into
Conversation
…dds#3158) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixed the clang-tidy ratchet failure: t_controls closes the first temporary file when the second cannot open. |
|
Rebased on current main; test_docs and test_patches pass (the host builds where the change touches it). The Tool tests failure came from a stale merge base. |
5ff3cb2 to
24fcee0
Compare
24fcee0 to
a9eed54
Compare
|
Rebased on current main (it was 50+ commits behind); the clang-tidy ratchet failure was only the baseline file out of step with the tree it ran on (0 findings above it, entries below it). The host builds, test_docs and test_env_switches pass, and the host tests pass here. Not run: GPU and game checks (no Metal 4 here). |
|
Rebased on current main: main.m and launcher.c conflicted only beside the new DM_ALBUM_DIR lines (both kept). The host builds; t_controls, test_docs and test_env_switches pass; launcher.c compiles with -Wall -Werror. |
a9eed54 to
41cda1a
Compare
41cda1a to
02cb0d6
Compare
|
Rebased on current main (23 commits behind). The host builds; test_docs, test_env_switches and test_patches pass. Not run: GPU and game checks (no Metal 4 here). |
d28971f to
e2f7b3f
Compare
|
Rebased on current main: the clang-tidy ratchet finding was in dm/gfx/tests/t_cpu_tex.m, which this change does not touch (old merge base). The host builds; test_docs and test_env_switches pass. Not run: GPU and game checks (no Metal 4 here). |
e2f7b3f to
07b4f5c
Compare
|
Rebased on current main: docs/playing.md conflicted beside main's HID paragraph (both kept). The host builds; test_docs, test_env_switches and test_patches pass. Not run: GPU and game checks (no Metal 4 here). |
07b4f5c to
a26487c
Compare
|
Rebased on current main: front_mac.m conflicted beside the new right-stick motion menu (both kept). The host builds; test_docs, test_env_switches and test_patches pass. Not run: GPU and game checks (no Metal 4 here). |
ce2f9e6 to
708a29a
Compare
|
Rebased on current main (53 commits behind): the Sanitizers failure was t_audio_device's watchdog test, which main has since made deterministic (2d0773f). The host builds; test_docs, test_env_switches and test_patches pass. Not run: GPU and game checks (no Metal 4 here). |
…se as a stick) The Mac keyboard's map was a fixed table in front_mac.m, a controller's buttons could not be sent as others, and the mouse was only the touch screen. The host now reads the player's controls (dm/host/controls.h): DM_CONTROLS, files separated by ':' read in order with later lines winning, else <DM_ROOT>/controls.txt. A file can send a controller's buttons as others on every controller path (hle_hid.c dm_pad_set_player, dm_joy_set), swap the sticks, change or clear the keyboard map (by macOS key code), and make the mouse a stick: a click in the picture captures the pointer, its movement is summed into a tilt 120 times a second, its buttons do the file's actions, and Escape, losing focus or the controller prompt give it back. The built-in keyboard map is unchanged without a file; Shift with an arrow is still the right stick while that arrow keeps its built-in action. A line the host does not understand is a [RED] controls: line and is skipped. The Mac app's launcher passes the global file and then the game's; the iPhone app reads Documents/controls.txt. Front-ends: new: the controls file (docs/frontends.md, Controls). A front end writes it; the host never does. Checked: t_controls (31 checks), t_hid (561), the host tests (make run), the host build, launcher.c compiled, test_docs, test_settings, test_launcher_settings, test_env_switches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clang-tidy's analyzer (lint-c) flagged the test's fdopen of an unchecked mkstemp result and the stream that could be NULL (unix.StdCLibraryFunctions, unix.Stream, two each). The test now stops with a message when either temporary file cannot be made or opened. Checked: t_controls (31 checks, 0 failed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d cannot open Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
708a29a to
79f4550
Compare
|
Rebased on current main (83 commits behind); the clang-tidy ratchet finding was in dm/gfx/tests/t_perf_order.m, which this change does not touch and main has since fixed (9fd5bbe). The host builds; test_docs and test_env_switches pass. Not run: GPU and game checks (no Metal 4 here). |
What and why
The Mac keyboard's map was a fixed table in
front_mac.m, a controller's buttons could not be sent as others, and the mouse was only the touch screen. The host now reads the player's controls (dm/host/controls.h):DM_CONTROLS, files separated by:read in order with later lines winning, else<DM_ROOT>/controls.txt. A file can send a controller's buttons as others on every controller path, swap the sticks, change or clear the keyboard map (by macOS key code), and make the mouse a stick (a click in the picture captures the pointer; Escape, losing focus or the controller prompt give it back). Without a file nothing changes. A line the host does not understand is a[RED] controls:line and is skipped. The Mac app's launcher passes the global file and then the game's; the iPhone app readsDocuments/controls.txt. Described in docs/frontends.md, Controls and docs/playing.md.Checked
t_controls(31 checks),t_hid(561), the host tests (make -C dm/host/tests run), the host build,launcher.ccompiled with-Wall -Werror,test_docs,test_settings,test_launcher_settings,test_env_switches040057C02159A000, v262144), a Mac app built from this branch, fullscreen on a DELL S2725QC, about 90 s per run from launch: with a controls file ofpad a=b,key 38=bandmouse=rightthe log showscontrols: read …andcontrols: controller buttons mapped, no[RED] controls:line, no crash. (One[RED] stage 0 cb7 has no uniform buffer boundat frame 6, the game's own, as without the change.)lint_c(no LLVM release installed here; CI's lint-c job runs it).Front ends
Front-ends: new: the controls file (docs/frontends.md, Controls). A front end writes it; the host never does.
Docs
python3 dm/tools/docs_symptoms.pywas run wheredocs/referencechanged