mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-19 16:20:01 -04:00
In-game mods (GameBanana browser, search and installs, with the Mask Salesman), code-patch and cheat mods, the devs' test18 to test45 work (full performance overlay, frame pacing on, steady frame rate, save export and import, bug capture, new options rows, Setup's Mods page and Add to Steam), occlusion queries and new defaults, Auto resolution that scales, replay helper threads and robust buffers off by default, the options in sections.
48 lines
2.1 KiB
Python
48 lines
2.1 KiB
Python
"""Execute production presentation/capture blits and interpolation recording with CPU API spies."""
|
|
import argparse
|
|
from pathlib import Path
|
|
import subprocess
|
|
import tempfile
|
|
|
|
RUN_ALL_ARGS = ["--cxx", "{cxx}", "--headers", "{vulkan_headers}"]
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def block(source, signature):
|
|
start = source.index(signature)
|
|
end = source.index("{", start) + 1
|
|
depth = 1
|
|
while depth:
|
|
depth += (source[end] == "{") - (source[end] == "}")
|
|
end += 1
|
|
return source[start:end]
|
|
|
|
|
|
def main():
|
|
p = argparse.ArgumentParser(description=__doc__)
|
|
p.add_argument("--cxx", default="g++")
|
|
p.add_argument("--headers", type=Path, required=True)
|
|
p.add_argument("--source", type=Path, default=ROOT)
|
|
a = p.parse_args()
|
|
replay = (a.source / "gpu/vk/vk_replay.cpp").read_text(encoding="utf-8")
|
|
fg = (a.source / "gpu/vk/vk_framegen.cpp").read_text(encoding="utf-8")
|
|
structs = fg[fg.index("struct Img {"):fg.index("int64_t now_ns()")]
|
|
# ((Triforce) make_vectors and make_frame: framegen_record's vectors and made frames, the old way or the fine vectors')
|
|
functions = "\n".join([block(replay, "void blit_crop_to_rect("), block(replay, "void blit_crop("),
|
|
block(fg, "void make_vectors("), block(fg, "void make_frame("),
|
|
block(fg, "bool framegen_record("), block(fg, "VkImage framegen_hdr(")])
|
|
template = (ROOT / "tests/present_source_crop_test.cpp").read_text(encoding="utf-8")
|
|
fixture = template.replace("/* ACTUAL_STATE */", structs).replace("/* ACTUAL_FUNCTIONS */", functions)
|
|
with tempfile.TemporaryDirectory(prefix="present-source-crop-") as temp:
|
|
cpp, exe = Path(temp) / "fixture.cpp", Path(temp) / "fixture.exe"
|
|
cpp.write_text(fixture, encoding="utf-8")
|
|
subprocess.run([a.cxx, "-std=c++20", "-O2", "-Wall", "-Wextra", "-Werror", "-Wno-missing-field-initializers",
|
|
"-pthread", "-I" + str(a.headers), "-I" + str(a.source / "gpu/vk"),
|
|
str(cpp), "-o", str(exe)], check=True)
|
|
subprocess.run([str(exe)], check=True, timeout=30)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|