From 3d0d77dca3e76faf8d1c171cb1da4f08e454e73c Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 26 Nov 2026 15:22:48 -0500 Subject: [PATCH] Klango added. Not really a game, but it does contain games, so it counts I guess. --- .includes/checkup.sh | 6 +++ README.md | 17 +++++++ game-scripts/klango-extract.py | 79 +++++++++++++++++++++++++++++ wine/install-dependencies-arch.sh | 1 + wine/install-dependencies-debian.sh | 1 + wine/install-dependencies-fedora.sh | 1 + wine/install-dependencies-mint.sh | 1 + 7 files changed, 106 insertions(+) create mode 100644 game-scripts/klango-extract.py diff --git a/.includes/checkup.sh b/.includes/checkup.sh index bc249b7..0d46e93 100755 --- a/.includes/checkup.sh +++ b/.includes/checkup.sh @@ -24,6 +24,12 @@ else errorList+=("Critical: Curl is not installed. Critical functionality will not work.") fi packageList+=("curl") +if command -v python3 &> /dev/null ; then + [[ $# -eq 0 ]] && echo "Python 3 is installed." +else + errorList+=("Warning: Python 3 is not installed. Required to install Klango and some other games.") +fi +packageList+=("python3") if command -v dialog &> /dev/null ; then [[ $# -eq 0 ]] && echo "Dialog is installed." else diff --git a/README.md b/README.md index a3a93e1..5419844 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,23 @@ relaunch City of Division twice, check the language menu and main menu keys, then switch away and back using the window list. Confirm the game accepts keys after returning and does not pull focus back while you use another window. +## Klango + +Choose **Klango** from `./audiogame-manager.sh -i`. AGM installs Klango 4.0.0b1 +in the shared `~/.local/wine64` bottle under `C:\Program Files\Klango4`. +Native Linux Python 3 extracts the Windows ZIP with usable paths and directory +permissions; without this repair, NumPy cannot load and Klango exits at startup. +No separate setup script or Windows Python installation is needed. + +An existing standalone installation in `~/.local/klango` is left intact. AGM's +installation has its own Klango preferences and account setup. Before submitting, +review the diff and test installation through both the console and graphical +menus, then launch **Klango** and check first-run prompts, speech, keyboard +navigation, game audio, and quitting/relaunching. The standalone permission +repair was confirmed working; the AGM installation still needs live acceptance. +Run `bash tests/klango_installer_tests.sh` for the isolated extraction and +failure checks, which do not start Wine or access the network or installed games. + ## AI-assisted contributions AI-assisted contributions are welcome. The person submitting the contribution remains responsible for reviewing and testing the changes before submission. Please review the generated diff, run the relevant tests, and describe what changed and how it was tested. diff --git a/game-scripts/klango-extract.py b/game-scripts/klango-extract.py new file mode 100644 index 0000000..6adbc30 --- /dev/null +++ b/game-scripts/klango-extract.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 +"""Extract Klango's Windows ZIP with usable Unix paths and permissions.""" + +from pathlib import Path, PurePosixPath +import shutil +import stat +import sys +import zipfile + + +def prepare_directory(directoryPath, installPath): + parents = [] + while directoryPath != installPath: + parents.append(directoryPath) + directoryPath = directoryPath.parent + parents.append(installPath) + for parentPath in reversed(parents): + if parentPath.is_symlink(): + raise ValueError(f"Refusing a symbolic link: {parentPath}") + parentPath.mkdir(parents=True, exist_ok=True) + # Enter each parent before trying to inspect or create its children. + parentPath.chmod(parentPath.stat().st_mode | 0o700) + + +def extract_klango(archivePath, installPath): + installPath = Path(installPath).absolute() + with zipfile.ZipFile(archivePath) as archive: + entries = [] + seenPaths = set() + for info in archive.infolist(): + name = info.filename.replace("\\", "/") + parts = PurePosixPath(name).parts + if (not parts or parts[0] != "Klango4" or ".." in parts + or any(":" in part for part in parts) + or stat.S_ISLNK(info.external_attr >> 16)): + raise ValueError(f"Unexpected archive path: {name!r}") + relativePath = PurePosixPath(*parts[1:]) + if relativePath in seenPaths: + raise ValueError(f"Duplicate archive path: {name!r}") + seenPaths.add(relativePath) + isDirectory = name.endswith("/") or bool(info.external_attr & 0x10) + if not parts[1:] and not isDirectory: + raise ValueError("The archive root must be a directory") + entries.append((info, installPath.joinpath(*parts[1:]), isDirectory)) + requiredPaths = {installPath / "Klango4.exe", installPath / "_internal/python313.dll"} + if not requiredPaths.issubset({path for _, path, isDir in entries if not isDir}): + raise ValueError("Missing Klango4.exe or its bundled Python runtime") + # Reject corrupt downloads before replacing any installed application files. + badFile = archive.testzip() + if badFile: + raise ValueError(f"Archive integrity check failed: {badFile}") + for info, targetPath, isDirectory in entries: + prepare_directory(targetPath if isDirectory else targetPath.parent, installPath) + if isDirectory: + continue + if targetPath.is_symlink(): + raise ValueError(f"Refusing a symbolic link: {targetPath}") + if targetPath.exists(): + targetPath.chmod(targetPath.stat().st_mode | 0o600) + with archive.open(info) as source, targetPath.open("wb") as destination: + shutil.copyfileobj(source, destination) + targetPath.chmod(targetPath.stat().st_mode | 0o600) + print(f"Klango extracted to {installPath}; directory permissions repaired.") + + +def main(): + if len(sys.argv) != 3: + print("Usage: klango-extract.py ZIP INSTALL_DIRECTORY", file=sys.stderr) + return 2 + try: + extract_klango(sys.argv[1], sys.argv[2]) + except (OSError, ValueError, zipfile.BadZipFile, RuntimeError) as error: + print(f"Could not extract Klango: {error}", file=sys.stderr) + return 1 + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/wine/install-dependencies-arch.sh b/wine/install-dependencies-arch.sh index 049775b..ed98e8e 100644 --- a/wine/install-dependencies-arch.sh +++ b/wine/install-dependencies-arch.sh @@ -40,6 +40,7 @@ configure_arch() { gst-plugins-ugly gst-libav p7zip + python xdg-utils ) if [[ "$(uname -m)" == "x86_64" ]]; then diff --git a/wine/install-dependencies-debian.sh b/wine/install-dependencies-debian.sh index 5da5adf..1183a90 100644 --- a/wine/install-dependencies-debian.sh +++ b/wine/install-dependencies-debian.sh @@ -16,6 +16,7 @@ configure_debian() { gstreamer1.0-plugins-ugly:i386 mono-complete ncurses5-dev + python3 w3m winehq-stable ) diff --git a/wine/install-dependencies-fedora.sh b/wine/install-dependencies-fedora.sh index 9c8068e..cd6dba8 100644 --- a/wine/install-dependencies-fedora.sh +++ b/wine/install-dependencies-fedora.sh @@ -29,6 +29,7 @@ configure_fedora() { ncurses openal-soft pulseaudio-libs + python3 sdl2-compat sox sqlite diff --git a/wine/install-dependencies-mint.sh b/wine/install-dependencies-mint.sh index 79d0ed2..4e546d6 100644 --- a/wine/install-dependencies-mint.sh +++ b/wine/install-dependencies-mint.sh @@ -16,6 +16,7 @@ configure_debian() { gstreamer1.0-plugins-ugly:i386 mono-complete libncurses5-dev + python3 w3m winehq-stable )