feat(builder): the game's own name and icon for its exe and window, from the .nup #857
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
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
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!857
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:feat/game-title-icon"
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: not run yet · Needs: Windows (any GPU), Linux (any GPU), built from a .nup
Why
A game the builder makes is called "Longshot" and has no icon: the window's title says Longshot, and on Windows the exe shows in Task Manager, the taskbar and its Properties as a nameless longshot.exe with the default icon. On Linux the window got the desktop's generic icon, since the game looked for its icon in the wrong folder. It should look like the game it is: its own icon, and the name "The Legend of Zelda: Ocarina of Time (Longshot)". See #228.
What changed
The builder reads the game's name and icon from the .nup it builds from, keeps them in the game folder so an update keeps them, and makes them into the Windows exe's icon and the name Windows shows for it, and into the window's title and (on Linux) its icon. The exe's file name stays
longshot.exe/longshot: the launcher, the folder's launcher (builder/setup/setup.c) and the driver profiles find the game by it, and Windows refuses the colon in a file name.nx2/game_title.py(new) reads the title's metadata in the .nup (the record at +0x20 of its title entry: kind/size records, 3 the icon JPEG, 5 the name). The .nup's name is fit for a file name, so its colon is gone ("The Legend of Zelda Ocarina of Time");NAMESgives the name as the game writes it, by title id. It keepslongshot_title.txt(the window title, with " (Longshot)") and.longshot_icon.jpgin the game folder.make_game.pygame_name()runs after the game is read (a .nup build reads it, an update uses what the folder kept, a build from an unpacked dump has neither and stays "Longshot"). On Windows it writeswork/longshot_game.res; on Linux the folder'slongshot.pngis the game's icon instead of Longshot's logo. Nothing in it stops a build.make_icon.pyis split into functions the builder reuses, and can add a VERSIONINFO (version_entry: FileDescription and ProductName). Its CLI makes the same files as before.build.pyexe_resources()linkslongshot_game.res, else a developer'slongshot.res, never both (both are icon 1).hos_game_title()inhost/hos_paths.hreads the first line oflongshot_title.txtin the game folder.host/display.csets it as the window's title (Unicode, through DefWindowProcW);host/posix/display_sdl.ccreates the window with it (HOS_WINDOW_TITLEstill wins).hos_game_path_a), not beside the exe. In a packaged builder's folder the game isbin/longshot, so it looked inbin/and never foundlongshot.png.tests/display_startup_failure_test.cppstubshos_game_title, which the startup loop it cuts out now calls.Measurements
Nothing to measure: no frame-time or memory change. What needs checking is the name and icon (below).
Flags and settings
None.
Testing
Tested: the .nup layout was read by hand from an Ocarina of Time 1.1.1 .nup on Linux: records 1 (NPDM, 1828 bytes), 3 (JPEG, 38073 bytes), 4 ("1.1.1"), 5 ("The Legend of Zelda Ocarina of Time"), 8 ("ZeldaOOT"); title id 0400486024dec000. No build was run, and
tests/run_all.pywas not run on this PC.Not tested: a build and a start of the game on either OS; the game-free checks.
Must be tested:
python -I -B tests/run_all.pypasses, expecting nothing new to fail (by hand, or the Forgejo checks).bin\longshot.exeshown under that name and icon in Task Manager and the taskbar (Test Farm:@Beanstalk windows, build from the .nup and check the window title and the exe's icon and name in Task Manager).longshot, expecting the same window title and the game's icon on X11 (Test Farm:@Beanstalk linux, same check).Risks
What could break: a .nup whose metadata isn't laid out as above gives no name or icon, and the game stays "Longshot" as before. A JPEG Pillow can't read gives no icon. The host's headers changed (
hos_paths.h), so the next build compiles the host code again.Turning it off: revert the commit. Deleting
longshot_title.txtfrom a game folder puts the title back to "Longshot".Compatibility: saves, the options file, the caches and the vk ABI don't change. The game folder gets
longshot_title.txtand.longshot_icon.jpg. A folder built before this PR keeps "Longshot" until it is built from its .nup again (an update alone has nothing to read the name from).Issues
See #228 (the generic Wayland icon on the game)
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). Not run on this PC.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._wfopenon a UTF-16 path on Windows.🤖 Generated with Claude Code
WIP: feat(builder): the game's own name and icon for its exe and window, from the .nupto feat(builder): the game's own name and icon for its exe and window, from the .nup