From 661f36ba72f7846c603445e0753a60133c406c31 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Wed, 11 Sep 2024 20:06:31 -0700 Subject: [PATCH] umu_run: validate compatibility tools used in session --- umu/umu_run.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/umu/umu_run.py b/umu/umu_run.py index 073cc45cb..49d7808ec 100755 --- a/umu/umu_run.py +++ b/umu/umu_run.py @@ -51,6 +51,7 @@ get_libc, get_library_paths, get_osrelease_id, + get_vdf_value, is_installed_verb, is_winetricks_verb, ) @@ -803,6 +804,36 @@ def main() -> int: # noqa: D103 ): sys.exit(1) + # Determine if the set of compatibility tools match. + # Proton is a compatibility tool as it will contain toolmanifest.vdf, + # therefore conforming to Steam's compatability tool interface. + # See steam-compat-tool-interface.md + # The value of 'require_tool_appid' will be the id of the SLR + toolappid_proton: str = get_vdf_value( + Path(env["PROTONPATH"], "toolmanifest.vdf"), "require_tool_appid" + ) + + # SLR is a compatibility tool, but will not contain the metadata of + # interest in toolmanifest.vdf. If we want to know if the tools are + # related, instead of toolmanifest.vdf, read a file from the depot. + # The value of 'appid' is the id of the SLR. + toolappid_slr: str = "" + for file in UMU_LOCAL.joinpath("steampipe/").glob("*.vdf"): + if toolappid_slr := get_vdf_value(file, "appid"): + break + + # Warn about mismatching compatibility tools, but don't crash + # e.g., Proton 7.0 should not be used with steamrt3 (sniper) + if toolappid_slr != toolappid_proton: + proton: Path = Path(env["PROTONPATH"]) + log.warning("Compatibility tools mismatch") + log.warning( + "%s requires Runtime Platform with App ID '%s'", + proton.name, + toolappid_slr, + ) + log.warning("See https://steamdb.info/app/%s/", toolappid_slr) + # Build the command command: tuple[Path | str, ...] = build_command(env, UMU_LOCAL, opts) log.debug("%s", command)