mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +00:00
fix: avoid incompatible Turnip selection and explain Steam startup failures
This commit is contained in:
1 parent
ffa40a15d5
commit
42de5f3dd1
14 files changed
+381
-6
No files matched your search
@@ -901,13 +901,25 @@ x64_gpu_watch() {
|
||||
x64_gpu_probe
|
||||
}
|
||||
|
||||
x64_arm_webhelper_cpu_supported() {
|
||||
local status=0
|
||||
# Valve's native ARM web helper contains LSE atomics; missing CPU data cannot establish incompatibility.
|
||||
awk -F: '
|
||||
$1 ~ /^[[:space:]]*Features[[:space:]]*$/ {
|
||||
if ($2 !~ /(^|[[:space:]])atomics([[:space:]]|$)/) unsupported = 1
|
||||
}
|
||||
END { exit unsupported ? 1 : 0 }
|
||||
' /proc/cpuinfo 2>/dev/null || status=$?
|
||||
[ "$status" != 1 ]
|
||||
}
|
||||
|
||||
x64_exec() {
|
||||
x64_env
|
||||
cd "$STEAM_X64"
|
||||
# The client checksums its files at start and reinstalls over edited ones, so the session shim (preload/net.c)
|
||||
# swaps the web helper at exec. The arm64 helper only comes up against a client of the same build.
|
||||
if [ "${BL_X64_X86_WEBHELPER:-0}" != 1 ] && [ -x /usr/local/bin/droiddeck-x64-arm-webhelper ] &&
|
||||
[ -x "$ARM_STEAM/steamrtarm64/steamwebhelper" ]; then
|
||||
[ -x "$ARM_STEAM/steamrtarm64/steamwebhelper" ] && x64_arm_webhelper_cpu_supported; then
|
||||
local chan x86_build arm_build
|
||||
chan=$(cat "$STEAM_X64/package/beta" 2>/dev/null || echo "$X64_CHANNEL")
|
||||
x86_build=$(awk -F'"' '$2 == "version" { print $4; exit }' "$STEAM_X64/package/steam_client_${chan}_steamrt64.manifest" 2>/dev/null || true)
|
||||
@@ -1142,4 +1154,4 @@ for attempt in 1 2 3 4 5; do
|
||||
( x64_exec -clientbeta "$X64_CHANNEL" -no-cef-sandbox "${cef[@]}" "$@" ) >>"$LOG" 2>&1 || rc=$?
|
||||
step "client exited rc=$rc"
|
||||
[ "$rc" = 42 ] || break
|
||||
done
|
||||
done
|
||||
@@ -0,0 +1,79 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parents[1] / 'linuxfs/overlay/usr/local/bin/droiddeck-steam-x64'
|
||||
|
||||
|
||||
class SteamX64CpuTest(unittest.TestCase):
|
||||
def selection(self, features, *, forced=False, same_build=True, unreadable=False):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
arm = root / 'arm'
|
||||
x64 = root / 'x64'
|
||||
for base in (arm, x64):
|
||||
(base / 'package').mkdir(parents=True)
|
||||
(arm / 'steamrtarm64').mkdir()
|
||||
(arm / 'steamrtarm64/steamwebhelper').touch(mode=0o700)
|
||||
shim = root / 'arm-shim'
|
||||
shim.touch(mode=0o700)
|
||||
(x64 / 'package/beta').write_text('publicbeta\n')
|
||||
for base, arch, version in ((x64, 'steamrt64', '123'), (arm, 'linuxarm64', '123' if same_build else '122')):
|
||||
(base / f'package/steam_client_publicbeta_{arch}.manifest').write_text(f'"version" "{version}"\n')
|
||||
cpuinfo = root / 'cpuinfo'
|
||||
if not unreadable:
|
||||
cpuinfo.write_text(features)
|
||||
text = SCRIPT.read_text()
|
||||
start = text.find('x64_arm_webhelper_cpu_supported() {')
|
||||
helper = text[start:text.index('x64_exec() {')] if start >= 0 else ''
|
||||
selection = text.split('x64_exec() {', 1)[1].split(' mkdir -p "$STEAM_X64/logs"', 1)[0]
|
||||
shell = helper + '\nx64_env() { :; }\nx64_webhelper_gpu() { return 1; }\nselect_helper() {' + selection + '\nprintf "%s|%s\\n" "${BL_X64_ARM_WEBHELPER:-x86}" "${BL_WEBHELPER_ARGS:-}";\n}\nselect_helper\n'
|
||||
shell = shell.replace('/proc/cpuinfo', str(cpuinfo)).replace('/usr/local/bin/droiddeck-x64-arm-webhelper', str(shim))
|
||||
env = dict(os.environ, STEAM_X64=str(x64), ARM_STEAM=str(arm), X64_CHANNEL='publicbeta', BL_X64_X86_WEBHELPER='1' if forced else '0')
|
||||
env.pop('BL_X64_ARM_WEBHELPER', None)
|
||||
env.pop('BL_WEBHELPER_ARGS', None)
|
||||
result = subprocess.run(['bash', '-eu', '-c', shell], env=env, capture_output=True, text=True)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
return result.stdout.strip(), str(shim)
|
||||
|
||||
def test_missing_atomics_keeps_x86_helper(self):
|
||||
result, _ = self.selection('Features : fp asimd aes crc32\n')
|
||||
self.assertEqual(result, 'x86|stock')
|
||||
|
||||
def test_atomics_keeps_same_build_arm_helper(self):
|
||||
result, arm = self.selection('Features : fp asimd atomics aes\n')
|
||||
self.assertEqual(result, arm + '|')
|
||||
|
||||
def test_exact_token_required(self):
|
||||
result, _ = self.selection('Features : fp noatomics atomics_extra\n')
|
||||
self.assertEqual(result, 'x86|stock')
|
||||
|
||||
def test_any_explicit_core_without_atomics_keeps_x86_helper(self):
|
||||
result, _ = self.selection('processor : 0\nFeatures : fp atomics\nprocessor : 1\nFeatures : fp aes\n')
|
||||
self.assertEqual(result, 'x86|stock')
|
||||
|
||||
def test_empty_features_is_explicitly_unsupported(self):
|
||||
result, _ = self.selection('Features : \n')
|
||||
self.assertEqual(result, 'x86|stock')
|
||||
|
||||
def test_absent_features_preserves_existing_behavior(self):
|
||||
result, arm = self.selection('processor : 0\n')
|
||||
self.assertEqual(result, arm + '|')
|
||||
|
||||
def test_unreadable_cpuinfo_preserves_existing_behavior(self):
|
||||
result, arm = self.selection('', unreadable=True)
|
||||
self.assertEqual(result, arm + '|')
|
||||
|
||||
def test_forced_x86_still_wins(self):
|
||||
result, _ = self.selection('Features : atomics\n', forced=True)
|
||||
self.assertEqual(result, 'x86|stock')
|
||||
|
||||
def test_supported_cpu_still_requires_same_build(self):
|
||||
result, _ = self.selection('Features : atomics\n', same_build=False)
|
||||
self.assertEqual(result, 'x86|stock')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user