forked from Sierraffinity/CrystalDust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alpha_builds.py
34 lines (28 loc) · 1.17 KB
/
alpha_builds.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python3
from sys import argv
from pathlib import Path
from shlex import quote
import os, subprocess, zlib
def flips(params):
subprocess.call(["/mnt/c/Hacking/Tools/Flips/flips-linux"] + params)
def create_bps(name):
flips(["--create", "--bps", "/mnt/c/Hacking/Pokemon 3rd generation/Pokemon - Emerald Version (U).gba", "CrystalDust.gba", "alphas/CrystalDust_" + name + ".bps"])
def apply_bps(name):
flips(["--apply", "--bps", "alphas/CrystalDust_" + name + ".bps", "/mnt/c/Hacking/Pokemon 3rd generation/Pokemon - Emerald Version (U).gba", "alphas/CrystalDust_" + name + ".gba"])
def build_and_encrypt(name):
crc = hex(zlib.crc32(bytes(name, encoding='utf8')))
subprocess.call(["make", "tidy"])
subprocess.call(["make", "-j8", "modern", "RELEASE_ID=" + crc])
create_bps(name)
apply_bps(name)
print(crc)
if __name__ == '__main__':
os.makedirs("alphas", exist_ok=True)
if len(argv) > 1:
build_and_encrypt(argv[1])
else:
with open("alpha_testers.txt", 'r') as f:
for _, line in enumerate(f):
line = line.rstrip('\n')
build_and_encrypt(line)
subprocess.call(["make", "tidy"])