feat(discord): the status names where Link is, his age and stats; its text and picture are the player's to set #1653
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1653
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:feat/discord-area"
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 3080 (driver 621.14) · Needs: Linux, any GPU
TL;DR
Longshot's Discord status said only "Longshot" and the build. Now it says where Link is and his age ("Water Temple - Adult"), with his hearts, Gold Skulltula tokens and pieces of heart under it ("❤️ 1.25/9 · 🕷️ 17 · 💗 5"), and the version where there is no place (the title screen). Players can rewrite both lines, the picture and its hover text in
longshot_options.ini. Checked in the game with a real Discord client on two saves, and with new game-free checks.Breakdown
Why
The Discord status showed "Playing Longshot" and the build and nothing else, the same on the title screen as at the Water Temple. #1082 asks for the area and other game details, and for the player to choose the text, picture and name. Fixes #1082 (the bold name is the Discord application's, so a different one is the player's own application through
discord_app_id=, as before).What changed
The status is now a template the player can rewrite, filled from what the game knows: where Link is, his age, his hearts, rupees, tokens and pieces of heart, and the version in readable parts. The defaults show the place over the stats in a map and the version elsewhere; the picture's hover text shows the version.
host/oot_area_names.cnames the game's 80 maps in English (Market Ruins, Zora's Domain (frozen), Fighting Queen Gohma, "(Master Quest)"), and spells out one it does not know.host/discord_activity.c:discord_text=(both lines, split by{break}),discord_image=,discord_image_text=;{name},{name|text}(only when name is not empty),{!name|text}(only when it is), nesting,{{}}; an empty part takes its brackets, spaces and a dangling dash or dot with it; a line is cut to Discord's 128 bytes at a whole letter. The version in parts:{version}v3.0.0,{build}RC7 or N486 (a nightly),{commit}(in the defaults only on a build with no version number, a nightly),{release}all of it.host/hos_main.creads Link's life, most life and rupees from the game data with the map, and his Gold Skulltula tokens from his pouch every 2 s; hearts show as plain decimals (1.25), as ¼ was too small to read in Discord.host/oot_heart_containers.creads the eight boss containers' placement ids from the player's own RomFS once, on the Discord thread (the dungeons' map files: zstd withPack/ZsDic.pack.zs's dictionary, BYML inside);host/oot_state_tap.c'shos_oot_gamedata_bool64reads whether each was taken (the game data's Bool64bitKey flags). Nothing from the game is in the source.host/discord_rpc.clooks every 2 s, sends a change once 15 s have passed since the last, keeps the 60 s keep-alive, and logs each new status ("discord: the status: ..."). The location shows only while Link was seen in the last 90 s (not through the title or a long load).Measurements
Nothing to measure: the status's text. The work it adds is a few game-data reads every 250 ms (with the map, as before), two pouch counts and eight flag reads every 2 s, and one read of eight map files on the Discord thread at the first status.
Flags and settings
Three new
longshot_options.inilines, documented in the README's Discord section; no switch.discord_text={location|{location} - {age}{break}{hearts|❤️ {hearts}/{max_hearts} · }{skulltulas|🕷️ {skulltulas} · }{heart_pieces|💗 {heart_pieces}}}{!location|{version} {build}{!version| {commit}}}discord_image=https://linklongshotdiscord_image_text=Longshot {version} {build}{!version| {commit}}Testing
Tested:
HOS_CONTROL_MEM=ro): of the eight boss containers' Bool64bitKey flags, exactly the five of Deku Tree, Dodongo's Cavern, Jabu-Jabu, Forest and Fire read 1 at +12 (Shadow, Spirit and Water 0), so 4 × (9 − 3 − 5) + 1 = 5, the pieces the player counted (the game's map marks 4 of them).python -I -B tests/test_discord_activity.py: every map named; the templates, conditionals, cleanup and the 128-byte cut; the version's parts (RC, beta, nightly, a bare hash, dirty); the hearts' decimals; the options lines (the Insert menu's owndiscord_status=left alone); the JSON parsed back.python -I -B tests/test_heart_containers.py: the pieces' total, and the readers on made-up SARC and BYML files of both byte orders, cut short at every length.python -I -B tests/run_all.pyon Windows: 640 passed, 49 failed, 121 skipped. The same 49 fail onmain(da91e770) on this PC, none from this branch: test_auto_handheld.py, test_bug_report_defaults.py, test_build_long_paths.py, test_capture_read_once.py, test_cpu_report.py, test_crash_dialog.py, test_crt_options.py, test_damage_debug_menu.py, test_dev_packs.py, test_discover.py, test_display_startup_failure.py, test_dlss_feature_size.py, test_failed_compile_keeps_objects.py, test_fastfp_fma.py, test_fma_soft.py, test_fpx_sticky.py, test_game_menu_mouse_buttons.py, test_guest_imported.py, test_host_guest_writes.py, test_hud_layout_row.py, test_invalidate_quick.py, test_invalidate_vcore.py, test_job_queue.py, test_libc_hooks.py, test_lift_lookups.py, test_linux_preflight.py, test_linux_pressure.py, test_longshot_ctl.py, test_missing_nup.py, test_pads_after_menu.py, test_pending_guest_import.py, test_pipeline_play_cache.py, test_prepare_cache_save.py, test_present_thread.py, test_profiling_mode.py, test_psychov35_fsr3_fg.py, test_readback_timeout_source.py, test_run_all_changed.py, test_sdiv_overflow.py, test_slow_frames.py, test_song_note_cue.py, test_spawn_emit.py, test_switch_table.py, test_tested_configurations.py, test_upscaler_rows.py, test_vbytes.py, test_vfpx_elem.py, test_walk.py, test_walk_key.py.Not tested: the last two commits (
31ffa5ad, the hearts as decimals;73398ede, the pieces' total) in a watched run: building now, its status lines follow as a comment. Linux: neither built nor run here (the new host code is plain C with no Windows calls); a Master Quest save (the containers are read from the normal dungeons' map files).Must be tested:
longshot_log.txt(by hand: a tester with Discord on Linux).Risks
What could break: the Discord status's text; a RomFS without the dungeons' map files (a mod that removes them) shows no 💗 and logs "0 of 8 found".
Turning it off: the Insert menu's Discord status row, or
discord_text=set to what you want shown; revert the commits.Compatibility: Nothing changes for saves or caches. The status's text is new; a player who wants the old line writes
discord_text=Longshot {version} {build}.Issues
Fixes #1082
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.
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.🤖 Generated with Claude Code
In a map the Discord status's first line is the place Link is and his age ("Kakariko Village - Adult", "Fighting Queen Gohma - Child"); on the title screen and before Link is first seen it says "Longshot" and the version, as before. Link counts as in a map while his update ran within 90 s (the pause menu and cutscenes keep it). host/oot_area_names.c names the game's 80 maps in English (the age, Master Quest and changed-state suffixes folded; the market's ruins by their own name; a boss's or a fight's room by the fight) and spells out one it does not know. host/discord_activity.c reads longshot_options.ini's discord_details=, discord_state=, discord_title_details=, discord_title_state=, discord_image= (an art asset's key or an https:// link) and discord_image_text=, templates with {area}, {age}, {map} and {version}, cut to Discord's 128 bytes at a whole letter, a line under 2 letters left out, the JSON escaped. host/discord_rpc.c sends a change within 15 s (Discord takes a few a minute) and logs each new text. Checks: tests/test_discord_activity.py (every map named, the templates, the settings lines, the in-map rule, the activity's JSON parsed). See #1082. Co-Authored-By: Claude Opus 5.5 <[email protected]>git describe's "v3.0.0-rc.7-25-g7a029028" becomes {version} v3.0.0, {build} RC7 (rc.7 and rc7; beta.2 "Beta 2"; nightly-70 "Nightly 70"; nothing on a release), {commit} 25-g7a029028 (-dirty kept) and {release} all of it. An empty part takes its brackets and the extra space with it, so "Longshot {version} {build} [{commit}]" reads "Longshot v3.0.0 RC7 [25-g7a029028]" on a test build and "Longshot v3.0.0" on a release. The defaults: "Longshot {version} {build}" on the second line, the commit in the picture's hover text. Co-Authored-By: Claude Opus 5.5 <[email protected]>The status is discord_status=, default {location|{location} - {age}{break}}Longshot {version} {build} {commit} so the place and the age lead and the version is the smaller line under them; on the title screen there is no location, the first part is left out and the version stands alone. {name|text} nests; {location}, {age} and {map} are empty outside a map. The bold name above it is the Discord application's (discord_app_id=): Discord shows no other there. Replaces the separate details/state keys of the earlier commits (not released). Co-Authored-By: Claude Opus 5.5 <[email protected]>{hearts}/{max_hearts} (quarter hearts as ¼ ½ ¾), {rupees} and {skulltulas} in the template, empty outside a map. The default's second line: "❤️ 2¾/3 · 🕷️ 12 · v3.0.0 RC7 ..."; a part not known goes with its middle dot. host/hos_main.c reads PlayerStatus.Life, .MaxLife and .CurrentRupee with the map on Link's update (host/oot_state_tap.c's lookup, hos_oot_gamedata_int) and the tokens (Item_Token_Gold, as the Cheats page counts them) every 2 s, kept for the Discord thread (hos_oot_stats). Co-Authored-By: Claude Opus 5.5 <[email protected]>Tested in game: Windows 11, RTX 3080 (NVIDIA 621.14), the Discord app running, the status watched in it: a new save (Kokiri Forest, a teleport to Kakariko) and a save at the Water Temple (title, Water Temple, a teleport to Kakariko Village). At 21c3afa3 the status read 'v3.0.0 RC7' on the title, then 'Water Temple - Adult' over the hearts, tokens and pieces, then 'Kakariko Village - Adult'. The eight boss containers' flags read in the game on that save: exactly the five taken set, so 5 pieces in all, as the player counted. The last two commits (hearts as decimals, the pieces' total) are building for a watched run; its lines follow as a comment.
WIP: feat(discord): the status names where Link is, his age and stats; its text and picture are the player's to setto feat(discord): the status names where Link is, his age and stats; its text and picture are the player's to setThe watched run of the last two commits (
31ffa5ad, the hearts as decimals;73398ede, the pieces of heart in all) was stopped before it started, to free this PC's shared build base: the pack over it was rebuilding the game's code, as the branch is 20 commits past that base. It is still owed: the status should read "Water Temple - Adult" over "❤️ 1.25/9 · 🕷️ 17 · 💗 5" on the save the containers' flags were read from, with "discord: the boss heart containers: 8 of 8 found in the RomFS" in the log. I'll post its lines here when it has run.