fix(windows): the launcher's Start menu shortcut is listed beside the game's again #88
No reviewers
Labels
No labels
area/build
area/install
area/saves
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
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/LongshotLauncher!88
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/LongshotLauncher:fix/start-menu-shortcut"
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?
On Windows, the launcher's own Start menu shortcut seems to disappear once the game's Start menu entry is made. Ticking "Start menu entry" on the Ready screen then makes only the game's entry, never the launcher's. A player reported both.
Why it happens
The Start menu lists one entry for each app it tells apart, and it tells shortcuts apart by their AppUserModelID. Both of the launcher's shortcuts start the same program:
Longshot Launcher.lnk, the launcher's own, made at install and again after each of its updates;Longshot.lnk, the game's, which is the launcher with--play, made by the Ready screen.Neither named an ID, so the Start menu took them for one app and showed only the first by name: Longshot, the game's. The launcher's file was still there, just not listed (Microsoft: AppUserModelIDs; the Start menu hiding shortcuts to the same exe).
What changed
Core/ShellLinks.cs(new) writes and reads shortcuts through the shell's own ShellLink object (IShellLinkW,IPersistFile,IPropertyStore), with the shortcut's AppUserModelID (PKEY_AppUserModel_ID).GeneratedComInterface,StrategyBasedComWrappers), since the release is built withBuiltInComInteropSupport=false.IOException, which every caller already handles (the Ready screen shows its toast, and the update-time refresh tries again at the next start).Core/Shortcuts.cs):MagicBean.LongshotLauncherfor the launcher's Start menu shortcut (Installer) and its own window (SetCurrentProcessExplicitAppUserModelIDat the start,WindowsInstall.UseAppId), so a pinned launcher and its window stay one taskbar button.MagicBean.Longshotfor the game's shortcuts (WindowsShortcuts.Write).IShortcutMaker.Maketakes the ID.Installer.RefreshandWindowsShortcuts.Refresh, unchanged), now with their IDs. The launcher's entry then shows again without the player doing anything.App/WindowsShortcuts.cs: the PowerShell shortcut script (Line,Run) is gone.Quotestays for the uninstall's clean-up.Testing
Tested (Windows 11, .NET SDK 10.0.103):
python -I tests/test_launcher_core.py --strict: 1097 checks pass. They include:ShellLinkChecksthat writes the launcher's and the game's shortcuts through the real shell in the test's scratch folder (never the Start menu) and reads them back: target, arguments and ID each. It also covers a shortcut written over itself, and a refused write coming out as anIOException.python -I tests/test_release.py: OK.dotnet build App -c Release: 0 warnings, 0 errors.Not tested:
%LOCALAPPDATA%\Programs). I didn't install one on this PC, so there are no screenshots yet.Must be tested (Windows, a launcher built from this branch):
Screenshots of the Start menu go here once someone has run it.
Risks
IOExceptionlike any other shortcut failure, and nothing else depends on it.See #90 (the Start menu shortcut point).
🤖 Generated with Claude Code
WIP: fix(windows): the launcher's Start menu shortcut is listed beside the game's againto fix(windows): the launcher's Start menu shortcut is listed beside the game's again