mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 13:59:56 -04:00
With NX2NAVI_RTSS=0, frame generation or the driver's low latency, the game keeps RTSS out of its frame limit, but a limit the player set in RTSS itself (its Global profile or the game's own: a frame rate limit, a frame time limit or scanline sync) still holds the frames, on top of the game's limiter, the driver's or frame generation's. Nothing read RTSS's settings in such a run: a first want that kept RTSS out never started its thread, and frame_step_cap_ns folded the reasons into -1, so the log said "NX2NAVI_RTSS=0 or frame generation" for low latency too. frame_step_cap_ns now passes the reason (rtss_decide.h RTSS_OUT_SETTING, RTSS_OUT_FRAMEGEN, RTSS_OUT_LOWLAT; the unlimited branch too), and the kept-out line names it. A kept-out first want starts the worker as well. While RTSS is kept out the worker never loads RTSS's hooks library and only reads: its shared memory, and once RTSS lists the game the [Framerate] values of Profiles\<exe>.cfg, else Profiles\Global, with the system's ini reader, again only when either file's write time changes. When one of them limits the game, the log names the file, the values and the other limiter, once per change, and rtss_limit_state returns 4, which the frame rate row shows as a new note (UI_MENU_FPS_RTSS_TWO, in English, Russian, Brazilian Portuguese and Simplified Chinese). A later want of a limit (frame generation or low latency switched off) loads the hooks and hands RTSS the limit as before; NX2NAVI_RTSS=0 stays read-only for the run. Pacing does not change. Not reproduced before the change: a stacked limit needs RTSS running in a play-test. tests/rtss_worker_check.c gains three scenarios against the fake RTSS (a Global limit with NX2NAVI_RTSS=0, scanline sync in the game's profile under low latency and then a limit, frame generation with no limit of RTSS's own), and tests/rtss_limit_check.c builds rtss_decide.h alone and checks which settings hold the frames and their text. Both pass, with frame_step_check and a compile of every runtime file; -Wall adds no warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
68 lines
2.6 KiB
Python
68 lines
2.6 KiB
Python
"""Build and run the checks of runtime/rtss_limit.c, RivaTuner Statistics Server as the frame limiter.
|
|
|
|
tests/rtss_limit_check.c builds runtime/rtss_decide.h alone, the parts that make no system call. tests/rtss_worker_check.c
|
|
(Windows only, skipped elsewhere) compiles the real rtss_limit.c against a fake RTSS and runs each of its scenarios in a
|
|
process of its own.
|
|
|
|
No GPU, no game files, no RTSS, any Python.
|
|
|
|
Usage: rtss_limit_check.py
|
|
"""
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
MSYS_BIN = Path(r'C:\msys64\ucrt64\bin')
|
|
|
|
|
|
def compiler():
|
|
"""$CC, else MSYS2 UCRT64's clang, else clang on PATH (as tests/diff/common.py picks it, without its Unicorn)."""
|
|
if os.environ.get('CC'):
|
|
return os.environ['CC']
|
|
if os.name == 'nt' and (MSYS_BIN / 'clang.exe').exists():
|
|
return str(MSYS_BIN / 'clang.exe')
|
|
return shutil.which('clang') or 'clang'
|
|
|
|
|
|
def build(src, exe, env):
|
|
subprocess.check_call([compiler(), '-std=gnu11', '-O1', '-Wall', '-Werror', '-I', str(ROOT / 'runtime'),
|
|
str(ROOT / 'tests' / src), '-o', str(exe)], env=env)
|
|
|
|
|
|
def main():
|
|
work = ROOT / 'build' / 'test' / 'rtss_limit'
|
|
work.mkdir(parents=True, exist_ok=True)
|
|
env = dict(os.environ)
|
|
if os.name == 'nt' and MSYS_BIN.exists():
|
|
env['PATH'] = str(MSYS_BIN) + os.pathsep + env.get('PATH', '')
|
|
failed = []
|
|
pure = work / ('rtss_limit_check.exe' if os.name == 'nt' else 'rtss_limit_check')
|
|
build('rtss_limit_check.c', pure, env)
|
|
if subprocess.run([str(pure)], env=env).returncode != 0:
|
|
failed.append('rtss_limit_check')
|
|
if os.name != 'nt':
|
|
print('rtss_worker_check: skipped (rtss_limit.c limits only on Windows)')
|
|
return 1 if failed else 0
|
|
exe = work / 'rtss_worker_check.exe'
|
|
build('rtss_worker_check.c', exe, env)
|
|
names = subprocess.run([str(exe), '--list'], env=env, capture_output=True, text=True, check=True).stdout.split()
|
|
for name in names:
|
|
try:
|
|
p = subprocess.run([str(exe), name], env=env, capture_output=True, text=True, timeout=120)
|
|
ok, out = p.returncode == 0, p.stdout + p.stderr
|
|
except subprocess.TimeoutExpired as e:
|
|
ok, out = False, (e.stdout or b'').decode(errors='replace') + '\nTIMEOUT'
|
|
print(f'rtss_worker_check {name}: {"ok" if ok else "FAIL"}')
|
|
if not ok:
|
|
print(out)
|
|
failed.append(name)
|
|
print(f'{len(names) + 1 - len(failed)} of {len(names) + 1} checks ok' + (f'; failed: {", ".join(failed)}' if failed else ''))
|
|
return 1 if failed else 0
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|