mirror of
https://github.com/Radiquum/anixart-patcher.git
synced 2025-09-08 12:13:51 +05:00
Compare commits
3 commits
0e47bf3e91
...
977d959d37
Author | SHA1 | Date | |
---|---|---|---|
|
977d959d37 | ||
831c2919b8 | |||
79bfd0b8d6 |
3 changed files with 61 additions and 1 deletions
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 Kentai Radiquum
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
|
@ -138,7 +138,7 @@ def add_patch_info(patch_statuses: list):
|
||||||
|
|
||||||
item = create_Preference(
|
item = create_Preference(
|
||||||
patch["name"].replace("_", " ").strip().title(),
|
patch["name"].replace("_", " ").strip().title(),
|
||||||
description=" ".join(description),
|
summary = " ".join(description),
|
||||||
)
|
)
|
||||||
if url:
|
if url:
|
||||||
item.append(create_intent(data=url))
|
item.append(create_intent(data=url))
|
||||||
|
|
|
@ -7,6 +7,7 @@ priority = -98
|
||||||
|
|
||||||
# imports
|
# imports
|
||||||
## bundled
|
## bundled
|
||||||
|
import os
|
||||||
from typing import TypedDict
|
from typing import TypedDict
|
||||||
|
|
||||||
## installed
|
## installed
|
||||||
|
@ -47,4 +48,42 @@ def apply(patch_conf: PatchConfig_ChangeAppVersion) -> bool:
|
||||||
) as f:
|
) as f:
|
||||||
apktool_yaml = yaml.dump(apktool_yaml, f, indent=2, Dumper=yaml.Dumper)
|
apktool_yaml = yaml.dump(apktool_yaml, f, indent=2, Dumper=yaml.Dumper)
|
||||||
|
|
||||||
|
for root, dirs, files in os.walk(f"{config['folders']['decompiled']}"):
|
||||||
|
if len(files) < 0:
|
||||||
|
continue
|
||||||
|
|
||||||
|
for filename in files:
|
||||||
|
file_path = os.path.join(root, filename)
|
||||||
|
if os.path.isfile(file_path) and filename.endswith(".smali"):
|
||||||
|
file_contents = None
|
||||||
|
with open(file_path, "r", encoding="utf-8") as file:
|
||||||
|
file_contents = file.read()
|
||||||
|
|
||||||
|
if file_contents.find(str(patch_conf["_internal_app_build"])) >= 0 or file_contents.find(
|
||||||
|
hex(patch_conf["_internal_app_build"])
|
||||||
|
) >= 0:
|
||||||
|
file_contents = file_contents.replace(
|
||||||
|
str(patch_conf["_internal_app_build"]),
|
||||||
|
str(patch_conf["version_code"]) or str(patch_conf["_internal_app_build"]),
|
||||||
|
)
|
||||||
|
file_contents = file_contents.replace(
|
||||||
|
hex(patch_conf["_internal_app_build"]),
|
||||||
|
hex(patch_conf["version_code"]) or hex(patch_conf["_internal_app_build"]),
|
||||||
|
)
|
||||||
|
log.debug(f"replaced build number in file: {file_path}")
|
||||||
|
log.debug(f"previous: {patch_conf["_internal_app_build"]} ({hex(patch_conf['_internal_app_build'])})")
|
||||||
|
log.debug(f"replaced: {patch_conf["version_code"]} ({hex(patch_conf['version_code'])})")
|
||||||
|
|
||||||
|
if file_contents.find(patch_conf["_internal_app_version"]) >= 0:
|
||||||
|
file_contents = file_contents.replace(
|
||||||
|
patch_conf["_internal_app_version"],
|
||||||
|
patch_conf["version_name"] or patch_conf["_internal_app_version"],
|
||||||
|
)
|
||||||
|
log.debug(f"replaced version name in file: {file_path}")
|
||||||
|
log.debug(f"previous: {patch_conf["_internal_app_build"]}")
|
||||||
|
log.debug(f"replaced: {patch_conf["version_code"]}")
|
||||||
|
|
||||||
|
with open(file_path, "w", encoding="utf-8") as file:
|
||||||
|
file.write(file_contents)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue