- Explicitly route OptiScaler to d4r\nvngx.dll in release packages. - Extract INI generation into a helper that preserves line endings and rejects missing or duplicate settings. - Check NGX routing separately from file presence and return failure when the installation is incomplete or misconfigured. - Add an optional OptiScaler patch for external DLSS backends while preserving AMD identity for FSR4, with matching launch guidance. - Align portable and launcher marker polling defaults at 200 us. - Log when d4r's model override replaces game or OptiScaler presets. - Add configuration, package, routing and coexistence regression tests. - Update installation documentation, add FSR/DLSS comparison videos and ignore local .tools artifacts. Refs: #7, #14
44 lines
1.7 KiB
Python
44 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Apply release settings to the supplied OptiScaler INI, preserving its defaults/CRLF."""
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def configure(source, settings):
|
|
lines = source.split("\n")
|
|
for setting in settings.splitlines():
|
|
setting = setting.strip()
|
|
if not setting or setting.startswith("#"):
|
|
continue
|
|
path, value = setting.split("=", 1)
|
|
section, key = path.split(".", 1)
|
|
starts = [i for i, line in enumerate(lines) if line.strip().casefold() == f"[{section}]".casefold()]
|
|
if len(starts) != 1:
|
|
raise ValueError(f"OptiScaler.ini must have exactly one [{section}]")
|
|
start = starts[0]
|
|
end = next((i for i in range(start + 1, len(lines)) if lines[i].lstrip().startswith("[")), len(lines))
|
|
matches = [i for i in range(start + 1, end)
|
|
if re.match(rf"\s*{re.escape(key)}\s*=", lines[i], re.IGNORECASE)]
|
|
if len(matches) != 1:
|
|
raise ValueError(f"OptiScaler.ini must have exactly one {key} in [{section}]")
|
|
i = matches[0]
|
|
lines[i] = f"{key}={value}" + ("\r" if lines[i].endswith("\r") else "")
|
|
return "\n".join(lines)
|
|
|
|
|
|
def main():
|
|
source, settings, output = map(Path, sys.argv[1:])
|
|
try:
|
|
# read_text() would translate CRLF before we could preserve it.
|
|
with source.open(encoding="utf-8", newline="") as handle:
|
|
result = configure(handle.read(), settings.read_text(encoding="utf-8"))
|
|
except ValueError as error:
|
|
sys.exit(str(error))
|
|
with output.open("w", encoding="utf-8", newline="") as handle:
|
|
handle.write(result)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|