forked from anixart-mod/patcher
Рефакторинг патчей, реализация Список патчей:
settings_urls: ✔ enabled disable_ad: ✔ enabled disable_beta_banner: ✔ enabled insert_new: ✔ enabled color_theme: ✔ enabled change_server: ✘ disabled package_name: ✔ enabled replace_navbar: ✔ enabled compress: ✔ enabled, обновление описаний
This commit is contained in:
+16
-10
@@ -1,8 +1,15 @@
|
||||
"""
|
||||
Удаляет баннеры рекламы
|
||||
Удаляет баннеры рекламы
|
||||
|
||||
"disable_ad": {
|
||||
"enabled": true
|
||||
}
|
||||
"""
|
||||
|
||||
priority = 0
|
||||
|
||||
# imports
|
||||
import textwrap
|
||||
from utils.smali_parser import (
|
||||
find_smali_method_end,
|
||||
find_smali_method_start,
|
||||
@@ -11,15 +18,14 @@ from utils.smali_parser import (
|
||||
)
|
||||
|
||||
|
||||
replace = """ .locals 0
|
||||
|
||||
const/4 p0, 0x1
|
||||
|
||||
return p0
|
||||
"""
|
||||
|
||||
|
||||
# Patch
|
||||
def apply(config) -> bool:
|
||||
replacement = textwrap.dedent("""\
|
||||
.locals 0
|
||||
const/4 p0, 0x1
|
||||
return p0
|
||||
""").splitlines()
|
||||
|
||||
path = "./decompiled/smali_classes2/com/swiftsoft/anixartd/Prefs.smali"
|
||||
lines = get_smali_lines(path)
|
||||
for index, line in enumerate(lines):
|
||||
@@ -27,7 +33,7 @@ def apply(config) -> bool:
|
||||
method_start = find_smali_method_start(lines, index)
|
||||
method_end = find_smali_method_end(lines, index)
|
||||
new_content = replace_smali_method_body(
|
||||
lines, method_start, method_end, replace
|
||||
lines, method_start, method_end, replacement
|
||||
)
|
||||
|
||||
with open(path, "w", encoding="utf-8") as file:
|
||||
|
||||
Reference in New Issue
Block a user