Skip to content

Commit

Permalink
Add support for downloading GE-Proton
Browse files Browse the repository at this point in the history
- Users will be able to automatically download the latest GE-Proton if setting 'GE-Proton' to PROTONPATH
  • Loading branch information
R1kaB3rN committed Mar 22, 2024
1 parent 47c0031 commit b546791
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
23 changes: 16 additions & 7 deletions umu/umu_dl_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@ def _fetch_releases() -> List[Tuple[str, str]]:
conn: HTTPConnection = HTTPSConnection(
"api.github.com", timeout=30, context=create_default_context()
)
repo: str = "/repos/Open-Wine-Components/umu-proton/releases"

if environ.get("PROTONPATH") == "GE-Proton":
repo = "/repos/GloriousEggroll/proton-ge-custom/releases"

conn.request(
"GET",
"/repos/Open-Wine-Components/umu-proton/releases",
repo,
headers={
"Accept": "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
Expand All @@ -85,12 +89,14 @@ def _fetch_releases() -> List[Tuple[str, str]]:

for asset in assets:
if (
"name" in asset
asset.get("name")
and (
asset["name"].endswith("sum")
asset.get("name").endswith("sum")
or (
asset["name"].endswith("tar.gz")
and asset["name"].startswith(("umu-proton", "ULWGL-Proton"))
asset.get("name").endswith("tar.gz")
and asset.get("name").startswith(
("umu-proton", "ULWGL-Proton", "GE-Proton")
)
)
)
and "browser_download_url" in asset
Expand Down Expand Up @@ -261,9 +267,12 @@ def _get_latest(
tarball: str = files[1][0]
sums: str = files[0][0]
proton: str = tarball[: tarball.find(".tar.gz")]
version: str = (
"GE-Proton" if environ.get("PROTONPATH") == "GE-Proton" else "umu-proton"
)

if steam_compat.joinpath(proton).is_dir():
log.console("umu-proton is up to date")
log.console(f"{version} is up to date")
environ["PROTONPATH"] = steam_compat.joinpath(proton).as_posix()
env["PROTONPATH"] = environ["PROTONPATH"]
return env
Expand All @@ -273,7 +282,7 @@ def _get_latest(
log.debug("Removing: %s", sums)
tmp.joinpath(tarball).unlink(missing_ok=True)
tmp.joinpath(sums).unlink(missing_ok=True)
log.console(f"Using umu-proton ({proton})")
log.console(f"Using {version} ({proton})")
env["PROTONPATH"] = environ["PROTONPATH"]
except ValueError:
log.exception("Exception")
Expand Down
5 changes: 5 additions & 0 deletions umu/umu_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ def check_env(
os.environ["PROTONPATH"]
).as_posix()

# GE-Proton
if os.environ.get("PROTONPATH") and os.environ.get("PROTONPATH") == "GE-Proton":
log.debug("GE-Proton selected")
get_umu_proton(env)

if "PROTONPATH" not in os.environ:
os.environ["PROTONPATH"] = ""
get_umu_proton(env)
Expand Down

0 comments on commit b546791

Please sign in to comment.