Merge pull request #262: Linux fixes (wdiasjunior)

Shader preparation reads MacNativeGames' whole shader list history,
release downloads resume from a .part file, appimagetool and the type-2
runtime come from release tags, and the preparation summary counts the
vertex and fragment variants it skips with the graphics pipeline library
off.

The gettid cache in runtime/platform/linux.c conflicted with the same fix
already on dev (8dd7e20, #236); dev's version is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-31 20:45:06 +03:00
commit 47485da7d9
6 files changed
+73 -25

No files matched your search

+1 -1
View File
@@ -51,7 +51,7 @@ def mng_pin() -> str:
"""The MacNativeGames commit tools/fetch_refs.sh pins."""
for line in (ROOT / "tools" / "fetch_refs.sh").read_text(encoding="utf-8").splitlines():
f = line.split()
if len(f) == 4 and f[:2] == ["fetch", "MacNativeGames"]:
if len(f) >= 4 and f[:2] == ["fetch", "MacNativeGames"]: # a fifth word asks for the history
return f[3]
sys.exit("tools/fetch_refs.sh pins no MacNativeGames commit")
+14 -4
View File
@@ -6,23 +6,33 @@ set -eu
cd "$(dirname "$0")/.."
mkdir -p refs
# fetch <name> <url> <commit> [history]: a shallow checkout of the commit, or with "history" the commit and all its
# ancestors (tools/shader_list.py walks the log of MacNativeGames' shader list). origin/HEAD names the commit either
# way, so tools can read the pinned revision as origin/HEAD.
fetch() {
name=$1 url=$2 commit=$3
name=$1 url=$2 commit=$3 history=${4:-}
dir=refs/$name
if [ "$(git -C "$dir" rev-parse HEAD 2>/dev/null)" = "$commit" ]; then
if [ "$(git -C "$dir" rev-parse HEAD 2>/dev/null)" = "$commit" ] &&
[ "$(git -C "$dir" rev-parse -q --verify refs/remotes/origin/HEAD 2>/dev/null)" = "$commit" ] &&
{ [ -z "$history" ] || [ "$(git -C "$dir" rev-parse --is-shallow-repository)" = false ]; }; then
echo "$name: up to date"
return
fi
rm -rf "$dir"
git init -q "$dir"
git -C "$dir" remote add origin "$url"
git -C "$dir" fetch -q --depth 1 origin "$commit"
if [ -n "$history" ]; then
git -C "$dir" fetch -q origin "$commit"
else
git -C "$dir" fetch -q --depth 1 origin "$commit"
fi
git -C "$dir" checkout -q FETCH_HEAD
git -C "$dir" update-ref refs/remotes/origin/HEAD "$commit"
echo "$name: $commit"
}
fetch LASRecomp https://github.com/peiikai/LASRecomp.git da35b83a9611d046a9a681aae668d7085954d37f
fetch MacNativeGames https://github.com/ly05010419/MacNativeGames.git b75be8cfa704df3701e86130c8ced268e79d6b11
fetch MacNativeGames https://github.com/ly05010419/MacNativeGames.git b75be8cfa704df3701e86130c8ced268e79d6b11 history
fetch d2r-mobile https://github.com/jhaizhou-ops/d2r-mobile.git 53e7c5bb9ca3ea53e2160005be8fbe920cd9cb53
fetch nxnative https://github.com/seedds/nxnative.git d5b380b3a80495609c2e751bb994911a638935ad
fetch SwitchRecomp https://github.com/bgyss/SwitchRecomp.git 0f99e1c5c1e78fdc8e01e58a0f8dc8622e82976b
+24 -5
View File
@@ -38,6 +38,7 @@ import subprocess
import sys
import tarfile
import time
import urllib.error
import urllib.request
import zipfile
from pathlib import Path
@@ -126,13 +127,31 @@ def fetch(name):
path = DL / f'{name}-9.0.4.tar.gz' # upstream archives have identical basenames
if name == 'libvpx-src':
path = DL / 'libvpx-1.17.0.tar.gz'
if not path.is_file():
print(f'download {url}')
with urllib.request.urlopen(url) as r, open(path, 'wb') as f:
shutil.copyfileobj(r, f)
if path.is_file():
if sha256_file(path) == want:
return path
print(f'{path}: not the pinned file (a cut download or an older pin); downloading it again')
path.unlink()
# into <name>.part, renamed once complete: a cut connection leaves a .part that the next run resumes, never a
# short file under the final name
part = path.with_name(path.name + '.part')
have = part.stat().st_size if part.is_file() else 0
print(f'download {url}' + (f' (resuming at {have} bytes)' if have else ''))
req = urllib.request.Request(url, headers={'Range': f'bytes={have}-'} if have else {})
try:
with urllib.request.urlopen(req) as r:
if have and r.status != 206: # the server ignored the range: start over
have = 0
with open(part, 'ab' if have else 'wb') as f:
shutil.copyfileobj(r, f)
except urllib.error.HTTPError as e:
if e.code != 416: # 416: the .part already holds the whole file
raise
part.replace(path)
got = sha256_file(path)
if got != want:
sys.exit(f'{path}: sha256 {got}, pinned {want}')
path.unlink() # a .part resumed from another upload, or the URL now serves another file: start clean next run
sys.exit(f'{path}: sha256 {got}, pinned {want}; deleted, run again to download it anew')
return path
+6 -6
View File
@@ -72,12 +72,12 @@ PINS = {
'vulkan-headers-src': ('https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.4.363.tar.gz',
'cbaf687d3c59b9666fe080e7f8396b6b4f4d344a768ee6b337c59852f4526b68'),
'vma-header': build_game.VMA_FETCH,
# appimagetool and the runtime are published only under the moving "continuous" tag: pinned by hash, so a new
# upload stops the build until the pins are updated on purpose
'appimagetool': ('https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage',
'ac7fd56feade6002c2f57db39587113275d351fce911a5fbb29ea84cd0666cab'),
'appimage-runtime': ('https://github.com/AppImage/type2-runtime/releases/download/continuous/runtime-x86_64',
'617aa77314d57c8b8e4fae9c3f0b35af7b30d5529cb69e98f64f92510ed98a46'),
# appimagetool and the type-2 runtime from release tags, not "continuous", whose uploads change under the same
# URL and would stop the build at the hash check
'appimagetool': ('https://github.com/AppImage/appimagetool/releases/download/1.9.1/appimagetool-x86_64.AppImage',
'ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0'),
'appimage-runtime': ('https://github.com/AppImage/type2-runtime/releases/download/20251108/runtime-x86_64',
'2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d'),
}
mr.PINS.update(PINS) # one cache (toolchain/release-dl) and one fetch for both releases
+4
View File
@@ -8,6 +8,7 @@ our play meets: at 1340bee the list alone has 134 rows of 1.4.3 shaders, its his
25,238. A row no draw asks for costs one translation. No copy of the list goes into the repository.
"""
import subprocess
import sys
PATH = 'games/totk/assets/shader_list.tsv'
@@ -18,6 +19,9 @@ def git(repo, *args):
def history(repo, rev='origin/HEAD'):
"""rev's list, then each V row of an older revision that no newer one has, newest first."""
if git(repo, 'rev-parse', '--is-shallow-repository').strip() == 'true':
# a shallow clone has rev's list only: preparing from it skips most variants and shows only as stutter in play
sys.exit(f'{repo} is a shallow clone without the shader list\'s history; run tools/fetch_refs.sh')
lines = git(repo, 'show', f'{rev}:{PATH}').splitlines()
seen = set(lines)
for h in git(repo, 'log', '--format=%H', rev, '--', PATH).split()[1:]: