Tekken 3 updated. Should be self-updating from now on because it uses github releases.

This commit is contained in:
Storm Dragon committed 2026-10-19 01:16:41 -04:00
1 parent 7709ec83d8
commit 8e33ef63d0
6 files changed
+125 -186

No files matched your search

+8 -3
View File
@@ -23,12 +23,17 @@ if ! mkdir -p "$cache"; then
alert "Tekken 3 Update" "Could not create the download cache: ${cache}"
exit 1
fi
if ! download "https://github.com/BlindChallengerX/Tekken3-Access/releases/download/v1.0.1/Tekken3Access-1.0.1.zip"; then
alert "Tekken 3 Update" "Could not download Tekken 3 Access 1.0.1."
if ! updateOutput="$(python3 "${scriptDir}/game-scripts/tekken3_setup.py" latest-release 2>&1)"; then
alert "Tekken 3 Update" "$updateOutput"
exit 1
fi
IFS=$'\t' read -r modVersion modUrl modHash <<< "$updateOutput"
if ! download "$modUrl"; then
alert "Tekken 3 Update" "Could not download Tekken 3 Access ${modVersion}."
exit 1
fi
if ! updateOutput="$(python3 "${scriptDir}/game-scripts/tekken3_setup.py" update \
"${cache}/Tekken3Access-1.0.1.zip" "$gamePath" 2>&1)"; then
"${cache}/${modUrl##*/}" "$gamePath" --mod-sha256 "$modHash" --mod-version "$modVersion" 2>&1)"; then
alert "Tekken 3 Update" "$updateOutput"
exit 1
fi
+74 -16
View File
@@ -3,6 +3,7 @@
import argparse
import hashlib
import json
import os
from pathlib import Path, PurePosixPath
import re
@@ -11,13 +12,14 @@ import stat
import subprocess
import sys
import tempfile
from urllib.request import Request, urlopen
from zipfile import BadZipFile, ZipFile
PORT_COMMIT = "b6e941378ad03dbd834fef340bd8d90bae6e430b"
PORT_EXE_HASH = "25d038f55d7a1c02a0e5bbcc97fe9b1738c8292198e7fa0d1b171b57129d18c0"
SETUP_HASH = "c1e0430498b2f4212d7e04187e3ba822d3ac273de487cd35d93aa2ef823ac5aa"
MOD_ARCHIVE_HASH = "7aacee1ce376dff83823a6fc9c6717ad31e94cd37fa85551a3a8e8048e709646"
RELEASE_API = "https://api.github.com/repos/BlindChallengerX/Tekken3-Access/releases/latest"
PRISM_HASH = "7c7d09c8c7306e8e1a0c46d603ccb2a391c194c77843400c11b746e7dd56a467"
USA_EXE_HASH = "fbda8b68e5799dbef4af39a161783bc670c15b0aa0e87dce65e210717da19b8c"
TRACK_SIZES = (632532768, 27701856, 28042896)
@@ -26,6 +28,36 @@ CUE_NAME = "Tekken 3 (USA).cue"
SECTOR_SIZE = 2352
def parse_release(releaseInfo):
if not isinstance(releaseInfo, dict) or releaseInfo.get("draft") is not False or releaseInfo.get("prerelease") is not False:
raise ValueError("GitHub did not return a published stable Tekken 3 Access release.")
versionMatch = re.fullmatch(r"v?(\d+(?:\.\d+)+)", str(releaseInfo.get("tag_name", "")))
if not versionMatch:
raise ValueError("The latest Tekken 3 Access release has an unsupported version tag.")
version = versionMatch.group(1)
archiveName = f"Tekken3Access-{version}.zip"
assets = releaseInfo.get("assets")
if not isinstance(assets, list):
raise ValueError("The latest release has no download assets.")
matchingAssets = [asset for asset in assets if isinstance(asset, dict) and asset.get("name") == archiveName]
if len(matchingAssets) != 1:
raise ValueError(f"The latest release must contain exactly one {archiveName} download.")
asset = matchingAssets[0]
downloadUrl = f"https://github.com/BlindChallengerX/Tekken3-Access/releases/download/{releaseInfo['tag_name']}/{archiveName}"
if asset.get("browser_download_url") != downloadUrl:
raise ValueError("The latest release has an unexpected download URL.")
digestMatch = re.fullmatch(r"sha256:([0-9a-f]{64})", str(asset.get("digest", "")))
if not digestMatch:
raise ValueError("GitHub did not supply a SHA-256 checksum for the latest release. Nothing was installed.")
return version, downloadUrl, digestMatch.group(1)
def latest_release():
request = Request(RELEASE_API, headers={"Accept": "application/vnd.github+json", "User-Agent": "audiogame-manager"})
with urlopen(request, timeout=30) as response:
return parse_release(json.load(response))
def validate_disc(discDir):
missingFiles = [name for name in (CUE_NAME, *TRACK_NAMES) if not (discDir / name).is_file()]
if missingFiles:
@@ -73,7 +105,26 @@ def extract_archive(archivePath, destination, stripRoot=None):
def verify_hash(path, expectedHash):
if hashlib.sha256(path.read_bytes()).hexdigest() != expectedHash:
raise ValueError(f"{path.name} does not match the tested version. Remove the cached download and retry.")
raise ValueError(f"{path.name} does not match the expected checksum. Remove the cached download and retry.")
def validate_mod(gameRoot):
"""Accept the supported mod layout without replacing game data or user state."""
modFiles = {
"INSTALL.txt", "Play Tekken 3 Access.exe", "tekken 3 pc link.txt",
"Use controller.bat", "Use keyboard.bat", "T3Access/T3Access.dll",
"T3Access/prism.dll", "T3Access/README.txt", "T3Access/movies.txt",
}
for path in gameRoot.rglob("*"):
if not path.is_file():
continue
relativePath = path.relative_to(gameRoot)
if relativePath.as_posix() not in modFiles and not (relativePath.parent == Path("T3Access/ad") and relativePath.suffix == ".wav"):
raise ValueError(f"Unsupported release file: {relativePath}. Update its AGM integration before installing this release.")
for name in ("Play Tekken 3 Access.exe", "T3Access/T3Access.dll", "T3Access/README.txt"):
if not (gameRoot / name).is_file():
raise ValueError(f"The release is missing {name}.")
verify_hash(gameRoot / "T3Access/prism.dll", PRISM_HASH)
def write_manual(gameRoot):
@@ -115,17 +166,14 @@ def validate_installation(destination):
raise ValueError(f"The existing installation is missing {name}. Install Tekken 3 through AGM first.")
def update_game(modArchive, destination):
def update_game(modArchive, destination, modHash, modVersion):
validate_installation(destination)
verify_hash(modArchive, MOD_ARCHIVE_HASH)
verify_hash(modArchive, modHash)
with tempfile.TemporaryDirectory(prefix=".tekken3-update-", dir=destination.parent) as temporaryDir:
gameRoot = Path(temporaryDir) / "mod"
gameRoot.mkdir()
extract_archive(modArchive, gameRoot)
for name in ("Play Tekken 3 Access.exe", "T3Access/T3Access.dll", "T3Access/README.txt"):
if not (gameRoot / name).is_file():
raise ValueError(f"The update is missing {name}.")
verify_hash(gameRoot / "T3Access/prism.dll", PRISM_HASH)
validate_mod(gameRoot)
write_manual(gameRoot)
relativeFiles = sorted(path.relative_to(gameRoot) for path in gameRoot.rglob("*") if path.is_file())
for relativePath in relativeFiles:
@@ -169,12 +217,12 @@ def update_game(modArchive, destination):
except OSError as restoreError:
raise OSError(f"Update and restoration failed. Restore files from {backupRoot}. {restoreError}") from error
raise OSError(f"Update failed; replaced files restored. Backup: {backupRoot}. {error}") from error
print(f"Updated Tekken 3 Access to 1.0.1. Backup of replaced files: {backupRoot}")
print(f"Updated Tekken 3 Access to {modVersion}. Backup of replaced files: {backupRoot}")
def install_game(discDir, portArchive, modArchive, destination):
def install_game(discDir, portArchive, modArchive, destination, modHash, modVersion):
validate_disc(discDir)
verify_hash(modArchive, MOD_ARCHIVE_HASH)
verify_hash(modArchive, modHash)
if destination.exists() and any(destination.iterdir()):
raise ValueError(f"An installation already exists at {destination}. It was left untouched; back it up before reinstalling.")
destination.parent.mkdir(parents=True, exist_ok=True)
@@ -184,7 +232,11 @@ def install_game(discDir, portArchive, modArchive, destination):
extract_archive(portArchive, gameRoot, f"Tekken3-PC-{PORT_COMMIT}")
verify_hash(gameRoot / "Tekken3.exe", PORT_EXE_HASH)
verify_hash(gameRoot / "setup_game_data.py", SETUP_HASH)
extract_archive(modArchive, gameRoot)
modRoot = Path(temporaryDir) / "mod"
modRoot.mkdir()
extract_archive(modArchive, modRoot)
validate_mod(modRoot)
shutil.copytree(modRoot, gameRoot, dirs_exist_ok=True)
subprocess.run([sys.executable, str(gameRoot / "setup_game_data.py"), str(discDir.resolve())], check=True)
for requiredFile in ("Play Tekken 3 Access.exe", "T3Access/T3Access.dll", "T3Access/prism.dll", "game_data/disc.cue"):
if not (gameRoot / requiredFile).is_file():
@@ -196,12 +248,13 @@ def install_game(discDir, portArchive, modArchive, destination):
if destination.exists():
destination.rmdir() # Only an empty destination is accepted above.
gameRoot.rename(destination)
print(f"Installed Tekken 3 Access in {destination}")
print(f"Installed Tekken 3 Access {modVersion} in {destination}")
def main():
parser = argparse.ArgumentParser(description=__doc__)
subparsers = parser.add_subparsers(dest="command", required=True)
subparsers.add_parser("latest-release")
validateParser = subparsers.add_parser("validate-disc")
validateParser.add_argument("discDir", type=Path)
installedParser = subparsers.add_parser("validate-installation")
@@ -212,17 +265,22 @@ def main():
installParser = subparsers.add_parser("install")
for name in ("discDir", "portArchive", "modArchive", "destination"):
installParser.add_argument(name, type=Path)
for commandParser in (updateParser, installParser):
commandParser.add_argument("--mod-sha256", required=True)
commandParser.add_argument("--mod-version", required=True)
args = parser.parse_args()
try:
if args.command == "validate-disc":
if args.command == "latest-release":
print("\t".join(latest_release()))
elif args.command == "validate-disc":
validate_disc(args.discDir)
print("Tekken 3 (USA) disc files validated.")
elif args.command == "validate-installation":
validate_installation(args.destination)
elif args.command == "update":
update_game(args.modArchive, args.destination)
update_game(args.modArchive, args.destination, args.mod_sha256, args.mod_version)
else:
install_game(args.discDir, args.portArchive, args.modArchive, args.destination)
install_game(args.discDir, args.portArchive, args.modArchive, args.destination, args.mod_sha256, args.mod_version)
except (OSError, ValueError, BadZipFile, subprocess.CalledProcessError) as error:
print(f"Tekken 3 setup failed: {error}", file=sys.stderr)
return 1