Compare commits

..
9 Commits
31 changed files with 719 additions and 38 deletions

No files matched your search

@@ -1,6 +1,6 @@
# Linux Game Manager Core Map # Linux Game Manager Core Map
Last refreshed: 2026-09-20 Last refreshed: 2026-11-05
## Top-Level Structure ## Top-Level Structure
@@ -9,16 +9,18 @@ Last refreshed: 2026-09-20
- `.launch/`: Per-game launch scripts (`.game`) and runnable entries (`.sh`, usually symlinks). - `.launch/`: Per-game launch scripts (`.game`) and runnable entries (`.sh`, usually symlinks).
- `.update/`: Optional per-game update scripts expected to define `run_update()`. - `.update/`: Optional per-game update scripts expected to define `run_update()`.
- `.includes/ipfs.sh`: Central associative array of IPFS download URLs, expanded against the configured gateway at startup. - `.includes/ipfs.sh`: Central associative array of IPFS download URLs, expanded against the configured gateway at startup.
- `.includes/desktop.sh`: Game-specific desktop shortcuts with Desktop Entry and Exec argument escaping.
- `.includes/wickets.sh`: Shared Wickets installer/updater; resolves the latest GitHub release and preserves portable saves.
- `speech/speak_window_title.sh`: Accessibility helper for announcing focused window titles. - `speech/speak_window_title.sh`: Accessibility helper for announcing focused window titles.
- `README.md`: Project summary and high-level behavior notes. - `README.md`: Project summary and high-level behavior notes.
- `.files/`: Game-specific auxiliary assets/scripts used by some installers or launchers. - `.files/`: Game-specific auxiliary assets/scripts used by some installers or launchers.
## Catalog Snapshot ## Catalog Snapshot
- Installers: 43 (`.install/*.sh`) - Installers: 50 (`.install/*.sh`)
- Launcher definitions: 43 (`.launch/*.game`) - Launcher definitions: 50 (`.launch/*.game`)
- Launcher runnable entries: 32 (`.launch/*.sh`, both symlinks and files) - Launcher runnable entries: 38 (`.launch/*.sh`, both symlinks and files; varies with local installations)
- Update scripts: 5 (`.update/*.sh`) - Update scripts: 11 (`.update/*.sh`)
Regenerate this snapshot with: Regenerate this snapshot with:
@@ -31,14 +33,22 @@ python3 .codex/skills/linux-game-manager-dev/scripts/audit_game_catalog.py
1. **Install flow** 1. **Install flow**
- `game_installer` builds menu from `.install/*.sh`. - `game_installer` builds menu from `.install/*.sh`.
- Selected installer is sourced in the current shell. - Selected installer is sourced in the current shell.
- Monkey Spank clones its required submodules recursively and stops installation if cloning fails.
- 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. - 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. - `download_named()` shares the same cache validation path as `download()`, so resolved asset URLs must still produce a valid payload for their file extension.
- RS Games installs the fixed 2.3 x86_64 archive under `${installPath}/RS_Games` and launches `./rsg` from that directory. The archive omits `speechd`; the installer requires host Python Speech Dispatcher bindings and copies their Python sources into `_internal/speechd`. Run `.files/rs-games-alsa.py` to silently test default-device initialization with the bundled library. Keep a working bundle untouched. Only set it aside as `libasound.so.2.bundled` when bundled initialization fails and system ALSA passes the same check; restore it if the system check fails. Inconclusive initial probes retain the bundle and report diagnostics. The bundled library has incompatible plugin paths and symbol versions on Arch Linux. Run `python3 -B -m unittest discover -s tests` for ALSA selection/restoration and path-resolution regressions. Run `.files/rs-games-audio.py` after extraction to correct non-Windows file-path encoding in `sound_lib.stream`; the helper renames its frozen PYZ entry so the corrected filesystem source is used and preserves `rsg.lgm-original`. Confirm with the frozen importer, since direct BASS decoding bypasses the failing wrapper. The repair also installs `sound_lib/lgm_paths.py` for per-call case-insensitive sound lookup: exact paths win, otherwise each component must have one case-insensitive match; missing or ambiguous paths stay unchanged. Downloads are never renamed and misses are not cached. Validate with `python3 -B -m unittest discover -s tests -p "test_rs_games_paths.py"` and the actual frozen importer. Client logs are in `~/.ZGP/errors.log`.
- Wickets resolves the latest stable GitHub release on each install/update, extracts its Linux x64 tarball into staging, and overlays `${installPath}/Wickets` while preserving `saves`. A `.lgm-version` marker records the release installed by the manager.
- 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. - 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** 2. **Launch flow**
- `game_launcher` enumerates `.launch/*.sh` entries. - `game_launcher` enumerates `.launch/*.sh` entries.
- Entries with first line `#//` are skipped. - Entries with first line `#//` are skipped.
- Selected launcher is sourced/executed. - Selected launcher is sourced/executed.
- The launch menu offers Desktop Shortcut in both Yad and dialog. It writes an executable `~/Desktop/linux-game-manager-<Game Name>.desktop`, refuses to overwrite existing files, and returns to the menu. The shortcut runs the manager with `-l` and sets its working directory to the repository root.
- `game_launcher <Game Name>` skips the menu and selects an installed, enabled entry by its exact display name. Missing or disabled entries fail with a message. Launcher discovery uses `scriptRoot` even when called from another working directory.
- `ui_menu --desktop-shortcut` adds the launch-menu buttons and returns status 3 for shortcut creation. Ordinary `ui_menu` calls keep their standard buttons. Both modes preserve cancellation status and discard any cancelled selection.
- Run `bash tests/game_shortcut_tests.sh` for isolated menu, direct-launch, CLI, and Desktop Entry checks; these require Python with PyGObject and `desktop-file-validate`. They do not launch installed games or use real user state. Live keyboard, screen-reader, and real-game acceptance remains separate.
- Monkey Spank runs from its repository directory so relative sound and text assets resolve; its explicit directory assignment also identifies the removal root.
- Text-terminal launchers can fall back to `xterm`, which inherits the requested working directory before executing the game command. - Text-terminal launchers can fall back to `xterm`, which inherits the requested working directory before executing the game command.
3. **Removal flow** 3. **Removal flow**
@@ -50,10 +60,12 @@ python3 .codex/skills/linux-game-manager-dev/scripts/audit_game_catalog.py
- `game_update` lists `.update/*.sh`. - `game_update` lists `.update/*.sh`.
- Selected updater is sourced. - Selected updater is sourced.
- `run_update()` is called and must exist. - `run_update()` is called and must exist.
- Wickets requires an existing installation, refreshes release metadata even with cached archives, and exits after an up-to-date notice if `.lgm-version` matches. Its own in-game updater is also available from 1.2.0 onward.
## CLI Surface ## CLI Surface
- `-i`: install game - `-i`: install game
- `-l <Game Name>`: launch an installed, enabled game directly by exact menu name
- `-r`: remove game - `-r`: remove game
- `-u`: update game - `-u`: update game
- `-t`: show number of available games - `-t`: show number of available games
@@ -104,6 +104,10 @@ python3 .codex/skills/linux-game-manager-dev/scripts/audit_game_catalog.py
- Use camelCase variable names. - Use camelCase variable names.
- Use snake_case for function names. - Use snake_case for function names.
- Keep scripts robust when sourced in the manager shell. - Keep scripts robust when sourced in the manager shell.
- Clone games with required submodules using `git clone --recurse-submodules` and stop installation on clone failure.
- Launch games that load relative assets from their own directory. Monkey Spank uses `${installPath}/monkeyspank` as its working directory and removal root.
- Wickets shares install/update logic in `.includes/wickets.sh`; its versioned tarball has one top-level directory, and portable saves must survive updates. Always refresh GitHub release metadata rather than reusing a cached latest-release response.
- RS Games 2.3 has a single `rsg/` archive root; strip that component into `${installPath}/RS_Games` and launch `./rsg` from that directory. Require `python-speechd:speechd` and copy its Python sources into `_internal/speechd`, since the frozen runtime cannot import host site-packages and the release omits these bindings. Run `.files/rs-games-alsa.py` to silently test default-device initialization with the bundled library. Keep a working bundle untouched. Only set it aside as `libasound.so.2.bundled` when bundled initialization fails and system ALSA passes the same check; restore it if the system check fails. Inconclusive initial probes retain the bundle and report diagnostics. The bundled library has incompatible plugin paths and symbol versions on Arch Linux. Run `python3 -B -m unittest discover -s tests` for ALSA selection/restoration and path-resolution regressions. Run `.files/rs-games-audio.py` after extraction to correct non-Windows file-path encoding in `sound_lib.stream`; the helper renames its frozen PYZ entry so the corrected filesystem source is used and preserves `rsg.lgm-original`. Confirm with the frozen importer, since direct BASS decoding bypasses the failing wrapper. The repair also installs `sound_lib/lgm_paths.py` for per-call case-insensitive sound lookup: exact paths win, otherwise each component must have one case-insensitive match; missing or ambiguous paths stay unchanged. Downloads are never renamed and misses are not cached. Validate with `python3 -B -m unittest discover -s tests -p "test_rs_games_paths.py"` and the actual frozen importer. Client logs are in `~/.ZGP/errors.log`.
- Avoid introducing unnecessary colorized output. - Avoid introducing unnecessary colorized output.
- For edited bash scripts, run shellcheck and fix all errors. - For edited bash scripts, run shellcheck and fix all errors.
- If `shellcheck` is not installed, prompt the user to install it first (see `references/tooling-prereqs.md`). - If `shellcheck` is not installed, prompt the user to install it first (see `references/tooling-prereqs.md`).
+84
View File
@@ -0,0 +1,84 @@
#!/usr/bin/env python3
"""Keep bundled ALSA unless the system copy demonstrably fixes audio startup."""
import ctypes
import os
from pathlib import Path
import shutil
import subprocess
import sys
def probe_audio(gamePath):
probeEnvironment = os.environ.copy()
libraryPath = str(gamePath / "_internal")
if probeEnvironment.get("LD_LIBRARY_PATH"):
libraryPath += os.pathsep + probeEnvironment["LD_LIBRARY_PATH"]
probeEnvironment["LD_LIBRARY_PATH"] = libraryPath
try:
result = subprocess.run(
[sys.executable, str(Path(__file__).resolve()), "--probe", str(gamePath)],
env=probeEnvironment, capture_output=True, text=True, timeout=10, check=False,
)
except (OSError, subprocess.TimeoutExpired) as error:
return 2, str(error)
return result.returncode, (result.stdout + result.stderr).strip()
def configure_alsa(gamePath):
libraryPath = gamePath / "_internal/libasound.so.2"
if not libraryPath.exists():
print("RS Games has no active bundled ALSA library; leaving it unchanged.")
return
probeStatus, probeDetails = probe_audio(gamePath)
if probeStatus == 0:
print("RS Games bundled ALSA initializes successfully; keeping it.")
return
if probeStatus != 1:
print(f"Could not verify RS Games audio; keeping bundled ALSA.\n{probeDetails}")
return
backupPath = libraryPath.with_name("libasound.so.2.bundled")
if backupPath.exists() and backupPath.read_bytes() != libraryPath.read_bytes():
raise ValueError("Existing ALSA backup differs; refusing to overwrite")
libraryPath.replace(backupPath)
systemWorks = False
try:
systemStatus, systemDetails = probe_audio(gamePath)
systemWorks = systemStatus == 0
finally:
if not systemWorks:
shutil.copy2(backupPath, libraryPath)
if systemWorks:
print("RS Games bundled ALSA failed; verified system ALSA and preserved the bundled copy.")
else:
print("Neither ALSA setup could be verified; restored bundled ALSA.")
print(f"Bundled: {probeDetails}\nSystem: {systemDetails}")
def run_probe(gamePath):
try:
bassLibrary = ctypes.CDLL(str(gamePath / "_internal/sound_lib/lib/x64/libbass.so"))
bassLibrary.BASS_Init.argtypes = [
ctypes.c_int, ctypes.c_uint, ctypes.c_uint, ctypes.c_void_p, ctypes.c_void_p,
]
if not bassLibrary.BASS_Init(1, 44100, 0, None, None):
errorCode = bassLibrary.BASS_ErrorGetCode()
print(f"Default audio device initialization failed (BASS error {errorCode}).")
return 1 if errorCode == 3 else 2
bassLibrary.BASS_Free()
return 0
except OSError as error:
print(f"Audio library could not load: {error}")
return 2
if __name__ == "__main__":
if len(sys.argv) == 3 and sys.argv[1] == "--probe":
raise SystemExit(run_probe(Path(sys.argv[2]).resolve()))
if len(sys.argv) != 2:
raise SystemExit("Usage: rs-games-alsa.py GAME_DIRECTORY")
try:
configure_alsa(Path(sys.argv[1]).resolve())
except (OSError, ValueError) as error:
raise SystemExit(f"RS Games ALSA setup failed: {error}") from error
+113
View File
@@ -0,0 +1,113 @@
#!/usr/bin/env python3
"""Repair Linux file paths in the frozen RS Games 2.3 sound wrapper."""
import marshal
from pathlib import Path
import shutil
import struct
import sys
def repair_audio(gamePath):
executablePath = gamePath / "rsg"
streamPath = gamePath / "_internal/sound_lib/stream.py"
executableData = executablePath.read_bytes()
streamData = streamPath.read_bytes()
originalBlock = (
b'if platform.system() == "Darwin" and file and not mem:\r\n'
b' unicode = False\r\n'
b' file = file.encode(sys.getfilesystemencoding())'
)
encodedBlock = (
b'if platform.system() != "Windows" and not mem and isinstance(file, (str, bytes, os.PathLike)):\r\n'
b' unicode = False\r\n'
b' file = os.fsencode(file)'
)
repairedBlock = (
b'if platform.system() != "Windows" and not mem and isinstance(file, (str, bytes, os.PathLike)):\r\n'
b' from .lgm_paths import resolve_sound_path\r\n'
b' unicode = False\r\n'
b' file = os.fsencode(resolve_sound_path(file))'
)
resolverData = Path(__file__).with_name("rs-games-paths.py").read_bytes()
if streamData.count(originalBlock) == 1:
repairedStream = streamData.replace(originalBlock, repairedBlock)
elif streamData.count(encodedBlock) == 1:
repairedStream = streamData.replace(encodedBlock, repairedBlock)
elif streamData.count(repairedBlock) == 1:
repairedStream = streamData
else:
raise ValueError("Unexpected RS Games sound wrapper; refusing to patch")
# Rename only this module's PYZ entry. PyInstaller then falls back to the
# supplied filesystem source, making the corrected stream.py effective.
cookiePosition = executableData.rfind(b"MEI\014\013\012\013\016")
if cookiePosition < 0:
raise ValueError("PyInstaller archive cookie not found")
_, packageSize, tocOffset, tocSize, pythonVersion, _ = struct.unpack_from(
"!8sIIII64s", executableData, cookiePosition
)
if pythonVersion != 312:
raise ValueError("Expected the Python 3.12 RS Games release")
packageStart = cookiePosition + 88 - packageSize
entryPosition = packageStart + tocOffset
tocEnd = entryPosition + tocSize
pyzStart = None
pyzEnd = None
while entryPosition < tocEnd:
entrySize, offset, dataSize, _, compressed, entryType = struct.unpack_from(
"!IIIIBc", executableData, entryPosition
)
if entrySize < 18 or entryPosition + entrySize > tocEnd:
raise ValueError("Invalid archive table entry")
entryName = executableData[entryPosition + 18:entryPosition + entrySize].rstrip(b"\0")
if entryName == b"PYZ.pyz" and entryType == b"z" and not compressed:
pyzStart = packageStart + offset
pyzEnd = pyzStart + dataSize
entryPosition += entrySize
if pyzStart is None or executableData[pyzStart:pyzStart + 4] != b"PYZ\0":
raise ValueError("Uncompressed PYZ archive not found")
pyzTocStart = pyzStart + struct.unpack_from("!i", executableData, pyzStart + 8)[0]
if not pyzStart + 12 <= pyzTocStart < pyzEnd <= cookiePosition:
raise ValueError("Invalid PYZ table bounds")
tableData = executableData[pyzTocStart:pyzEnd]
originalName = b"sound_lib.stream"
savedName = b"lgm_saved_stream"
originalTable = dict(marshal.loads(tableData))
if "sound_lib.stream" in originalTable and "lgm_saved_stream" not in originalTable:
if tableData.count(originalName) != 1:
raise ValueError("Ambiguous sound module table entry")
repairedTableData = tableData.replace(originalName, savedName)
expectedTable = originalTable.copy()
expectedTable["lgm_saved_stream"] = expectedTable.pop("sound_lib.stream")
if dict(marshal.loads(repairedTableData)) != expectedTable:
raise ValueError("Archive table verification failed")
repairedExecutable = executableData[:pyzTocStart] + repairedTableData + executableData[pyzEnd:]
elif "lgm_saved_stream" in originalTable and "sound_lib.stream" not in originalTable:
repairedExecutable = executableData
else:
raise ValueError("Unexpected sound module archive entries")
if repairedExecutable != executableData:
backupPath = executablePath.with_name("rsg.lgm-original")
if backupPath.exists() and backupPath.read_bytes() != executableData:
raise ValueError("Existing executable backup differs; refusing to overwrite")
if not backupPath.exists():
shutil.copy2(executablePath, backupPath)
streamPath.with_name("lgm_paths.py").write_bytes(resolverData)
streamPath.write_bytes(repairedStream)
if repairedExecutable != executableData:
temporaryPath = executablePath.with_name("rsg.lgm-new")
temporaryPath.write_bytes(repairedExecutable)
temporaryPath.chmod(executablePath.stat().st_mode)
temporaryPath.replace(executablePath)
print("RS Games Linux audio file paths repaired.")
if __name__ == "__main__":
if len(sys.argv) != 2:
raise SystemExit("Usage: rs-games-audio.py GAME_DIRECTORY")
try:
repair_audio(Path(sys.argv[1]))
except (OSError, ValueError, EOFError, TypeError, struct.error) as error:
raise SystemExit(f"RS Games audio repair failed: {error}") from error
+29
View File
@@ -0,0 +1,29 @@
"""Resolve uniquely matching sound paths from Windows-authored game packs."""
import os
def resolve_sound_path(filePath):
originalPath = os.fspath(filePath)
if os.path.exists(originalPath):
return originalPath
pathText = os.fsdecode(originalPath)
resolvedPath = os.path.sep if os.path.isabs(pathText) else os.curdir
for component in pathText.split(os.path.sep):
if component in ("", "."):
continue
candidatePath = os.path.join(resolvedPath, component)
if os.path.exists(candidatePath):
resolvedPath = candidatePath
continue
try:
with os.scandir(resolvedPath) as entries:
matches = [entry.name for entry in entries if entry.name.casefold() == component.casefold()]
except OSError:
return originalPath
if len(matches) != 1:
return originalPath
resolvedPath = os.path.join(resolvedPath, matches[0])
return os.fsencode(resolvedPath) if isinstance(originalPath, bytes) else resolvedPath
+54
View File
@@ -0,0 +1,54 @@
# shellcheck shell=bash
# Desktop Entry escaping is separate from Exec argument quoting.
desktop_entry_value() {
local value="$1"
value="${value//\\/\\\\}"
value="${value//$'\n'/\\n}"
value="${value//$'\r'/\\r}"
value="${value//$'\t'/\\t}"
printf '%s' "$value"
}
desktop_exec_argument() {
local value="$1"
value="${value//%/%%}"
value="${value//\\/\\\\}"
value="${value//\"/\\\"}"
value="${value//\$/\\\$}"
value="${value//\`/\\\`}"
desktop_entry_value "\"${value}\""
}
game_desktop_shortcut() {
local gameName="$1"
local fileName="${gameName//\//_}"
fileName="${fileName//[$'\n\r\t']/_}"
local desktopFile="${HOME}/Desktop/linux-game-manager-${fileName}.desktop"
local launcherPath
# shellcheck disable=SC2154 # Set by the manager before sourcing this helper.
launcherPath="$(readlink -e "${scriptRoot}/linux-game-manager.sh")" || return 1
if ! mkdir -p "${HOME}/Desktop"; then
ui_msgbox "Desktop Shortcut" "" "Could not create ~/Desktop."
return 1
fi
# Refuse to overwrite files or follow existing symbolic links.
if ! (
set -o noclobber
printf '%s\n' '[Desktop Entry]' \
"Name=$(desktop_entry_value "$gameName")" \
"Exec=$(desktop_exec_argument "$launcherPath") -l $(desktop_exec_argument "$gameName")" \
"Path=$(desktop_entry_value "$scriptRoot")" \
'Terminal=true' 'Type=Application' 'Categories=Game;' \
> "$desktopFile"
); then
ui_msgbox "Desktop Shortcut" "" "Could not create ${desktopFile}. Check permissions and whether a shortcut already exists."
return 1
fi
if ! chmod +x "$desktopFile"; then
ui_msgbox "Desktop Shortcut" "" "Could not make ${desktopFile} executable."
return 1
fi
ui_msgbox "Desktop Shortcut" "" "Created ${desktopFile}."
}
+10 -2
View File
@@ -3,7 +3,15 @@
declare -Ag ipfs=( declare -Ag ipfs=(
# Games (alphabetical order) # Games (alphabetical order)
[Audio_Defence_aarch64]="${ipfsGateway}/ipfs/QmPoj7kdC3pBfr5zraeQzMPNjAA5SkeqRSjYbDVLWeZPwx?filename=AudioDefence-26.09.22-2-aarch64.AppImage" [Audio_Defence_aarch64]="${ipfsGateway}/ipfs/QmV5ihxcwnjR2hRKyKSgbL24mXzwvsmKKAmWhAw1vw6K6v?filename=AudioDefence-26.09.26-1-aarch64.AppImage"
[Audio_Defence_x86_64]="${ipfsGateway}/ipfs/QmVr83MpSX7Afk5JQqiEZVtDudn5hAUg5tm5XBaqPieaB4?filename=AudioDefence-26.09.22-2-x86_64.AppImage" [Audio_Defence_x86_64]="${ipfsGateway}/ipfs/QmSq5a7roo2h2xNgungeLVnmyt7AyjrqzGgrPzRhq7t9Ls?filename=AudioDefence-26.09.26-1-x86_64.AppImage"
[FreeDoom]="${ipfsGateway}/ipfs/QmU6REFot8CGVSBy2YWQxnmXoh7M4EF74RxFtLzvtJxoGC?filename=toby_doom_9.0_full.zip" [FreeDoom]="${ipfsGateway}/ipfs/QmU6REFot8CGVSBy2YWQxnmXoh7M4EF74RxFtLzvtJxoGC?filename=toby_doom_9.0_full.zip"
[Papa_Sangre_aarch64]="${ipfsGateway}/ipfs/QmVGVXjZWXN3ETyBYGo244KMxzc37hAkFPNF3YnMeXD8Vv?filename=PapaSangre-1.0.7-aarch64.AppImage"
[Papa_Sangre_x86_64]="${ipfsGateway}/ipfs/QmQNrLLA3pDHJCiNHNRtzDRTULmZviRR25denhs9dv8aPE?filename=PapaSangre-1.0.7-x86_64.AppImage"
[Papa_Sangre_II_aarch64]="${ipfsGateway}/ipfs/QmPpHNg6qPSVWeN22nbWqJYE28XsV9wpBuYgHmezX2VxKX?filename=PapaSangreII-2026-09-29-aarch64.AppImage"
[Papa_Sangre_II_x86_64]="${ipfsGateway}/ipfs/QmXWQyqZD2cB6gjZQnETMTaspgfBQNLRC2Zska9vWk4PAp?filename=PapaSangreII-2026-09-29-x86_64.AppImage"
[The_Nightjar_aarch64]="${ipfsGateway}/ipfs/QmZFA9j3Jz5rX7wKpnMwssCs7CAni7yYP246MKBTF22SLg?filename=TheNightjar-2026-09-28-aarch64.AppImage"
[The_Nightjar_x86_64]="${ipfsGateway}/ipfs/QmNSG3ugpGCFkUWf7CHF3Jo4hjXc9QAVENEPamzAWaEyvs?filename=TheNightjar-2026-09-28-x86_64.AppImage"
[Soul_Trapper_aarch64]="${ipfsGateway}/ipfs/QmTH6kYq2sg7Ly5wk8Up11V98WQNBfDGz7JjiQ4XX52nH1?filename=SoulTrapper-1.1-1-aarch64.AppImage"
[Soul_Trapper_x86_64]="${ipfsGateway}/ipfs/QmVRJAkFnNULnVuLiZYNjzgYnj4c1eSvtLDX6ygesp69Dv?filename=SoulTrapper-1.1-1-x86_64.AppImage"
) )
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# shellcheck disable=SC2154 # Paths and download helpers are supplied by the manager.
install_wickets() {
check_architecture x86_64
check_dependencies tar
local updateOnly="${1:-false}"
local gamePath="${installPath}/Wickets"
local metadataFile="Wickets-latest.json"
local releaseVersion assetName assetUrl stagingPath
if [[ "${updateOnly}" == true ]] && [[ ! -f "${gamePath}/wickets" ]]; then
ui_msgbox "Wickets" "Linux Game Manager" "Wickets is not installed. Please install it with -i first."
return 1
fi
# Always resolve the current release, even when the archive is cached.
rm -f "${cache}/${metadataFile}" || return 1
download_named "${metadataFile}" "https://api.github.com/repos/orinks-games/wickets/releases/latest" || return 1
if ! releaseVersion="$(jq -er '.tag_name | select(test("^v[0-9]+\\.[0-9]+\\.[0-9]+$"))' "${cache}/${metadataFile}")"; then
ui_msgbox "Wickets" "Linux Game Manager" "Could not determine the latest Wickets release. Please try again later."
return 1
fi
assetName="wickets-${releaseVersion#v}-linux-x64.tar.gz"
if ! assetUrl="$(jq -er --arg name "${assetName}" '.assets[] | select(.name == $name) | .browser_download_url' "${cache}/${metadataFile}")" ||
[[ "${assetUrl}" != "https://github.com/orinks-games/wickets/releases/download/${releaseVersion}/${assetName}" ]]; then
ui_msgbox "Wickets" "Linux Game Manager" "The latest Wickets release has no supported Linux x64 archive."
return 1
fi
if [[ "${updateOnly}" == true ]] && [[ -f "${gamePath}/.lgm-version" ]] &&
[[ "$(< "${gamePath}/.lgm-version")" == "${releaseVersion}" ]]; then
ui_msgbox "Wickets" "Linux Game Manager" "Wickets ${releaseVersion#v} is already up to date."
# The manager otherwise displays a generic update-success message.
exit 0
fi
download_named "${assetName}" "${assetUrl}" || return 1
stagingPath="$(mktemp -d "${cache}/wickets.XXXXXX")" || return 1
if ! tar -xzf "${cache}/${assetName}" --strip-components=1 -C "${stagingPath}" ||
[[ ! -f "${stagingPath}/wickets" ]] || [[ ! -f "${stagingPath}/sounds.pak" ]]; then
rm -rf "${stagingPath}"
ui_msgbox "Wickets" "Linux Game Manager" "Could not extract the Wickets archive. The installed game has not been changed."
return 1
fi
# Overlay release files so the portable saves directory is preserved.
if ! mkdir -p "${gamePath}" || ! cp -a "${stagingPath}/." "${gamePath}/" ||
! chmod +x "${gamePath}/wickets" ||
! printf '%s\n' "${releaseVersion}" > "${gamePath}/.lgm-version"; then
rm -rf "${stagingPath}"
ui_msgbox "Wickets" "Linux Game Manager" "Could not install Wickets. Please check free space and directory permissions, then try again."
return 1
fi
rm -rf "${stagingPath}"
}
+6
View File
@@ -0,0 +1,6 @@
check_architecture x86_64 aarch64
# Doubles both as the URl and the file name, which is cconvenient since I can be lazy.
url="https://github.com/orinks-games/Freight-Fate/releases/download/v1.9.4/FreightFate-v1.9.4-linux-$(uname -m).AppImage"
download "${url}"
mkdir -p "${installPath}/Freight_Fate"
install -vm 0755 "${cache}/FreightFate-v1.9.4-linux-$(uname -m).AppImage" "${installPath}/Freight_Fate/Freight_Fate.appimage"
+6 -2
View File
@@ -1,2 +1,6 @@
check_dependencies python-pygame:pygame python-xdg:xdg python-pyperclip:pyperclip python-requests:requests python-setproctitle:setproctitle check_dependencies git python-pygame:pygame python-xdg:xdg python-pyperclip:pyperclip python-requests:requests python-setproctitle:setproctitle
git -C "${installPath}" clone --recurse-submodules https://gitlab.com/stormdragon2976/monkeyspank.git # shellcheck disable=SC2154 # installPath is supplied by the manager.
if ! git -C "${installPath}" clone --recurse-submodules https://git.stormux.org/storm/monkeyspank.git; then
ui_msgbox "Game Installer" "Game Installer" "Could not clone Monkey Spank and its required submodules."
exit 1
fi
+8
View File
@@ -0,0 +1,8 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
check_architecture x86_64 aarch64
papaSangreIIUrl="${ipfs[Papa_Sangre_II_$(uname -m)]}"
downloadFile="${papaSangreIIUrl##*filename=}"
downloadFile="${downloadFile%%&*}"
download_named "$downloadFile" "$papaSangreIIUrl"
mkdir -p "${installPath}/Papa_Sangre_II"
install -v -m 0755 "${cache}/${downloadFile}" "${installPath}/Papa_Sangre_II/PapaSangreII.AppImage"
+8
View File
@@ -0,0 +1,8 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
check_architecture x86_64 aarch64
papaSangreUrl="${ipfs[Papa_Sangre_$(uname -m)]}"
downloadFile="${papaSangreUrl##*filename=}"
downloadFile="${downloadFile%%&*}"
download_named "$downloadFile" "$papaSangreUrl"
mkdir -p "${installPath}/Papa_Sangre"
install -v -m 0755 "${cache}/${downloadFile}" "${installPath}/Papa_Sangre/PapaSangre.AppImage"
+14
View File
@@ -0,0 +1,14 @@
# shellcheck shell=bash disable=SC2154 # installPath and cache are supplied by the manager.
check_architecture x86_64
check_dependencies python-speechd:speechd
download "https://github.com/rsgames-zgp/rsgames-client-releases/releases/download/v2.3/rsg-linux-x86_64.tar.gz"
mkdir -p "${installPath}/RS_Games" || exit 1
tar -xzf "${cache}/rsg-linux-x86_64.tar.gz" --strip-components=1 -C "${installPath}/RS_Games" || exit 1
# Keep bundled ALSA when it works; use system ALSA only after verifying it.
python3 "${scriptRoot}/.files/rs-games-alsa.py" "${installPath}/RS_Games" || exit 1
chmod +x "${installPath}/RS_Games/rsg" || exit 1
# The frozen client omits speechd and cannot import host site-packages.
speechdPath="$(python3 -c 'import pathlib, speechd; print(pathlib.Path(speechd.__file__).resolve().parent)')" || exit 1
mkdir -p "${installPath}/RS_Games/_internal/speechd" || exit 1
cp "${speechdPath}/"*.py "${installPath}/RS_Games/_internal/speechd/" || exit 1
python3 "${scriptRoot}/.files/rs-games-audio.py" "${installPath}/RS_Games" || exit 1
+8
View File
@@ -0,0 +1,8 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
check_architecture x86_64 aarch64
soulTrapperUrl="${ipfs[Soul_Trapper_$(uname -m)]}"
downloadFile="${soulTrapperUrl##*filename=}"
downloadFile="${downloadFile%%&*}"
download_named "$downloadFile" "$soulTrapperUrl"
mkdir -p "${installPath}/Soul_Trapper"
install -v -m 0755 "${cache}/${downloadFile}" "${installPath}/Soul_Trapper/SoulTrapper.AppImage"
+8
View File
@@ -0,0 +1,8 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
check_architecture x86_64 aarch64
theNightjarUrl="${ipfs[The_Nightjar_$(uname -m)]}"
downloadFile="${theNightjarUrl##*filename=}"
downloadFile="${downloadFile%%&*}"
download_named "$downloadFile" "$theNightjarUrl"
mkdir -p "${installPath}/The_Nightjar"
install -v -m 0755 "${cache}/${downloadFile}" "${installPath}/The_Nightjar/TheNightjar.AppImage"
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# shellcheck disable=SC2154 # scriptRoot is supplied by the manager.
# shellcheck source=.includes/wickets.sh
source "${scriptRoot}/.includes/wickets.sh"
install_wickets false || exit 1
+2
View File
@@ -0,0 +1,2 @@
gamePath="${installPath}/Freight_Fate"
run_with_optional_gamemode "${gamePath}/Freight_Fate.appimage"
+4 -2
View File
@@ -1,2 +1,4 @@
pushd "${installPath}" # shellcheck disable=SC2154 # installPath is supplied by the manager.
"${installPath}/monkeyspank/monkeyspank" gamePath="${installPath}/monkeyspank"
cd "${gamePath}" || exit 1
./monkeyspank
+3
View File
@@ -0,0 +1,3 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
gamePath="${installPath}/Papa_Sangre_II"
run_with_optional_gamemode "${gamePath}/PapaSangreII.AppImage"
+3
View File
@@ -0,0 +1,3 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
gamePath="${installPath}/Papa_Sangre"
run_with_optional_gamemode "${gamePath}/PapaSangre.AppImage"
+6
View File
@@ -0,0 +1,6 @@
# shellcheck shell=bash disable=SC2154 # installPath and fex are supplied by the manager.
check_architecture x86_64
gamePath="${installPath}/RS_Games"
cd "${gamePath}" || exit 1
# shellcheck disable=SC2086 # fex intentionally expands to an optional command prefix.
run_with_optional_gamemode ${fex}./rsg
+3
View File
@@ -0,0 +1,3 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
gamePath="${installPath}/Soul_Trapper"
run_with_optional_gamemode "${gamePath}/SoulTrapper.AppImage"
+3
View File
@@ -0,0 +1,3 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
gamePath="${installPath}/The_Nightjar"
run_with_optional_gamemode "${gamePath}/TheNightjar.AppImage"
+4
View File
@@ -0,0 +1,4 @@
# shellcheck shell=bash disable=SC2154 # installPath is supplied by the manager.
gamePath="${installPath}/Wickets"
cd "${gamePath}" || exit 1
run_with_optional_gamemode ./wickets
+17
View File
@@ -0,0 +1,17 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
run_update() {
check_architecture x86_64 aarch64
local papaSangreIIUrl="${ipfs[Papa_Sangre_II_$(uname -m)]}"
local downloadFile="${papaSangreIIUrl##*filename=}"
downloadFile="${downloadFile%%&*}"
# download_named reads this dynamically scoped flag.
# shellcheck disable=SC2034
local redownload=true
download_named "$downloadFile" "$papaSangreIIUrl"
local gamePath="${installPath}/Papa_Sangre_II"
mkdir -p "$gamePath"
install -v -m 0755 "${cache}/${downloadFile}" "${gamePath}/PapaSangreII.AppImage.new"
mv -v "${gamePath}/PapaSangreII.AppImage.new" "${gamePath}/PapaSangreII.AppImage"
}
+17
View File
@@ -0,0 +1,17 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
run_update() {
check_architecture x86_64 aarch64
local papaSangreUrl="${ipfs[Papa_Sangre_$(uname -m)]}"
local downloadFile="${papaSangreUrl##*filename=}"
downloadFile="${downloadFile%%&*}"
# download_named reads this dynamically scoped flag.
# shellcheck disable=SC2034
local redownload=true
download_named "$downloadFile" "$papaSangreUrl"
local gamePath="${installPath}/Papa_Sangre"
mkdir -p "$gamePath"
install -v -m 0755 "${cache}/${downloadFile}" "${gamePath}/PapaSangre.AppImage.new"
mv -v "${gamePath}/PapaSangre.AppImage.new" "${gamePath}/PapaSangre.AppImage"
}
+17
View File
@@ -0,0 +1,17 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
run_update() {
check_architecture x86_64 aarch64
local soulTrapperUrl="${ipfs[Soul_Trapper_$(uname -m)]}"
local downloadFile="${soulTrapperUrl##*filename=}"
downloadFile="${downloadFile%%&*}"
# download_named reads this dynamically scoped flag.
# shellcheck disable=SC2034
local redownload=true
download_named "$downloadFile" "$soulTrapperUrl"
local gamePath="${installPath}/Soul_Trapper"
mkdir -p "$gamePath"
install -v -m 0755 "${cache}/${downloadFile}" "${gamePath}/SoulTrapper.AppImage.new"
mv -v "${gamePath}/SoulTrapper.AppImage.new" "${gamePath}/SoulTrapper.AppImage"
}
+17
View File
@@ -0,0 +1,17 @@
# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh
run_update() {
check_architecture x86_64 aarch64
local theNightjarUrl="${ipfs[The_Nightjar_$(uname -m)]}"
local downloadFile="${theNightjarUrl##*filename=}"
downloadFile="${downloadFile%%&*}"
# download_named reads this dynamically scoped flag.
# shellcheck disable=SC2034
local redownload=true
download_named "$downloadFile" "$theNightjarUrl"
local gamePath="${installPath}/The_Nightjar"
mkdir -p "$gamePath"
install -v -m 0755 "${cache}/${downloadFile}" "${gamePath}/TheNightjar.AppImage.new"
mv -v "${gamePath}/TheNightjar.AppImage.new" "${gamePath}/TheNightjar.AppImage"
}
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
run_update() {
# shellcheck disable=SC2154 # scriptRoot is supplied by the manager.
# shellcheck source=.includes/wickets.sh
source "${scriptRoot}/.includes/wickets.sh"
install_wickets true || exit 1
}
+88
View File
@@ -9,6 +9,55 @@ As the project grows, more dependencies will most likely be added. When LGM is l
Current base dependencies checked on launch: `7z`, `curl`, `dialog`, `jq`, `yad`, and `unzip`. Current base dependencies checked on launch: `7z`, `curl`, `dialog`, `jq`, `yad`, and `unzip`.
## Desktop shortcuts
Use `./linux-game-manager.sh -U` to choose Play, Install, Remove, or Update
from an action menu. The lowercase `-u` still opens game updates directly.
New manager shortcuts created with `-D` open the action menu using `-U`.
Recreate existing manager shortcuts with `-D` to use this behavior.
Open `./linux-game-manager.sh`, select an installed game, and choose **Desktop
Shortcut**. This works in both the graphical and console menus and creates an
executable `.desktop` file in `~/Desktop`. Existing files are left intact, and
the game list opens again after creation. Your desktop environment may ask you
to trust the shortcut before launching it.
The shortcut launches that game directly through the manager's `-l` option.
You can also use this option from a terminal with the exact game menu name:
```bash
./linux-game-manager.sh -l "RS Games"
```
Only installed, enabled launcher entries can be launched this way.
## Wickets
Install Wickets on x86_64 Linux by selecting it under `./linux-game-manager.sh -i`.
Both installation and updating (`./linux-game-manager.sh -u`, then select Wickets)
query GitHub for the latest stable release, so versioned download links do not
need to be tracked manually. Updating preserves the portable `saves` directory
under `~/.local/games/Wickets`. Wickets 1.2.0 also includes its own updater.
## RS Games
Install RS Games 2.3 on x86_64 Linux by selecting RS Games under
`./linux-game-manager.sh -i`. The client is installed under
`~/.local/games/RS_Games` and can then be launched from the main game menu.
The installer requires the host Python Speech Dispatcher bindings (`python-speechd`
on Arch Linux or `python3-speechd` on Debian) and copies them into the client,
whose Linux release omits them.
The installer silently checks audio initialization and keeps bundled ALSA when
it works. If it fails and system ALSA passes the same check, the bundled copy
is set aside as `_internal/libasound.so.2.bundled`. If audio cannot be verified,
the bundled library is retained and the installer reports the problem.
The installer also repairs Linux audio file-path handling in the sound wrapper
and preserves the original executable as `rsg.lgm-original`.
Sound lookup automatically handles capitalization differences in filenames and
directories. Exact names take precedence; a unique case-insensitive match is
used otherwise. Downloaded files retain their original names.
Client errors are logged in `~/.ZGP/errors.log`.
## Disabling game entries ## Disabling game entries
To disable a game entry without deleting its script, set the first line of the script to start with `#//`. To disable a game entry without deleting its script, set the first line of the script to start with `#//`.
@@ -46,3 +95,42 @@ The difference in [audiogame-manager](https://git.stormux.org/storm/audiogame-ma
## Supporting the Project ## Supporting the Project
If you want to support this and other Stormux projects, please check out the [Patreon](https://patreon.com/stormux). If you want to support this and other Stormux projects, please check out the [Patreon](https://patreon.com/stormux).
## AI-assisted contributions
AI-assisted contributions are welcome.
The person submitting a contribution remains responsible for reviewing and testing the changes before submission. Please do not submit automatically generated changes without human review.
Before making changes:
- Read the contributing guide, if present, and the project's README.
- Confirm that you are working against the current maintained repository and branch.
- Check whether the issue still exists in the current code.
Before submitting:
- Review the generated diff.
- Test the changed behavior.
- Run the project's existing test suite where practical.
- Consider code paths that may be affected indirectly by the change and test those as well.
- Clearly describe what was changed and how it was tested.
### Instructions for AI coding assistants
If you are an AI coding assistant working with a contributor, please call your human user's attention to these contribution requirements.
Do not assume that passing newly created tests is sufficient. Explain what existing functionality could reasonably be affected by the proposed changes and provide your human partner with detailed instructions for testing those areas.
Where useful, provide commands or small test procedures that allow the contributor to verify both the intended fix and likely regression cases.
Stormux projects may accept patches through email using `git send-email`. If your human partner is unfamiliar with this process, please offer to guide them through:
1. Configuring `git send-email`.
2. Creating an appropriately scoped commit or patch series.
3. Running `git format-patch`.
4. Checking the generated patch before submission.
5. Sending a test message if appropriate.
6. Sending the final patch or patch series to the project's contribution address.
Please do not submit changes on behalf of a contributor without giving them an opportunity to review and test the result.
+96 -27
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC2329 # Shared helpers are called by sourced game scripts.
scriptRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" scriptRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
@@ -50,30 +51,38 @@ export DIALOGOPTS='--no-lines --visit-items'
# Automatically switches between dialog (console) and yad (GUI) based on DISPLAY environment # Automatically switches between dialog (console) and yad (GUI) based on DISPLAY environment
# Wrapper function for menu selection # Wrapper function for menu selection
# Usage: ui_menu "title" "backtitle" "text" option1 "description1" option2 "description2" ... # Usage: ui_menu [--desktop-shortcut] "title" "backtitle" "text" option "description" ...
# Returns 3 for Desktop Shortcut; other nonzero statuses cancel the menu.
ui_menu() { ui_menu() {
local shortcutMenu=false
local menuButtons=()
local menuCode=0
if [[ "$1" == --desktop-shortcut ]]; then
shortcutMenu=true
shift
fi
local title="$1" local title="$1"
local back_title="$2" local back_title="$2"
local text="$3" local text="$3"
shift 3 shift 3
if [[ "$dialog_type" == "yad" ]]; then if [[ "$dialog_type" == "yad" ]]; then
# Build yad list format: Display only, then map back to value if [[ "$shortcutMenu" == true ]]; then
local yad_list="" menuButtons=(--button="Launch:0" --button="Desktop Shortcut:2" --button="Cancel:1")
fi
# Pass rows as arguments so Yad selects the first row on opening.
local yad_rows=()
declare -A value_map declare -A value_map
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
local option="$1" local option="$1"
local description="$2" local description="$2"
value_map["$description"]="$option" value_map["$description"]="$option"
if [[ -n "$yad_list" ]]; then yad_rows+=("$description")
yad_list="$yad_list\n"
fi
yad_list="${yad_list}${description}"
shift 2 shift 2
done done
local selected_description local selected_description
selected_description=$(echo -e "$yad_list" | yad --list \ selected_description=$(yad --list \
--title="$title" \ --title="$title" \
--text="$text" \ --text="$text" \
--column="Option" \ --column="Option" \
@@ -81,7 +90,13 @@ ui_menu() {
--selectable-labels \ --selectable-labels \
--search-column=1 \ --search-column=1 \
--height=400 \ --height=400 \
--width=600) --width=600 "${menuButtons[@]}" "${yad_rows[@]}" </dev/null) || menuCode=$?
if [[ "$shortcutMenu" == true && $menuCode -eq 2 ]]; then
menuCode=3
fi
if [[ $menuCode -ne 0 && ( "$shortcutMenu" != true || $menuCode -ne 3 ) ]]; then
return "$menuCode"
fi
# Strip trailing newline, pipe, and any other whitespace # Strip trailing newline, pipe, and any other whitespace
selected_description=$(echo "$selected_description" | tr -d '\n\r' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//;s/|$//') selected_description=$(echo "$selected_description" | tr -d '\n\r' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//;s/|$//')
@@ -89,7 +104,11 @@ ui_menu() {
if [[ -n "$selected_description" ]]; then if [[ -n "$selected_description" ]]; then
echo "${value_map["$selected_description"]}" echo "${value_map["$selected_description"]}"
fi fi
return "$menuCode"
else else
if [[ "$shortcutMenu" == true ]]; then
menuButtons=(--extra-button --extra-label "Desktop Shortcut")
fi
# Build dialog menu format with mapping (same approach as yad) # Build dialog menu format with mapping (same approach as yad)
local dialog_args=() local dialog_args=()
declare -A value_map declare -A value_map
@@ -104,15 +123,20 @@ ui_menu() {
local selected_description local selected_description
selected_description=$(dialog --backtitle "$back_title" \ selected_description=$(dialog --backtitle "$back_title" \
--title "$title" \ --title "$title" \
"${menuButtons[@]}" \
--no-tags \ --no-tags \
--menu "$text" 0 0 0 \ --menu "$text" 0 0 0 \
"${dialog_args[@]}" \ "${dialog_args[@]}" \
--stdout) --stdout) || menuCode=$?
if [[ $menuCode -ne 0 && ( "$shortcutMenu" != true || $menuCode -ne 3 ) ]]; then
return "$menuCode"
fi
# Return the mapped value # Return the mapped value
if [[ -n "$selected_description" ]]; then if [[ -n "$selected_description" ]]; then
echo "${value_map["$selected_description"]}" echo "${value_map["$selected_description"]}"
fi fi
return "$menuCode"
fi fi
} }
@@ -413,6 +437,20 @@ open_url() {
xdg-open "${*}" 2> /dev/null xdg-open "${*}" 2> /dev/null
} }
action_menu() {
local selectedAction
selectedAction="$(ui_menu "Linux Game Manager" "Linux Game Manager" \
"Please select an action" \
play "Play" install "Install" remove "Remove" update "Update")" || return 0
case "$selectedAction" in
play) game_launcher ;;
install) game_installer ;;
remove) game_removal ;;
update) game_update ;;
esac
}
# Create desktop launcher file # Create desktop launcher file
desktop_launcher() { desktop_launcher() {
local desktopFile="${HOME}/linux-game-manager.desktop" local desktopFile="${HOME}/linux-game-manager.desktop"
@@ -433,9 +471,9 @@ desktop_launcher() {
done done
launchDirectory="${scriptRoot}" launchDirectory="${scriptRoot}"
if [[ "${terminal}" == "xterm" ]]; then if [[ "${terminal}" == "xterm" ]]; then
printf -v execLine "Exec=xterm -T \"Linux Game Manager\" -e /usr/bin/bash -c \"pushd %q;nohup ./%q 2> /dev/null\"" "${launchDirectory}" "${0##*/}" printf -v execLine "Exec=xterm -T \"Linux Game Manager\" -e /usr/bin/bash -c \"pushd %q;nohup ./%q -U 2> /dev/null\"" "${launchDirectory}" "${0##*/}"
else else
printf -v execLine "Exec=%s -t \"Linux Game Manager\" -e \"/usr/bin/bash -c 'pushd %q;nohup ./%q 2> /dev/null'\"" "${terminal}" "${launchDirectory}" "${0##*/}" printf -v execLine "Exec=%s -t \"Linux Game Manager\" -e \"/usr/bin/bash -c 'pushd %q;nohup ./%q -U 2> /dev/null'\"" "${terminal}" "${launchDirectory}" "${0##*/}"
fi fi
dotDesktop=('[Desktop Entry]' dotDesktop=('[Desktop Entry]'
'Name=Linux game manager' 'Name=Linux game manager'
@@ -878,7 +916,7 @@ game_update() {
game_launcher() { game_launcher() {
# Initialize array for menu construction # Initialize array for menu construction
mapfile -t menuList < <( mapfile -t menuList < <(
if [[ -d ".launch" ]]; then if [[ -d "${scriptRoot}/.launch" ]]; then
# shellcheck disable=SC2016 # variables expand in the child bash, not this single-quoted string # shellcheck disable=SC2016 # variables expand in the child bash, not this single-quoted string
find -L "${scriptRoot}/.launch" -maxdepth 1 -type f -iname "*.sh" -print0 | sort -z | xargs -0 bash -c ' find -L "${scriptRoot}/.launch" -maxdepth 1 -type f -iname "*.sh" -print0 | sort -z | xargs -0 bash -c '
for f; do for f; do
@@ -889,20 +927,45 @@ game_launcher() {
done' _ done' _
fi fi
) )
if [[ ${#menuList} -eq 0 ]]; then local selectedGame=""
ui_msgbox "Linux Game Manager" "Linux Game Manager" "No games found." if [[ $# -gt 0 ]]; then
exit 0 for ((i=0; i<${#menuList[@]}; i+=2)); do
fi if [[ "$1" == "${menuList[i+1]}" ]]; then
# Create the menu of all games selectedGame="${menuList[i]}"
# menuList has alternating full_path, display_name pairs break
declare -a menuArgs fi
for ((i=0; i<${#menuList[@]}; i+=2)); do done
menuArgs+=("${menuList[i]}" "${menuList[i+1]}") if [[ -z "$selectedGame" ]]; then
done ui_msgbox "Linux Game Launcher" "Linux Game Manager" "Game $1 is not installed or is disabled."
selectedGame="$(ui_menu "Linux Game Launcher" "Linux Game Launcher" "Please select a game to play" "${menuArgs[@]}")" exit 1
local menuCode=$? fi
if [[ $menuCode -ne 0 ]] || [[ -z "$selectedGame" ]]; then else
exit 0 if [[ ${#menuList[@]} -eq 0 ]]; then
ui_msgbox "Linux Game Manager" "Linux Game Manager" "No games found."
exit 0
fi
# Create the menu of all games
# menuList has alternating full_path, display_name pairs
declare -a menuArgs
for ((i=0; i<${#menuList[@]}; i+=2)); do
menuArgs+=("${menuList[i]}" "${menuList[i+1]}")
done
local menuCode
local gameName
while true; do
selectedGame="$(ui_menu --desktop-shortcut "Linux Game Launcher" "Linux Game Launcher" "Please select a game to play" "${menuArgs[@]}")"
menuCode=$?
if [[ $menuCode -eq 3 ]]; then
if [[ -n "$selectedGame" ]]; then
gameName="${selectedGame##*/}"
game_desktop_shortcut "${gameName%.sh}"
fi
continue
elif [[ $menuCode -ne 0 || -z "$selectedGame" ]]; then
exit 0
fi
break
done
fi fi
# shellcheck disable=SC1090 # launcher scripts are selected dynamically from .launch # shellcheck disable=SC1090 # launcher scripts are selected dynamically from .launch
. "${selectedGame}" . "${selectedGame}"
@@ -969,6 +1032,8 @@ export ipfsGateway="${ipfsGateway:-https://ipfs.stormux.org}"
source "${scriptRoot}/.includes/ipfs.sh" source "${scriptRoot}/.includes/ipfs.sh"
# shellcheck source=.includes/gamemode.sh # shellcheck source=.includes/gamemode.sh
source "${scriptRoot}/.includes/gamemode.sh" source "${scriptRoot}/.includes/gamemode.sh"
# shellcheck source=.includes/desktop.sh
source "${scriptRoot}/.includes/desktop.sh"
export spd_module="${spd_module:+ -o ${spd_module}}" export spd_module="${spd_module:+ -o ${spd_module}}"
export spd_pitch="${spd_pitch:+ -p ${spd_pitch}}" export spd_pitch="${spd_pitch:+ -p ${spd_pitch}}"
export spd_rate="${spd_rate:+ -r ${spd_rate}}" export spd_rate="${spd_rate:+ -r ${spd_rate}}"
@@ -1006,11 +1071,13 @@ declare -A command=(
[h]="This help screen." [h]="This help screen."
[i]="Install games." [i]="Install games."
[L]="Display license information." [L]="Display license information."
[l:]="Launch an installed game directly by its menu name."
[N]="No cache, delete the installer after it has been extracted." [N]="No cache, delete the installer after it has been extracted."
[R]="Redownload. Removes old versions of packages from cache before installing." [R]="Redownload. Removes old versions of packages from cache before installing."
[r]="Remove game. Remove a game and its menu entry." [r]="Remove game. Remove a game and its menu entry."
[t]="Total games. Show how many games are currently available." [t]="Total games. Show how many games are currently available."
[u]="Update games. Run available game update scripts." [u]="Update games. Run available game update scripts."
[U]="Choose Play, Install, Remove, or Update from a menu."
) )
# Convert the keys of the associative array to a format usable by getopts # Convert the keys of the associative array to a format usable by getopts
@@ -1023,6 +1090,7 @@ while getopts "${args}" i ; do
h) help ;; h) help ;;
i) game_installer ;; i) game_installer ;;
L) license ;; L) license ;;
l) game_launcher "$OPTARG" ;;
N) noCache="true" ;; N) noCache="true" ;;
R) redownload="true" ;; R) redownload="true" ;;
r) game_removal ;; r) game_removal ;;
@@ -1032,6 +1100,7 @@ while getopts "${args}" i ; do
exit 0 exit 0
;; ;;
u) game_update ;; u) game_update ;;
U) action_menu; exit $? ;;
esac esac
done done