1
0
Fork 0
mirror of https://github.com/Radiquum/anixart-patcher.git synced 2025-09-08 12:13:51 +05:00

feat: add settings menu items patch

This commit is contained in:
Kentai Radiquum 2025-09-04 10:24:36 +05:00
parent 1e84f31eb0
commit 9e06ed8c9f
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
5 changed files with 187 additions and 18 deletions

View file

@ -69,7 +69,29 @@ progress = Progress(
)
def apply_patches(patches: list[str]) -> list[PatchStatus]:
def get_patch_config(
patch_name: str,
all_patch_statuses: list,
app_version: str,
app_build: int,
) -> dict:
_config = {}
if os.path.exists(f"{config['folders']['patches']}/{patch_name}.config.json"):
with open(
f"{config['folders']['patches']}/{patch_name}.config.json",
"r",
encoding="utf-8",
) as f:
_config = json.loads(f.read())
_config["_internal_all_patch_statuses"] = all_patch_statuses
_config["_internal_app_version"] = app_version
_config["_internal_app_build"] = app_build
return _config
def apply_patches(
patches: list[str], app_version: str, app_build: int
) -> list[PatchStatus]:
modules = []
statuses = []
@ -84,19 +106,7 @@ def apply_patches(patches: list[str]) -> list[PatchStatus]:
task = progress.add_task("applying patch:", total=len(modules), patch="")
for module in modules:
progress.update(task, patch=module.name)
patch_conf = {}
if os.path.exists(
f"{config['folders']['patches']}/{module.name}.config.json"
):
with open(
f"{config['folders']['patches']}/{module.name}.config.json",
"r",
encoding="utf-8",
) as f:
patch_conf = json.loads(f.read())
status = module.apply(patch_conf)
status = module.apply(get_patch_config(module.name, statuses, app_version, app_build))
statuses.append({"name": module.name, "status": status})
progress.update(task, advance=1)

View file

@ -137,10 +137,14 @@ def init_patch():
f.write("")
name = prompt("Patch name: ", lambda x: x.strip().lower().replace(" ", "_"))
description = prompt("Patch description: ", lambda x: x.strip())
summary = prompt("Patch summary: ", lambda x: x.strip())
developer = prompt("Patch developer: ", lambda x: x.strip())
URL = prompt("URL: ", lambda x: x.strip())
priority = prompt("Patch priority: ", target_type=int, initial_value="0")
patch_content = f"""\"\"\"{description}\"\"\"
patch_content = f"""\"\"\"{summary}\"\"\"
# Developer: {developer}
# URL: {URL}
# patch settings
# priority, default: {priority}