Triforce v0.4.0

What was merged from NX2navi (DLSS frame generation, AMD FSR 4 in Setup builds, texture detail by video memory, sprint, volume, frame caps, safer saves, the above-60 fixes), the ultrawide HUD at the screen edges, camera speed, movies without the AV1 Video Extension, the 5120x2880 + RenoDX HDR start fix, the renderer work of 11-14 and the first float changes of the lift.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-15 06:39:00 -06:00
parent 183b05d8c4
commit 93eeb714c2
87 changed files with 5947 additions and 153 deletions

125
scripts/fsr_sdk.py Normal file
View File

@@ -0,0 +1,125 @@
"""AMD's FSR 4 libraries for a build with AMD FSR 4 (HOOKSHOT_FSR=1, gpu/vk/vk_fsr4.cpp).
The build itself needs nothing from here: AMD's headers are in third_party/fidelityfx. What the game needs at run time,
beside its exe, are AMD's two signed libraries of FidelityFX SDK 2.4.0, which this fetches from AMD's own repository at
that tag, each checked against its SHA-256:
- amd_fidelityfx_loader_vk.dll (39 KB)
- amd_fidelityfx_upscaler_vk.dll (36 MB)
They are AMD's, under the SDK's MIT license (third_party/fidelityfx/LICENSE.md, copied beside them). Without them the
game runs as before and the Upscaler row does not offer AMD FSR 4; with them FSR 4 is offered where AMD's library says
the card runs it (Radeon RX 6000, 7000 and 9000 cards with a current driver).
Usage: python -I scripts/fsr_sdk.py [--game <game folder>] [<folder>]
<folder>: where the two files are kept between builds; default work/fsr-sdk
--game: copied beside the game's exe too (nx2/make_game.py --fsr does the same for the folder it builds)
Windows only: on Linux the game looks for a Vulkan FSR 4 library of its own (see gpu/vk/vk_fsr4.cpp).
"""
import argparse
import hashlib
import os
import shutil
import sys
import urllib.request
VERSION = "2.4.0"
BASE = "https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK/v%s/Kits/FidelityFX/signedbin/" % VERSION
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# (file, its size, its SHA-256)
RUNTIME = [
("amd_fidelityfx_loader_vk.dll", 39184, "38a56a01fb3565c0757d9f5c1e4e69de4b65e5f2e5769b323b200dc1f142bab9"),
("amd_fidelityfx_upscaler_vk.dll", 36135696, "4a7e895af6e0b615d40a84d59eb8c2b1054ad91cdd0c739567940270d51bdab7"),
]
LICENSE_SOURCE = os.path.join(ROOT, "third_party", "fidelityfx", "LICENSE.md")
LICENSE_NAME = "amd-fidelityfx-LICENSE.md"
NOTICE = ("AMD FSR 4 uses AMD's signed libraries of FidelityFX SDK %s (MIT license), downloaded from AMD's repository: "
"github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK" % VERSION)
def sha256_file(path):
h = hashlib.sha256()
with open(path, "rb") as f:
for block in iter(lambda: f.read(1 << 20), b""):
h.update(block)
return h.hexdigest()
def missing(folder):
"""The files that are not in folder, or are other files than the pinned ones"""
return [name for name, _, digest in RUNTIME
if not os.path.isfile(os.path.join(folder, name)) or sha256_file(os.path.join(folder, name)) != digest]
def complete(folder):
return bool(folder) and os.path.isdir(folder) and not missing(folder)
def download(url):
request = urllib.request.Request(url, headers={"User-Agent": "fsr-sdk-fetch"})
with urllib.request.urlopen(request, timeout=300) as r:
return r.read()
def fetch(folder, say=print, get=download):
"""Every pinned file into folder that is not there yet. Raises OSError or ValueError; a file that is not the pinned
one is never left in folder"""
need = missing(folder) if os.path.isdir(folder) else [name for name, _, _ in RUNTIME]
if not need:
say("AMD's FSR 4 libraries are in %s already" % folder)
return
os.makedirs(folder, exist_ok=True)
table = {name: (size, digest) for name, size, digest in RUNTIME}
for name in need:
size, digest = table[name]
say("AMD FSR 4: %s (%.1f MB) from AMD's repository" % (name, size / 1048576.0))
data = get(BASE + name)
if len(data) != size or hashlib.sha256(data).hexdigest() != digest:
raise ValueError("%s is not the file of FidelityFX SDK %s (%d bytes, another SHA-256)" % (name, VERSION, len(data)))
tmp = os.path.join(folder, name + ".part")
with open(tmp, "wb") as f:
f.write(data)
os.replace(tmp, os.path.join(folder, name))
def install_runtime(folder, game):
"""AMD's two libraries and their license text from folder beside the game's exe. Returns what was placed"""
placed = []
for name, _, _ in RUNTIME:
shutil.copyfile(os.path.join(folder, name), os.path.join(game, name))
placed.append(os.path.join(game, name))
if os.path.isfile(LICENSE_SOURCE):
shutil.copyfile(LICENSE_SOURCE, os.path.join(game, LICENSE_NAME))
return placed
def remove_runtime(game):
"""A game folder built without FSR 4 after one built with it loses AMD's files. True when any was there"""
gone = False
for name in [name for name, _, _ in RUNTIME] + [LICENSE_NAME]:
path = os.path.join(game, name)
if os.path.isfile(path):
os.remove(path)
gone = True
return gone
def main():
p = argparse.ArgumentParser(description=__doc__.split("\n")[0])
p.add_argument("folder", nargs="?", default=os.path.join(ROOT, "work", "fsr-sdk"))
p.add_argument("--game")
a = p.parse_args()
print(NOTICE)
try:
fetch(a.folder)
except (OSError, ValueError) as e:
print("AMD's FSR 4 libraries could not be downloaded: %s" % e)
return 1
if a.game:
for path in install_runtime(a.folder, a.game):
print("AMD FSR 4: %s" % path)
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@@ -178,9 +178,34 @@ def pick(found, name, flag, wanted=None):
return next(iter(found.items()))
def own_tx(save):
"""Hookshot commits its save as a transaction too (host/save_tx.h): <user>/save-tx/<uid> beside <user>/save/<uid> holds
the game's working copy (work) and a finished commit that could not be put in place yet (ready-<n>, newer than the save
folder). That folder for a save folder, or None when there is none."""
save = os.path.normpath(save)
parent = os.path.dirname(save)
tx = os.path.join(os.path.dirname(parent), "save-tx", os.path.basename(save))
return tx if os.path.basename(parent).lower() == "save" and os.path.isdir(tx) else None
def own_newest(save):
"""The save Hookshot loads at its next start: the highest ready-<n> of its transaction folder that holds a save, else the
save folder."""
tx = own_tx(save)
ready = []
for name in (os.listdir(tx) if tx else []):
digits = name[6:]
path = os.path.join(tx, name)
if name.startswith("ready-") and digits.isdigit() and len(digits) <= 9 and is_save_folder(path):
ready.append((int(digits), path))
return max(ready)[1] if ready else save
def pending_commit(save):
"""NX2navi writes a save to profile/save-tx first and moves it into profile/save/<account> after: while something is
waiting there, that is the save the game loads next, not the account folder."""
if own_tx(save): # (Hookshot's own transaction folder, which own_newest reads)
return None
parent = os.path.dirname(os.path.normpath(save))
tx = os.path.join(os.path.dirname(parent), "save-tx")
if os.path.basename(parent).lower() == "save" and os.path.isdir(tx):
@@ -352,7 +377,7 @@ def run(args):
_, em = locate(other, args.folder, flag)
hs_id, hs_path = pick(hs, "Hookshot", "--hookshot <the user id folder>")
em_id, em_path = pick(em, other.display, "--profile <id>", args.profile)
src, dst = (em_path, hs_path) if args.command == "import" else (hs_path, em_path)
src, dst = (em_path, hs_path) if args.command == "import" else (own_newest(hs_path), em_path)
if os.path.realpath(src) == os.path.realpath(dst):
raise Fail("%s is both the source and the target" % src)
if not args.force:
@@ -372,6 +397,10 @@ def run(args):
n += 1
backup = "%s-%d" % (base, n)
copy_saves(src, dst, backup, args.keep_settings, args.dry_run)
# (into Hookshot: its working copy and any finished commit still waiting belong to the save that was replaced, and the
# game would put such a commit over the copy at its next start)
if args.command == "import" and not args.dry_run and own_tx(dst):
shutil.rmtree(own_tx(dst), ignore_errors=True)
def main(argv=None):

