Files
Triforce-Source/tests/test_fsr4_models.py
ruckus7382sfgsgdf 4fa4f9188b Triforce v0.8.0
Evil HD (SMAA Ultra, 16x filtering, full textures, ambient occlusion with bounce light, sunlight shafts, foliage drawn 4x as far, the remastered texture pack's loader and the launcher's download of it), FSR 3.1 frame generation for every GPU, Intel XeSS, FSR 4 model choice, ReShade presets, Auto (this PC), HUD placement, the options menu in 13 languages, a second input for every control, hold to toggle, DualSense speaker and haptics, NFC from the player's own dumps, the above-60 fps game fixes, the Debug tab's flight and Inventory fixes, the launcher's full settings, and over 250 fixes.
2026-11-25 10:21:32 -06:00

52 lines
1.9 KiB
Python

"""The FSR 4 model scanner (gpu/vk/fsr4_models.h/.cpp) on synthetic PE images: the
four provider classes, their Complete Object Locators, vtables and static registry, laid out as AMD's 4.1.2 Vulkan DLL
has them. Checks the four providers and their order, the registry instances, the 4.1.2 shape (entries 0, 1, 3..7
shared, entry 2 distinct), a missing Lite, a single provider, a shifted shared entry, an unknown provider, a non-PE
image, the fail-closed install and the selection helpers. No AMD DLL, GPU or game.
python -I -B tests/test_fsr4_models.py [--cxx g++]
"""
import argparse
import os
import subprocess
import sys
import tempfile
from pathlib import Path
RUN_ALL_ARGS = ["--cxx", "{cxx}"]
ROOT = Path(__file__).resolve().parents[1]
VK = ROOT / "gpu" / "vk"
HARNESS = ROOT / "tests" / "fsr4_models_test.cpp"
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--cxx", default=os.environ.get("CXX", "c++"))
args = ap.parse_args()
with tempfile.TemporaryDirectory() as td:
exe = Path(td) / ("fsr4_models_test.exe" if os.name == "nt" else "fsr4_models_test")
cmd = [args.cxx, "-std=c++20", "-O2", "-DFSR4_MODELS_TEST", "-I", str(VK), str(VK / "fsr4_models.cpp"), str(HARNESS), "-o", str(exe)]
if os.name == "nt":
cmd.append("-static")
built = subprocess.run(cmd, capture_output=True, text=True)
if built.returncode != 0:
print(built.stdout, end="")
print(built.stderr, end="", file=sys.stderr)
print("FAIL: the scanner test did not build")
return 1
ran = subprocess.run([str(exe)], capture_output=True, text=True)
print(ran.stdout, end="")
if ran.returncode != 0:
print(ran.stderr, end="", file=sys.stderr)
print("FAIL: the scanner test failed")
return 1
print("OK")
return 0
if __name__ == "__main__":
sys.exit(main())