mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-05-02 14:47:58 +03:00
build: simplify build pipeline a bit
This commit is contained in:
parent
f871f298a7
commit
77e904e56d
6 changed files with 27 additions and 25 deletions
33
scripts/generate_init
Normal file
33
scripts/generate_init
Normal file
|
@ -0,0 +1,33 @@
|
|||
from pathlib import Path
|
||||
import json
|
||||
import pyjson5
|
||||
|
||||
REPO_DIR = Path(__file__).parent.parent
|
||||
CONFIG_DIR = REPO_DIR / "cfg"
|
||||
SRC_DIR = REPO_DIR / "src"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
gf = pyjson5.loads(
|
||||
(CONFIG_DIR / "Tomb1Main_gameflow.json5").read_text(encoding="utf-8")
|
||||
)
|
||||
with (SRC_DIR / "init.c").open("w") as handle:
|
||||
print('#include "init.h"', file=handle)
|
||||
print(file=handle)
|
||||
print('#include "global/vars.h"', file=handle)
|
||||
print(file=handle)
|
||||
print("// THIS IS AN AUTOGENERATED FILE.", file=handle)
|
||||
print("// To generate it, run scripts/generate_init.", file=handle)
|
||||
print("", file=handle)
|
||||
print("void T1MInit()", file=handle)
|
||||
print("{", file=handle)
|
||||
for key, value in gf["strings"].items():
|
||||
print(
|
||||
f" GF.strings[GS_{key}] = {json.dumps(value)};",
|
||||
file=handle,
|
||||
)
|
||||
print("}", file=handle)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue