mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
* fix: Red Dead Redemption 2 launches again, its Vulkan runtime installer is left to run droiddeck-seed-redists marked every process in every game's install script as already run, Red Dead Redemption 2's VulkanRT-1.1.108.0 installer included. Steam's compat config for the game says nativevulkanloader, so Proton loads vulkan-1.dll native only, and Khronos' loader is in the prefix only once that installer has run. Without it the Rockstar launcher starts RDR2.exe and it exits with STATUS_DLL_NOT_FOUND (0xc0000135) before it opens a window. A Vulkan runtime installer is now left out of the seeding, and a marker an earlier seeding wrote for one comes out of each prefix and Proton template once (dates kept), so the client runs the installer on the next launch. The installer finishes in a few seconds under FEX. * fix: Steam's screensaver no longer covers a running game The client's defaults show screensavers while a game runs, after 300 s on AC power without a button press - and a held stick or trigger is no press. Red Dead Redemption 2's intro runs longer than that: the slideshow covered the game, and the button that woke it reached the game too (B asked to quit to the desktop). Customization/Screensaver/WhileInGame is seeded "0" in config.vdf once, like the UI scale and native resolution, so turning it back on in Settings stays the user's choice. On the RedMagic: 18 minutes from the last button press through the intro and riding, focus never left the game and no screensaver was created. * fix: Rockstar's hidden launcher no longer takes cores from its game The Rockstar Games Launcher keeps drawing its Chromium interface (SocialClubHelper.exe: renderers, and a GPU process compositing through DXVK) for as long as the game runs, hidden behind it - and Wine passes Chromium's priorities on, so those threads ran above the game's (the GPU process at nice -10), across every core. With Red Dead Redemption 2 in front that was 1.3 to 2.5 cores under FEX for a page nobody sees. droiddeck-launcher-cores follows gamescope's focus from the agent's focus.json: while a game window has it, every SocialClubHelper thread runs on the last core of the slowest cluster at nice 19; when the launcher's own window has focus again each thread gets its own mask and priority back (also on exit). Stopping the helpers would not hold - proot resumes a stopped tracee. Started for Steam sessions; BL_LAUNCHER_CORES=0 turns it off. RedMagic, RDR2 all Low, riding at the thermal limit, same spot and session: released 46.5 fps, 1% low 27.5, p99 31.8 ms, CPU 89%, 2200 MHz; held 48.7 fps, 1% low 32.6, p99 27.6 ms, CPU 79%, 2638 MHz. * fix: sessions clean up what earlier ones left in /tmp The guest's /tmp is a directory in the rootfs that no boot ever empties, and Android ends sessions by killing them. Every session left a /tmp/mangohud.XXXXXXXX (mktemp, never removed), and the Steam client, its web helper, Chromium apps, dbus-run-session, AppImage runs and KDE their own temporary files and sockets: 1,422 entries on the RedMagic. mangoapp's config is now one fixed file rewritten each session, and the session's first pass sweeps each kind of leftover while nothing that could own one is running, with a single find. On the device that cleared 1,391 entries over two sessions, leaving 38.
160 lines
6.7 KiB
Python
160 lines
6.7 KiB
Python
import os
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
SCRIPT = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin/droiddeck-seed-redists"
|
|
|
|
GAME_SCRIPT = r'''"InstallScript"
|
|
{
|
|
"Run Process"
|
|
{
|
|
"VCRedist2022"
|
|
{
|
|
"HasRunKey" "HKEY_LOCAL_MACHINE\\Software\\Valve\\Steam\\Apps\\CommonRedist\\vcredist\\2022"
|
|
"process 1" "%INSTALLDIR%\\_CommonRedist\\vcredist\\2022\\VC_redist.x64.exe"
|
|
"command 1" "/q /norestart"
|
|
"NoCleanUp" "1"
|
|
}
|
|
}
|
|
}
|
|
'''
|
|
|
|
# Red Dead Redemption 2's own script: Proton needs Khronos' vulkan-1.dll for it, which only the
|
|
# Vulkan runtime installer puts in the prefix.
|
|
VULKAN_SCRIPT = r'''"InstallScript"
|
|
{
|
|
"Run Process"
|
|
{
|
|
"Vulkan111080"
|
|
{
|
|
"HasRunKey" "HKEY_LOCAL_MACHINE\\Software\\Valve\\Steam\\Apps\\1174180"
|
|
"process 1" "%INSTALLDIR%\\Redistributables\\VulkanRT-1.1.108.0-Installer.exe"
|
|
"command 1" "/S"
|
|
"NoCleanUp" "0"
|
|
}
|
|
"RockstarLauncher"
|
|
{
|
|
"HasRunKey" "HKEY_LOCAL_MACHINE\\Software\\Rockstar Games\\Steam\\Launcher"
|
|
"process 1" "%INSTALLDIR%\\Redistributables\\Rockstar-Games-Launcher.exe"
|
|
"command 1" "/s /t"
|
|
"NoCleanUp" "0"
|
|
}
|
|
}
|
|
}
|
|
'''
|
|
|
|
|
|
class SeedRedistsTest(unittest.TestCase):
|
|
def setUp(self):
|
|
self.tmp = Path(tempfile.mkdtemp())
|
|
self.addCleanup(shutil.rmtree, self.tmp, True)
|
|
self.steam = self.tmp / "Steam"
|
|
self.reg = self.steam / "steamapps/compatdata/1234/pfx/system.reg"
|
|
self.reg.parent.mkdir(parents=True)
|
|
self.reg.write_text("WINE REGISTRY Version 2\n")
|
|
|
|
def game(self, name="Some Game", script=GAME_SCRIPT, library=None):
|
|
root = Path(library or self.steam)
|
|
path = root / "steamapps/common" / name / "_CommonRedist/vcredist/2022/installscript.vdf"
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_text(script)
|
|
manifest = root / "steamapps" / ("appmanifest_%d.acf" % (abs(hash(name)) % 100000))
|
|
manifest.write_text('"AppState" { "installdir" "%s" }' % name)
|
|
return path
|
|
|
|
def run_seed(self, libraries=""):
|
|
env = dict(os.environ, DROIDDECK_LIBRARIES=libraries)
|
|
return subprocess.run(["bash", str(SCRIPT), str(self.steam)], env=env, capture_output=True, text=True, check=True)
|
|
|
|
def test_a_games_own_install_script_is_marked_as_run(self):
|
|
self.game()
|
|
self.run_seed()
|
|
reg = self.reg.read_text()
|
|
self.assertIn("[Software\\\\Valve\\\\Steam\\\\Apps\\\\CommonRedist\\\\vcredist\\\\2022]", reg)
|
|
self.assertIn("[Software\\\\Wow6432Node\\\\Valve\\\\Steam\\\\Apps\\\\CommonRedist\\\\vcredist\\\\2022]", reg)
|
|
self.assertIn('"VCRedist2022"=dword:00000001', reg)
|
|
|
|
def test_games_in_other_libraries_are_read(self):
|
|
sd = self.tmp / "sd"
|
|
self.game(library=sd)
|
|
self.run_seed(str(sd))
|
|
self.assertIn('"VCRedist2022"=dword:00000001', self.reg.read_text())
|
|
|
|
def test_the_vc_runtime_is_recorded_for_every_architecture_and_view(self):
|
|
self.run_seed()
|
|
reg = self.reg.read_text()
|
|
for view in ("Software", "Software\\\\Wow6432Node"):
|
|
for arch in ("x86", "x64", "arm64"):
|
|
self.assertIn("[%s\\\\Microsoft\\\\VisualStudio\\\\14.0\\\\VC\\\\Runtimes\\\\%s]" % (view, arch), reg)
|
|
self.assertIn('"Installed"=dword:00000001', reg)
|
|
self.assertIn('"Major"=dword:0000000e', reg)
|
|
self.assertIn('"Version"="v14.51.36247.00"', reg)
|
|
|
|
def test_a_seeded_prefix_is_left_alone_until_a_game_changes(self):
|
|
self.run_seed()
|
|
once = self.reg.read_text()
|
|
self.run_seed()
|
|
self.assertEqual(once, self.reg.read_text())
|
|
self.game()
|
|
self.run_seed()
|
|
self.assertIn('"VCRedist2022"=dword:00000001', self.reg.read_text())
|
|
|
|
def test_an_evaluator_script_nested_deeper_is_read(self):
|
|
script = self.tmp / "legacycompat/evaluatorscript_409710.vdf"
|
|
script.parent.mkdir(parents=True)
|
|
script.write_text('"evaluatorscript"\n{\n\t"1"\n' + "\n".join("\t" + line for line in GAME_SCRIPT.replace("VCRedist2022", "x64 14.99.1.0").splitlines()) + "\n}\n")
|
|
env = dict(os.environ, DROIDDECK_LIBRARIES="", DROIDDECK_SEED_SCRIPTS=str(script))
|
|
subprocess.run(["bash", str(SCRIPT), str(self.steam)], env=env, capture_output=True, text=True, check=True)
|
|
self.assertIn('"x64 14.99.1.0"=dword:00000001', self.reg.read_text())
|
|
|
|
def test_the_prefix_date_is_kept(self):
|
|
os.utime(self.reg, (1_000_000_000, 1_000_000_000))
|
|
self.run_seed()
|
|
self.assertEqual(int(self.reg.stat().st_mtime), 1_000_000_000)
|
|
|
|
def rdr2(self):
|
|
path = self.steam / "steamapps/common/Red Dead Redemption 2/installscript.vdf"
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_text(VULKAN_SCRIPT)
|
|
(self.steam / "steamapps/appmanifest_1174180.acf").write_text('"AppState" { "installdir" "Red Dead Redemption 2" }')
|
|
|
|
def test_a_vulkan_runtime_installer_is_left_to_run(self):
|
|
self.rdr2()
|
|
self.run_seed()
|
|
reg = self.reg.read_text()
|
|
self.assertNotIn("Vulkan111080", reg)
|
|
self.assertIn('"RockstarLauncher"=dword:00000001', reg)
|
|
self.assertNotIn("Vulkan111080", (self.reg.parent / ".droiddeck-redists").read_text())
|
|
|
|
def test_a_vulkan_marker_an_earlier_seeding_wrote_comes_out_once(self):
|
|
self.rdr2()
|
|
marker = "HKEY_LOCAL_MACHINE\\\\Software\\\\Valve\\\\Steam\\\\Apps\\\\1174180\tVulkan111080"
|
|
self.reg.write_text(
|
|
"WINE REGISTRY Version 2\n"
|
|
"\n[Software\\\\Valve\\\\Steam\\\\Apps\\\\1174180] 1791729070\n#time=1dd598d29161f72\n"
|
|
'"Other"=dword:00000001\n"Vulkan111080"=dword:00000001\n'
|
|
"\n[Software\\\\Wow6432Node\\\\Valve\\\\Steam\\\\Apps\\\\1174180] 1791729070\n"
|
|
'"Vulkan111080"=dword:00000001\n'
|
|
"\n[Software\\\\Valve\\\\Steam\\\\Apps\\\\22380] 1791311644\n"
|
|
'"Vulkan111080"=dword:00000001\n')
|
|
(self.reg.parent / ".droiddeck-redists").write_text(marker + "\n")
|
|
os.utime(self.reg, (1_000_000_000, 1_000_000_000))
|
|
self.run_seed()
|
|
reg = self.reg.read_text()
|
|
self.assertEqual(reg.count('"Vulkan111080"'), 1, "only the other app's value stays")
|
|
self.assertIn('"Other"=dword:00000001', reg)
|
|
self.assertNotIn("Vulkan111080", (self.reg.parent / ".droiddeck-redists").read_text())
|
|
self.assertEqual(int(self.reg.stat().st_mtime), 1_000_000_000)
|
|
# The client writes the marker itself once the installer has run; that one is left alone.
|
|
with self.reg.open("a") as out:
|
|
out.write('\n[Software\\\\Valve\\\\Steam\\\\Apps\\\\1174180] 1791730000\n"Vulkan111080"=dword:00000001\n')
|
|
self.run_seed()
|
|
self.assertEqual(self.reg.read_text().count('"Vulkan111080"'), 2)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|