diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env index 6f665494ec..fe0d794bc0 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env @@ -131,6 +131,12 @@ def arkham_city_x87(game): +@fix +def teardown_vsync(game): + if game.stem == "teardown": + return {"vblank_mode": "2"}, [], "Teardown: OpenGL keeps the game's own vsync" + + @fix def protonfixes_off(game): if game.stem in ("blackops3", "darksoulsremastered"): @@ -746,6 +752,8 @@ def main(): command = skip_red_launcher(command) ubisoft_overlay_off(env) fixes, extra, notes = engine_fixes(command[2], command[3:]) if len(command) > 2 else ({}, [], []) + if not gl_default: + fixes.pop("vblank_mode", None) for note in notes: print("droiddeck-game-env: " + note, file=sys.stderr) command += extra @@ -759,6 +767,8 @@ def main(): with path.open(encoding="utf-8") as source: config = json.load(source) if waiting: + if "vblank_mode" in config.get("shared", {}): + fixes.pop("vblank_mode", None) env = apply_config(env, config, app_id, fixes) else: env = apply_config(env, sync_config(config, app_id), app_id) diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session index d55d6db77a..d94c4a1c26 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session @@ -22,6 +22,17 @@ if [ -n "${BL_LOG:-}" ] && [ -z "${BL_INSIDE:-}" ]; then echo "== rootfs: $(cat /.version 2>/dev/null || echo unversioned)" fi +sync_timezone() { + local zone=${TZ:-} + case "$zone" in ''|/*|*..*) return 0 ;; esac + [ -f "/usr/share/zoneinfo/$zone" ] || return 0 + if [ "$(readlink /etc/localtime 2>/dev/null)" != "/usr/share/zoneinfo/$zone" ]; then + ln -sfn "/usr/share/zoneinfo/$zone" /etc/localtime.droiddeck && mv -Tf /etc/localtime.droiddeck /etc/localtime || return 0 + fi + [ "$(cat /etc/timezone 2>/dev/null)" = "$zone" ] || printf '%s\n' "$zone" > /etc/timezone +} 2>/dev/null +sync_timezone + write_system_bus_config() { mkdir -p /run/dbus /usr/local/share/droiddeck cat > /usr/local/share/droiddeck/system-bus.conf <<'BUSCONF' diff --git a/tools/tests/test_game_environment.py b/tools/tests/test_game_environment.py index 0fa6b07d93..9010e12957 100644 --- a/tools/tests/test_game_environment.py +++ b/tools/tests/test_game_environment.py @@ -638,6 +638,27 @@ class GameEnvironmentTest(unittest.TestCase): self.assertEqual(result.stdout.strip(), expected) self.assertEqual(said in result.stderr, expected == "0" and not inherited, result.stderr) + def test_teardown_keeps_its_own_vsync_unless_the_player_chose(self): + with tempfile.TemporaryDirectory() as tmp: + probe = Path(tmp) / "probe" + probe.write_text("#!" + sys.executable + "\nimport os\nprint(os.environ.get('vblank_mode', 'unset'))\n") + probe.chmod(0o755) + game = Path(tmp) / "Teardown/teardown.exe" + game.parent.mkdir() + game.write_bytes(b"MZ") + config = Path(tmp) / ".config/droiddeck/game-environment.json" + config.parent.mkdir(parents=True) + for inherited, edits, shared, expected in (({}, None, None, "2"), ({"vblank_mode": "0"}, None, None, "0"), + ({}, {"vblank_mode": "1"}, None, "1"), + ({}, None, {"vblank_mode": "1"}, "1")): + with self.subTest(inherited=inherited, edits=edits, shared=shared): + config.write_text(json.dumps({"version": 1, "shared": shared or {}, "games": {"1167630": edits or {}}})) + env = {name: value for name, value in os.environ.items() if name != "vblank_mode"} + env.update(HOME=tmp, STEAM_COMPAT_DATA_PATH="/compatdata/1167630", **inherited) + result = subprocess.run([sys.executable, str(BIN / "droiddeck-game-env"), str(probe), "waitforexitandrun", str(game)], + env=env, text=True, capture_output=True, check=True) + self.assertEqual(result.stdout.strip(), expected, result.stderr) + def test_windows_cpu_0_is_the_fastest_core(self): os_mod = MODULE["os"] pocket_fit = {0: 379, 1: 379, 2: 923, 3: 923, 4: 923, 5: 867, 6: 867, 7: 1024}