MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / update_bytecode_version_header

Function update_bytecode_version_header

bytecode_generator.py:692–705  ·  view source on GitHub ↗
(dir: Path, bytecode_classes: list[BytecodeClass])

Source from the content-addressed store, hash-verified

690
691
692def update_bytecode_version_header(dir: Path, bytecode_classes: list[BytecodeClass]) -> None:
693 file_path = dir / "bytecode_versions.h"
694 with open(file_path, "r") as f:
695 code = f.read()
696
697 # split into lines, find `static constexpr int LATEST_GDSCRIPT_COMMIT`, replace the line with `static constexpr int LATEST_GDSCRIPT_COMMIT = 0x` + the bytecode_rev of the first bytecode_class
698 lines = code.split("\n")
699 for i, line in enumerate(lines):
700 if "static constexpr int LATEST_GDSCRIPT_COMMIT" in line:
701 lines[i] = line.split("=")[0] + "= 0x" + str(bytecode_classes[0].bytecode_rev) + ";"
702 break
703 code = "\n".join(lines)
704 with open(file_path, "w") as f:
705 f.write(code)
706
707
708def generate_bytecode_versions_cpp(dir: Path, bytecode_classes: list[BytecodeClass]) -> None:

Callers 1

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected