Repository: lutris/lutris

Issue:
Auto update latest DXVK versions
https://github.com/lutris/lutris/blob/525c84d9da173e84fd5585eed6b9d2fef5bef2b2/lutris/util/dxvk.py#L11-L12

Instead of writing static versions, use GitHub API to get the latest versions of DXVK:
```bash
curl -s https://api.github.com/repos/doitsujin/dxvk/tags  | jq '[.[] | .name] | join(", ")'
"v0.62, v0.61, v0.60, v0.54, v0.53, v0.52, v0.51, v0.50, v0.42, v0.41, v0.40, v0.31, v0.30, v0.21, v0.20"
```


Discussion:
You can actually type in the release version you want, and it will fetch and install it for you. As in, type it in, via the GUI. That's what I've been doing and works like a champ for me.
The small problem is that you won't know if there's a new version available already or not, if you don't check it before on its Github repo.
Of course you can also use **latest** tag, or as you say, specify the version you want, because the code is ready for that.

https://github.com/lutris/lutris/blob/525c84d9da173e84fd5585eed6b9d2fef5bef2b2/lutris/util/dxvk.py#L17

The idea of this, is just to make the version selector updated with all versions, not having to set it manually.
Right now, DXVK is in very big flux. In many cases, there are only specific scenarios where upping the DXVK version on an already existing installation is worthwhile. I don't think this is an actual problem at this time, and even still, the long-term roadmap for DXVK is uncertain.

As a hypothetical, what if it gets into mainline WINE? Do we really need to invest more coding time into this aspect? Which in my opinion is a non-issue, as if you know what DXVK is, and you know where this setting is, you are probably plenty capable to go look at the github repo to see if a new release is out.

I don't think the minor, minor, convenience warrants the function. Even though as an automatic function is kinda does make sense.

Resolving patch:
diff --git a/lutris/util/dxvk.py b/lutris/util/dxvk.py
--- a/lutris/util/dxvk.py
+++ b/lutris/util/dxvk.py
@@ -1,16 +1,41 @@
 """DXVK helper module"""
 import os
+import json
 import time
 import shutil
+import urllib.request
 
 from lutris.settings import RUNTIME_DIR
 from lutris.util.log import logger
 from lutris.util.extract import extract_archive
 from lutris.util.downloader import Downloader
 
-DXVK_LATEST = "0.52"
-DXVK_PAST_RELEASES = ["0.51", "0.50", "0.42", "0.31", "0.21"]
 
+def get_latest_dxvk_versions():
+    """Get latest DXVK versions from GitHub"""
+    dxvk_url = "https://api.github.com/repos/doitsujin/dxvk/tags"
+    cache = os.path.join(RUNTIME_DIR, 'dxvk', 'dxvk_versions.json')
+
+    # If the DXVK cache does not exist then download it
+    if not os.path.exists(cache):
+        urllib.request.urlretrieve(dxvk_url, cache)
+
+    # Re-download DXVK versions cache if more than a day old
+    if os.path.getmtime(cache)+86400 < time.time():
+        urllib.request.urlretrieve(dxvk_url, cache)
+
+    with open(cache, "r") as f:
+        dxvk_json = json.load(f)
+        DXVK_LATEST = dxvk_json[0]['name'].replace('v','')
+        DXVK_PAST_RELEASES = [x['name'].replace('v', '') for x in dxvk_json][1:]
+
+    return DXVK_LATEST, DXVK_PAST_RELEASES
+
+try:
+    DXVK_LATEST, DXVK_PAST_RELEASES = get_latest_dxvk_versions()
+except:
+    DXVK_LATEST = "0.52"
+    DXVK_PAST_RELEASES = ["0.51", "0.50", "0.42", "0.31", "0.21"]
 
 class DXVKManager:
     """Utility class to install DXVK dlls to a Wine prefix"""


Test patch: