Add v1.2 development quest progression and experimental battle runtime
This commit is contained in:
@@ -12,7 +12,6 @@ from repack_apk import repack_members
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
ANALYSIS = ROOT / "analysis"
|
||||
BUILD_TOOLS = Path(r"C:\Users\11789\AppData\Local\Android\Sdk\build-tools\36.0.0")
|
||||
|
||||
|
||||
def sha256(path: Path) -> str:
|
||||
@@ -27,7 +26,7 @@ def run(*args: str) -> None:
|
||||
subprocess.run(list(map(str, args)), cwd=ROOT, check=True)
|
||||
|
||||
|
||||
def build(mode_filter: str = "both", revision: str = "V3", refresh_air_cache: bool = False) -> None:
|
||||
def build(mode_filter: str = "both", revision: str = "V3", refresh_air_cache: bool = False, *, build_tools: Path) -> None:
|
||||
source = ROOT / "\u7267\u7f8a\u4eba\u4e4b\u5fc3_1.9.68.apk"
|
||||
expected = "01678ee3a8465d818d32cbbd94baa0d8253b04b4c57b70ebc5544ed341f1015d"
|
||||
if sha256(source) != expected:
|
||||
@@ -61,17 +60,17 @@ def build(mode_filter: str = "both", revision: str = "V3", refresh_air_cache: bo
|
||||
print(f"New AIR extracted-code cache ID: {cache_id}", flush=True)
|
||||
print(f"Repacking {mode}", flush=True)
|
||||
repack_members(source, replacements, unsigned)
|
||||
run(BUILD_TOOLS / "zipalign.exe", "-f", "-p", "4", unsigned, aligned)
|
||||
run(build_tools / "zipalign.exe", "-f", "-p", "4", unsigned, aligned)
|
||||
if refresh_air_cache:
|
||||
xmltree = subprocess.check_output([str(BUILD_TOOLS / "aapt.exe"), "dump", "xmltree", str(aligned), "AndroidManifest.xml"]).decode("utf-8", errors="replace")
|
||||
xmltree = subprocess.check_output([str(build_tools / "aapt.exe"), "dump", "xmltree", str(aligned), "AndroidManifest.xml"]).decode("utf-8", errors="replace")
|
||||
if cache_id not in xmltree or '"uniqueappversionid"' not in xmltree or '"MYRDyd.swf"' not in xmltree:
|
||||
raise ValueError("Compiled Android manifest validation failed")
|
||||
(ANALYSIS / f"{revision.lower()}_manifest_dump.txt").write_text(xmltree, encoding="utf-8")
|
||||
run(BUILD_TOOLS / "apksigner.bat", "sign", "--ks", ANALYSIS / "myrzx-local-test.p12",
|
||||
run(build_tools / "apksigner.bat", "sign", "--ks", ANALYSIS / "myrzx-local-test.p12",
|
||||
"--ks-key-alias", "myrzx-local", "--ks-pass", "pass:myrzx-local-test",
|
||||
"--key-pass", "pass:myrzx-local-test", "--out", output, aligned)
|
||||
run(BUILD_TOOLS / "zipalign.exe", "-c", "-p", "4", output)
|
||||
run(BUILD_TOOLS / "apksigner.bat", "verify", "--verbose", "--print-certs", output)
|
||||
run(build_tools / "zipalign.exe", "-c", "-p", "4", output)
|
||||
run(build_tools / "apksigner.bat", "verify", "--verbose", "--print-certs", output)
|
||||
with zipfile.ZipFile(output) as apk, zipfile.ZipFile(source) as original:
|
||||
bad = apk.testzip()
|
||||
if bad is not None:
|
||||
@@ -104,5 +103,6 @@ if __name__ == "__main__":
|
||||
parser.add_argument("--mode", choices=("both", "damage", "stats"), default="both")
|
||||
parser.add_argument("--revision", choices=("V3", "V4"), default="V3")
|
||||
parser.add_argument("--refresh-air-cache", action="store_true")
|
||||
parser.add_argument("--build-tools", type=Path, required=True, help="Android SDK build-tools directory")
|
||||
args = parser.parse_args()
|
||||
build(args.mode, args.revision, args.refresh_air_cache)
|
||||
build(args.mode, args.revision, args.refresh_air_cache, build_tools=args.build_tools)
|
||||
|
||||
Reference in New Issue
Block a user