View File

@@ -49,6 +49,23 @@ SHADERS = [
(0xD08E7AD8, "scene_mapping_hdr_0x09EB4538.frag.slang", 2, "the scene's tone mapping, native HDR, with local exposure"),
(0xCCB24C45, "fov_capture_0x0258153C.frag.slang", 1, "the fog, which records the camera's field of view"),
]
# (Triforce, 11-14) The same four game shaders under the other checksums they have. The four above are what a translator
# built with Microsoft's C++ library makes (the lab's builds); a translator built with libc++ (llvm-mingw: EVERY Setup build,
# and the build the patch's author matched on) gives the same programs other bytes, and v0.3.6 shipped with the lab's four
# alone: RenoDX replaced nothing in any player's game, the wide scene format on and the game's own tone mapping drawn (a
# player's log of 11-14: "none of its four shaders has replaced"; a copy of his Setup-built folder run in the lab with
# RX_VK_RENODX_TRACE=1: the frame's last draw is module C749AC23, the patch's encoder). Each entry here names one of the four
# above and is the same replacement under another name. Found by what the modules are, not their bytes (the lab's
# perf\night\spvsig.py: opcode counts, constants, decorations; the two builds' modules differ only in how ids are numbered,
# 41 of the encoder's 1,327 words): of the 24,350 modules a Setup build of v0.3.6 made, exactly one has each of the four's
# signature. C749AC23 and D2EDEE38 are also the patch's; its other two (0D00542E, 9E0C0C3A: v0.3.3's translator) are made by
# neither build any more. A change to the emitter changes all eight: match again the same way
ALSO = {
0x4AE77AB6: (0xC749AC23,),
0x66644A1B: (0xD2EDEE38,),
0xD08E7AD8: (0xCC713D29,),
0xCCB24C45: (0x93C92C19,),
}
FLAGS = ["-stage", "fragment", "-O3", "-g0", "-entry", "main", "-Wno-30056", "-Wno-15205", "-Wno-30081", "-Wno-41035",
"-DNDEBUG", "-target", "spirv"]
@@ -215,7 +232,7 @@ def fetch(folder, platform, opener=urllib.request.urlopen, say=print):
def stamp():
"""What a compiled header is made from: the commit, the compiler, the shaders and their flags. In the header's first line,
so one made from something else is made again"""
h = hashlib.sha256(repr((COMMIT, SLANG_VERSION, SHADERS, FLAGS, FILES)).encode())
h = hashlib.sha256(repr((COMMIT, SLANG_VERSION, SHADERS, FLAGS, FILES, sorted(ALSO.items()))).encode())
return "// renodx_shaders.py %s" % h.hexdigest()[:16]
@@ -253,6 +270,9 @@ def compile_header(renodx, compiler, out_path, say=print, first_line=None):
lines.append("static const struct { uint32_t crc; const uint32_t* words; uint32_t count; int kind; } RENODX_SHADERS[] = {")
for crc, name, kind, what in SHADERS:
lines.append(" {0x%08Xu, RENODX_%08X, sizeof RENODX_%08X / 4, %d}," % (crc, crc, crc, kind))
for crc, name, kind, what in SHADERS: # (the same replacement under the game shader's other checksums: ALSO)
for other in ALSO.get(crc, ()):
lines.append(" {0x%08Xu, RENODX_%08X, sizeof RENODX_%08X / 4, %d}," % (other, crc, crc, kind))
lines.append("};")
os.makedirs(os.path.dirname(out_path) or ".", exist_ok=True)
with open(out_path + ".part", "w", newline="\n", encoding="utf-8") as f:

