mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-23 17:49:57 -04:00
Crash fixes (a load crash from the virtual cores' escape, the upscaler-before-the-bloom crash, out of memory at a file's open), slow motion after a movie fixed, three save files with per-save achievements (ZakyPew), ten more achievements and their own menu group, N64 Classic, native ultrawide output (Kaefergeneral), the community AMD frame-time fixes, the helper threads' calm-scene tuner and benchmark test, update and Linux launcher fixes.
36 lines
1.8 KiB
Python
36 lines
1.8 KiB
Python
"""Every Insert menu row that takes a restart has a slot in menu_restart.h's State (kMax of them). Main grew to ten such rows
|
|
while kMax was 8: the last two (Audio output, Button prompts) had slot -1, and the menu read start[-1], out of bounds, so the
|
|
Button prompts row said "After restart" with nothing changed. Checks the count against kMax, and that the menu asks
|
|
restart_changed (which skips a row with no slot) rather than indexing start[] itself.
|
|
|
|
python -I -B tests/test_menu_restart_slots.py
|
|
"""
|
|
import re
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def main():
|
|
menu = (ROOT / "gpu/vk/vk_menu.cpp").read_text(encoding="utf-8")
|
|
kmax = int(re.search(r"constexpr int kMax = (\d+);", (ROOT / "gpu/vk/menu_restart.h").read_text(encoding="utf-8")).group(1))
|
|
table = menu[menu.index("Row rows[] = {"):]
|
|
table = table[:table.index("\n};")]
|
|
restart = []
|
|
for entry in re.split(r"\n \{TAB_", table)[1:]:
|
|
name = re.match(r'\w+, ("[^"]+"|\w+),', entry).group(1).strip('"')
|
|
flags = re.findall(r"\b(true|false)\b", entry)
|
|
if flags and flags[0] == "true":
|
|
restart.append(name)
|
|
if len(restart) > kmax:
|
|
raise SystemExit("FAIL: %d rows take a restart (%s), menu_restart.h kMax is %d" % (len(restart), ", ".join(restart), kmax))
|
|
if re.search(r"restart_state\.start\[restart_slot_of\(", menu):
|
|
raise SystemExit("FAIL: vk_menu.cpp indexes restart_state.start with a slot that can be -1: use restart_changed")
|
|
if "slot >= 0 && restart_value_of(r) != restart_state.start[slot]" not in menu:
|
|
raise SystemExit("FAIL: restart_changed does not skip a row with no slot")
|
|
print("PASS: %d rows take a restart, %d slots" % (len(restart), kmax))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|