Hotspot Magnet: directional hotspot navigation

Status: Planning baseline. The research in Section 3 is done for everything except SCUMM/HE (WP-086, 2026-11-26). Jeff decided H1–H5, H7 and H8 in §10.4 the same day, and H6, the cursor fallback, on 2026-11-27 after the TCL remote capture. Part II is designed for the Phase 1 TerraGlyph prototype (WP-089, 2026-11-27), and its directional algorithm in WP-091 (2026-11-28). Jeff decided WP-089’s choices H9–H16 on 2026-11-27 (H15 conditional) and WP-091’s H17–H24 on 2026-11-28. Nothing here is built. Date: 2026-11-26 (Revision history). Author: Jeff (with AI assistance).

Primary prototype: the TerraGlyph engine. Secondary integration: SCUMM / Humongous Entertainment. Long-term objective: a shared ScummVM accessibility feature (a goal, not a dependency).

Related pages: WP-008 object.ini catalog · WP-018 hotspots and exits · WP-021 clickable actions · WP-085 Google TV app pipeline · ScummVM on smart TVs · ScummVM on the Raspberry Pi · Upstream submission decision brief


Part I — Research and requirements

1. Executive summary

Conventional D-pad cursor movement on televisions (ScummVM’s Virtual Mouse) is continuous and imprecise. Young children and players with motor impairments struggle to stop the cursor exactly on small interactive objects. Jeff saw this on the TCL 65Q77K on 2026-11-26: the D-pad moves ScummVM’s pointer but lacks the fine movement needed to click a button or object (WP-085 D2).

Why it matters for the TV app. Google’s TV app quality rules require an app to be navigable with a five-way D-pad unless it requires a game controller. Because the D-pad pointer can’t click reliably, WP-085 chose “gamepad required” for the Play release and left D-pad-only control as its open remote-first item. Hotspot Magnet is that item: if it makes the games playable with the standard remote, a later release could reconsider that requirement.

Hotspot Magnet is a directional, hotspot-to-hotspot navigation system. The four D-pad directions move the selection from one currently interactive hotspot to the next; OK/Select activates it. A clear fallback to conventional cursor movement stays available at all times.

Audiences

Three-phase strategy

  1. A working TerraGlyph prototype (valuable on its own).
  2. Reuse of the same navigation core in one SCUMM/HE title.
  3. Extraction into shared ScummVM code and an upstream contribution attempt.

Upstream acceptance is an external decision. The project succeeds if Phase 1 (and ideally Phase 2) delivers a reliable, optional feature even if shared-code integration is declined or delayed.

2. Goals, requirements, and scope

2.1 Functional goals

2.2 User experience goals

2.3 Non-functional requirements

2.4 Out of scope

3. Existing ScummVM architecture: research findings

Verified by WP-086 on 2026-11-26, except 3.6 (SCUMM/HE, a later packet). Every finding cites the fork at origin/scooby-engine ff490ad9449f, and each has a row in the evidence register (E1, E2, …). Gen 1 means Showdown and Phantom; the shared-code findings carry no generation.

What the research changes. Three findings matter most to the design:

3.1 Keymapper and input events

3.2 Android TV and gamepad input

The TCL 65Q77K’s remote (E22, E25, E26). Captured with getevent -lt on 2026-11-26 and 2026-11-27 (Android 14):

Button Kernel key HID usage (page 0x0C) Short press Held 3.4–4.3 s
D-pad up KEY_UP 0x42 one press, one release —
D-pad down KEY_DOWN 0x43 same —
D-pad left KEY_LEFT 0x44 same one press, one release
D-pad right KEY_RIGHT 0x45 same one press, one release
OK KEY_SELECT 0x41 same one press, one release (three holds)
BACK KEY_BACK 0x224 same —

Short presses last 0.10–0.20 s. The remote never repeats: a held button sends one press and one release, nothing between. Android does repeat. dumpsys input shows HandlesKeyRepeat: false for every input device, with KeyRepeatTimeout: 400ms and KeyRepeatDelay: 50ms, so Android’s input dispatcher adds a repeated key-down 400 ms into a hold and then every 50 ms. ScummVM’s JE_GAMEPAD path ignores the repeat count (E7), so a held OK reaches the engine as JOYBUTTON_DOWN, repeated every 50 ms after 400 ms, then one JOYBUTTON_UP at release. This is inferred from the kernel capture, the dispatcher settings and the source, not observed inside ScummVM. A held D-pad direction does the same, which matters for navigation (6.3).

For H6, a hold of OK can be timed from the first JOYBUTTON_DOWN to the JOYBUTTON_UP if the engine ignores repeated downs while the button is already down. MENU and Home weren’t pressed in either capture. MENU is already taken (E8) and Home never reaches an app, so neither is needed for H6. The remote was /dev/input/event7 in the first capture and /dev/input/event9 in the second (the TV had restarted), so a tool must find it by name, not by node. The first 3-minute capture had no presses. What it did show: getevent works over adb without root, and the TV’s input devices are the Bluetooth remote BT_RC923A_B1 Consumer Control (/dev/input/event7), a virtual-remote, the MTK Smart TV IR Receiver, the TV keypad, a gIrTouch_Mouse and a virtual-search device. The remote’s HID report lists about 150 possible keys, many more than its buttons, so only presses show which exist.

3.3 Existing hotspot navigation and display features

3.4 Shared component conventions

What already lives where (E11–E15):

Location What’s there now Fit for Hotspot Magnet
common/ General utilities Could hold a pure point-navigation function, but nothing hotspot-related lives there
gui/ The enable_hotspots checkbox and its sibling options (edit-game dialog) The shared setting, in Phase 3
engines/ Engine::getHotspotPositions(), drawHotspots(), showHotspots(); MetaEngine::createHotspotAction() and hotspotsEnabled() The data source and the action pattern
backends/keymapper/ The Virtual Mouse and the Keymapper Only the bindings; a navigation action is an engine-level action, as HOTS is
graphics/ HotspotInfo, HotspotRenderer The selected-target marker

Recommendation (proposed): engines/, beside the hotspot display. Its input is getHotspotPositions(), its action follows createHotspotAction(), and its marker can come from graphics/hotspot_renderer. Keep the directional algorithm a standalone class with no engine dependency, so it can be tested without an engine. Phase 1 still prototypes inside engines/terraglyph/ (7.1); this is where the shared extraction would land.

3.5 TerraGlyph hotspot data

From earlier packets, Gen 1: object.ini names the objects and their kinds (WP-008), and hits test step polygons or cel pixels, front to back (WP-018). In the source:

Proposed eligibility rule (Gen 1, from E18–E20): a sprite is a target when it is not hidden, not detached, has hitType ≠ 0, and is an exit (has a destination), a clickable, a requires object, an inventory object or a toolbar sprite; and handleMouse() would accept a click now (no script busy, input not blocked, room class not busy). Leave out simple sprites, which are hittable but do nothing, and the ghost. Characters: the engine passes a click to clickCharacter() only with the arrow cursor, and whether that does something in every room is unverified, so leave them out at first and revisit.

Proposed interaction point: search the sprite’s polygon bounding box (or cel rect) on a small grid, centre first, and keep the first point where hitTest() returns that sprite, as SCUMM does with findObject(). A sprite with no such point (fully covered by another) isn’t eligible.

3.6 SCUMM / Humongous Entertainment

Not researched yet (the SCUMM/HE research packet). One lead from 3.3: SCUMM already implements getHotspotPositions() for v0–v8 and HE, with hit-checked points (E16).

3.7 Per-game configuration

3.8 Research evidence register

