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
- Primary: young children using a standard TV remote.
- Secondary: players with motor impairments.
Three-phase strategy
- A working TerraGlyph prototype (valuable on its own).
- Reuse of the same navigation core in one SCUMM/HE title.
- 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
- Navigate between interactive hotspots using four D-pad directions.
- OK/Select activates the selected hotspot (left-click equivalent).
- Support secondary actions (right-click / alternate verb) where the engine allows.
- Instant fallback to conventional Virtual Mouse / free-cursor movement, reachable with the standard remote alone (6.2).
- Every eligible hotspot reachable by directional input (5.8).
- Work across multiple ScummVM engines via engine-supplied hotspot data.
- Optional visual indication of the selected hotspot.
2.2 User experience goals
- Simple enough for young children.
- No mouse or keyboard required for normal play.
- Predictable, deterministic directional navigation.
- Minimal parent configuration (a single per-game checkbox).
- Impossible to become permanently trapped in Magnet mode.
2.3 Non-functional requirements
- The navigation algorithm is engine-independent.
- Low processing overhead (expected hotspot counts are small).
- Compatible with ScummVM coding conventions and the Keymapper.
- Zero behavior change when the feature is disabled.
- Correct handling of different game resolutions and display scaling.
- Deterministic tie-breaking and scoring.
2.4 Out of scope
- Replacing ScummVM’s Keymapper or Virtual Mouse.
- Modifying original game assets.
- Automatic image recognition of clickable objects.
- Requiring every engine to support the feature.
- Rewriting engine-specific interaction systems.
- Guaranteeing upstream acceptance.
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:
- The remote’s D-pad reaches ScummVM as joystick buttons, and a game can take it over (3.1, 3.2). Android binds those buttons to the Virtual Mouse in the Global keymap, and an exact match in the game’s keymap is checked first, so an engine keymap that binds them gets them instead. Turning that keymap off hands the D-pad back to the Virtual Mouse.
- ScummVM already has an engine hotspot interface,
Engine::getHotspotPositions(), and five engine implementations fill it (3.3), SCUMM’s among them. Each returns a point that is checked to hit the object, which is the interaction point the design needs. TerraGlyph doesn’t implement it yet. - TerraGlyph already has a single click path,
TerraglyphEngine::handleMouse(), which the test script drives with synthetic clicks (3.5). Activation can go through it unchanged.
3.1 Keymapper and input events
- Dispatch (E1).
EventDispatcher::dispatchpasses each event toKeymapper::mapEvent. That runsgetMappedActionson the enabled keymaps of the current type (Game or GUI), andKeymapper::executeActionbuilds the output events. An unmapped event goes through raw, and any match swallows the raw event. - Priority (E2). Game (or GUI) keymaps are searched first. The Global keymap is searched only when that first pass has no exact match. Joystick inputs always match exactly when bound. Game and GUI keymaps are never searched together.
- Can an engine keymap take the D-pad from the Virtual Mouse? Yes (E2,
E3). The Virtual Mouse’s D-pad bindings live in the Global keymap. While a
game runs, an enabled game keymap that binds
JOY_UP/DOWN/LEFT/RIGHTmatches first, so the Virtual Mouse never sees those presses. Its other bindings (the left stick) keep working. In ScummVM’s own menus, game keymaps aren’t searched, so the D-pad moves the pointer there as before. - The Virtual Mouse (E4). Its actions are
VMOUSEUP,VMOUSEDOWN,VMOUSELEFT,VMOUSERIGHTandVMOUSESLOW. It has no click action: an in-game left click is the engine-defaultLCLKonMOUSE_LEFT/JOY_A. It moves the pointer at a constant velocity every 12 ms (no acceleration), scaled bykbdmouse_speedandjoystick_deadzone. It is always built on Android, with no enable flag (E5). - Precedent for an engine-defined action: the hotspot display’s
“Show/hide hotspots” action is added by each engine through
MetaEngine::createHotspotAction()(E11).
3.2 Android TV and gamepad input
- D-pad and OK (E6).
ScummVMEvents.onKeysendsDPAD_UP,DOWN,LEFT,RIGHTandCENTERasJE_GAMEPAD. The native side turns them intoEVENT_JOYBUTTON_DOWN/UPwithJOYSTICK_BUTTON_DPAD_*, which are the hardware inputsJOY_UP…JOY_CENTER. They are not key events, not hat axes and not mouse movement. Android’s defaults bind the four directions to the Virtual Mouse (Global keymap) andJOY_CENTERto “interact” in the GUI only. In a game,JOY_CENTERis unbound, so the engine receives it raw.ENTERfrom a keyboard arrives asKEYCODE_RETURN. Correction (WP-089, E27): the Virtual Mouse gets the D-pad in a game only if no game keymap binds it. ScummVM’s default game keymap does, to keypad arrow keys, and it’s the keymap TerraGlyph has today, so in a TerraGlyph game the D-pad sends keys the engine ignores. Beneath a Steel Sky declares its own keymap without the D-pad, which is where the pointer moves. H1 still holds: TerraGlyph’s own keymaps replace the default (6.4). - Gamepad hat D-pads arrive separately, as
EVENT_JOYAXIS_MOTIONon the hat axes (E6). A design that binds the remote’s buttons doesn’t cover a game controller’s D-pad, which needs its own binding. - The old D-pad-to-mouse code is dead (E6). The native
JE_DPADpath, which emulated the mouse with acceleration, is commented “no longer used”, and Java never sends that event. - Holding a key (E7). Key events carry a repeat count, and the Keymapper
drops repeats.
JE_GAMEPADignores the count, so if the remote repeats a held D-pad press, each repeat arrives as a freshJOYBUTTON_DOWN. On the TCL the remote itself doesn’t repeat, but Android does (3.2 remote, below). Long-press detection exists only for BACK and MENU. -
Keys the backend uses itself (E8):
Key Short press Long press BACK KEYCODE_AC_BACK: skip (ESC) in a game, close in the GUIKEYCODE_MENU: ScummVM’s main menuMENU ScummVM’s main menu Toggles the on-screen keyboard Volume up/down Left to Android — Play/pause VMOUSESLOW(Virtual Mouse slow)— Gamepad START / SELECT Main menu / virtual keyboard — - Pointer Speed is
kbdmouse_speed(default 2 on Android), read only by the Virtual Mouse. There is no cursor-acceleration setting (E9). - The on-screen gamepad (
touchcontrols.cpp) becomes active only from touch input, so on a TV with no touch screen it never shows and never takes input (E10). - Upstream drift (E21). Since the fork’s base (
2982fe324b6c),scummvm/scummvmmaster (7b6fa644d74a, 2026-11-26) changed only735ad86c21among these files: mouse pointer capture with relative motion. It changes no D-pad or key finding.
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
- The data:
Graphics::HotspotInfois a point, a name and a type (E12):Common::Point position(“in game coordinates”),Common::U32String name, andHotspotType type(default, object, exit or NPC). It has no rectangle and no identifier. - The engine interface (E13).
Engine::getHotspotPositions(Common::Array<HotspotInfo> &)is empty by default.Engine::drawHotspots(), which each implementing engine calls once per frame, asks for positions only whenhotspotDirty()(default: every frame), creates the renderer lazily and draws to the overlay.showHotspots()turns the display on and off, and pausing or opening the GUI suspends it. - The key and the setting (E11, E14). The “Show/hide hotspots” action
(
HOTS, keyh) sendsEVENT_HOTSPOTS_SHOWon press and…_HIDEon release.DefaultEventManagerhandles both as hold or toggle (thehotspot_key_modesetting) and doesn’t pass them to the engine. The per-gameenable_hotspotscheckbox sits in the edit-game dialog’s Misc tab for every game, and defaults to off. An engine opts in by adding the action in itsinitKeymapsonly whenhotspotsEnabled(target); there is no feature flag. - The renderer (E15) draws markers (crosshair, square or point), leader
lines and labels at the given points, scaled from game to overlay size. It
draws no outlines, ignores
type, and always draws the whole list it’s given. It can draw one selected target only by being given a one-item list, and it has no selected style. It draws through the generic overlay API; no backend has hotspot-specific code. -
Who fills it (E16): five engine implementations, each returning only interactive things, and each placing the point so it hits the object:
Engine What it returns How the point is chosen scumm(v0–v8 and HE; the HE sports games, rebel1/2 and moonbase are excluded at the keymap)Touchable objects in view, and visible actors other than the player The first point of a 3 × 3 grid over the object where findObject()returns that objecttoucheHit boxes not locked or hidden, and characters The rectangle’s centre, or the centre of its visible part hollywood(both games)Named hotspot ids found by scanning the viewport The bounding box’s centre, or the nearest pixel of the region if the centre falls outside macs2Colour-map regions and scene objects Each region’s centroid, snapped into the region - Data reuse or visual reuse? Both, with limits. For data,
getHotspotPositions()is usable as the Hotspot Magnet provider as it stands: its points are hit-checked interaction points, and directional navigation can run on points alone. It lacks a stable identifier, which keeping a selection across refreshes would want; an addition may be needed there. For visuals, the renderer can mark one target if given a one-item list, but it has no highlight style, and it shares the overlay with the show-all display. - Other navigation (E17). Lab is the only engine that moves the
cursor between interactive items: its “FOCUS” action (TAB /
JOY_X) moves the mouse to the centre of the next close-up in its list, wrapping. Its logic is tied to Lab’s data. Riven’s arrow keys run named hotspots (“forward”, “left”) without moving the cursor. MADS’s tab swaps the cursor between two saved positions. Grim cycles objects through script keys (unverified past the key events). AGOS and Sword25 only reveal all hotspots. None is reusable as a navigation core. - Two small inaccuracies in the fork, recorded for the record: the comment at
engines/engine.h:560says the markers are “semi-transparent circles”, but the default is a crosshair, andHotspotTypeis never used in drawing.
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:
- Hit testing (E18).
Room::hitTest(x, y)returns a sprite index into the room’s sprites, or −1. It walks the private draw list front to back, skips a sprite that ishiddenor hashitType0, tests the current step’s polygon (type 2) or the current frame’s cels (type 1), and returns the first hit. Detached sprites aren’t in the list. The cursor is a separate sprite and is never hit. - The placements (E18). Each is a private
Room::Spritewith aKind(layer, simple, character, ghost, exit, requires, inventory, clickable, engine). A room’s class can override the kind. They are listed throughgetSpriteCount()and per-index accessors:getLabel,getMode,getStep,isHidden,getHitType,isDetached,getDestination(an exit is a sprite with a destination),isClickable,isInventoryObject,isRequiresObject,isEngineSprite,getCharacters(). Geometry isgetFrameRect()(first cel only) orgetSize(); the polygon and its bounding box are private (getPolygon), so an interaction-point search over a polygon needs a small accessor. - One room, gated input (E19). Play uses a single
Roomobject. The toolbar’s sprites are added to it at depth 5000, sohitTest()covers the toolbar too, and close-ups and Big Head are rooms loaded into the same object. Nothing reroutes input. InsteadTerraglyphEngine::handleMouse()drops clicks while a script runs or the inventory blocks input, and turns a click into a skip while the room’s class is busy. - The click path (E20).
TerraglyphEngine::handleMouse(bool click, Point)updates the hover throughhitTest()and then hands the click on, in order: character, room class, inventory, hint, then exit or clickable. Thetest_scriptclick x ycommand already callshandleMouse(false, p)and thenhandleMouse(true, p): a synthetic click through the real path. - Headless listing: yes (E20). The self-test’s
checkAllRoomsbuilds a bareRoom(no room class, no toolbar) and hit-tests a 4-pixel grid; other checks drive the live room withhitTest(x, y) == sprite. The accessors above are enough to list each room’s sprites headlessly.
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
- The engine mechanism (E23). An engine declares a per-game checkbox as
an
ADExtraGuiOptionsMapentry (a GUIO flag plus anExtraGuiOption: label, tooltip, config key, default) returned fromgetAdvancedExtraGuiOptions()on its meta-engine. The option shows only for detection entries whose GUIO list has the flag (GUIO_GAMEOPTIONSn), it’s saved in the game’s own config domain, andregisterDefaultSettings()registers its default, so the engine just callsConfMan.getBool(key). Example: Awe’scopy_protection(engines/awe/metaengine.cpp,detection_tables.h). - TerraGlyph today (E24). It declares no extra options: its meta-engine
overrides only
getName,createInstanceandhasFeature, and every detection entry has onlyGUIO1(GUIO_NOMIDI). A default-off “Hotspot Assist” would go in an override ofTerraglyphMetaEngine::getAdvancedExtraGuiOptions()(engines/terraglyph/metaengine.{h,cpp}), with aGAMEOPTION_flag added to the entries indetection_tables.h. - The shared model (E14).
enable_hotspotsis the other pattern: a shared per-game key in the edit-game dialog for every game, with each engine opting in through its keymap. Proposed: the engine option for Phase 1, and a shared key on theenable_hotspotsmodel for Phase 3.
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:
- One room class is new,
WizardsRuleRoom, and one existing class,KstRoom, newly reads the pointer and the held button. Both are in 6.8 (E45, E46). No other room class gained a pointer or held-button read. Room::ActorgainedactorPlays().hitTest()doesn’t use it (E49).- No keymapper, event or hotspot file changed. The Android changes are
package management under
advanced/;ScummVMActivityandAdvancedModeare untouched.
| # | 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
- Separate hotspot discovery from navigation.
- Separate navigation from input mapping.
- Keep engine-specific data outside the shared algorithm.
- Minimize changes to existing engine behavior.
- Prefer composition over deep inheritance.
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
- Who owns what. The engine owns the target list and the selection, which it holds as an identity (room, source, index), never as a list index. The core owns nothing. The list is rebuilt on each directional press and each OK (H8); between presses nothing is queried.
- Matching across refreshes. After a rebuild, the selection is the entry with the same identity. If it isn’t there, the selection is dropped, and the next press starts from the cursor’s position (5.5).
-
What drops the selection (H7, H8), each with the TerraGlyph signal that shows it (E34, E38):
Change Detected by Noticed Room change, a close-up, Big Head showRoom()(the one place a room is entered)A hook at the change The target hidden or detached, or a class target no longer valid Room::isHidden(),isDetached(); the class’s validity hookA check each tick of the one selected target A scene or exit running RoomScript::isBusy()Each tick A pick-up movie Inventory::isInputBlocked()Each tick The room class busy RoomClass::isBusy()Each tick; OK is then a skip (6.1) An item taken in hand or put back, when that removes the target (4.6) Inventory::isDefaultCursor()Each tick The main menu or another dialog pauseEngineIntern()A hook at the pause; OK’s hold is also reset (6.2) The cursor moved off the selected target’s point (the mouse, cursor mode, or the point searched again after its sprite moved) The cursor against the point the cursor adapter last moved it to, within 2 px (5.5, H17) At each directional press and each OK, before anything else While a scene runs, input is blocked or the class is busy, the list is empty (4.6, H7), so dropping the selection loses nothing: the cursor stays where it was, and the next press after the scene starts from there. The per-tick check reads one target and four flags, not the list, so H8’s “no query every frame” holds.
- Occlusion doesn’t drop. A character walking in front of the selected target (characters are hittable, E37) blocks activation through the re-check but keeps the selection.
- The activation re-check (H8). On OK the provider rebuilds the list and
the engine re-checks the selected target: in the list, and
hitTest(point)still the sprite (or the class’s validity hook true). If either fails, nothing is clicked. A vanished or disabled hotspot can’t be activated.
4.5 Coordinate systems
- One space. Gen 1 draws a room’s top-left 640×480 at the screen’s
origin, with no scrolling (E37). Room, game and screen coordinates are the
same, and
hitTest()works in them. A room can be up to 1920 px wide, and the hidden toolbar sits at negative x, so the provider drops every target whose interaction point is outside 0–639 × 0–479. - Moving the cursor (D). TerraGlyph draws its own cursor sprite and moves
it only from mouse events (E39). The cursor adapter calls
g_system->warpMouse(x, y), which moves the host pointer on SDL, and then pushes anEVENT_MOUSEMOVEat the point. The push is what updates TerraGlyph’s hover, rollover cursor andButtonRoom’s hover sound, and the event manager’s mouse position, which the Virtual Mouse starts from in cursor mode (E31); Android’s warp produces no mouse event at all. Warp first: it purges queued mouse events (E31). No warp is made while a release is pending (4.2). - The overlay. ScummVM’s hotspot renderer takes game coordinates and converts them itself (E32); Phase 1 draws no overlay of its own (6.5).
- The interaction point (H3). TerraGlyph’s data has no preferred point,
so the provider searches for one. The box is the current step’s polygon
box for a polygon-hit sprite (its offsets are relative to the sprite’s x
and y), and the union of the current frame’s cels for a cel-hit one
(
getFrameRect()gives the first cel only, but a hit tests every cel, E37). The search tries the box’s centre, then a 4 px grid in rings outward from it, and takes the first point wherehitTest()returns the sprite and that is on screen. No such point: not a target. The polygon box is private today, so the search needs a publicRoom::getHitBox(sprite)(E37). A room class that knows a better point supplies it through its hook (H11). Points are cached per sprite and step, and each cached point is re-checked with onehitTest()at every rebuild; one that fails is searched again. Sprites move by offset as well as by step (the jigsaw’s pieces, a carried item), and characters walk in front of targets, so the step alone isn’t enough to trust a cache. A point moved by a collision (H22) or by something in front stays cached while it still hits its sprite, so a list can depend on what came before it (WP-107’s review).
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:
- It’s not hidden or detached, and its hit type isn’t 0.
- 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
ButtonRoomis 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 onButtonRoom, notRoomClass, so the hook, aRoomClassvirtual, 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). - 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.
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).- 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):
- Starts from the selected target’s point, or with no selection from the cursor’s position (5.5).
- 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.
- 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.
- Scores each candidate of the tier as major² + 4·minor². The lowest wins.
- 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.
- Stays when no target is a candidate (5.4).
- 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
- Why tiers. On points, a plain weighted distance can answer a press right with a target almost straight below, because it’s near. From (100, 240), a target at (110, 280) is 10 px right and 40 px down, and it would beat one at (300, 240). The 45° tier sends right to the target to the right, and leaves the steep one to down (Appendix C, C11).
- Why 4. With weight 4, a curve of equal score is an ellipse twice as long along d as across it. An aligned target 158 px away ties with one at 45° and 100 px. Alignment counts, and so does distance. 4 is a starting value for the user-experience tests (12.6).
- Why not Android’s. Android’s focus search ranks rectangles that overlap the source’s beam first, then scores 13·major² + minor² (Appendix E). The beam needs boxes, which the core doesn’t have (H12). Without the beam, that score is close to “the smallest major wins”, which picks the steep near target above.
- Integers. Every term is an integer product of integer coordinates. On a screen up to 16384 px in each dimension, the score fits a signed 32-bit integer: 5 × 16383² < 2³¹. With no floating point, x86 and ARM break near-ties alike, and exact ties fall to the tie-break. Exact ties are common on the 4 px grid (4.5) and in menus.
- The type.
HotspotInfo::type(exit or object) changes nothing, and an exit is navigated to like any target. A priority by type would only make some targets harder to reach. - No rule names a screen size. Two constants are in pixels, the 32 px reading-order band (5.8) and the per-room check’s 40 px grid. They suit 640×480 and scale with the screen in Phase 2.
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):
- A child who presses right at the rightmost target and lands on the far left has lost their place. Staying is predictable.
- Reachability doesn’t need wrap (5.8).
- It’s one less option for a parent to set (6.6).
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).
- Entering a room, a close-up or Big Head.
showRoom()drops the selection (4.4). The cursor stays where it was, so the first press starts from it. - After a scene, a pick-up movie or a busy room class. The selection is dropped (4.4), and the list was empty meanwhile (4.6). The cursor hasn’t moved, so if it’s still over the player’s target, the hover row selects it again. The player keeps their place without a selection surviving a change that H8 says must drop it.
- Back from the main menu or a dialog. The pause drops the selection (4.4), and the hover row brings it back the same way.
5.6 Dynamic hotspots
Designed in WP-089 (Gen 1); the rules are in 4.4:
- Moving and animated objects. A target’s point is recomputed when its step changes (4.5), each cached point is re-checked at every rebuild, and the selected target’s state is checked each tick (4.4). The only characters that are targets are those a room class answers (H25); they move, and their points move with them.
- Objects that appear and disappear. A hidden or detached target leaves the list at the next rebuild; if it was selected, the selection is dropped at once.
- Scene transitions, inventory, dialogs, cutscenes. A room change, a running scene, a pick-up movie, a busy room class and a dialog all drop the selection (4.4), and the list is empty while they last (4.6); a dialog also resets OK’s hold. Afterwards the hover row of 5.5 picks the target up again if the cursor is still on it (H17). Movies play in their own event loop (E40), during which Magnet does nothing.
- A target that becomes invalid mid-navigation is dropped, never activated, and the next directional press starts from no selection (5.5).
5.7 Performance
- List size (E50). No room of either title places more than 45 objects. Showdown’s 69 rooms average 8.9 and Phantom’s 53 average 10.4. The open toolbar adds at most nine targets, one per click index: four slots, the van, Scrappy, quit, the magnifier and the snacks. It has more sprites than that, an item over each filled slot and the snack box’s two digits, but sprites that click the same index are one target (H22). Placements count every placed object, characters and layers included, so a real list is usually shorter. About 54 targets is the working estimate, not a bound: room-class targets that aren’t placements (the quit screen’s buttons, Sign In’s rows, later hooks) add to it.
- Cost per press. One direction’s choice is one pass over the list: O(n). The guarantee (5.8) computes every target’s choice in all four directions and two reachability searches: O(4n²) scores, about 12,000 at n = 54. Measured in WP-106’s self-test on Windows, in an unoptimized debug build: about 60 µs a press at 54 targets, and no single press over 1 ms, the clock’s resolution. The Pi’s figure is left to packet 11.
- No per-frame work. The core runs only on a directional press (H8). The per-tick checks of 4.4 read the one selected target, not the list.
5.8 Hotspot reachability
The basic requirement isn’t that the selection moves intelligently. It’s that a child can reach every interactive object.
- Every eligible hotspot must be reachable from every other through a finite sequence of directional inputs.
- Navigation must not trap the player in a subset of hotspots.
- The algorithm must handle isolated, overlapping and unusually placed hotspots.
- If directional navigation alone can’t guarantee reachability, the design adds a deterministic alternative (for example, a fixed reading-order cycle when no candidate lies in the pressed direction).
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:
- a node per target;
- for each direction the room leaves to the core, an edge from each target to the target a press (not a repeat) from it selects. A press that stays is an edge to itself.
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:
- 2–20 targets (2, 3, 5, 8, 12 and 20; 20,000 layouts each): the graph wasn’t strongly connected in 0, 0, 0, 1, 1 and 3 of them.
- 40 and 54 targets (5,000 layouts each): it failed in 2 and 8 of them.
- 3 and 4 targets: a search of 200,000 layouts each found none.
- 5 targets: the search found one.
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.
- If it is, the press uses 5.1’s choice.
- If it isn’t, left and right follow reading order for that list, and up and down stay as 5.1 has them.
How reading order is built:
- Rows. Sort the targets by y, then x. The first target not yet placed starts a row. The row takes every unplaced target whose y is less than the row’s first y + 32.
- Order. Each row runs by x, then y, and the rows run top to bottom.
- Right selects the next target in reading order, and from the last, the first. Left selects the previous target, and from the first, the last.
Why it holds:
- If 5.1’s graph is strongly connected, it’s used as it is.
- If it isn’t, right’s edges alone form one cycle through every target, so right presses alone reach every target from every other, whatever the other directions do.
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:
- No selection. 5.5’s rule selects a target on the first press whenever the list isn’t empty, so no cursor position is a trap.
- The real presses. The press graph is what the player gets while the cursor stays at the selected point between presses, which the cursor adapter makes so (4.5). If something moves it (the mouse, cursor mode, or a warp held back while a release is pending), the selection drops and 5.5’s hover and cursor rows take over. They’re total too, so that’s never a trap either, though the press taken is then not the graph’s.
- Repeats don’t change the graph. Phase 1 has none (6.3), and if a later packet adds them, a repeat is handled exactly as a press (H21).
- The worst case. A shortest path in a strongly connected graph of n nodes visits no node twice, so any target is at most n − 1 presses from any other: 53 at n = 54, and far fewer in a typical room of 5–15 targets. In the fallback, left and right together reach any target within ⌊n/2⌋ presses.
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:
- In such a list, left and right stop following geometry and wrap like reading a page.
- The switch can come and go as targets appear and vanish.
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):
- States. Every room of both titles as it starts (after its opening,
12.7), and again with the toolbar open, in rooms where the player can open
it: not where
isToolbarHidden()hides it (menus, chases, close-ups and set pieces,inventory.cpp:251-254). Parked, only the van is on screen: the sprites it tows sit at negative x, and the hidden toolbar puts the van off screen too (E50). Open, its slots and buttons join the list. The check opens it as a click on the van would (Inventory::clickToolbar()), and waits until the van has driven in and the toolbar is open. - Graph. For each target and each direction,
navigate()with that target ascurrentand repeat false, then strong connectivity by a forward and a backward search. A failure is a bug in the core, since the argument above says it can’t happen, and fails the check. - The geometric graph. Whether 5.1’s choices alone are strongly
connected (
HotspotMagnet::isGeometricConnected(), Appendix B). A room where they aren’t is listed with its stranded targets as a warning, not a failure: it’s where the fallback runs. - Order. The graphs built from the list as given and from the list reversed must match edge for edge, by identity.
- No selection. From cursor positions every 40 px across the screen, and along its right and bottom edges, each of the four presses must select some target. The guarantee is 5.5’s rule; this checks the code.
- Report. On a failure: the room, the state, each target with its identity, label and point, the target no path reaches, and the presses tried. On a pass: one line per room with its target count and whether the fallback ran.
- Where. The self-test, with the other script checks, on the
scriptdebug channel at level 3 (12.7). - Option off. The check runs whether or not Hotspot Assist is on, since it calls the provider and the core directly. In play with the option off, neither runs and input is today’s (6.6, H16). §12.4’s “feature disabled” regression test shows that.
- Not covered. States reached by play (a clickable moved, an object revealed, an item in hand), and graphs that change between presses. Those are 12.2’s live tests.
The result (WP-107, 2026-12-01, fork pin 837ca576da):
- Every listed state passes, with no failure: 71 of Showdown’s and 76 of Phantom’s, as started and with the toolbar open.
- No room needs the reading-order fallback. Real rooms’ layouts are geometric enough, as the scratch numbers above suggested.
- The rooms with an empty list as they start, and why:
- Cursor-mode rooms (§6.8): Pie Noon.
- Set pieces and close-ups that hold input and leave by themselves: the chases (B1, B4, C1–C6), the strong boxes SB1–5, and Artie’s close-up.
- Rooms that hold input until a skip, which leaves them: the title, Big Head, the credits and the ghost spot.
- Nothing eligible: the open safe, a cut scene that takes every click with the cursor hidden; and the cheat room.
Each is in the WP’s §Result.
- Arena 2 with the toolbar open isn’t checked. While the van drives in, the room leaves for Brad’s game.
Where the core’s own tests run (H23).
- Phase 1: the engine’s self-test. The Appendix C cases run there as a check that needs no room: each layout, each case, its expected target, and the same with the list reversed.
- Not CxxTest yet. Running them under ScummVM’s CxxTest, in
test/engines/terraglyph/, would mean adding a TerraGlyph block to the sharedtest/module.mk(E47). §7.1 says no shared changes unless strictly needed, and the self-test exercises a pure function just as well. - Later. When the core moves to
engines/(H4, packet 15), its cases move to CxxTest with it, where upstream expects unit tests.
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):
- Two states, Magnet and cursor, plus OK’s hold, which the input adapter (C) keeps as the time of OK’s first start event, or none.
- Transitions. OK’s first start records the time; later starts while it’s held (Android’s repeats, E29) are ignored. Each engine tick, if OK is held and the threshold has passed, the mode flips and the hold is marked used. At OK’s end: a used hold does nothing; otherwise it’s a short press and gives a click (6.1). A room change sets the room class’s starting mode (6.1).
- Resets. The hold is cleared, with no click, and any pending release of a click is made (4.2), when the room changes, when a movie starts (it runs its own event loop and drops the release, E40), and when the engine pauses for the main menu or a dialog (the release then arrives in the GUI and the game never sees it, E30).
- Ends with no start are ignored, for OK and for the directions alike: a hat returning to centre sends an end to both of its halves (E29), and the test-build gesture swallows a down but passes its up (E33).
- The same contract on every device (E29). The Keymapper sends a start for every incoming button down, Android’s repeats included, and one end on the release; it drops keyboard repeats; and a gamepad hat or stick gives one start and one end. Timing from the first start to the end, ignoring repeats, gives the same result from the remote, a hat and a keyboard.
- How cursor mode is entered. The Magnet direction keymap is disabled,
so on Android the D-pad falls through to the Global keymap’s Virtual Mouse
(E2, E3; off the TV, see 6.1). OK stays bound, because it’s in a second
keymap that stays enabled: the Virtual Mouse has no click (E4), and
setEnabled()works on a whole keymap (E28). This refines H1, whose “turning it off is the fallback” would also unbind OK (H16).
6.3 Standard TV remote limitations
- The physical buttons available.
- Held buttons repeat (3.2, E26). Android adds a repeated press 400 ms into a hold and then every 50 ms, and ScummVM passes each one on as a new button press. Holding a D-pad direction would step through hotspots 20 times a second unless navigation ignores or slows repeats. The input adapter ignores those starts (4.3). Phase 1 has no repeats at all: one press moves the selection once, however long it’s held (H21). Children hold buttons longer than they mean to, and a held direction that kept stepping would carry the selection past the target they wanted. With a few dozen targets at most, pressing again is quick. The adapter’s repeat clock (4.3) has a delay of 0, meaning none. If the user-experience tests (12.6) call for repeats, a later packet sets a delay and an interval, and the core handles a repeat exactly as a press (5.8).
- A press reported twice. WP-085’s code says the TCL’s remote sometimes
reports one press twice (E33); the captures (E25, E26) didn’t.
- Two downs before one up are one press already, since the adapter ignores starts while a direction is held.
- Two full presses would move the selection twice. So the adapter ignores a start of a direction that comes within 80 ms (3 ticks) of that direction’s last end (H21). That’s far quicker than a child can press twice. The 80 ms lives in one named constant, so the TV tests can change it without touching the design.
Whether and how it happens, and whether 80 ms is right, is checked on the TV in packet 6, then 10.
- A ring press that also presses OK. The same code says the remote’s ring often registers OK too when pressed near its edge (E33). In Magnet mode that would click the target just selected. Checked on the TV in packet 6, then 10; if it happens, the input adapter ignores an OK that starts within a short window of a direction.
- The test-build gesture (E33). Test builds of the TV app (WP-085) open their hidden advanced mode on up, down, up, down, left, right, left, right within 10 s, swallowing the last right. A player moving between hotspots could make it. Release builds don’t have it. H15 (conditional): the gesture stays for testing but must not unexpectedly interrupt Magnet navigation. Disabling it while Magnet mode is active is investigated (14.3); if that needs disproportionate changes, the conflict is documented as a temporary test-build limitation. Release builds stay unaffected.
- Android TV system-reserved buttons.
- Long-press detection reliability.
- Button conflicts.
- Accessibility implications.
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:
- Hotspot Assist off:
initKeymaps()returns WP-113’sterraglyph-defaultunchanged (plus the show-all action, below), which is H1’s “the D-pad returns to the Virtual Mouse”. (Corrected by WP-113: this line said ScummVM’s default keymap unchanged, which on a TV leaves the remote dead.) - Hotspot Assist on: three game keymaps.
| 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 |
- The directions must leave the always-on keymap, or in cursor mode an exact game match would still win over the Virtual Mouse (E2) and the pointer wouldn’t move.
JOY_Amust be in one keymap only: two enabled game keymaps that bind the same input both fire (E28).- The Windows OK is keypad Enter, not Enter: Sign In reads every ASCII key, and Enter starts play (E43). The arrow keys carry no ASCII, so Sign In loses nothing.
- The standard action ids matter. Android binds BACK and
JOY_Yto skip by the standard action id, for every keymap that has an action with that id (E44), soterraglyph-defaultkeepskStandardActionSkip(and the other standard ids) or BACK stops skipping. MENU opens the main menu through the Global keymap, which game keymaps don’t touch. - A gamepad in Magnet mode:
JOY_Ais OK, so A no longer skips a movie (a movie reads only real button presses, E40);JOY_Y(skip) andJOY_B(right click) still do.JOY_Xwas skip line, which TerraGlyph never reads, so moving it to left click costs nothing. - A raw SDL joystick’s hat isn’t bound: SDL pushes its D-pad buttons as events the Keymapper never maps (E44). Recorded for packet 11.
- The show-all action is added to the game keymap whenever
hotspotsEnabled(target), with Hotspot Assist on or off, as other engines do (E32). Withenable_hotspotsat its default (off) that adds nothing.
6.5 Visual feedback
Phase 1 (WP-089) (H14):
- The selection is the game’s own cursor at the interaction point, with
its rollover cursor, and a
ButtonRoombutton’s hover sound, exactly as if a mouse had moved there. No overlay marker. - The mode has no marker of its own in Phase 1, and nothing moves when the mode changes: the cursor stays where it is, and the next press shows the difference (it jumps to a target, or it glides). That’s weak, so whether a child can tell the modes apart is a user-experience test (12.6); if not, a one-item marker from ScummVM’s hotspot renderer is the next step. It can draw any list it’s given (E32), but only one renderer may own the overlay at a time, so it would replace the show-all display while shown.
- ScummVM’s show-all display comes with
getHotspotPositions(): the same list, so it shows exactly the targets Magnet visits. The engine callsdrawHotspots()each frame and adds the show-all action whenenable_hotspotsis on (E32). While it’s shown it asks for the list every frame (hotspotDirty()is true by default), so TerraGlyph overrideshotspotDirty()to report a change only after a room change, a step change or a hide or show, and the point cache keeps the cost down. There’s no remote button for it.
6.6 Parent-friendly configuration
- A single per-game checkbox: “Hotspot Assist” (or similar).
- Disabled by default.
- Saved configuration.
- Clear fallback instructions in the GUI.
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
- Reduced fine-motor requirements.
- Predictable navigation.
- Alternative input devices.
- Possible future support for switch-based navigation.
- Complement, not replace, the existing TTS and hotspot display features.
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
- Prototype primarily within
engines/terraglyph/in the ScummVM fork. - Keep the navigation logic as engine-neutral as possible.
- Use the existing TerraGlyph hotspot data.
- No shared ScummVM changes unless the prototype strictly needs them.
7.2 TerraGlyph hotspot provider
- Take the targets from the room’s live placements, which the engine already
built from
object.iniand the art, not by parsingobject.iniagain. - Keep only eligible targets (4.6): an interactive kind, not hidden, in the room the player is in.
- Use each target’s current step polygon (or cel bounds) for navigation
geometry, and find an interaction point that
Room::hitTest()resolves to that target. - Supply normalized hotspot data to the navigation core.
7.3 Cursor and input integration
- Move the cursor to the selected target’s interaction point.
- Activate through the game’s existing interaction mechanisms.
- Preserve conventional mouse and Virtual Mouse operation.
- Implement the fallback.
7.4 Configuration
- Enable/disable Hotspot Assist.
- Save the per-game setting.
- Zero changes when disabled.
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
- Windows development (keyboard D-pad simulation).
- Smart TV with its standard remote (setup: ScummVM on smart TVs): the TCL 65Q77K (Google TV) now, then the Sony Bravia XBR-75X81CH next.
- Raspberry Pi with a D-pad controller (setup: ScummVM on the Raspberry Pi).
7.6 Phase 1 acceptance criteria
- Reachability (5.8): every eligible interactive hotspot is reachable through a finite sequence of D-pad inputs, and the navigation algorithm never traps the player within a subset of hotspots, with the standard TV remote, menu buttons and room-specific targets included (H11, H13). Checked for every room’s starting state in both Gen 1 titles.
- The Options knobs, Brad’s game and the vault’s clock are listed as unsupported by the standard remote until their assists (packet 16, H11) land.
- A hotspot that disappears or is disabled is never activatable, even while selected (H8).
- A long OK press never activates a hotspot (H6).
- Activating a selected hotspot clicks that hotspot: its interaction point hit-tests to it.
- Cursor mode can be entered and left with the standard remote alone, with no system-reserved button and no accidental click (6.2).
- Navigation is predictable and repeatable.
- No unintended clicks.
- Dynamic hotspots and room transitions are handled.
- Normal cursor mode remains fully functional.
- Disabling the feature restores the existing behavior exactly.
- The per-room check passes for every room of both titles: every target reachable from every other (5.8). Its output names each room whose target list needs the reading-order fallback. A room that fails reachability is never accepted silently (H20).
- One target per interaction (H22). Sprites that are one logical interaction are one target, and two genuinely different interactions stay separately reachable even when they overlap. A point moved to resolve a collision still hit-tests to its own target, stays on screen, creates no new collision, and never changes which interaction is activated.
- No game-specific logic leaks into the navigation core.
8. Phase 2: SCUMM / Humongous Entertainment
Objective: demonstrate reuse of the navigation core in a second ScummVM engine.
8.1 Initial game selection
- Putt-Putt is the preferred candidate (exact game and version to be chosen after research).
- Establish a reproducible test scenario.
8.2 SCUMM hotspot provider
- Retrieve interactive objects.
- Convert object geometry.
- Determine current availability.
- Handle room transitions.
8.3 Reusing the navigation core
- Reuse directional selection unchanged.
- Keep SCUMM-specific logic in the provider/adapter.
- Don’t duplicate the navigation algorithm.
8.4 Compatibility investigation
- Document which HE titles and versions share compatible structures.
8.5 SCUMM maintainer coordination
Questions to ask before deep implementation:
- Does equivalent functionality already exist?
- What is the preferred integration point?
- Which HE versions should be supported first?
- Event-driven or polled hotspot discovery?
- What testing and documentation are expected?
- Where should the reusable component live?
8.6 Phase 2 acceptance criteria
- At least one HE title works.
- The reachability criterion of 7.6 holds in that title’s rooms.
- The same navigation core is reused.
- SCUMM-specific code stays isolated.
- Existing controls are unchanged when the feature is disabled.
- Maintainer feedback is documented.
9. Phase 3: shared ScummVM integration (goal)
Preconditions: Phases 1 and 2 demonstrated; research complete; maintainer feedback received.
9.1 Shared code extraction
- Move the reusable navigation logic.
- Preserve the engine adapters.
- Establish stable interfaces.
- Update build integration.
9.2 Shared configuration and input
- Engine capability declarations.
- Per-game settings.
- Keymapper compatibility.
- Platform considerations.
9.3 Upstream contribution strategy
- Early architectural discussion.
- Maintainer review.
- Incremental pull requests.
- Tests and documentation.
- Coding-style compliance.
9.4 Upstream justification
- The user problem and the accessibility benefits.
- Demonstrated reuse across engines.
- Why the existing Virtual Mouse is insufficient for the target audience.
- Why the solution belongs in shared code.
- Maintenance responsibilities and compatibility safeguards.
9.5 Acceptance criteria
- A shared navigation core used by two engines.
- No duplicated navigation algorithm.
- Existing games unaffected when disabled.
- Code meets ScummVM conventions.
- Maintainer review requirements addressed.
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
- Incomplete or dynamic hotspot data.
- Input event conflicts with the Keymapper / Virtual Mouse.
- Coordinate scaling and overlay rendering.
- Game-specific interaction behavior.
- Stale hotspot references.
10.2 Usability risks
- Unpredictable navigation.
- Too many or too few hotspots.
- Difficulty escaping Magnet mode.
- Too few remote buttons.
- Children getting trapped in inventory/dialog interfaces.
10.3 Integration risks
- SCUMM architectural differences.
- HE version fragmentation.
- Disagreement over the shared-code location.
- Upstream maintenance concerns.
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
- Windows development environment.
- Smart TV: TCL 65Q77K (Google TV) now; Sony Bravia XBR-75X81CH next.
- Raspberry Pi.
12.2 Navigation tests
- All four directions, and every rule of 5.1–5.5. The cases of Appendix C, run in the self-test (H23), each also with the list reversed and with repeat true.
- Reachability. The per-room check of 5.8, for every room of both titles as it starts and with the toolbar open; then live, in states reached by play and while targets move.
- Overlapping, sparse and dense layouts. C5, C6, C7.
- Edge cases and repeatability. C8, C10, C14, C15.
12.3 Interaction tests
- Click, secondary action, inventory, exits, dialog, cutscenes, and the free-cursor fallback.
12.4 Regression tests
- Feature disabled.
- Mouse, keyboard, and existing gamepad behavior.
- Save/load and room transitions.
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:
- tell which object is selected;
- move to another object without being told how;
- activate the object they meant;
- recover from a wrong selection;
- switch to conventional cursor movement when they need it;
- finish a representative game interaction without a mouse.
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):
- Listing every room’s targets, headless. A new self-test check, run
with the other script checks (the
scriptdebug channel at level 3), enters each room of both titles throughshowRoom(), the live path that builds the room class, the script, the toolbar and the inventory, and skips the room’s opening until the script is idle; until then the list is empty by design (4.6). The bareRoomthatcheckAllRoomsbuilds has none of these, so it can’t see room-class buttons, toolbar sprites or the click gate. For each room the check lists every target with its identity, label and point, and fails if a point doesn’t hit-test to its sprite or is off screen. It also lists every sprite of an eligible kind that got no point: that’s the real risk, since a 4 px grid can miss a thin object. The per-room reachability check of 5.8 (packet 5) builds its graph on this list. -
test_scriptverbs for a live run, beside the existingdown x yandup x y. A pushed hardware event is never mapped by the Keymapper (E44), so these call the input adapter directly with Magnet’s action starts and ends; enabling and disabling the keymaps, and the hand-off to the Virtual Mouse, are tested with real input on each device (packets 9–11):Verb Does nav up,nav down,nav left,nav rightA directional press and release okA short OK press okhold <ms>OK held for that long magnetLogs the mode, the selected target and its point The verbs log through
debugCon the input channel, so a run’s log shows each step’s result.
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
- TerraGlyph is the first implementation.
- SCUMM/HE is the proposed second integration.
- A shared ScummVM contribution is the long-term goal, not a hard dependency.
- Implementation stays in the ScummVM fork.
- Research and work packets stay in this repository.
- All engine C++ is written by hand.
Requirements adopted on 2026-11-26 from the review:
- A cursor-mode fallback that works with the standard remote alone (6.2).
- Every eligible hotspot reachable (5.8).
- Selection, cursor positioning and activation kept separate, with the engine supplying the interaction point (4.2, 4.5).
- The engine supplies only currently eligible targets (4.6).
- Observational user-experience tests (12.6).
14.2 Decisions requiring research
- Final module interfaces.
- Input integration strategy (Keymapper or direct events).
- Navigation scoring details. Designed in WP-091 (5.1, 5.2; H18).
- Hotspot refresh mechanism.
- Shared-code location.
- SCUMM integration point.
- Cursor placement policy.
- Wrap-around default. Designed in WP-091: none (5.4; H19).
- The remote mapping for the cursor-mode fallback.
- Whether reachability needs a deterministic alternative beyond directional input. It does: WP-091’s reading-order fallback (5.8; H20).
- Whether the existing hotspot display offers data reuse, visual reuse, both or neither.
14.3 Immediate next steps
Run WP-086✅ 2026-11-26: Section 3 is verified except 3.6.Jeff decides H1–H8✅ 2026-11-26: H1–H5, H7 and H8 decided in §10.4; H6 on 2026-11-27.Capture the TCL remote’s buttons✅ 2026-11-27 (3.2, E26): held OK sends one press and one release; Android repeats it.- Get early maintainer feedback, which also settles H4.
Draft the interface design packet📝 2026-11-27: WP-089, from the §10.4 decisions and the remote capture.Run WP-089✅ 2026-11-27: Part II designed except the algorithm; evidence E27–E44, proposals H9–H16.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.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).Add a packet for the room assists✅ 2026-11-27: packet 16 in §11 (H11), for the rooms of 6.8.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).- 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.
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.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).Run WP-106✅ 2026-12-01: the core is in the fork (barefootbetters/scummvm#61,837ca576da), with its self-test passing on both titles.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.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:
repeattrue gives the same result (H21).- The list reversed gives the same target, at index n − 1 − i.
- All of C1–C14 have a strongly connected geometric graph except C9.
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).
- Why c is stranded. 5.1’s rules alone give no edge into c:
- Right from d: b scores 59,449 and c 61,448.
- Down from d: c is tier 2 (minor 118 > major 109), so tier-1 e wins.
- From b, c loses left to d and down to a.
- From e, c loses right to a and up to d.
- From a, c loses left to e and up to b.
- The fallback.
isGeometricConnected()is false, so left and right follow reading order. The rows are d, b (y < 42); then c; then e; then a. The order is d, b, c, e, a, and up and down keep 5.1’s choices.
| 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).
- The tie. Right from a: b and c tie at 20,000 with major 100, so the smaller y wins (b).
- The boundary. d lies exactly at 45° from a, so it’s tier 1 for both right and down. It loses on score.
- Tier 2. Up from a: only b lies above, and it’s in tier 2.
| 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).
- Up from e reaches a: a is the only button within 45° (major 300, minor 240).
- Left from e reaches d.
- Up and down aren’t inverses here. Down from d reaches e, but up from e skips d for a. A child may notice; it’s for the user-experience tests (12.6).
| 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). |