mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-25 18:48:51 -04:00
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.
60 lines
2.7 KiB
Python
60 lines
2.7 KiB
Python
"""Compile the real output section with synthetic audio/device spies, without opening a device.
|
|
|
|
python -I -B tests/test_audio_output_errors.py [--cc clang]
|
|
"""
|
|
import argparse
|
|
import os
|
|
from pathlib import Path
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
CASES = ("normal", "busy", "prepare", "write", "unprepare", "open", "bounded", "stall", "surround", "fallback",
|
|
"lost", "gone", "service", "default", "selection", "named-missing", "named-override", "named-format", "named-default-change",
|
|
"layout-reopen", "upmix", "downmix", "retry", "same-layout-retry", "pre-mix",
|
|
"named-stall-budget", "named-backoff", "named-open-failure", "named-healthy-reset", "named-write-failure",
|
|
"named-retry-stereo")
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--cc", default="cc")
|
|
parser.add_argument("--source", type=Path, default=ROOT / "host/nn_audio.c")
|
|
parser.add_argument("--case", choices=CASES)
|
|
args = parser.parse_args()
|
|
process_flags = (subprocess.CREATE_NO_WINDOW | subprocess.BELOW_NORMAL_PRIORITY_CLASS) if os.name == "nt" else 0
|
|
|
|
def run(command):
|
|
result = subprocess.run(command, creationflags=process_flags, capture_output=True,
|
|
text=True, encoding="utf-8", errors="replace")
|
|
print(result.stdout, end="")
|
|
print(result.stderr, end="", file=sys.stderr)
|
|
result.check_returncode()
|
|
source = args.source.read_text(encoding="utf-8")
|
|
definitions = []
|
|
for name in ("FRAME", "RATE"):
|
|
matches = re.findall(r"^#define " + name + r"\s+\d+[^\n]*", source, re.M)
|
|
assert len(matches) == 1, name
|
|
definitions.extend(matches)
|
|
start, end = source.index("#define NBLOCKS"), source.index("/* ---- parameter updates")
|
|
actual = "\n".join(definitions) + "\n" + source[start:end]
|
|
temporary = tempfile.TemporaryDirectory(prefix="audio-output-")
|
|
folder = Path(temporary.name).resolve()
|
|
try:
|
|
assert folder.parent == Path(tempfile.gettempdir()).resolve() and folder.name.startswith("audio-output-")
|
|
(folder / "audio_output.inc").write_text(actual, encoding="utf-8")
|
|
executable = folder / "fixture.exe"
|
|
run([args.cc, "-std=c11", "-Wall", "-Wextra", "-Werror", "-I" + str(folder),
|
|
str(ROOT / "tests/audio_output_errors_test.c"), "-o", str(executable)])
|
|
for case in ((args.case,) if args.case else CASES):
|
|
run([str(executable), case])
|
|
finally:
|
|
assert folder.parent == Path(tempfile.gettempdir()).resolve() and folder.name.startswith("audio-output-")
|
|
temporary.cleanup()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|