Pinned commits: fork origin/scooby-engine ff490ad9449f for E1–E26; upstream scummvm/scummvm master 7b6fa644d74a (2026-11-26), merge base 2982fe324b6c. E27 onward (WP-089) are at fork 0d5a69c7694f (2026-11-27). Between the two fork pins only WP-085’s four commits landed (fork PR #13), all Android: no keymapper, event, hotspot or TerraGlyph file changed. android.cpp gained six lines at 363, so E3, E8 and E9 cite the new line numbers with the old ones beside them. Paths are in the fork.

E45 onward (WP-091) are at fork 1539a7b59cf3 (2026-11-28). Between 0d5a69c7694f and it, twelve merges landed (fork PRs #9 and #14–#24): Gen 1 rooms (WP-083’s and WP-094’s Wizard’s Rule, WP-090’s Knights of the Snack Table, the well, the fountain, Wizard’s Skull, the hedge maze, the arena pile, below the balcony, the princess’s bedroom, the drawbridge flags) and WP-096’s TV package work. Every changed file was checked:

# Section Source (file, symbol) Verified behavior Implication for Hotspot Magnet Still unverified
E1 3.1 common/events.cpp EventDispatcher::dispatch; backends/keymapper/keymapper.cpp Keymapper::mapEvent, getMappedActions, executeAction; keymap.cpp Keymap::getMappedActions, loadMappings Events map to actions through enabled keymaps; unmapped events pass raw; a match swallows the raw event Navigation can be Keymapper actions, rebindable like any other —
E2 3.1 keymapper.cpp:183-199 Keymapper::mapEvent; keymap.cpp:240 Game/GUI keymaps first; Global only without an exact match; joystick inputs match exactly An engine keymap wins over the Virtual Mouse for the same buttons —
E3 3.1, 3.2 backends/platform/android/android.cpp:748-760 getKeymapperDefaultBindings (:742-754 at ff490ad9449f); hardware-input.cpp:266-270 Android binds VMOUSE* to JOY_UP…JOY_RIGHT in the Global keymap and GUI interact to JOY_A, JOY_CENTER, SELECT Binding the D-pad in a game keymap takes it from the Virtual Mouse; disabling that keymap gives it back —
E4 3.1 backends/keymapper/virtual-mouse.cpp addActionsToKeymap, handleAxisMotion, pollEvent, computeJoystickMouseSpeedFactor; engines/metaengine.cpp:97-101 Five movement actions, no click; constant velocity every 12 ms; in-game click is LCLK on MOUSE_LEFT/JOY_A Conventional cursor mode is the Virtual Mouse as it is —
E5 3.1 backends/events/default/default-events.cpp:57; android.cpp:457, :364 The Virtual Mouse is always built on Android; kbdmouse_speed defaults to 2 No enable step needed for the fallback —
E6 3.2 ScummVMEvents.java:519-545 onKey; events.cpp:1243-1337 (JE_GAMEPAD), :613-617 (JE_DPAD), :1359-1369 (JE_JOYSTICK) D-pad keys become JOYBUTTON events; JOY_CENTER is unbound in games; hat D-pads are axis events; JE_DPAD is dead Bind JOY_UP…JOY_CENTER for the remote; a gamepad hat needs JOY_HAT_* too —
E7 3.2 ScummVMEvents.java:446, :456-486, :593; events.cpp:422-424; keymapper.cpp:308 Key repeats are flagged and dropped; gamepad repeats arrive as new presses; long press only for BACK and MENU A held OK can be timed from JOYBUTTON_DOWN to UP in the engine Whether the TCL’s remote repeats a held press
E8 3.2 ScummVMEvents.java:238-261, :423-441, :508-511; android.cpp:717, :734, :739 (:711, :728, :733 at ff490ad9449f); events.cpp:678-718, :1261 BACK, MENU, volume, play/pause and START/SELECT are taken (table in 3.2) The fallback can’t use BACK or MENU without losing skip, the main menu or the keyboard —
E9 3.2 gui/options.cpp:290, :970, :1446; android.cpp:598 (:592 at ff490ad9449f); virtual-mouse.cpp:204 Pointer Speed is kbdmouse_speed; no acceleration setting Magnet mode doesn’t need to touch pointer settings —
E10 3.2 touchcontrols.cpp:214, :241-281; ScummVMEvents.java:720-745; options.cpp:496-527 The on-screen gamepad activates only from touch No conflict on a TV —
E11 3.1, 3.3, 3.4 engines/metaengine.cpp:73-78 createHotspotAction, :80-85 hotspotsEnabled; standard-actions.cpp:44 HOTS action, key h, added by each engine in initKeymaps when enabled The pattern for a shared navigation action —
E12 3.3 graphics/hotspot_renderer.h:41-60 HotspotType, HotspotInfo Position, name, type; no rectangle, no id Points are enough to navigate; a stable id is missing —
E13 3.3 engines/engine.h:555-594, engine.cpp:751-826 Default empty; queried when dirty (default every frame) from drawHotspots(); suspended on pause and GUI Hotspot Magnet can query the same interface on each press —
E14 3.3, 3.7 gui/editgamedialog.cpp:332-372, :587-608; engines/metaengine.cpp:80-85; default-events.cpp:123-142; keymapper.cpp:380-381 Per-game enable_hotspots, default off, every game; hold/toggle handled in the event manager The shared-setting model for Phase 3 —
E15 3.3 graphics/hotspot_renderer.h:73-133, hotspot_renderer.cpp:181-309, :322, :449, :699 Markers, leader lines, labels for the whole list; no outline; type unused; overlay API One-item list marks a target; no highlight style How it looks with one marker on the TV
E16 3.3, 3.6 engines/scumm/object.cpp:559-649; scumm/metaengine.cpp:1176-1188; touche/touche.cpp:1511-1575; hollywood/hotspots.cpp:113-156, monsters/hollywood.cpp:404-408, runaway/engine.cpp:104-110; macs2/macs2.cpp:2202-2386 Each returns interactive things only, with hit-checked points The interface is already filled by five engines; SCUMM covers v0–v8 and HE macs2 map scrolling; touche’s player hit box
E17 3.3 engines/lab/metaengine.cpp:284-288, lab/engine.cpp:755-762, processroom.cpp:170-206; mohawk/riven_card.cpp:1174-1244; mads/core/game.cpp:997-1001; grim/grim.cpp:605-614 Only Lab moves the cursor to the next interactive item, by its own data Precedent for a “next object” action; no reusable core What Grim’s scripts do with PageUp/PageDown
E18 3.5 engines/terraglyph/room.h:52-73, :108-235, :278-356; room.cpp:145-255, :294-344, :563-565, :838-898; cel.cpp:192 hitTest returns a sprite index; kinds, hidden, hitType, accessors; polygon private The provider can be built from public accessors plus one polygon-box accessor Whether a hidden parent hides its children
E19 3.5 terraglyph.cpp:112, :125, :336-381, :471-477, :1541-1556; inventory.cpp:148, :241-242, :427; inventory.h:165, :227 One room object; toolbar at depth 5000 in it; input gated in handleMouse Eligibility must include the toolbar and follow handleMouse’s gates Whether every close-up is a room like the chase close-up
E20 3.5 terraglyph.cpp:231-237, :336-381, :414-417, :2003-2045; chase_check.cpp:259-270 handleMouse(false/true, p) is the click path; the test script already synthesizes clicks; the self-test lists sprites and hit-tests headlessly Activation reuses handleMouse; the reachability check is feasible —
E21 3.2 git diff 2982fe324b6c 7b6fa644d74a over the files in E1–E15 Only 735ad86c21 (Android mouse pointer capture) changed No finding changes upstream —
E22 3.2 adb shell getevent -lt, getevent -lp, dumpsys input on the TCL 65Q77K, 2026-11-26 Devices listed; no presses captured The remote’s devices —
E25 3.2 adb shell "timeout 600 getevent -lt" on the TCL 65Q77K, 2026-11-26 Short presses of down, left, right, OK and BACK: kernel keys and HID usages, one press and release each, held 0.10–0.16 s The D-pad and OK arrive as single key events —
E26 3.2 adb shell "timeout 600 getevent -lt" and dumpsys input on the TCL 65Q77K, 2026-11-27; events.cpp:1242-1252 (JE_GAMEPAD) D-pad up is KEY_UP (0x42). OK held three times (3.4–4.3 s) and left and right held once each: one press and one release, no hardware repeat. Android repeats held keys (400 ms, then every 50 ms); JE_GAMEPAD turns each repeat into a new JOYBUTTON_DOWN A held OK can be timed from the first down to the up (H6); held D-pad presses repeat ScummVM’s own event log during a hold (inferred, not observed)
E27 3.1, 6.4 engines/metaengine.cpp:87-177 MetaEngine::initKeymaps; base/main.cpp:312-316; engines/terraglyph/metaengine.h:29-41; engines/sky/metaengine.cpp:81 ScummVM’s default game keymap (“engine-default”) binds JOY_UP…JOY_RIGHT to keypad 8, 2, 4, 6 key events, JOY_A to left click, JOY_B to right click and JOY_Y to skip. TerraGlyph doesn’t override initKeymaps(), so it gets this keymap, and in a game the D-pad sends keypad keys the engine ignores instead of moving the Virtual Mouse. Sky (Beneath a Steel Sky) declares its own keymap without the D-pad, so there the Virtual Mouse has it TerraGlyph’s own initKeymaps() replaces the default; with the option off it returns WP-113’s terraglyph-default (6.4) Confirmed on the TCL, 2026-11-29 (WP-113): D-pad presses at Sign In changed nothing; with the directions unbound the cursor moved. Fixed by WP-113 (fork PR barefootbetters/scummvm#38)
E28 6.2, 6.4 engines/touche/metaengine.cpp:115-214; backends/keymapper/keymap.h:82-83, :167-168; keymapper.cpp:142-165, :231-246; engines/bbvs/bbvs.cpp:244-248 An engine declares several game keymaps with custom actions (setCustomEngineActionEvent, addDefaultInputMapping), and toggles one with setEnabled() or setGameKeymapState(), leaving the others on. Every enabled game keymap with the same match fires together One keymap for OK, one for the directions; an input bound in two enabled keymaps fires twice —
E29 6.2, 6.4 keymapper.cpp:257-278, :300-318, :377-378; action.cpp:31, action.h:128-132; hardware-input.cpp:281-282, :498-514; keymapper.h:159-160; sdl-common-events.cpp:249-277; android/events.cpp:1243-1337, :1359-1369 A custom action gets EVENT_CUSTOM_ENGINE_ACTION_START for every incoming button down (Android’s repeats included; no de-duplication) and one _END on release. Keyboard repeats are dropped unless the action allows them. Hats are axes (JOY_HAT_X/Y, bound as halves -/+): one start past half travel, one end below a quarter, no repeats; a hat returning to centre ends both halves. Android sends a gamepad hat as axis motion; SDL turns a raw joystick’s hat into pushed D-pad button events, which aren’t mapped (E44) OK’s hold is timed from the first start to the end, repeats ignored (6.2); the remote binds as JOY_UP…, an Android hat as JOY_HAT_* —
E30 6.2 gui/gui-manager.cpp:759-761, :771-772; engines/engine.cpp:711-724, :994-999; default-events.cpp:168-170 Opening the main menu or a dialog pauses the engine and switches the Keymapper to the GUI keymaps; game keymaps aren’t consulted, and no end is sent for an action held when it opened Reset OK’s hold at the pause, not at an end that may never come —
E31 4.5 backends/modular-backend.cpp:282-283; backends/graphics/windowed.h:435-452; backends/graphics/android/android-graphics.h:47, :60; default-events.cpp:144-146; keymapper.cpp:324-329 warpMouse() purges queued mouse events, then moves the backend’s cursor. On SDL it produces a mouse motion event; on Android setSystemMousePosition() is empty, so no EVENT_MOUSEMOVE arrives and the event manager’s mouse position stays where it was Warp, then push EVENT_MOUSEMOVE (4.5) Run on the TV (inferred from source)
E32 6.5 engines/engine.cpp:774-826; engines/metaengine.cpp:73-85; engines/touche/touche.cpp:522; graphics/hotspot_renderer.cpp:158-236 The show-all display needs getHotspotPositions(), a drawHotspots() call each frame and the show-all action in a keymap. The renderer draws any list it’s given, one item included, but refuses while another renderer owns the overlay One list serves the display and Magnet; a selection marker would replace the display while shown —
E33 6.3 ScummVMActivity.java:1287-1296; advanced/…/AdvancedMode.java:24-75; advanced-stub/…/TestFeatures.java:21-23; dists/android/build.gradle:155, :163-172 In test (debug) builds, up, down, up, down, left, right, left, right within 10 s opens the advanced mode and swallows only the last right’s down; release builds compile a stub that does nothing. The code’s comment says the TCL’s remote sometimes reports one press twice A Magnet player can trigger it on a test build (H15) The double report (packet 6, then 10)
E34 4.2 engines/terraglyph/terraglyph.cpp:231-245, :336-381 The main loop passes EVENT_MOUSEMOVE and EVENT_LBUTTONDOWN to handleMouse(), then sets _mouseDown on the down and clears it on EVENT_LBUTTONUP. handleMouse() drops a click while a scene runs or a pick-up movie blocks input, takes it as a skip while the room class is busy, and otherwise hands it to the character, room class, inventory, hint, exit or clickable. A blocked click has no sound or other feedback Activation sets _mouseDown and calls handleMouse(true, p) itself, clearing _mouseDown after one game tick, so the held-button rooms see a real press (H9) —
E35 6.8 room_class.cpp:130-165; options_rooms.cpp:160-233; pienoon_rooms.cpp:726-786; corral_rooms.cpp:189-210; brad_rooms.cpp:246-255, :326-386, :447-448; chase_rooms.cpp:637-749; maria_rooms.cpp:198-208, :400-433; vault_rooms.cpp:578-644; signin_room.cpp:276-281, :335-367 The rooms that read the held button or the pointer, and what each needs (table in 6.8). The Options knobs, Brad’s game and the vault’s clock need the button held while the pointer moves Room-class assists (H11) Kids’ play in each (12.6)
E36 4.6 room_class.cpp:82-115; room_class.h:97-98; room.h:288-298; room.cpp:294-343, :505-557; menu_rooms.cpp:127-134, :177-188, :216-217; signin_room.cpp:92-107; accusation_rooms.cpp:141-201 ButtonRoom buttons are placements found by object name or engine sprites, exposed by getButtonCount()/getButtonSprite(). The menus’, Sign In’s and the clue book’s buttons are these, not exits or clickables; the quit screen’s Yes and No are engine sprites Room-class buttons as targets (H13) The menu placements’ object.ini kinds (game data)
E37 4.5 terraglyph.cpp:461-466; room.cpp:231-255, :819-823, :843-848, :864-898, :990-1012; room.h:334-337; inventory.cpp:250, :309-316 The screen shows a room’s top-left 640×480 with no scrolling; rooms up to 1920 px wide; hitTest() in room coordinates, front to back, so a character can cover a target. The polygon box (at +8…+14, relative to the sprite’s x and y) is private; hitsPoint(), getFrameRect() (the first cel only, while a cel hit tests every cel) and getSize() are public. The hidden toolbar sits at negative x Drop off-screen points; add Room::getHitBox() Which rooms are wider than 640
E38 4.4 terraglyph.cpp:1541-1607 showRoom; room_script.h:267; inventory.h:165; room_class.h:74-76; terraglyph.h:253-259 Every room change, close-up and Big Head goes through showRoom(); RoomScript::isBusy(), Inventory::isInputBlocked() and RoomClass::isBusy() are the click gates The selection’s drop and block rules (4.4) —
E39 4.5 room.cpp:834-835, :1069-1105; terraglyph.cpp:342, :472, :484 TerraGlyph draws its own cursor sprite, moved only from mouse events through handleMouse()/updateHover(). It never calls warpMouse() or CursorMan The cursor adapter pushes a mouse move (4.5) —
E40 5.6, 6.2 movie.cpp:116-125 A movie polls events itself, honours mouse moves and its skip keys and buttons, and discards everything else, button releases included Reset OK’s hold when a movie starts Whether _mouseDown is left set after a movie
E41 12.7 terraglyph.cpp:128-153, :383-459, :2003-2045 The self-test runs by debug channel at level 3; checkAllRooms builds a bare Room with no class, toolbar or inventory. test_script runs a step list each frame: click calls handleMouse() directly, down/up push real button events The listing hook uses showRoom(); new verbs (12.7) —
E42 6.6 engines/terraglyph/metaengine.h:26-43; detection_tables.h:49, :64, :78 TerraglyphMetaEngine declares no options or keymaps; every entry is GUIO1(GUIO_NOMIDI); settings are read with plain ConfMan calls “Hotspot Assist” is the engine’s first option —
E43 6.4 signin_room.cpp:306-333, :396-409 Sign In queues every ASCII key (Enter, '\r', starts play) and Delete; Escape and an early Space still skip; arrow keys carry no ASCII and aren’t taken The Windows OK is keypad Enter —
E44 6.1, 6.4 common/events.h:318-329 (ArtificialEventSource::allowMapping() false); default-events.cpp:272-279; backends/keymapper/virtual-mouse.cpp:93, :153-180; sdl-common-events.cpp:249-272; sdl2-events.cpp:880-883; backends/keymapper/keymap.cpp:255-272; android.cpp:734-735 Events pushed with pushEvent() are never mapped by the Keymapper. SDL pushes a raw joystick hat’s D-pad buttons that way, so they never reach a keymap; a recognised game controller’s D-pad is mapped. The Virtual Mouse’s own defaults are the left stick and right shoulder; only Android (and two handheld ports) bind the D-pad to it. It starts each move from the event manager’s mouse position. A backend’s standard-action binding (Android: skip on BACK and JOY_Y) applies to any keymap’s action with that id Cursor mode’s D-pad is Android’s; Magnet’s actions can’t be driven by pushing hardware events (12.7); keep the standard ids (6.4) Raw-hat and D-pad-only controllers on the Pi (packet 11)
E45 6.8, 4.6 engines/terraglyph/wfr_rooms.cpp:120-132 (WizardsRuleRoom::claimPlacement), :349-359 (click); room.cpp:546-549; room_class.h:74 Wizard’s Rule’s six bottles are claimed as plain sprites (kind simple, hit by polygon), and the class catches a click on one in its own click(). It never reports busy H7’s kinds leave the bottles out, so the class must add them through the target hook (H11, H13) Whether the song’s beat window suits a remote press (packet 6)
E46 6.8 kst_rooms.cpp:590-696 (KstRoom::updateShaggy; the walk to the bench at :651-675), :448-466 (slideMug), :737-739 (hidesCursor) Shaggy walks to the bench nearest the pointer’s y. A press while he’s at that bench fills a mug, the release slides it, and a slid mug is always full. The cursor hides below the counter rows Cursor mode, like Pie Noon Whether H9’s one-tick press is seen while Shaggy is at his bench (packet 6)
E47 5.8 test/module.mk (the twine, ultima and wintermute STATIC_PLUGIN blocks); test/engines/twine/gridtest.h; engines/terraglyph/configure.engine:3 Engine unit tests are CxxTest headers linked against a static engine library, each through a block in the shared test/module.mk. There’s none for TerraGlyph, which is off by default Phase 1’s core cases run in the self-test (H23) —
E48 App. E engines/lab/processroom.cpp:170-206 (LabEngine::setCurrentClose) With next, it steps to the close-up after the one under the cursor, in data order, wrapping; with none under the cursor, the first A fixed cycle reaches every item but ignores direction —
E49 5.3 engines/terraglyph/room.cpp:887-899 (Room::hitTest) Walks the draw list front to back, skipping hidden and type-0 sprites; the first hit wins Two sprite targets never share a point, and 4.5’s re-check keeps it so —
E50 5.7, 5.8 tools/probe_art.py --list (this repo) on both titles’ TGIFILE.ART; inventory.h:51; inventory.cpp:68-72, :196-250 (enterRoom), :251-254 (isToolbarHidden), :309-314 (hideToolbar) 69 Showdown rooms (placements average 8.9, at most 45); 53 Phantom rooms (10.4, at most 45). The toolbar’s nine click indices are four slots, the van, Scrappy, quit, the magnifier and the snacks. Its sprites are towed by the van at negative offsets, so parked (van at x = 0) only the van is on screen, and hidden (van at −(width + 30)) none is Lists of about 54 targets (an estimate); one target per toolbar index Placements count every placed object, so real lists are shorter
E23 3.7 engines/advancedDetector.h:400-405, :715; advancedDetector.cpp:333-341; engines/metaengine.h:71-78; engines/dialogs.cpp:472-495; metaengine.cpp:460-468; base/main.cpp:225; awe/metaengine.cpp:31-75, awe/detection_tables.h:40, awe/awe.cpp:195 Declare, tie to entries by GUIO flag, persist per game, read with ConfMan.getBool The Phase 1 setting is a standard extra option —
E24 3.7 engines/terraglyph/metaengine.h:29-41; detection_tables.h:50-123 No extra options; only GUIO_NOMIDI Where “Hotspot Assist” goes —

Part II — Technical design

Status: designed for the Phase 1 TerraGlyph prototype (WP-089, 2026-11-27), within Jeff’s decisions H1–H8. The choices WP-089 added are marked with their row, (Hn); Jeff decided H9–H16 on 2026-11-27 (§10.4). §5, the directional algorithm, is designed in WP-091 (2026-11-28), with its choices H17–H24 decided the same day. Source facts are E27 onward in §3.8, at fork 0d5a69c7694f (E27–E44) and 1539a7b59cf3 (E45 onward); everything is Gen 1 except the shared core and input adapter, which carry no generation. Nothing here is built.

4. Proposed software architecture

4.1 Architectural principles

4.2 Component responsibilities

Component Lives in Responsibility
A. Engine Hotspot Provider Engine Supplies only the targets that are eligible right now (4.6), each with its geometry, metadata and an interaction point; reports availability changes
B. Hotspot Navigation Core Shared Selection: holds the active selection, evaluates directional requests, picks the next hotspot, handles unavailable or changing targets
C. Input Adapter Shared, or thin engine glue Turns D-pad / Keymapper events into navigation requests and OK/Select and secondary actions into activation requests; provides the conventional cursor fallback
D. Cursor Adapter Engine or shared Cursor positioning: moves the game cursor to the target’s interaction point, with coordinate conversion; optionally highlights the selected target (possible reuse of the existing hotspot display)
E. Activation Engine Activation: invokes the engine’s own interaction behavior at the interaction point, as a real click would. The shared code never triggers game logic directly

Selection, cursor positioning and activation are separate steps. Moving the cursor to a target doesn’t by itself guarantee the game will accept a click there, so the engine owns both the point and the click.

Phase 1 contracts (WP-089). Declarations are in Appendix B.

  Inputs Outputs Owner, location Runs when Builds on
A The live room, its room class, the toolbar, the cursor in use The target list: one Graphics::HotspotInfo per target (4.3), with each target’s identity kept beside it TerraGlyph, TerraglyphEngine On each directional press and each OK (H8), and when ScummVM’s show-all display asks getHotspotPositions() (H2), Room::hitTest(), a new Room::getHitBox() (E37), room-class targets (E36, H11, H13)
B The target list, the current selection’s index or none, the cursor’s position, the direction, whether the press is a repeat The index to select: current itself to stay, and none (−1) only for an empty list (5.1) Shared, with no engine type; in engines/terraglyph/ for Phase 1 (H4) On each directional press in Magnet mode Nothing; a pure function (4.3)
C Magnet’s action starts and ends, the clock, each engine tick One of: navigate (direction, repeat), activate, enter cursor mode, enter Magnet mode, nothing Shared, with no engine type On each Magnet action event and each engine tick Keymapper custom engine actions (E28, E29)
D The point to move to The game cursor at that point, hover and rollover updated TerraGlyph When the selection changes OSystem::warpMouse() and a pushed EVENT_MOUSEMOVE (E31, E39)
E The selected target, or the pointer in cursor mode A left-button press at the point, released after one game tick has seen it TerraGlyph On OK’s short press (H6) handleMouse(true, p) and _mouseDown, owned by the engine (E34) (H9)

Activation (E) (H9). After the re-check (4.4) the engine sets _mouseDown, calls handleMouse(true, p) itself, and clears _mouseDown once at least one game tick has run with it set. That is what a real press does to TerraGlyph’s state (the main loop sets _mouseDown on a button down and clears it on the up, E34), so the rooms that read the held button (the corral, Pie Noon, ButtonRoom’s pressed frame) see it. It doesn’t go through the event queue: a pushed release can be lost, because a movie’s own event loop discards releases (E40) and warpMouse() purges queued mouse events (E31), which would leave _mouseDown stuck. Ticks run at 36 a second against 60 frames, so “after one game tick” is counted in the tick loop, not in frames (E34). Every reset (6.2) also clears a pending release. What blocks a click, and what the player sees, is today’s handleMouse() (E34): a running scene or a pick-up movie drops it with no sound; a busy room class takes it as a skip (the title, credits, Big Head); the cursor is already hidden in both cases. Phase 1 adds no feedback of its own for a blocked click.

4.3 Interfaces

The hotspot record is ScummVM’s Graphics::HotspotInfo unchanged (H2):

HotspotInfo field Holds for a TerraGlyph target
position The interaction point (H3), in game coordinates (4.5)
name The target’s label (Room::getLabel(), or the room class’s), for logs and the show-all display
type The closest HotspotType: an exit is an exit, the rest are objects. Nothing draws by type (E15)

The provider keeps, in a second array beside the list, each target’s identity: its source and index. The source is the room (the index is a sprite) or the room class (the index is the class’s own target number, H11). With the room, that is the selection (4.4). HotspotInfo gets no id, so H2’s condition (b) isn’t needed yet. The core navigates over points only: the interaction point is where the player’s eye goes and where the click lands, and a polygon’s box can be far bigger than the object it outlines. WP-091’s scoring needs no box (5.2), so H2 (b) stays unraised (H12).

The navigation core’s contract. One pure function: given the targets, the current selection’s index (or none), the cursor’s position, the direction (up, down, left, right) and whether the press is a repeat, it returns the index to select. To stay, it returns current itself; it returns none only for an empty list, since with no selection a press always selects a target (5.5). It keeps no state and knows no engine. Its rules are 5.1–5.5, repeats are handled as presses (H21), and reachability is 5.8’s.

The input adapter (C) keeps the mode, OK’s hold and the directions’ held state, and turns Keymapper events into the five results in the table above. It’s specified in 6.2. Repeats are its own, the same on every device: it ignores the repeated starts a device sends (Android’s, E26) and, while a direction is held, reports repeats from its own clock on each tick, at a delay and interval in milliseconds. Phase 1 sets no repeats at all (6.3, H21). The remote, a hat and a keyboard then behave alike: a hat never repeats and the Keymapper drops keyboard repeats (E29).

Room-class hooks (H11). Some rooms aren’t sprite clicks (6.8). A room class may add targets of its own (a point, a label, and a sprite if it has one), say whether each is still valid, take a directional press for itself, and let OK click with no target (the corral). ButtonRoom implements the target hook with its visible buttons (H13). A class that does none of this behaves as today.

4.4 Data ownership and lifetime

4.5 Coordinate systems

4.6 Eligibility

Who decides whether a hotspot is interactive right now? There’s a difference between an object defined in the game data, an object currently visible, an object currently clickable, and an object currently meaningful to click.

Requirement: the engine hotspot provider supplies only targets the engine currently considers eligible for interaction. Static object definitions alone aren’t enough when game state controls availability. This keeps engine-specific scripting out of the shared navigation core.

The Phase 1 filter (H7, E36, E37). A sprite is a target when all hold:

  1. It’s not hidden or detached, and its hit type isn’t 0.
  2. It’s one of: an exit, a clickable, a requires object, an inventory object, a toolbar sprite (H7); or a target the room class adds through its hook, which for a ButtonRoom is each visible button (getButtonSprite()) (H13). Without this, the main menu, level select, quit screen, Sign In and the clue book would have no targets: their buttons are room-class buttons and engine sprites, not those kinds. getButtonSprite() is on ButtonRoom, not RoomClass, so the hook, a RoomClass virtual, is how the provider reaches it. A class that catches clicks on sprites of other kinds must add them the same way, or those sprites aren’t targets: Wizard’s Rule’s bottles are plain sprites (E45), and so are the characters the 15 classes of WP-107’s audit answer (H25).
  3. With an item in hand (the cursor isn’t the default arrow), exits and clickables are left out: they answer only the arrow (E34). Requires objects, inventory objects and the toolbar stay.
  4. handleMouse() would accept a click now: no scene running, input not blocked, the room class not busy (H7’s rule in 3.5). Otherwise the list is empty, and OK only skips (6.1).
  5. It has an interaction point on screen (4.5).

Characters, simple sprites, layers and the ghost are left out (H7), except the characters a room class adds through its hook (H25).

5. Directional navigation algorithm

5.1 Basic directional selection

Designed in WP-091 (2026-11-28). The core works on points only (H12), in integers. A press in direction d (H17, H18):

  1. Starts from the selected target’s point, or with no selection from the cursor’s position (5.5).
  2. Takes as candidates every other target whose point lies strictly further along d: for right x > the origin’s x, for left x < it, for down y > the origin’s y, for up y < it (y points down). A target level with the origin on that axis is never a candidate, so a press right never selects a target straight above or below.
  3. Sorts them into two tiers. Major is a candidate’s distance along d (always > 0) and minor its distance across d (≥ 0). A candidate with minor ≤ major lies within 45° of d and is tier 1, the boundary included; the rest are tier 2. Tier 2 is used only when tier 1 is empty.
  4. Scores each candidate of the tier as major² + 4·minor². The lowest wins.
  5. Breaks ties by the smaller major, then the smaller y, then the smaller x. The points are distinct (H22), so this is a total order and the result never depends on the list’s order.
  6. Stays when no target is a candidate (5.4).
  7. Falls back to reading order for left and right if the choices of steps 1–6 would leave some target unreachable (5.8, H20).

The core returns the chosen target’s index in the list it was given.

5.2 Selection scoring

5.3 Special cases

Case Rule or answer Appendix C
Overlapping and nested sprites Their points are distinct, since each hit-tests to its own sprite, front first (E49). They’re navigated like any two close points C6
A large object One point, where the provider’s search found it (4.5). A press measures from that point, not from the object’s middle or edges —
Closely spaced targets The score picks the nearer, and the tie-break settles the rest C6
One target Every press from it stays. With no selection, any press selects it C14, C15
No targets The list is empty, the core returns none, and nothing moves (4.6) —
A row or a column (the menus) Along the line, the neighbour. Across it, tier 2’s lowest score if there is one, otherwise stay C2, C3, C4, C12
Equal distance The tie-break: the smaller major, then the smaller y, then the smaller x C10, C15
Exactly 45° Tier 1 for both directions it lies between C10
Equal points Never given: the provider merges or re-searches them (H22). The core assumes distinct points —
Outside the view Never given: the provider drops points off screen (4.5) —
On the screen’s edge Nothing special. y = 479 is 239 px below a point at y = 240, and y = 0 is 240 px above it, so the bottom one is nearer C8

5.4 Wrap-around behavior

A press with no candidate stays: the selection doesn’t move. There’s no wrap at the screen’s edges, and it’s fixed, not a setting (H19):

The only wrap is in the fallback’s reading-order cycle (5.8), which runs only when the rules of 5.1 would strand a target.

5.5 Initial selection

The provider decides what current is, and the core uses it (H17):

Situation current A press starts from
A target selected, and the cursor at its point That target Its point
A target selected, but the cursor not at its point (the mouse or cursor mode moved it, or the target’s point was searched again after its sprite moved, 4.5) The selection is dropped first, then the rows below apply —
No selection, and the cursor over a target (hitTest() at the cursor gives a target’s sprite, or RoomClass::navTargetAt() gives a room-class target, Appendix B) That target: hovering counts as selected Its point
No selection, and the cursor over no target None The cursor’s position

“At its point” is tested against the point the cursor adapter last moved the cursor to, within 2 px. A backend’s own echo of the warp, rounded in a scaled window, mustn’t drop the selection (an inference about SDL; packet 6 checks it). The same rows apply on OK (6.1).

With no selection, a press runs 5.1’s rules from the cursor. If they find no candidate, it selects the target nearest the cursor: the smallest squared distance, then the smaller y, then the smaller x. This holds even while the reading-order fallback is in force (5.8): reading order has no place for a cursor, so the first press is always geometric (Appendix C, C9). So whenever a target is listed, a first press selects one, and no selection is never a trap (5.8).

5.6 Dynamic hotspots

Designed in WP-089 (Gen 1); the rules are in 4.4:

5.7 Performance

5.8 Hotspot reachability

The basic requirement isn’t that the selection moves intelligently. It’s that a child can reach every interactive object.

Jeff carried this forward with H9–H16 (2026-11-27): on the standard TV remote, with menu buttons and room-specific targets included.

As a graph (WP-091). For one list, the press graph has:

Jeff’s requirement is that this graph is strongly connected: there’s a path from every target to every other. With no selection, the state is the cursor’s position instead, and 5.5’s total rule handles it.

The rules of 5.1 alone don’t guarantee it. A scratch check during WP-091 (local only, never committed) applied them to random layouts of distinct points on a 640×480 screen:

Appendix C’s C9 is that five-target layout. From each neighbour, the target at (424, 129) loses every direction: where it’s inside the neighbour’s 45° cone, a better-placed target outscores it, and where it isn’t, a tier-1 target wins. Rounding the five points to tens removes the problem. Such layouts are rare and fragile, which is also why they can’t be ruled out.

The guarantee (H20). On each press the core also checks whether the list’s press graph under 5.1’s rules is strongly connected: it computes every target’s choice in every direction, then searches forward and backward from one target.

How reading order is built:

Why it holds:

Either way the graph is strongly connected. The argument needs only two things: distinct points, so reading order is a total order (H22), and right among the room’s directions. Packet 16 lets a room class take directions (H11). It passes the core the directions the room leaves it, and the cycle then uses the first of right, down, left, up that the core still has, with its opposite stepping back (H24).

What follows from it:

Why a whole-list switch, and not a repair. Changing only the edges that would let a stranded target in can break other paths, and each repair would need its own proof. A whole-list switch is one rule, easy to test, and the per-room check below names every room where it happens.

The switch has two costs:

The check reports the switch rather than hiding it. If it turns out common in real rooms, H20 is revisited.

What a snapshot can’t show. The guarantee holds per list. While targets move, appear or vanish between presses, the graph changes. Each press is still taken in a strongly connected graph, but a target that exists only between two presses may never be selected. Those cases are the live tests’ (12.2).

The per-room check (packet 5, on the listing hook of 12.7):

The result (WP-107, 2026-12-01, fork pin 837ca576da):

Where the core’s own tests run (H23).

6. Input and user experience

6.1 Control scheme

With Hotspot Assist on (Gen 1, WP-089). Gen 1 reads no right button except to skip a movie (E40), so there is no secondary action.

Input Magnet mode Cursor mode
D-pad up, down, left, right Select the next target that way (5.1) Move the pointer (ScummVM’s Virtual Mouse)
OK, short (released before the threshold) Click the selected target. First, 5.5’s rows apply as for a press: a selection the cursor has left is dropped, and with none, a target under the cursor is the one clicked, at the cursor (H17). With none: a click at the cursor if the room class is busy (a skip) or lets OK click with no target (the corral, H11); otherwise nothing Click at the pointer
OK, held past the threshold Switch to cursor mode when the threshold passes; the release clicks nothing Switch to Magnet mode when the threshold passes; the release clicks nothing
BACK Unchanged: skip in a game; held, the main menu (E8) Unchanged
MENU Unchanged: the main menu; held, the on-screen keyboard (E8) Unchanged

Magnet mode is where a game starts. At each room change the room class says which mode it starts in: Magnet by default, cursor mode for the rooms 6.8 plays with the pointer, and a close-up or Big Head keeps the mode the player was in (H10). A child who drifts into cursor mode is brought back at the next ordinary room. The threshold is 600 ms: over Android’s 400 ms repeat start (E26), short enough not to feel stuck (H10), to be tuned in the user-experience tests (12.6).

Off the TV. The D-pad moves the Virtual Mouse only because Android binds it there (E3); on Windows and the Raspberry Pi the Virtual Mouse’s own defaults are the left stick, so cursor mode moves with the stick or the mouse, and a D-pad-only controller can’t move the pointer unless the player rebinds it in the Keymaps tab (E44). A raw SDL joystick’s hat never reaches the Keymapper at all (E44); a recognised game controller’s D-pad does. Both are for packet 11 (Raspberry Pi validation).

6.2 Cursor-mode fallback requirement

A long press may already mean something on a remote: holding OK might repeat the click instead of switching modes.

Requirement: Hotspot Magnet must provide a reliable way to enter and leave conventional cursor mode using only the standard TV remote. The method must not depend on a system-reserved button, need extra hardware, or unintentionally activate a game object. Device testing on the TV sets the final mapping. This is a Phase 1 acceptance criterion (7.6).

The design (H1, H6; WP-089):

6.3 Standard TV remote limitations

6.4 Gamepad and keyboard support

The keymaps (H1, WP-089) — the structure is H16’s. TerraGlyph used to declare no keymap, so it got ScummVM’s default game keymap, which binds the D-pad to keypad arrow keys that the engine ignores (E27): on a TV the remote was dead in every TerraGlyph game. Since WP-113 its own initKeymaps() returns terraglyph-default with no directions and left click also on JOY_CENTER, so the D-pad drives the Virtual Mouse and OK clicks. Packet 6 builds on that keymap:

Keymap Actions and default bindings Enabled
terraglyph-default The default keymap’s actions with the same standard action ids, without the four directions, and with JOY_A moved to Magnet’s OK: left click (mouse left, and JOY_X, so a gamepad can still hold the button and drag with the stick), right click (mouse right, JOY_B), pause (Space), game menu (F5, left shoulder), skip (Escape, JOY_Y), skip line (period only), confirm. Partial matches off, as in the default (E27) Always
terraglyph-magnet-ok OK: JOY_CENTER (the remote), JOY_A (a gamepad), keypad Enter (Windows) Always
terraglyph-magnet-dir Up, down, left, right: JOY_UP…JOY_RIGHT (the remote, and a recognised SDL game controller’s D-pad), JOY_HAT_Y-/+ and JOY_HAT_X-/+ (an Android gamepad’s hat, E29), the arrow keys (Windows) Magnet mode only

6.5 Visual feedback

Phase 1 (WP-089) (H14):

6.6 Parent-friendly configuration

The option (H5, WP-089; E42):

   
Config key hotspot_assist
Label “Hotspot Assist”
Tooltip “Move between objects with the arrows; OK clicks. Hold OK for the free pointer.”
GUIO flag GAMEOPTION_HOTSPOT_ASSIST (GUIO_GAMEOPTIONS1)
Detection entries The three Gen 1 entries (Showdown English and Norwegian, Phantom): GUIO2(GUIO_NOMIDI, GAMEOPTION_HOTSPOT_ASSIST). Gen 2 and 3 stay GUIO1(GUIO_NOMIDI)
Declared TerraglyphMetaEngine::getAdvancedExtraGuiOptions(), from an ADExtraGuiOptionsMap (E23, E24)
Default Off
Read ConfMan.getBool("hotspot_assist", target) in initKeymaps(), and in the engine at start
Off No Magnet keymap and no Magnet code path runs: input is exactly today’s (7.6)

The option is TerraGlyph’s first: today the engine reads its settings with plain ConfMan calls and declares none (E42).

6.7 Accessibility considerations

6.8 Rooms that aren’t plain clicks

Some Gen 1 rooms read the held button or the pointer itself (E35). A click from component E is a real press and release (H9), so a room that needs only a click, wherever it lands, works in either mode. A room that needs the button held while the pointer moves can’t be played on the remote: the OK button sits inside the D-pad ring, so holding it while pressing a direction isn’t practical (an inference about the remote’s layout).

Room (Gen 1) What it reads With the remote, before assists
Main menu, level select, quit, the clue book (ButtonRoom) Hover, then a click Magnet mode, once room-class buttons are targets (H13)
Sign In’s player list A click inside a row; a second click within 1 s plays Magnet mode through its buttons (WP-107): up and down move the selection a row at a time, and Play plays the selected player. The rows themselves aren’t targets
The artifact jigsaw (Showdown) Click a piece, move it near its place (no button held), it snaps Cursor mode, or a hook adding the target places
Maria’s game (Phantom) Click an item, carry it, click to throw Cursor mode, or a hook adding the pans
Pie Noon (Showdown) Scooby follows the pointer’s x; a press throws Cursor mode
The corral (Showdown) A press at the right moment, anywhere Either mode, once its hook lets OK click with no target
The Options knobs Press on a knob, drag along its line, release Not playable on the remote
Brad’s game (Phantom) Press on a piece, drag it its way more than 60 px, release Not playable on the remote
The vault’s clock (Showdown) Press on a hand, circle the pointer while held, release Not playable on the remote
Knights of the Snack Table (Phantom) Shaggy follows the pointer’s y to the nearest of three benches; a press at his bench fills a mug, and the release slides it (E46) Cursor mode, like Pie Noon, which the room starts in (H10). A short OK serves, if the tick that moves Shaggy sees H9’s press while he’s at the bench (packet 6)
Wizard’s Rule (Phantom) A click on one of six bottles, on the song’s beat (E45) Magnet mode: its class adds the six bottles as targets (WP-107)
The drawbridge (Phantom) A click on one of four flags, plain sprites the flags’ own update reads (WP-107’s audit) Magnet mode: its class adds the flags as targets while they answer the arrow (WP-107)

H11: room-class hooks (4.3), with one assist per room in its own later packet: the hook adds the room’s own targets, and a directional press in Magnet mode is passed to the class first, so a knob or a clock hand turns with left and right, and a piece of Brad’s armour comes off with the direction it needs. The assists aren’t designed here; they’re packet 16 in §11. Until each lands, that room is tracked as unsupported by the standard remote: it’s played with a mouse, or a gamepad holding JOY_X (left click, 6.4) and steering with the stick, and the gap is listed in the Phase 1 results.


Part III — Implementation roadmap

7. Phase 1: TerraGlyph prototype

Objective: demonstrate Hotspot Magnet in a working TerraGlyph game without modifying the original game assets. Phase 1 is valuable on its own.

7.1 Implementation boundaries

7.2 TerraGlyph hotspot provider

7.3 Cursor and input integration

7.4 Configuration

Specified in 6.6 (key, flag, entries, default) and 6.4 (what the keymaps are with it on and off). Phase 1 checks the off state by comparing a run with the option off against today’s build: the same keymaps listed in the Keymapper tab, and the same self-test results.

7.5 Testing environments

7.6 Phase 1 acceptance criteria

8. Phase 2: SCUMM / Humongous Entertainment

Objective: demonstrate reuse of the navigation core in a second ScummVM engine.

8.1 Initial game selection

8.2 SCUMM hotspot provider

8.3 Reusing the navigation core

8.4 Compatibility investigation

8.5 SCUMM maintainer coordination

Questions to ask before deep implementation:

8.6 Phase 2 acceptance criteria

9. Phase 3: shared ScummVM integration (goal)

Preconditions: Phases 1 and 2 demonstrated; research complete; maintainer feedback received.

9.1 Shared code extraction

9.2 Shared configuration and input

9.3 Upstream contribution strategy

9.4 Upstream justification

9.5 Acceptance criteria

Upstream acceptance is an external decision, not a guaranteed project milestone.

10. Risks, constraints, and open questions

Rank by severity × likelihood once the research is done.

10.1 Technical risks

10.2 Usability risks

10.3 Integration risks

10.4 Open design decisions

A living decision register. The recommendations are WP-086’s proposals. Jeff decided H1–H5, H7 and H8 on 2026-11-26, and H6 on 2026-11-27 after the remote capture (3.2). H9–H16 are WP-089’s proposals; Jeff decided them on 2026-11-27. H17–H24 are WP-091’s proposals; Jeff decided them on 2026-11-28, all approved, three with clarifications. H25 came out of WP-107’s click audit; Jeff decided it on 2026-12-02. Status is Jeff’s word for each, and what’s still provisional is said in its resolution.

With H9–H16 Jeff carried one requirement forward: every eligible hotspot, menu buttons and room-specific targets included, stays reachable with the standard TV remote, with no subset of targets the player can’t leave (5.8, 7.6).

# Question Alternatives Recommendation Evidence Status Resolution
H1 Input integration (a) a game keymap that binds JOY_UP…JOY_CENTER while Magnet mode is on; (b) handle raw joystick events in the engine; (c) a new Global keymap (a): it wins over the Virtual Mouse for those buttons only in games, stays rebindable, and turning it off is the fallback. Add JOY_HAT_* for game controllers E2, E3, E6 Approved (2026-11-26) (a), a game keymap
H2 Provider interface (a) Engine::getHotspotPositions() as is; (b) it, plus a stable id; (c) a new interface (a) first, (b) if keeping the selection across refreshes needs it. Five engine implementations already fill it, SCUMM’s among them; TerraGlyph implementing it also gets the hotspot display E12, E13, E16 Approved for prototype (2026-11-26) (a), the existing interface. If refreshing the list makes the selection unstable, investigate stable hotspot ids (b)
H3 Cursor placement (a) the target’s centre; (b) the first point on a small grid, centre first, that hit-tests to the target (b), as SCUMM does; no such point means not eligible E16, E18 Approved (2026-11-26) (b), a validated interaction point. Prefer a point the engine supplies when it has one; otherwise the hit-tested grid. Never assume the rectangle’s centre is clickable
H4 Shared-code location common/, gui/, engines/, backends/keymapper/, graphics/ engines/, beside the hotspot display, with the algorithm a standalone class E11–E15 Provisional (2026-11-26) engines/ as the preferred future location, subject to ScummVM maintainer feedback (13.3). The first implementation stays inside engines/terraglyph/
H5 Per-game setting (a) an engine extra option now, a shared key in Phase 3; (b) a shared key now (a): a standard option in TerraglyphMetaEngine, default off E14, E23, E24 Approved (2026-11-26) (a), TerraGlyph-specific at first
H6 Cursor-mode fallback on the remote (a) hold OK, timed from press to release, with a short press activating on release; (b) BACK or MENU (a). BACK and MENU are taken (skip, main menu, keyboard). The capture supports it: the remote sends one press and one release for a held OK, and Android’s repeats (every 50 ms after 400 ms) can be ignored while the button is down. Proposed: a short press activates on release; a hold past a threshold (over 400 ms, so it’s a deliberate hold) enters cursor mode, and its release activates nothing E7, E8, E22, E25, E26 Approved (2026-11-27) (a), hold OK: a short press activates on release; a hold past a threshold over 400 ms enters cursor mode and its release activates nothing; repeated downs while OK is held are ignored. A long press must never activate a hotspot, and the fallback works on the standard remote with no extra hardware. The input integration packet confirms the event sequence inside ScummVM on the TV (E26’s open item)
H7 TerraGlyph eligibility The rule in 3.5, with or without characters The rule in 3.5, without characters at first E18–E20 Approved (2026-11-26) The rule in 3.5: only objects that are visible, eligible and hittable now. Characters come later, once their click behavior is verified
H8 Hotspot refresh (a) query on each press; (b) every frame, as the display does (a): navigation only needs the targets when a key is pressed E13 Approved (2026-11-26) (a), refresh on directional input. Also invalidate the current selection when game state changes: a hotspot that disappears or is disabled must never stay activatable
H9 Activation (4.2 E) (a) push EVENT_LBUTTONDOWN and EVENT_LBUTTONUP through the event queue; (b) call handleMouse(false, p) then handleMouse(true, p), as test_script’s click; (c) the engine sets _mouseDown, calls handleMouse(true, p) itself, and clears _mouseDown after one game tick has seen it (c): it gives the rooms that read the held button (the corral, Pie Noon, ButtonRoom’s pressed frame) a real press, which (b) doesn’t; and unlike (a) its release can’t be lost, since a movie’s event loop drops releases and warpMouse() purges queued mouse events, which would leave _mouseDown stuck. Ticks are counted in the tick loop (36/s), not frames (60/s) E31, E34, E35, E40, E41 Approved (2026-11-27) (c), an engine-managed press and release through the existing click path. The release is guaranteed, including during room transitions, cutscenes and interruptions. Provisional: whether the one-tick release satisfies the rooms that need a held button is verified in implementation
H10 Starting mode and hold threshold (6.1) Mode: (a) the room class says its starting mode, Magnet by default and cursor mode for the pointer rooms of 6.8, with close-ups and Big Head keeping the player’s mode; (b) Magnet at every room change; (c) keep the mode across rooms. Threshold: 600 ms, or another value over 400 ms (a) and 600 ms, tuned in the user-experience tests (12.6). (b) would throw a child out of cursor mode at every close-up E26, E29, E35, E38 Approved, provisional timing (2026-11-27) (a), room-specific starting modes, with close-ups and Big Head keeping the player’s mode. 600 ms is the initial long-press threshold, provisional, subject to TCL remote testing and usability validation
H11 Rooms that aren’t plain clicks (6.8) (a) room-class hooks (own targets, a direction for the class, a click with no target, a starting mode), with one assist per room in its own later packet; (b) cursor mode only, and the three hold-and-drag rooms left to a mouse or a gamepad; (c) a drag lock in cursor mode (a): the Options knobs, Brad’s game and the vault’s clock can’t be played on the remote any other way, since OK sits inside the D-pad ring. The assists aren’t designed yet and need a packet in §11 (14.3); until each lands, its room is a Phase 1 gap, playable with a mouse or a gamepad holding JOY_X E35 Approved (2026-11-27) (a), room-specific assist hooks, with a dedicated packet for special-room accessibility (§11, packet 16). The Options knobs, Brad’s game and the vault’s clock are tracked as unsupported by the standard remote until their assists are implemented
H12 Identity and geometry (4.3) (a) an identity (source, index) beside the list, and points only; (b) an id or a box on the shared record (H2’s (b)) (a): HotspotInfo unchanged; packet 3 raises (b) if its scoring needs a box E12, E18 Approved (2026-11-27) (a), points with separate stable target identities. ScummVM’s hotspot record stays unchanged at first; the interface is revisited only if WP-091 shows a concrete need
H13 Room-class targets (4.6) Extend H7’s kinds with the targets a room class adds (a ButtonRoom’s visible buttons), or keep H7’s kinds only Extend: without it the main menu, level select, quit screen, Sign In and the clue book have no targets. H7’s click gate and its other conditions still apply E36 Approved (2026-11-27) Extend. Menu buttons are eligible targets whenever they are visible and accept interaction, under the same eligibility checks as every other hotspot
H14 Feedback (6.5) (a) the game’s own cursor and rollover, no marker, and the mode shown by behavior; (b) a one-item marker from ScummVM’s hotspot renderer in Magnet mode (a) for Phase 1, with (b) next if the user-experience tests show children can’t tell the modes apart E32 Approved (2026-11-27) (a) for Phase 1. The usability tests (12.6) must establish whether children can tell Magnet mode from free-pointer mode; if they can’t, add an explicit selection or mode indicator
H15 The test-build gesture (6.3) Live with it in test builds and tell testers; ask WP-085’s successor to change the gesture Live with it: release builds don’t have it, and the gesture is WP-085’s E33 Conditional (2026-11-27) Not “live with it” as proposed. Keep WP-085’s diagnostic gesture, but it must not unexpectedly interrupt normal Magnet navigation. Investigate disabling it while Magnet mode is active; if that needs disproportionate changes, document the conflict as a temporary test-build limitation. Release builds must be unaffected. WP-091 is not expanded for it
H16 Keymap structure (6.4); refines H1 (a) three keymaps: the default without the directions and with JOY_A moved to OK and JOY_X to left click, OK always on, the directions in Magnet mode only; the default unchanged when the option is off; (b) one Magnet keymap toggled whole, as H1’s wording has it (a): turning one whole keymap off, as H1 says, would also unbind OK in cursor mode, where the Virtual Mouse can’t click; and a direction left in an always-on keymap would keep the Virtual Mouse from the D-pad. H1’s intent, that the D-pad goes back to the pointer, is kept E4, E27, E28, E44 Approved, subject to input testing (2026-11-27) (a), three keymaps. Required: Magnet mode captures directional navigation; free-pointer mode restores conventional D-pad movement; OK works in both modes; turning Hotspot Assist off restores the existing input behavior; no button is left permanently unavailable after a mode switch. Provisional: keymap precedence and activation are verified in implementation
H17 Where a press starts (5.5) (a) The selection is valid only while the cursor is at its point (within 2 px of where the cursor adapter put it), on a press and on OK. navigate() returns current to stay and −1 only for an empty list, refining 4.3’s “none to stay”. The provider passes a hovered target as current. With no selection, a press runs 5.1’s rules from the cursor, otherwise selects the nearest target. Scenes drop the selection (4.4), and hover picks it up again. (b) Keep the selection across cursor moves and scenes, as §5.6 first had it. (c) The core decides hover by point distance (a): the provider has the hit test the core lacks. One rule (the cursor at the point) covers the mouse, cursor mode and a moved sprite, and the hover row restores the player’s place after a scene without breaking H8. The rule is total, so no selection is never a trap E34, E38, E49 Approved with clarification (2026-11-28) (a). H8 is preserved: scene transitions still clear the selection. Selection is cursor-based, with the 2 px tolerance: it expires when the cursor moves away, and hover may pick a target up again. A directional press moves from the valid selection, otherwise from the cursor, and only establishes or moves the selection; it never activates a target. OK activates the selected or hovered target. §4.3 says so (current to stay, −1 only for an empty list)
H18 Candidates and score (5.1, 5.2) (a) A strict half-plane; a 45° tier first; major² + 4·minor² in integers; ties by major, then y, then x; HotspotInfo::type ignored. (b) Android’s 13·major² + minor² with a beam, which needs boxes (H12). (c) A 90° cone only, nothing outside it (a): it works on points, sends right to what’s to the right, and is integer and order-free. (c) would leave a menu’s off-axis buttons unreachable by left and right, and lean harder on the fallback E49, App. E Approved (2026-11-28) (a), exactly as recommended: point-based scoring, the 45° preference, the weighted distance and deterministic integer tie-breaking. Exits get no priority. H12 is preserved; the hotspot record isn’t expanded
H19 Nothing in the direction (5.4) (a) Stay, with no wrap, fixed. (b) Wrap to the far side. (c) A setting (a): predictable for a child. Reachability doesn’t need wrap (5.8), and it’s one less option (6.6) App. C Approved (2026-11-28) (a). With no candidate in the direction, the selection stays. No wrap-around in spatial navigation
H20 The reachability guarantee (5.8) (a) 5.1’s choices, and if their graph isn’t strongly connected, left and right follow a reading-order cycle (32 px rows) for that list. (b) Left and right always in reading order. (c) Repair only the edges a stranded target needs. (d) 5.1’s rules alone, with the per-room check. (e) A reading-order step only on a press with no candidate, the requirement’s own example (5.8) (a): a two-line proof for any list of distinct points, and the geometric feel wherever it already works, which the scratch check suggests is nearly always. The per-room check names each room where the fallback runs. (d) can’t guarantee it (App. C, C9), and neither can (e): in C9 every press has a candidate, yet c is stranded. (c) needs a proof per repair, and (b) loses the geometry in every room E50, App. C Approved with clarification (2026-11-28) (a). Reachability is a requirement, not a preference: every target must be reachable from every other. Natural spatial navigation wherever it works; where a room’s target list fails, left and right use reading order for that list, with the deterministic 32 px row rule. The per-room check verifies reachability from every target and names in its output each room that needs the fallback. A room that fails reachability is never accepted silently (7.6)
H21 Repeats and double reports (6.3) Repeats: (a) none in Phase 1, with a repeat handled as a press if one is added later; (b) a delay of 500 ms (18 ticks) and an interval of 250 ms (9). Double reports: ignore a start within 80 ms (3 ticks) of the same direction’s end, or not (a), and ignore within 80 ms: a child holding a direction overshoots, and the lists are short. The debounce is far below a child’s double tap. Both are tuned on the TV (packets 6 and 10) E26, E33 Approved, provisional timing (2026-11-28) (a). One movement per physical directional press; no held-direction repeat in Phase 1. Duplicate suppression starts at 80 ms, held in one named constant so that TV hardware testing (packets 6 and 10) can change it without touching the design
H22 Equal points (5.3) (a) The provider guarantees distinct points: a room-class target on a room sprite is that sprite’s target, merged; toolbar sprites that click the same index (an item over its slot, the snack box’s digits) are one target; for any other coincidence, the later target’s point moves to its next grid point (4.5). (b) The core handles equal points by list index (a): two targets at one point lie in no direction from each other, so a points-only core would strand one, and a tie by index depends on list order E49 Approved with clarification (2026-11-28) (a). Targets that are one logical interaction merge into one target. Two genuinely different interactions stay separately reachable even when their points or sprites overlap. Any remaining collision resolves deterministically: the moved point still hit-tests to its own target, stays inside the valid navigation area, and creates no new collision. Moving a point never changes which interaction is activated (7.6)
H23 Where the core’s tests run (5.8) (a) The self-test in Phase 1, and CxxTest when the core moves to engines/ (packet 15). (b) CxxTest under test/engines/terraglyph/ now, with a TerraGlyph block in the shared test/module.mk. (c) Both (a): it changes no shared file (7.1) for a pure function the self-test exercises just as well. Upstream’s CxxTest comes with the move upstream E47 Approved (2026-11-28) (a). Phase 1’s unit tests run through the engine’s self-test, and move to ScummVM’s CxxTest with the core during packet 15
H24 The directions a room leaves to the core (5.8; H11) (a) Phase 1’s navigate() unchanged, since every room leaves all four. Packet 16 adds a directions parameter when a room class first takes one, and the cycle then uses the first of right, down, left, up that’s still left. (b) Add the parameter now (a): no room takes a direction before packet 16, and a parameter added now would go untested. For packet 16: a class may take a direction only while a given target is selected (a knob), so the parameter may need to be per target, and 5.8’s proof then needs the cycle’s direction left to the core at every target. With only one of a pair left, it steps forward — Approved (2026-11-28) (a). navigate() stays unchanged in Phase 1; packet 16 introduces direction availability when the room assists need it. The reachability guarantee must hold when a room reserves directions: a control that consumes them (a selected knob turning with left and right) must leave a reliable way out, with every other target still reachable. That is one of packet 16’s acceptance criteria (§11)
H25 Characters a room class answers (4.6; WP-107’s audit) (a) Each class that gives a character click a meaning adds that character through its hook, as 4.6 rule 2 reads: 11 classes for the clicks that move the story on, 15 with those that only give a line. (b) Keep H7: no characters. Phase 1 then can’t finish either title in Magnet mode. (c) Revisit H7 for every character (a), all 15: without the 11, neither title can be finished with the remote alone. Characters no class answers stay out, as H7 has it E18–E20; WP-107’s audit Approved (2026-12-02) (a), all 15. Each class lists its characters while the cursor it answers is up, and the per-room check holds each item’s cursor such a target answers

11. Development work packets

Work packets live in their own WP-NNN files under work-packets. This plan sets only their sequence and goals; detailed tasks, files touched, and test procedures belong in the packets. Numbers are assigned when each packet is drafted.

# Proposed packet WP
1 Input and hotspot-feature research (Section 3 except 3.6) WP-086 ✅
2 Hotspot Magnet interface design WP-089 ✅
3 Directional algorithm design and test cases (including the reachability check) WP-091 ✅
4 Directional selection implementation (hand-written) WP-106 ✅
5 TerraGlyph hotspot provider, with the listing hook and the per-room check WP-107 ✅
6 TerraGlyph input integration —
7 Dynamic hotspot handling —
8 Configuration and fallback —
9 Windows validation —
10 Android TV validation —
11 Raspberry Pi validation —
12 SCUMM/HE research —
13 SCUMM maintainer consultation —
14 SCUMM/HE prototype —
15 Shared code proposal —
16 Special-room accessibility: room assists for the Options knobs, Brad’s game and the vault’s clock (6.8, H11). Acceptance includes H24’s: a control that consumes directions leaves a reliable way out, and every other target stays reachable —

The two research packets of the first draft are one, and the directional algorithm is split into its design with test cases and its implementation. Packet 16 was added with Jeff’s H11 (2026-11-27).

Each packet includes: goal, prerequisites, files touched, design constraints, hand-written implementation tasks, test procedure, done-when criteria, and documentation updates.

12. Testing and validation matrix

12.1 Test environments

12.2 Navigation tests

12.3 Interaction tests

12.4 Regression tests

12.5 Evidence collection

Record for each test: environment, game and version, build identification, steps, expected and actual result, pass/fail.

12.6 User experience validation

The technical criteria can all pass and the feature still feel confusing. Watch whether a child can:

These are observational tests, recorded as what was seen, not claims that a given age group will succeed.

12.7 Test hooks

Designed in WP-089 (Gen 1), so packets 3–8 can be tested without a remote (E41):


Part IV — Upstream strategy and governance

13. ScummVM community engagement

13.1 Early architectural feedback

Introduce the accessibility problem, describe the proposed approach, ask about existing solutions, and ask for guidance before the SCUMM integration.

13.2 Draft community post

A short, editable draft for Discord or the ScummVM forum, to be written after the research.

13.3 Maintainer feedback register

Date Contributor/maintainer Feedback Architectural implications Decision or follow-up
(none yet)        

13.4 Upstream submission readiness

Working demonstrations, code quality, tests, documentation, review feedback, and licensing and contribution compliance. The engine’s own upstream path is in the upstream submission decision brief.

14. Decisions, dependencies, and next steps

14.1 Settled project direction

Requirements adopted on 2026-11-26 from the review:

14.2 Decisions requiring research

14.3 Immediate next steps

  1. Run WP-086 ✅ 2026-11-26: Section 3 is verified except 3.6.
  2. Jeff decides H1–H8 ✅ 2026-11-26: H1–H5, H7 and H8 decided in §10.4; H6 on 2026-11-27.
  3. Capture the TCL remote’s buttons ✅ 2026-11-27 (3.2, E26): held OK sends one press and one release; Android repeats it.
  4. Get early maintainer feedback, which also settles H4.
  5. Draft the interface design packet 📝 2026-11-27: WP-089, from the §10.4 decisions and the remote capture.
  6. Run WP-089 ✅ 2026-11-27: Part II designed except the algorithm; evidence E27–E44, proposals H9–H16.
  7. Jeff decides H9–H16 ✅ 2026-11-27 in §10.4: all approved except H15, which is conditional; H10’s timing and H16’s keymap behavior are provisional.
  8. Draft the directional algorithm packet 📝 2026-11-27: WP-091 (§11, packet 3), against the core’s contract (4.3) and the target-listing hook (12.7).
  9. Add a packet for the room assists ✅ 2026-11-27: packet 16 in §11 (H11), for the rooms of 6.8.
  10. Run WP-091 ✅ 2026-11-28: §5 designed; evidence E45–E50, proposals H17–H24, the navigation examples (Appendix C) and the prior art (Appendix E).
  11. Investigate disabling the test-build D-pad gesture while Magnet mode is active (H15), with the input integration (packet 6). Release builds must stay unaffected.
  12. Jeff decides H17–H24 ✅ 2026-11-28 in §10.4: all approved, H17, H20 and H22 with clarifications, and H21’s 80 ms provisional until the TV tests.
  13. Draft packet 4 and packet 5 📝 2026-11-28: WP-106 (the core) and WP-107 (the provider). Packet 4 writes the core by hand from §5 and Appendix C. Packet 5 writes the provider, with the listing hook and the per-room check of 5.8, and checks each room class that catches clicks itself for targets H7’s kinds leave out (4.6, E45).
  14. Run WP-106 ✅ 2026-12-01: the core is in the fork (barefootbetters/scummvm#61, 837ca576da), with its self-test passing on both titles.
  15. Run WP-107 ✅ 2026-12-01: the provider is in the fork (barefootbetters/scummvm#62, dcf2630b21), and its per-room check passes on both titles with no room needing the fallback. 2026-12-02: the character targets of H25 are in too (barefootbetters/scummvm#66, 37b75bf77e), and the check, now with item-held states and a story pass, passes in 162 listed states.
  16. Jeff decides WP-107’s two open questions ✅. The classes that give a character click a meaning: 2026-12-02, all 15 (H25). The covered targets and empty rooms: 2026-12-04, accepted as listed (WP-107 §Result).

15. Appendices

Appendix Contents
A Source code reference index, below
B Interface declarations, below (WP-089)
C Navigation examples, below (WP-091)
D Terminology, below (WP-089)
E References, below: the prior art (WP-091); contribution guidelines, accessibility guidance and maintainer discussions still to add

Appendix A: source code reference index

Every file WP-086 read, at the fork’s ff490ad9449f, with the symbols used.

File Symbols
common/events.cpp EventDispatcher::dispatch
backends/keymapper/keymapper.cpp Keymapper::mapEvent, getMappedActions, executeAction, hardcodedEventMapping
backends/keymapper/keymap.cpp Keymap::getMappedActions, loadMappings, getActionDefaultMappings
backends/keymapper/hardware-input.cpp JOY_UP…JOY_CENTER definitions
backends/keymapper/virtual-mouse.cpp, .h VirtualMouse::addActionsToKeymap, handleAxisMotion, pollEvent, notifyEvent, computeJoystickMouseSpeedFactor
backends/keymapper/standard-actions.cpp kStandardActionToggleHotspots
backends/events/default/default-events.cpp Virtual Mouse construction; EVENT_HOTSPOTS_SHOW/HIDE handling; Global keymap
backends/platform/android/android.cpp getKeymapperDefaultBindings, feature flags, kbdmouse_speed default
backends/platform/android/events.cpp OSystem_Android::pushEvent (JE_KEY, JE_GAMEPAD, JE_DPAD, JE_JOYSTICK, JE_TV_REMOTE), pollEvent
backends/platform/android/jni-android.cpp JNI::pushEvent
backends/platform/android/touchcontrols.cpp, options.cpp TouchControls::draw, update; applyTouchSettings
backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java onKey, onGenericMotionEvent, processJoystickInput, BACK/MENU long press
gui/editgamedialog.cpp, gui/options.cpp enable_hotspots and sibling options; Pointer Speed
engines/engine.h, engine.cpp getHotspotPositions, drawHotspots, createHotspotRenderer, hotspotDirty, showHotspots, suspendHotspots, effectiveHotspotKeyMode
engines/metaengine.cpp, .h createHotspotAction, hotspotsEnabled, ExtraGuiOption, registerDefaultSettings, engine-default keymap
engines/advancedDetector.h, .cpp ADExtraGuiOptionsMap, getAdvancedExtraGuiOptions, getExtraGuiOptions
engines/dialogs.cpp ExtraGuiOptionsWidget::load, save
graphics/hotspot_renderer.h, .cpp HotspotType, HotspotInfo, HotspotStyle, HotspotRenderer
engines/scumm/object.cpp, scumm/metaengine.cpp ScummEngine::getHotspotPositions, findObject; keymap opt-in
engines/touche/touche.cpp ToucheEngine::getHotspotPositions
engines/hollywood/hotspots.cpp, monsters/hollywood.cpp, runaway/engine.cpp HotspotSource::getHotspotPositions and both games’ overrides
engines/macs2/macs2.cpp getHotspotPositions and its snapshot
engines/lab/metaengine.cpp, lab/engine.cpp, lab/processroom.cpp “FOCUS” action, setCurrentClose
engines/mohawk/riven.cpp, riven_card.cpp; engines/mads/core/game.cpp; engines/grim/grim.cpp; agos/metaengine.cpp; sword25/metaengine.cpp Keyboard hotspot actions (none reusable)
engines/awe/metaengine.cpp, detection_tables.h, awe.cpp Extra-option example
engines/terraglyph/room.h, room.cpp, cel.cpp Room::hitTest, Room::Sprite, Kind, sprite accessors, getPolygon, hitPolygon, hitCels
engines/terraglyph/terraglyph.cpp, inventory.cpp, inventory.h handleMouse, updateHover, test_script click, checkAllRooms; toolbar sprites
engines/terraglyph/metaengine.h, detection_tables.h; chase_check.cpp, chase_rooms.h, accusation_rooms.h Meta-engine overrides, GUIO flags; check harness; close-up and Big Head classes

Added by WP-089, at 0d5a69c7694f:

File Symbols
engines/metaengine.cpp, .h; base/main.cpp; engines/sky/metaengine.cpp MetaEngine::initKeymaps (the default game keymap); where game keymaps are added; Sky’s own keymap
engines/touche/metaengine.cpp; engines/bbvs/bbvs.cpp, bbvs/metaengine.cpp Two game keymaps with custom actions; toggling one keymap during play
backends/keymapper/keymapper.cpp, .h, keymap.h, keymap.cpp, action.h, action.cpp, hardware-input.cpp getMappedActions, mapEvent, convertStartToEnd, setGameKeymapState, getKeymap, setEnabled, allowKbdRepeats, axis thresholds, JOY_HAT_X/Y
backends/events/sdl/sdl-common-events.cpp, backends/platform/android/events.cpp Hat to D-pad buttons (SDL); hat as axis motion (Android)
gui/gui-manager.cpp, engines/engine.cpp saveState, restoreState; runDialog, pauseEngine, drawHotspots
backends/modular-backend.cpp, backends/graphics/windowed.h, backends/graphics/android/android-graphics.h, backends/events/default/default-events.cpp warpMouse, setSystemMousePosition; the event manager’s mouse position
graphics/hotspot_renderer.cpp setHotspots, exchangeHotspots, renderOverlay, overlay ownership
backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java, advanced/…/AdvancedMode.java, dists/android/build.gradle dispatchKeyEvent, the test-build gesture, its debug-only source set
engines/terraglyph/terraglyph.cpp, .h Main loop, handleMouse, showRoom, drawRoom, checkAllRooms, runTestScript, isMouseDown, getMousePos
engines/terraglyph/room.cpp, room.h, room_class.cpp, .h, room_script.h, inventory.cpp, .h Kinds, polygon box, hitsPoint, cursor sprite; addButton, getButtonSprite, isBusy; RoomScript::isBusy; isInputBlocked, toolbar parking
engines/terraglyph/options_rooms.cpp, pienoon_rooms.cpp, corral_rooms.cpp, brad_rooms.cpp, chase_rooms.cpp, maria_rooms.cpp, vault_rooms.cpp, signin_room.cpp, menu_rooms.cpp, accusation_rooms.cpp, movie.cpp The held-button, drag and pointer-reading rooms; the menu rooms’ buttons; Sign In’s keys; the movie’s event loop

Added by WP-091, at 1539a7b59cf3:

File Symbols
engines/terraglyph/wfr_rooms.cpp, .h; kst_rooms.cpp, .h WizardsRuleRoom::claimPlacement, click; KstRoom::updateShaggy, slideMug, hidesCursor
engines/terraglyph/room.cpp, room_class.h, inventory.cpp, inventory.h Room::hitTest, the claim’s kinds; RoomClass::isBusy; the toolbar’s slots and buttons
test/module.mk, test/engines/twine/gridtest.h, engines/terraglyph/configure.engine Engine unit-test wiring; TerraGlyph off by default
engines/lab/processroom.cpp LabEngine::setCurrentClose
tools/probe_art.py (this repo) --list: placements per room

Appendix B: interface declarations

Design-level declarations for the Phase 1 prototype (WP-089), with no function bodies. They’re a contract for packets 4–8, not code to paste: the engine C++ is written by hand (14.1), and a packet that departs from these records why. Names are proposals. B and C use no TerraGlyph type.

// --- B. Navigation core (shared; engines/terraglyph/ in Phase 1, H4) ---
namespace HotspotMagnet {

enum Direction { kDirUp, kDirDown, kDirLeft, kDirRight };

// The index of the target to select; current itself to stay; -1 only for
// an empty list. current is -1 when nothing is selected (the provider passes
// a hovered target, 5.5); from is the cursor's position. A repeat is handled
// as a press (H21). The rules are 5.1-5.5; the guarantee is 5.8. Points
// must be distinct (H22). With current -1 the press is always geometric
// from the cursor, even while the reading-order fallback is in force.
int navigate(const Common::Array<Graphics::HotspotInfo> &targets,
             int current, const Common::Point &from,
             Direction dir, bool repeat);

// Whether 5.1's choices alone make every target reachable from every other.
// When false, navigate() uses the reading-order fallback for left and right
// (5.8). For the per-room check and the log.
bool isGeometricConnected(const Common::Array<Graphics::HotspotInfo> &targets);

// Added in WP-106, for the core's self-test: the choice by direction alone
// from a point (5.1, before the fallback), or -1 when nothing lies that way;
// and the targets' indices in reading order (5.8). navigate() also asserts
// that current is -1 or a valid index.
int geometricChoice(const Common::Array<Graphics::HotspotInfo> &targets,
                    const Common::Point &from, Direction dir);
void readingOrder(const Common::Array<Graphics::HotspotInfo> &targets,
                  Common::Array<int> &order);

// --- C. Input adapter (shared) ---
enum Mode { kModeMagnet, kModeCursor };
enum Action { kActUp, kActDown, kActLeft, kActRight, kActOk };

struct Result {
	enum Kind { kNone, kNavigate, kActivate, kEnterCursor, kEnterMagnet } kind;
	Direction dir;  // for kNavigate
	bool repeat;    // for kNavigate
};

class InputAdapter {
public:
	// All times in milliseconds. holdMillis: OK's threshold, 600 (H10).
	// repeatDelay 0 means no repeats, Phase 1's setting (H21).
	// debounceMillis: a direction's start within it of that direction's last
	// end is ignored, 80 (H21).
	InputAdapter(uint32 holdMillis, uint32 repeatDelay, uint32 repeatInterval,
	             uint32 debounceMillis);
	Result actionStart(Action action, uint32 now);  // device repeats ignored
	Result actionEnd(Action action, uint32 now);    // an end with no start ignored
	Result tick(uint32 now);   // the hold threshold, and the adapter's repeats
	void reset();              // room change, movie, pause: no click
	void setMode(Mode mode);   // the room class's starting mode (H10)
	Mode getMode() const;
};

} // namespace HotspotMagnet

// --- A, D, E. TerraGlyph (Gen 1) ---
struct MagnetTarget {           // a target's identity (4.3, 4.4)
	enum Source { kRoom, kRoomClass } source;
	int index;                  // a sprite, or the class's own target number
};

// Added in WP-107. The hover lookup (5.5): the target under p, or -1. And
// 5.5's `current` as one function: the selection (null for none) holds while
// it's listed, its point is still warp (where the cursor was last put) and
// the cursor is within 2 px of warp on each axis (kMagnetPointSlack);
// otherwise the hover; otherwise -1. dropped tells packet 7 to drop it.
//   int targetAt(const Common::Array<MagnetTarget> &ids, const Common::Point &p);
//   int magnetCurrent(const Common::Array<Graphics::HotspotInfo> &targets,
//                     const Common::Array<MagnetTarget> &ids,
//                     const MagnetTarget *selection, const Common::Point &cursor,
//                     const Common::Point &warp, bool &dropped);
// hotspotDirty() compares with what getHotspotPositions() last listed, so a
// read changes nothing. Room::getHitBox() takes a uint and isn't const (a
// cel hit decodes its cels on first use); Room::getDrawOrder() and
// Inventory::getToolbarIndex() are added for the provider. A NavTarget's
// point (-1, -1) asks the provider to search its sprite (4.5).

class TerraglyphEngine {
	// A. Every current target (4.6), for Magnet and the show-all display.
	void getHotspotPositions(Common::Array<Graphics::HotspotInfo> &hotspots) override;
	bool hotspotDirty() const override;  // only after a change (6.5)
	// A. The same list, with each target's identity beside it.
	void listTargets(Common::Array<Graphics::HotspotInfo> &targets,
	                 Common::Array<MagnetTarget> &ids);
	// D. Warp, then push EVENT_MOUSEMOVE (4.5); never while a release is pending.
	void moveCursorTo(const Common::Point &p);
	// E. Re-check (4.4); set _mouseDown and call handleMouse(true, p); the
	// release is made after one game tick has run (H9).
	bool activate(const MagnetTarget &target, const Common::Point &p);
	bool _magnetSelected;            // false for none; cleared in showRoom()
	MagnetTarget _magnetSelection;
	int _magnetReleaseTicks;         // ticks until the pending release, or -1
	HotspotMagnet::InputAdapter _magnetInput;
};

class Room {
public:
	// The current step's polygon box, or the union of the current frame's
	// cels for a cel hit (4.5).
	Common::Rect getHitBox(int sprite) const;
};

class RoomClass {  // H11; ButtonRoom implements addNavTargets (H13)
public:
	struct NavTarget {
		Common::Point point;
		Common::String label;
		int sprite;                // -1 if the target isn't a sprite
	};
	virtual void addNavTargets(Common::Array<NavTarget> &targets) {}
	virtual bool isNavTargetValid(int index) const { return false; }
	// The class target under p, or -1: the hover row of 5.5 (H17).
	virtual int navTargetAt(const Common::Point &p) const { return -1; }
	// True if the class took the press (a knob, a clock hand).
	virtual bool navigate(HotspotMagnet::Direction dir) { return false; }
	// True if OK may click with no target (the corral).
	virtual bool clicksWithoutTarget() const { return false; }
	// The mode a player starts this room in (H10). A close-up or Big Head
	// keeps the player's mode instead.
	virtual HotspotMagnet::Mode startMode() const { return HotspotMagnet::kModeMagnet; }
	virtual bool keepsMode() const { return false; }
};

class TerraglyphMetaEngine {
	// The three keymaps of 6.4, or ScummVM's default when the option is off.
	Common::KeymapArray initKeymaps(const char *target) const override;
	const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
};

Appendix C: navigation examples

The core’s test cases (WP-091), for packet 4 to transcribe one-to-one. Each layout is a target list in the order given: a is index 0, b index 1, and so on. Each row is a selection (current), and each column gives what a press in that direction selects. stay means the selection doesn’t move.

Three rules apply to every case:

The expected results were worked by hand from 5.1–5.5. A scratch check that applies the same rules agreed on every case (5.8).

C1, three on a diagonal. a (100, 100), b (200, 200), c (300, 300). From a, b and c both lie at 45° and both are tier 1; b scores 50,000 and c 200,000.

From Right Down Left Up
a b b stay stay
b c c a a
c stay stay b b

C2, a row. a (100, 240), b (250, 240), c (400, 240), d (550, 240).

From Right Down Left Up
a b stay stay stay
b c stay a stay
c d stay b stay
d stay stay c stay

C3, a column. a (320, 80), b (320, 200), c (320, 320), d (320, 440). Targets level with the origin are never left or right of it.

From Right Down Left Up
a stay b stay stay
b stay c stay a
c stay d stay b
d stay stay stay c

C4, a 3 × 2 grid. a (160, 160), b (320, 160), c (480, 160), d (160, 320), e (320, 320), f (480, 320).

From Right Down Left Up
a b d stay stay
b c e a stay
c stay f b stay
d e stay stay a
e f stay d b
f stay stay e c

C5, an isolated target. a (100, 100), b (140, 120), c (100, 160), d (600, 450). Left from d: all three are tier 1, and c scores 586,400 against b’s 647,200 and a’s 740,000. Up from d: all three are tier 2, and b scores lowest.

From Right Down Left Up
a b c stay stay
b d c a a
c b d stay a
d stay stay c b

C6, a dense cluster. a (300, 200), b (310, 205), c (320, 200), d (305, 215), e (315, 215). Down from b: d and e tie at 200 with equal major and equal y, so the smaller x wins (d).

From Right Down Left Up
a b d stay stay
b c d a a
c stay e b stay
d e stay a b
e c stay d b

C7, a wide gap. a (40, 240), b (600, 240).

From Right Down Left Up
a b stay stay stay
b stay stay a stay

C8, the screen’s edges. a (0, 0), b (639, 0), c (0, 479), d (639, 479), e (320, 240). Right from e: b and d are both tier 1 with major 319, but d’s minor is 239 and b’s is 240, so d wins.

From Right Down Left Up
a e c stay stay
b stay d e stay
c e stay stay a
d stay stay e b
e d d c b

C9, a stranded target: the fallback. a (616, 444), b (549, 10), c (424, 129), d (306, 20), e (166, 366).

From Right Down Left Up Right, 5.1 alone Left, 5.1 alone
a d stay e b stay e
b c a d stay a d
c e a b d b d
d b e a b b e
e a a c d a stay

With no selection (current none), the first press is geometric even though the fallback is in force (5.5):

Cursor Right Down Left Up
(400, 300) a a e c
(0, 0) d e d (nearest) d (nearest)

C10, a tie and the 45° boundary. a (320, 240), b (420, 190), c (420, 290), d (420, 340), e (330, 300).

From Right Down Left Up
a b e stay b
b stay c a stay
c stay d e b
d stay stay e c
e c d a a

C11, steep against aligned. a (100, 240), b (110, 280), c (300, 240). Right from a: b is tier 2 (minor 40 > major 10), so c wins.

From Right Down Left Up
a c b stay stay
b c stay a a
c stay b a stay

C12, a menu. A column of four buttons and a quit button at the bottom right: a (320, 140), b (320, 220), c (320, 300), d (320, 380), e (560, 440).

From Right Down Left Up
a e b stay stay
b e c stay a
c e d stay b
d e e stay c
e stay stay d a

C13, the open toolbar under two room objects. a (200, 200), b (450, 250), then the toolbar row: c (60, 440), d (140, 440), e (220, 440), f (300, 440), g (560, 440).

From Right Down Left Up
a b e d stay
b g g a a
c d stay stay a
d e stay c a
e f stay d a
f g stay e a
g stay stay f b

C14, one target. a (320, 240). Every press from a stays.

C15, no selection (current none). On C4’s grid, from the cursor:

Cursor Right Down Left Up
(0, 0) a a a (nearest) a (nearest)
(639, 479) f (nearest) f (nearest) f f
(320, 240) c (ties f, smaller y) e a (ties d, smaller y) b
(320, 100) c b a b (nearest)

On C14, any press from any cursor position selects a.

Which case tests which rule:

Rule Cases
Strict half-plane: level targets are never candidates C2 (up, down), C3 (left, right)
The 45° tier, and tier 2 only when tier 1 is empty C10 (up from a), C11, C12
The score C1, C5, C9, C13
The tie-break (major, then y, then x) C6 (down from b), C10 (right from a), C15 (320, 240)
Stay when there’s no candidate C2, C3, C7, C14
The 45° boundary C10 (d from a)
Screen edges C8
The reading-order fallback, its rows and its wrap C9
No selection: from the cursor, then the nearest C9, C15
Order independence Every case, with the list reversed
repeat handled as a press Every case, with repeat true

The hover row of 5.5 and the cursor-at-point rule are the provider’s (packet 5). The core’s cases can’t test them.

Appendix D: terminology

Term Meaning here
Hotspot Anything a player can click in a room
Target A hotspot the provider lists now: eligible, hittable, on screen (4.6)
Selection The target Magnet’s cursor is on, held as (room, sprite index) (4.4)
Interaction point The point the cursor goes to and the click lands on; it hit-tests to its target (4.5, H3)
Magnet mode The D-pad moves between targets; OK clicks the selection
Cursor mode The D-pad moves the free pointer (the Virtual Mouse); OK clicks at it
Provider Component A: the engine code that lists the targets
Navigation core Component B: picks the next target for a direction, with no engine knowledge
Input adapter Component C: turns Magnet’s actions into navigate, click and mode changes
Adapter (engine) Components A, D and E together: TerraGlyph’s side
Assist A room class’s own handling of a direction or an OK, for rooms that aren’t plain clicks (6.8, H11)
Press graph For one target list: an edge from each target, per direction, to the target a press selects (5.8)
Tier 1: a candidate within 45° of the direction; 2: any other candidate (5.1)
Reading order The targets in rows of 32 px, top to bottom, each row left to right: the fallback’s cycle (5.8)

Appendix E: references

The prior art for the navigation core (WP-091, read 2026-11-28). The other references this appendix is for, ScummVM’s contribution guidelines, accessibility guidance and maintainer discussions, are still to add.

Source Filters on Scores by Nothing in the direction Reachability
Android’s D-pad focus search: FocusFinder in AOSP frameworks/base, core/java/android/view/FocusFinder.java, the main branch as mirrored on GitHub Rectangles. A candidate lies at least partly beyond the source in the direction (isCandidate). With nothing focused, a zero-size rectangle at a corner of the root is the source A candidate overlapping the source’s beam (the band across the direction) beats one outside it (beamBeats); otherwise 13·major² + minor², major edge to edge and minor between centres (getWeightedDistanceFor). Ties keep the earlier view in the list No focus change, and no wrap. Tab order (forward and backward) does wrap No claim
W3C CSS Spatial Navigation Level 1, Working Draft of 26 November 2019 (w3.org/TR/css-nav-1) Boxes: visible, focusable items in the direction within the current navigation container (§3, the overview) Not recorded: the processing model (§8) couldn’t be read verbatim, so its distance function isn’t cited here The container scrolls; if it can’t, the search moves to the parent container, up to the root (§3). No wrap unless an author adds one No claim. Items outside a scrollport are reachable only once scrolled into view
Lab’s FOCUS action (engines/lab/processroom.cpp:170, E48) Nothing: a list of close-ups Nothing: data order Wraps to the first Every close-up, by the fixed cycle; direction plays no part

What Magnet takes from them. Neither Android nor the CSS draft promises reachability, and both need boxes for their beams and overlaps. Lab guarantees it by ignoring direction. Magnet uses direction first, on points (5.1), and keeps a Lab-like cycle as the backstop that makes the guarantee (5.8).


Document governance

This page is the authoritative architecture and roadmap for Hotspot Magnet. Individual work packets govern implementation, testing, and completion. Source-dependent conclusions rest on the evidence register; one that isn’t in it stays unresolved.

Revision history

Date Change
2026-11-26 First version, from Jeff’s plan.
2026-11-26 Accepted as the planning baseline after Microsoft Copilot’s review, relayed by Jeff. Adopted its four corrections (remote fallback 6.2, reachability 5.8, separate selection, positioning and activation 4.2/4.5, and data vs visual reuse of the hotspot display 3.3), its eligibility requirement (4.6), its packet resequencing (11) and its user-experience tests (12.6). Also added the link to WP-085’s gamepad requirement (1), what WP-018 already established about TerraGlyph hit testing (3.5, 7.2), and an exhaustive per-room reachability check (5.8).
2026-11-26 WP-086’s research: Section 3 verified except 3.6, with the evidence register (E1–E24), the decision register’s proposals (H1–H8) and Appendix A. The TCL remote’s button capture is still a gap.
2026-11-26 Jeff’s decisions on H1–H8 (10.4): H1, H3, H5, H7 and H8 approved, H2 approved for the prototype, H4 provisional, H6 pending remote testing, each with his conditions. Reachability, never activating a vanished hotspot, and no activation on a long OK press added to the acceptance criteria (7.6, 8.6) and navigation tests (12.2). A second remote capture recorded short presses of the D-pad, OK and BACK (3.2, E25); held presses are still a gap.
2026-11-27 Third remote capture (3.2, E26): D-pad up’s code, and held OK, left and right send one press and one release; Android repeats held keys (400 ms, then every 50 ms), and ScummVM turns each repeat into a new press. Repeating D-pad presses added to the remote limitations (6.3). Jeff approved H6, hold OK (10.4).
2026-11-27 Packet 2 drafted as WP-089 (11, 14.3).
2026-11-27 WP-089 run: Part II designed for the Phase 1 TerraGlyph prototype (4.2–4.6, 5.6, 6.1–6.6, the new 6.8 and 12.7, 7.4, Appendices B and D), evidence E27–E44 at fork 0d5a69c7694f, proposals H9–H16. Corrected 3.2: ScummVM’s default game keymap, which TerraGlyph has today, binds the D-pad to keypad keys (E27). A cold review of the design then corrected it before close: activation owns its press (H9), the click gate and an item in hand are in the filter (4.6), repeats are the adapter’s own, and off the TV the D-pad doesn’t reach the Virtual Mouse (6.1, E44). E3, E8 and E9 cite android.cpp’s new line numbers.
2026-11-27 Packet 3 drafted as WP-091 (§11, §14.3).
2026-11-27 Jeff’s decisions on H9–H16 (10.4): H9 and H11–H14 approved, H10 approved with provisional timing, H16 approved subject to input testing, H15 conditional, each with his conditions. Reachability with the standard remote, menu buttons and room targets included, carried forward (7.6). Packet 16, the room assists, added to §11; §14.3 updated.
2026-11-28 WP-091 run: §5 designed (5.1–5.5, 5.7, 5.8) at fork 1539a7b59cf3. The geometric rules on points, a reading-order fallback that makes every list strongly connected, the per-room check, no repeats in Phase 1 (6.3), the Knights of the Snack Table and Wizard’s Rule rows (6.8), evidence E45–E50, proposals H17–H24, Appendices C (navigation examples) and E (prior art). §5.6 now agrees with 4.4.
2026-11-28 Jeff’s decisions on H17–H24 (10.4): all approved; H17, H20 and H22 with clarifications, H21’s 80 ms provisional. Reachability and one-target-per-interaction added to the Phase 1 acceptance criteria (7.6); H24’s direction-consumption requirement added to packet 16 (§11); the 80 ms named constant (6.3).
2026-11-28 Packets 4 and 5 drafted as WP-106 (the core) and WP-107 (the provider) (§11, §14.3).
2026-12-01 WP-106 run: the navigation core is in the fork (837ca576da), with its self-test (Appendix C’s 802 checks, the connectivity and targeted cases, and a fixed-seed property test) passing on both titles. §5.7’s cost is measured; Appendix B gains geometricChoice() and readingOrder().
2026-12-01 WP-107 run: the provider is in the fork (dcf2630b21), with its per-room check passing in all 147 listed states of both titles and no room needing the fallback (§5.8). §4.5 notes a moved point stays cached; §6.8 gains the drawbridge and updates Sign In and Wizard’s Rule; Appendix B records targetAt(), magnetCurrent() and the departures. Two decisions await Jeff (§14.3).
2026-12-02 Jeff decides H25 (10.4): the 15 room classes that answer a click on a character add those characters as targets. 4.6’s filter and the moving-objects note say so. WP-107’s second fork PR (37b75bf77e) adds the hooks, and its check, with item-held states and a story pass, passes in 162 listed states (§14.3).
2026-12-04 Jeff accepts WP-107’s covered targets and empty rooms as listed (§14.3). WP-107 is done, and packet 5 with it (§11).