WIP: feat(input): a minimap toggle button, with the choice kept #711
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!711
Loading…
Reference in a new issue
No description provided.
Delete branch "kendowashere/Longshot:feat/minimap-toggle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: feat · Risk: low · Tested on: Windows 11, RTX 5070 Ti, DualSense · Needs: Linux, any GPU
Why
The game ties the minimap to the In-Game Interface option. Normal shows it, along with the rest of the busier HUD. Pro and Master hide it along with everything else. Nothing gives you Pro's clean screen with a minimap, or Normal without one, and switching means going into the options each time. This adds a button for it. It is a port of the minimap toggle in NX2navi, a static recompilation of the same game build: https://github.com/tangerineturtle1/NX2navi/pull/870. No issue on the tracker fits (searched for minimap).
What changed
The Controls tab gets a Minimap button row. With it on D-pad down, holding the button for a quarter of a second during gameplay shows or hides the minimap whatever the In-Game Interface option says, and the choice is kept. A tap still does what the game gives D-pad down (changing boots). The minimap is a screen of the game's own, so hiding clears its drawn byte and showing sets it (and opens it when the game left it closed), without touching the pause menu's map.
press_step,HOLD_NS,TAP_NS). A menu or event that starts during the hold hands the press to the game. A boots change therefore lands when the button is let go rather than when it is pressed.minimap=(0 the game's own until the first press, then 1 shown or 2 hidden). It has no row of its own, because the button is how it is changed.minimap=holds.host/oot_minimap.c: the minimap is the screenMapMenu_00in its small form (+0x2350, the IsMiniMap thatSeqOneShotOpenMapMenuwrites). The pause menu's map is the same screen in its large form and is never touched. The screen is found through the game's own lookup (f_80b45cd0, screen manager**0x84c9e098).+0x1a8, the oneSeqOneShotSetScreenVisiblewrites. The screen still opens and closes as the game asks, so nothing that waits on its state changes.SeqOneShotOpenMapMenudoes (vtable+0x28). It only does so after 20 consecutive reads of gameplay with the screen closed, so it is never opened behind a menu or a cutscene the game is going into.SeqQueryIsEventRunningreports (event manager**0x84c9e090+0x68), the minimap is never opened, and one this file opened is closed with vtable+0x30. The Pro interface would otherwise leave it up through conversations, where Link's update keeps running. A press during an event goes to the game.nx2/oot_patches.pypatch_minimap_link): one call at the top of Link's movement update (f_804caa80) records that the update ran. A hold counts only while that update runs. In menus, cutscenes and loads the button keeps its role. During gameplay a press is kept from the game until it is either a hold (the minimap's) or released as a tap (the game's).host/nn_hid.c(npad_statescallshos_minimap_buttonson the first controller's read),gpu/vk/vk_menu.cpp,vk_menu.h,vk_replay.cpp,vk_api.h(the row, the kept choice and the host's view of them: option ids 90 and 91, which no open pull request uses),gpu/vk/menu_i18n.h(the row's texts in all 13 languages),README.md, andtests/test_input_background.py(its stub of the controller read).Measurements
Verdict: nothing to measure: an input feature that is off by default; with the button Off the controller read returns after one option lookup and a read of the event manager's state.
Flags and settings
One new menu row (the ini key
minimap_button) and one kept choice that has no row (the ini lineminimap); no switch and no build flag. The README's option table lists the row.minimap_button, id 91)minimap(id 90, no row)Testing
Tested:
tests/test_minimap.py(new) applies the patch to a fixture of Link's movement update (once, and again unchanged; I also applied it by hand to the real liftedf_804caa80of a build), and checks that the button and the kept choice reach the host, that the options file writes and readsminimap=(with the key owned bysave()), that the button off leaves the minimap to the game, and that the Minimap button is the only row. With a C compiler (--cc, whichrun_all.pypasses) it also cutspress_stepout ofhost/oot_minimap.cwith itsHOLD_NS/TAP_NSas they are there, and runs it at a 4 ms read rate: a tap never switches the minimap and reaches the game after release, a hold switches it exactly once and never reaches the game, outside gameplay the button is the game's untouched, and a menu opening during a hold hands it to the game. It fails with the tap handoff removed and with a 900 ms hold (both tried).tests/test_minimap.py --cc gccpasses on this branch's head,a43db600.python -I -B tests/run_all.pyon this branch (1575bf72) onmain@a8a30c22: 580 passed, 25 failed, 41 skipped. A cleanmain@a8a30c22on this PC, run at the same time: 579 passed, 25 failed, 41 skipped. The same 24 fail on both:test_appimage_player_build,test_auto_handheld,test_cpp_preflight,test_crash_dialog,test_crt_options,test_env_on,test_fsr_uniform_ownership,test_lift_cleanup_error,test_linux_preflight,test_make_game_cache,test_make_game_prepare,test_missing_nup,test_options_budget_once,test_pads_after_menu,test_parallel_init_order,test_portable_builder_home,test_portable_builder_startup,test_readback_late,test_replay_write_order,test_run_all_changed,test_tested_configurations,test_vk_occlusion_queries,test_vk_pgo,test_walk_key. The 25th differed between the runs (test_fallback_buffer_cleanupon the branch,test_invalidate_vcoreonmain); each passes when run alone on both trees.main@6c9edffe, before the rebase ontoe090cc48, which touches none of this branch's files. The Minimap button was set to D-pad down and pressed in gameplay: it shows and hides the minimap as intended (it works well), and the choice is kept:longshot_options.iniwent from the game's own to hidden and then to shown.main@6c9edffetogether with my other branches): a tap of D-pad down changes boots, and a hold of a quarter of a second shows or hides the minimap. An earlier 0.4 s hold also worked but was slow for quick boot changes.host/oot_minimap.candhost/nn_hid.ccompile for a Linux target (clang-fsyntax-onlyagainst the Linux sysroot's own headers andhost/posix's compatibility layer, on a build tree with both of my branches merged). The same check passes on untouched host files and fails withouthost/posix, so it can tell. That is not a Linux build, link or run: the renderer's C++ files and the shader and game build were not compiled for Linux.Not tested: these cases were not checked one by one in the run above: the result under each interface option (Normal and Pro), that the pause menu's map still draws after hiding it on Pro, the conversation and cutscene cases, the forced open on Pro, and Linux and a Steam Deck. Their logic is in the game-free test only against a stand-in; the Test Farm cannot see the screen.
Must be tested:
host/oot_minimap.cuses the same locking calls as the other host files) and the game starts (asked of the Test Farm on this PR: build and start the game, open the Controls tab, expecting the game to start and the Minimap button row to be there, Off by default).Screenshots
After: this PR (a pack of this branch built on
main@6c9edffe, before the rebase ontoe090cc48): the Controls tab's new Minimap button row on D-pad down, with its help text.After: this PR, the same build: the minimap on screen in the Ice Cavern with the Minimap button on D-pad down.
Risks
What could break: the controller read now calls
hos_minimap_buttonson every read of the first controller, and Link's movement update calls the host once a frame. With the button Off both do almost nothing. With it on, the read calls the game's own screen lookup (f_80b45cd0) from the game's thread, as the game itself does when it opens the screen. A wrong gameplay test would only make a press go to the game as it does today, or open the minimap late.Turning it off: Minimap button Off (the default), or revert the commit.
Compatibility: the options file gains two lines,
minimap_buttonandminimap(an older file reads the defaults). The player's next build translates the game again because the lifted function changes, as for any change tonx2/oot_patches.py. The shader and pipeline caches andMKWVK_API_VERSIONare untouched (the option ids are newHOS_OPT_*numbers and no struct changed, as when the earlier options such asHOS_OPT_HOLD_TOGGLEwere added).Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
in Risks. Not ticked yet: Risks states extra per-frame and controller-read calls when the button is on, with no timing given.
main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.tests/that reads changed source updated in this PR, not weakened.aa626cc97aa57feb1930Rebased onto
main@7bacf846: conflicts in gpu/vk/menu_i18n.h (same as above) and gpu/vk/vk_menu.cpp: kept theminimapoption's save and load lines beside main's newgpu_device_idblock, and dropped thehas_vram_budgetline main removed. No tests were run here; the test boxes stay yours.@kendowashere only members of
BigBeanscan start the farm.One of them can approve this request by reacting 👍 to it.This request was fora43db60, and the PR has changed since (1575bf7), so a 👍 no longer approves it. Comment@Beanstalkagain to ask for the new commit.a43db600a11575bf72a2@Beanstalk On Linux, any GPU: build this branch and start the game. Open the Controls tab and set Minimap button to D-pad down. In the field, hold D-pad down for about a quarter of a second: the minimap should hide, and a second hold should bring it back (try In-Game Interface on Normal and on Pro). A quick tap should change boots and leave the minimap alone. Pass: it builds and starts, the row is there (Off by default), and the hold and tap behave as described. Please copy any log line containing 'minimap'.
@kendowashere only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it.Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.