245
scripts/streamline_sdk.py Normal file
View File

@@ -0,0 +1,245 @@
"""NVIDIA's Streamline files for a build with NVIDIA DLSS frame generation (HOOKSHOT_STREAMLINE_SDK, gpu/vk/vk_dlssg.cpp).
NVIDIA's files are not part of Triforce and are never committed or bundled. The sl.*.dll files and the headers are under
Streamline's own MIT license (license.txt); nvngx_dlssg.dll is under the NVIDIA RTX SDKs License (nvngx_dlss.license.txt),
which licenses it for systems with NVIDIA GPUs. Both texts are fetched beside them: read them before using the files.
This takes them out of NVIDIA's Streamline SDK release at one pinned version, each file checked against its SHA-256,
into <sdk folder>, at the paths they have in the SDK:
- include/*.h: what the build reads (only gpu/vk/vk_dlssg.cpp sees them; nothing of Streamline is linked);
- bin/x64/: the six DLLs the game loads at run time (sl.interposer, sl.common, sl.dlss_g, sl.pcl, sl.reflex, nvngx_dlssg);
- license.txt and bin/x64/nvngx_dlss.license.txt.
The release is one archive of 276 MB. Only the parts of it that hold these files are downloaded (HTTP range requests,
about 12 MB); a server that does not serve ranges gets the whole archive read once instead. A folder that already is
NVIDIA's whole SDK, unpacked, serves as it is.
Usage: python -I scripts/streamline_sdk.py [--accept-nvidia-license] [--game <game folder>] [<sdk folder>]
<sdk folder>: default work/streamline-sdk
--game: the DLLs and the two license texts copied into <game folder>/dlssg too, where the game looks for them
(nx2/make_game.py does the same for the folder it builds)
--accept-nvidia-license: the licenses accepted without the question (scripts, Setup's NVIDIA DLSS tick)
Then build with HOOKSHOT_STREAMLINE_SDK=<sdk folder>. Windows only.
"""
import argparse
import hashlib
import io
import os
import shutil
import sys
import urllib.request
import zipfile
VERSION = "2.14.16"
URL = "https://github.com/NVIDIA-RTX/Streamline/releases/download/v%s/streamline-sdk-v%s.zip" % (VERSION, VERSION)
SIZE = 276016170
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
LICENSE_URL = "https://github.com/NVIDIA-RTX/Streamline/blob/v%s/license.txt" % VERSION
# (path in NVIDIA's SDK, its SHA-256)
HEADERS = [
("include/sl.h", "e1e81a7428d15b30db37587e9469bd68a56d630d820a4accec0aee3b17e157dd"),
("include/sl_appidentity.h", "1337385ac9867d66fa6beb34c750e79aaf25a74a156a47e83f24937299dade87"),
("include/sl_consts.h", "17de74afda2cb96204ff380464bed926f660d92015fe0304dff4e329509c88b9"),
("include/sl_core_api.h", "328dc3a2c1dee579c200ca97e2d5b1ec38c893be4ba2745ef5ad506af7172e81"),
("include/sl_core_types.h", "f420cb052ce14489fc9fa0d933c3ed81a010deb01fa13b1aa8d45da1c5ba3234"),
("include/sl_deepdvc.h", "c6086ffe6b1e00588368fdb91e4ab9dd9617624e0e4344cd503a2ca73e46d1a4"),
("include/sl_device_wrappers.h", "af7741305b1a468c3a83efaa2005ecd53d2ffd7aadb8ec6868c9dcb4a8a8e3a1"),
("include/sl_directsr.h", "65d4e68b2a0f0425ea4d381379172197b81352a50a5e399a8e8f51953e765c71"),
("include/sl_dlss.h", "d2c8c61fa71794c8ba424cebce5b3079ebfab8e47ed98b4b00cf8b257ecfd6b5"),
("include/sl_dlss_d.h", "6e51cf9815301c597d0657970a668147e34a20db5a76d0af254ec11248f5c4fe"),
("include/sl_dlss_g.h", "1fc18cbe004e280df1f787276d08a1b28b8a8c4c65856fbaa659f56dff6a915d"),
("include/sl_helpers.h", "48629edbf25dfdb6444c91235fc278f0f9a5878243fae83204c5906ce9eacd8a"),
("include/sl_helpers_vk.h", "82604567d239d00ac0ac2270cec744f6f11266e1d9d5187a95d4954f76d8c41c"),
("include/sl_hooks.h", "cfeff70a52e1cc012cf4c955a15cc9d0b290f7e084dcb3c0168a9af06ff8f122"),
("include/sl_matrix_helpers.h", "a65758d85abba1e12845d266d7d5e36aaefa952383cdf093f3143cd6d8653341"),
("include/sl_nis.h", "f45be3cf149200e1eae081cd144c95726a7a290a89822a5d52b9f538e52484aa"),
("include/sl_nvperf.h", "025f9f1c8482e75a90f8b8efccdc9cfc53a9fc8b05ba3acc6c3783708b66bd69"),
("include/sl_pcl.h", "f43c5135fc8d5349ccd345e424f8cf1f61953a9f17e9897204b0741a3ab7b0fb"),
("include/sl_reflex.h", "3b623a1189e04a686384d224a58c4ad9974c4e6e3204077676f6ec529475164c"),
("include/sl_result.h", "2a0f6c12863bdc00b38910a5ec85d1f083c5671ee817a920afe626ac2a9100f7"),
("include/sl_security.h", "a36b1c20394402bee7ce738089a5a1305ff6e9dd9dd517566154ce834f7c32b4"),
("include/sl_struct.h", "28deda67ea1a74371dd4f33ff4842b7db03b2db007001da6db06f6982297928d"),
("include/sl_template.h", "af2d4a61361f2603872dcb6edc86cc9e18912762a5c03e6a782ff39a8c3b871b"),
("include/sl_version.h", "2a43f565b45a07d4a4259dc61038ec93a7fb8ce7cb3509ea1fbeeb217f9a1ce8"),
]
# What the game loads at run time: without all of it the game leaves DLSS frame generation off (vk_dlssg.cpp early)
RUNTIME = [
("bin/x64/sl.interposer.dll", "b1d7395aebd7b9722841d64dcf7433680020b6a8e421f851c16d5ba0c2182edf"),
("bin/x64/sl.common.dll", "38eea3b4209afc455636ea372b5933d65fcc13becec6c84d101dcfc4d8648f75"),
("bin/x64/sl.dlss_g.dll", "3ed9538df724993bea8a050195a6a78b9c8c8a566d5b05ade477aab3c390e90f"),
("bin/x64/sl.pcl.dll", "5698c38e722318681f215c9fe68e45b9bedd51378acc699d8eee26e961e57770"),
("bin/x64/sl.reflex.dll", "443577e869352436ff7ec8f4d9c90418d3e95368436ce219261e0f4f07a38122"),
("bin/x64/nvngx_dlssg.dll", "8d59d49b36410dd6b62fef2503a5871d347415bd85d943fa0848563a95dd50c7"),
]
LICENSES = [
("license.txt", "7b6f23e7d6f3ad6292f9308d2b42cdc3d82ae4e9b2abb55f230279d83bedd43d"),
("bin/x64/nvngx_dlss.license.txt", "3027f23ca5a46dd9cb8183fbd522983a86f64d7daac5982912bf9f214671f294"),
]
# The license texts as they are named beside the DLLs in a game folder
GAME_LICENSE_NAMES = {"license.txt": "streamline-LICENSE.txt", "bin/x64/nvngx_dlss.license.txt": "nvidia-rtx-sdks-LICENSE.txt"}
GAME_DIR = "dlssg"
NOTICE = ("NVIDIA DLSS frame generation uses NVIDIA's Streamline (its sl.*.dll files, under Streamline's MIT license) and "
"nvngx_dlssg.dll (under the NVIDIA RTX SDKs License, for systems with NVIDIA GPUs). They are NVIDIA's, not part of "
"Triforce: " + LICENSE_URL)
def files():
return HEADERS + RUNTIME + LICENSES
def sha256_file(path):
h = hashlib.sha256()
with open(path, "rb") as f:
for block in iter(lambda: f.read(1 << 20), b""):
h.update(block)
return h.hexdigest()
def missing(sdk):
"""The pinned files that are not in sdk, or are other files than the pinned ones"""
return [name for name, digest in files()
if not os.path.isfile(os.path.join(sdk, *name.split("/"))) or sha256_file(os.path.join(sdk, *name.split("/"))) != digest]
def complete(sdk):
"""sdk holds every pinned file: what nx2/build.py and the game need"""
return bool(sdk) and os.path.isdir(sdk) and not missing(sdk)
class RangeReader(io.RawIOBase):
"""The archive at url as a seekable file that downloads only what is read (HTTP range requests)"""
def __init__(self, url, size, opener=None):
self.url, self.size, self.pos = url, size, 0
self.opener = opener or urllib.request.urlopen
self.fetched = 0
def readable(self):
return True
def seekable(self):
return True
def tell(self):
return self.pos
def seek(self, offset, whence=io.SEEK_SET):
self.pos = offset if whence == io.SEEK_SET else self.pos + offset if whence == io.SEEK_CUR else self.size + offset
return self.pos
def readinto(self, buffer):
want = min(len(buffer), self.size - self.pos)
if want <= 0:
return 0
request = urllib.request.Request(self.url, headers={"Range": "bytes=%d-%d" % (self.pos, self.pos + want - 1),
"User-Agent": "streamline-sdk-fetch"})
with self.opener(request, timeout=120) as r:
if getattr(r, "status", 206) != 206: # (the whole archive would come: the caller reads it once instead)
raise ValueError("the server does not serve parts of the archive")
data = r.read()
if len(data) != want:
raise ValueError("a part of the archive came short (%d of %d bytes)" % (len(data), want))
buffer[:want] = data
self.pos += want
self.fetched += want
return want
def open_archive(url=URL, size=SIZE, opener=None, say=print):
"""(zip file, how it is read): by ranges, or downloaded whole into memory when the server serves none"""
reader = RangeReader(url, size, opener)
try:
return zipfile.ZipFile(io.BufferedReader(reader, buffer_size=1 << 20)), reader
except (ValueError, zipfile.BadZipFile, OSError) as e:
say("NVIDIA's archive is read whole (%s): %d MB" % (e, size >> 20))
request = urllib.request.Request(url, headers={"User-Agent": "streamline-sdk-fetch"})
with (opener or urllib.request.urlopen)(request, timeout=600) as r:
data = r.read()
if len(data) != size:
raise ValueError("NVIDIA's archive is %d bytes, not the %d of Streamline %s" % (len(data), size, VERSION))
return zipfile.ZipFile(io.BytesIO(data)), None
def fetch(sdk, say=print, archive=None):
"""Every pinned file into sdk that is not there yet. archive: an open zipfile to take them from (tests); else NVIDIA's
release. Raises OSError or ValueError; a file that is not the pinned one is never left in sdk"""
need = missing(sdk) if os.path.isdir(sdk) else [name for name, _ in files()]
if not need:
say("NVIDIA's Streamline %s is in %s already" % (VERSION, sdk))
return
reader = None
if archive is None:
say("NVIDIA's Streamline %s: %d files from %s" % (VERSION, len(need), URL))
archive, reader = open_archive(say=say)
digests = dict(files())
names = {info.filename.replace("\\", "/"): info for info in archive.infolist()}
for name in need:
info = names.get(name) or next((i for n, i in names.items() if n.endswith("/" + name)), None)
if info is None:
raise ValueError("NVIDIA's archive has no %s" % name)
data = archive.read(info)
if hashlib.sha256(data).hexdigest() != digests[name]:
raise ValueError("%s is not the file of Streamline %s (another SHA-256)" % (name, VERSION))
dst = os.path.join(sdk, *name.split("/"))
os.makedirs(os.path.dirname(dst), exist_ok=True)
tmp = dst + ".part"
with open(tmp, "wb") as f:
f.write(data)
os.replace(tmp, dst)
if reader is not None:
say("NVIDIA's Streamline %s: %d files, %.1f MB downloaded of the archive's %d MB" %
(VERSION, len(need), reader.fetched / 1048576.0, SIZE >> 20))
def install_runtime(sdk, game):
"""The DLLs and the license texts from sdk into <game>/dlssg. Returns the folder"""
dst = os.path.join(game, GAME_DIR)
os.makedirs(dst, exist_ok=True)
for name, _ in RUNTIME:
shutil.copyfile(os.path.join(sdk, *name.split("/")), os.path.join(dst, os.path.basename(name)))
for name, _ in LICENSES:
shutil.copyfile(os.path.join(sdk, *name.split("/")), os.path.join(dst, GAME_LICENSE_NAMES[name]))
return dst
def remove_runtime(game):
"""A game folder built without frame generation after one built with it loses NVIDIA's files"""
dst = os.path.join(game, GAME_DIR)
if not os.path.isdir(dst):
return False
known = {os.path.basename(name) for name, _ in RUNTIME} | set(GAME_LICENSE_NAMES.values())
for name in os.listdir(dst):
if name in known:
os.remove(os.path.join(dst, name))
try:
os.rmdir(dst)
except OSError:
pass
return True
def main():
p = argparse.ArgumentParser(description=__doc__.split("\n")[0])
p.add_argument("sdk", nargs="?", default=os.path.join(ROOT, "work", "streamline-sdk"))
p.add_argument("--game")
p.add_argument("--accept-nvidia-license", action="store_true")
a = p.parse_args()
print(NOTICE)
if not a.accept_nvidia_license:
if input("Accept NVIDIA's licenses and download the files? [y/N] ").strip().lower() not in ("y", "yes"):
print("Nothing was downloaded.")
return 1
try:
fetch(a.sdk)
except (OSError, ValueError) as e:
print("NVIDIA's Streamline could not be downloaded: %s" % e)
return 1
print("Build with HOOKSHOT_STREAMLINE_SDK=%s" % a.sdk)
if a.game:
print("NVIDIA's files for the game: %s" % install_runtime(a.sdk, a.game))
return 0
if __name__ == "__main__":
sys.exit(main())