Repository navigation
ios/gamepad: optional swipe camera, floating left stick, touch settings - #258
harshulkuhar wants to merge 3 commits into
Conversation
|
Heads-up: seedds asked in #388 to agree on one settings schema and one store for player choices before the launchers are extended. I posted a proposal there (#388 (comment)): one optional |
Hi, sorry this is my first time. As far as I am aware, the four touch-control options are rows in settings.tsv, marked platform:ios, and go through the existing launcher.json generator. They use the existing persistence, override precedence and reset handling, without introducing a separate format or store. This builds on the shared settings infrastructure used by #355, #399 and #379. Happy to have a conversation and make changes accordingly if need be. |
9093aea to
69e9fee
Compare
|
One complementary control option that may fit this PR: a floating left movement stick. I’ve been using a very small
I also hide the left ring/knob in my personal layout, but I think upstream should make that/minimal artwork optional and keep the current gear/menu available. The floating-left behaviour has been used on-device in Let's Go Pikachu. I also built and installed the same generalized controller path for Wonder, Link's Awakening and Luigi's Mansion 3; I haven't done dedicated gameplay validation across all three, so I don't want to overclaim that evidence. Since this PR already owns iOS touch-control settings and adds the left-stick dead-zone setting, would an opt-in Floating left stick (default off) fit here? The core movement change is tiny and does not need a new polling or rendering path. Happy to provide the focused diff if useful. |
…orded as an open risk; not reproduced on an M4 Pro with 85 GB punched while Ocarina of Time rendered S2Arm (jhaizhou-ops/S2Arm #258, #305) saw kIOGPUCommandBufferCallbackErrorHang in 6 of 6 Ocarina of Time runs on an M1 Pro (macOS 27.0.1) when it punched its guest files during play, and now never punches. Here (M4 Pro, macOS 27.2, the Kokiri Forest deck save, 8 minutes a run) a probe wrote, fsynced and punched unmapped alias-region pages of the guest files the game uses: 36.5 GB in 2.39 million 16 KB punches and 49 GB in 140,000 whole-run punches, no command buffer error; four runs with the sweep itself had none either. Frames over 1 s came with and without punching. The entry names what may differ (machine and OS; S2Arm punched ranges the moment they were unmapped, the sweep only pages given back a whole interval earlier) and the iPad run still to do.
i'll work on it and get in-sync with main branch. |
In the 3D touch layout the camera is a floating right stick: a finger held away from where it landed keeps the camera turning, and short drags give little input, unlike a mobile swipe camera. A left thumb that lands near the stick's centre also walks the character through unintended directions. Four iOS rows in the launcher's Controls section, in settings.tsv and stored, reset and overridden like every other choice (seedds#388); every default keeps the current behaviour: - DM_TOUCH_SWIPE (off): the camera takes finger velocity instead of the floating stick (DmSwipeLook.h). Timestamped velocity is resampled at each display callback rather than cleared every frame, which alternated tilt and neutral when touch, display and guest rates differed. It expires 40 ms after the last movement sample, since UIKit sends none while a finger rests; release, cancellation and reset clear it at once. - DM_TOUCH_SWIPE_GAIN (1, 0.25 to 4): applied after the motion is normalized and clamped, so a fast swipe gives a quarter tilt at 25 % instead of saturating at every gain. - DM_TOUCH_RIGHT_AREA (third, or half): where a camera touch may start, in either mode; buttons keep priority. - DM_TOUCH_LEFT_DEADZONE (0.1, 0 to 0.4): the movement stick's radial dead zone, scaling the rest of the travel without snapping to axes. DmTouchControls.h holds the parsing, bounds and stick math without UIKit, so t_touch_controls.c tests them natively: mixed 30/60/120 Hz sampling and phases, expiry, reversal, gain bounds, invalid values and the unchanged radial response. The launcher storage check covers loading, persistence, reset and env-file locking of the four choices. Physical controllers and game code are unchanged. The reference entry is "Relative swipe camera input on iOS" in docs/reference/services.md. Checked on Breath of the Wild 1.9.0 on an iPhone Duo, iOS 27.2, from an earlier launcher-integrated build: the dead zone removes the unintended movement, and 25 % and 400 % feel clearly different. At 400 % the game's own stick response still limits the camera: this is controller input, not direct camera rotation.
With the movement stick fixed, a thumb that lands off the stick's centre starts already tilted, and a thumb that drifts past the ring has to come all the way back before reversing registers. As proposed in PR seedds#258's conversation, DM_TOUCH_LEFT_FLOAT (off by default, an iOS launcher row) makes it float the way the camera stick already does: - a touch-down within 1.65 ring radii of the stick's home (1.4 for the fixed stick) grabs it and becomes its centre; the diamond and the D-pad keep their ownership rule (smallest distance over grab radius); - past the ring the centre follows the thumb just far enough to keep it on the rim, so a reversal responds at once. dm_touch_follow in DmTouchControls.h is that rule, now used by both sticks; - the ring is drawn at the centre while held and returns home on release; the dead zone applies around the new centre. t_touch_controls.c checks the parsing and the follow rule (inside the ring the centre stays, past it the thumb stays on the rim at full tilt, a reversal turns the axis at once); the launcher tests cover the new row and its storage. Not yet checked on a device.
69e9fee to
b3ffe8a
Compare
…h settings beginLook: was never called, so the display link that turns finger velocity into right-stick tilt never ran and Swipe camera sent nothing. The camera touch now starts it where the right stick is claimed. The Duo harness test drives a swipe through DmGamepad and fails without that line. Also: - lookFrame: only recomputes when the camera value changed, so a resting finger does no work each frame. - DM_TOUCH_FULL and DM_TOUCH_DEAD name the 0.8 full-tilt fraction and the 0.1 dead zone again, and the headers use DM_STICK_MAX. - DM_TOUCH_SWIPE and DM_TOUCH_LEFT_FLOAT read with atoi, like DM_TOUCH_HAPTICS. - Swipe sensitivity shows only with Swipe camera on (needs=, as Rumble strength does). - t_touch_controls.c follows the CHECK style of the host tests. - The reference entry uses Symptom / Cause / Fix / Check, and settings.md has one or two sentences per row.
What and why
In the 3D touch layout the camera is a floating right stick: a finger held away from where it landed keeps the camera turning, and short drags give little input, unlike a mobile swipe camera. Starting the left thumb near the stick's centre also walks the character through unintended directions. This adds five iOS rows to the launcher's Controls section, all in
settings.tsv, stored and overridden like every other choice (#388). Every default keeps the current behaviour.DM_TOUCH_SWIPEDM_TOUCH_SWIPE_GAINDM_TOUCH_RIGHT_AREADM_TOUCH_LEFT_DEADZONEDM_TOUCH_LEFT_FLOATDmSwipeLook.h): timestamped finger velocity is resampled at each display callback instead of being cleared every frame, which alternated tilt and neutral when touch, display and guest rates differed. Input expires 40 ms after the last movement sample, since UIKit sends none while a finger rests; release, cancellation andresetclear it at once. The gain is applied after the motion is normalized and clamped, so a fast swipe gives a quarter tilt at 25 % instead of saturating at every gain.dm_touch_follow, now shared by both). The ring is drawn at the centre while held and returns home on release. The diamond and D-pad keep their ownership rule (smallest distance over grab radius).DmTouchControls.hholds the parsing, bounds and stick math without UIKit, so they are tested natively. Physical controllers and game code are unchanged.The reference entry is Relative swipe camera input on iOS, with its line in the symptom index and in Breath of the Wild's note.
docs/settings.md,docs/playing.mdanddocs/env_switches.tsvdescribe the five settings.Checked
On
ba9ce212, Xcode 27.2, Metal 32023.922, macOS on Apple silicon:test_touch_controls(the native C test: mixed 30/60/120 Hz sampling and phases, expiry, reversal, gain bounds, parsing of invalid values, the unchanged radial response, the floating centre staying inside the ring, following past it and responding to a reversal at once),test_launcher_settings,test_launcher_storage(all five choices load, persist, survive relaunch, reset and env-file locking),test_settings,test_docs,test_pr_areas;docs_symptoms.pyis current;git diff --check.test_env_switchesfails onmainalready (DM_NVN_*rows read nowhere,DM_GL_RENDERPROGSwithout a class); this change adds its row and does not touch the rest.mainalready: ASan reports a stack-use-after-return insvc_thread_impl(hle_thread.c:1081, readingg_unlock's locald) duringt_condvar, reproduced locally on87422462withmake -C dm/host/tests asan. This change touches no host code.dm/ios/tools/compile_check.py: 264 files, 0 failed.lint_python.py: 0 new findings.regress.py impact main..HEAD: no NVN or HLE entry point is reached; the four games listed are there only through the broad iOS-app rule.regress.py checkruns Mac builds, which do not useDmGamepad.m, so none was run.01007EF00011E000) on an iPhone Duo, iOS 27.2, from an earlier launcher-integrated build of these settings: the left-stick dead zone removed the unintended movement, and 25 % and 400 % sensitivity feel clearly different.Not checked: the floating left stick and this rebase on a device. At 400 % the camera is still limited by the game's own stick response: this is controller input, not direct camera rotation.
Docs
docs/reference/services.mdentry, andpython3 dm/tools/docs_symptoms.pywas run