Compare commits

...

2 Commits

Author SHA1 Message Date
Storm Dragon 03e72a8263 For Top Speed always try to get a valid download link. 2026-04-14 00:12:51 -04:00
Storm Dragon ae37f1a71f For Top Speed always try to get a valid download link. 2026-04-13 19:16:42 -04:00
4 changed files with 74 additions and 40 deletions
@@ -1,6 +1,6 @@
# Linux Game Manager Core Map
Last refreshed: 2026-04-12
Last refreshed: 2026-04-14
## Top-Level Structure
@@ -16,7 +16,7 @@ Last refreshed: 2026-04-12
- Installers: 42 (`.install/*.sh`)
- Launcher definitions: 42 (`.launch/*.game`)
- Launcher runnable entries: 30 (`.launch/*.sh`, both symlinks and files)
- Launcher runnable entries: 31 (`.launch/*.sh`, both symlinks and files)
- Update scripts: 5 (`.update/*.sh`)
Regenerate this snapshot with:
@@ -30,7 +30,8 @@ python3 .codex/skills/linux-game-manager-dev/scripts/audit_game_catalog.py
1. **Install flow**
- `game_installer` builds menu from `.install/*.sh`.
- Selected installer is sourced in the current shell.
- Shared downloads try `curl` first, fall back to `wget` when available, and reject obvious HTML error pages for unknown file types.
- Shared downloads try `curl` first, fall back to `wget` when available, validate archive payloads before install, and reject obvious HTML error pages for unknown file types.
- `download_named()` shares the same cache validation path as `download()`, so resolved asset URLs must still produce a valid payload for their file extension.
- If `.launch/<game>.game` exists and `.launch/<game>.sh` does not, the manager creates a symlink using the repository root, even if the installer changed directories.
2. **Launch flow**
+19 -2
View File
@@ -1,7 +1,24 @@
#!/usr/bin/env bash
# shellcheck disable=SC2154 # set by linux-game-manager.sh
check_architecture x86_64
download "https://github.com/diamondStar35/top_speed/releases/download/release-build/TopSpeed-linux-x64-Release-v-2026.4.13.1.zip"
releaseMetadataFile="TopSpeed-release-build.json"
releaseMetadataPath="${cache}/${releaseMetadataFile}"
releaseMetadataUrl="https://api.github.com/repos/diamondStar35/top_speed/releases/tags/release-build"
assetPattern='^TopSpeed-linux-x64-Release-v-.*\.zip$'
rm -f "${releaseMetadataPath}"
download_named "${releaseMetadataFile}" "${releaseMetadataUrl}"
assetName="$(jq -r --arg assetPattern "${assetPattern}" '.assets[] | select(.name | test($assetPattern)) | .name' "${releaseMetadataPath}" | head -n 1)"
assetUrl="$(jq -r --arg assetPattern "${assetPattern}" '.assets[] | select(.name | test($assetPattern)) | .browser_download_url' "${releaseMetadataPath}" | head -n 1)"
if [[ -z "${assetName}" ]] || [[ -z "${assetUrl}" ]] || [[ "${assetName}" == "null" ]] || [[ "${assetUrl}" == "null" ]]; then
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Unable to find the latest Top Speed Linux download in the GitHub release metadata."
exit 1
fi
download_named "${assetName}" "${assetUrl}"
mkdir -p "${installPath}/TopSpeed"
unzip -o -d "${installPath}/TopSpeed" "${cache}/TopSpeed-linux-x64-Release-v-2026.4.13.1.zip"
unzip -o -d "${installPath}/TopSpeed" "${cache}/${assetName}"
chmod +x "${installPath}/TopSpeed/TopSpeed"
+2
View File
@@ -7,6 +7,8 @@ Installer and launcher for accessible to the blind games that run natively in Li
As the project grows, more dependencies will most likely be added. When LGM is launched, it will check to make sure it has the required dependencies for it to do the work of downloading and extracting the game. Note that because every distro has a different package manager, dependencies for games themselves will not be resolved. Please consult the game's documentation to find out what is needed for the game to run.
Current base dependencies checked on launch: `7z`, `curl`, `dialog`, `jq`, `yad`, and `unzip`.
## Disabling game entries
To disable a game entry without deleting its script, set the first line of the script to start with `#//`.
+49 -35
View File
@@ -556,44 +556,56 @@ download() {
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$i\"...\n\ndownload exit codes: ${downloadAttemptExitCodes}\nError details: ${downloadErrorLog}"
exit 1
fi; } | ui_progressbox "Linux Game Manager" "Downloading \"$dest\" from \"$i\""
local downloadError=0
case "${dest##*.}" in
"pk3"|"zip")
unzip -tq "${cache}/${dest}" | ui_progressbox "Linux Game Manager" "Validating ${dest##*.} file"
downloadError=$?
;;
"7z")
7z t "${cache}/${dest}" | ui_progressbox "Linux Game Manager" "Validating 7z file"
downloadError=$?
;;
"exe")
# Check if it's a valid Windows executable by looking at the MZ header
if ! hexdump -n 2 -v -e '/1 "%02X"' "${cache}/${dest}" | grep -q "4D5A"; then
downloadError=0
fi
;;
"wad")
if [[ "$(file -b --mime-type "${cache}/${dest}")" == "application/octet-stream" ]]; then
downloadError=0
fi
;;
*)
# Add HTML check for other file types
if file -b "${cache}/${dest}" | grep -q "HTML document" ; then
downloadError=1
else
downloadError=0
fi
;;
esac
if [[ $downloadError -ne 0 ]]; then
rm -fv "${cache}/${dest}"
alert "Linux Game Manager" "Linux Game Manager" "Error downloading \"${dest}\". Installation cannot continue."
exit 1
fi
validate_downloaded_cache_file "${dest}"
done
}
validate_downloaded_cache_file() {
local dest="$1"
local downloadError=0
case "${dest##*.}" in
"pk3"|"zip")
if ! (
set -o pipefail
unzip -tq "${cache}/${dest}" | ui_progressbox "Linux Game Manager" "Validating ${dest##*.} file"
); then
downloadError=1
fi
;;
"7z")
if ! (
set -o pipefail
7z t "${cache}/${dest}" | ui_progressbox "Linux Game Manager" "Validating 7z file"
); then
downloadError=1
fi
;;
"exe")
# Check if it's a valid Windows executable by looking at the MZ header
if ! hexdump -n 2 -v -e '/1 "%02X"' "${cache}/${dest}" | grep -q "4D5A"; then
downloadError=0
fi
;;
"wad")
if [[ "$(file -b --mime-type "${cache}/${dest}")" == "application/octet-stream" ]]; then
downloadError=0
fi
;;
*)
if file -b "${cache}/${dest}" | grep -q "HTML document" ; then
downloadError=1
else
downloadError=0
fi
;;
esac
if [[ ${downloadError} -ne 0 ]]; then
rm -fv "${cache}/${dest}"
alert "Linux Game Manager" "Linux Game Manager" "Error downloading \"${dest}\". Installation cannot continue."
exit 1
fi
}
download_named() {
# Only needed if url breaks the name, e.g. downloads/?filename=1234
# Required arguments: filename url
@@ -614,6 +626,7 @@ download_named() {
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$dest\"...\n\ndownload exit codes: ${downloadAttemptExitCodes}\nError details: ${downloadErrorLog}"
exit 1
fi
validate_downloaded_cache_file "${dest}"
}
get_installer() {
@@ -946,6 +959,7 @@ requiredPackages=(
"7z"
"curl"
"dialog"
"jq"
"yad"
"unzip"
)