Добавление патча для удаления рекламы и минимального парсера для .smali файлов

This commit is contained in:
2025-09-01 00:20:48 +05:00
parent 4ad4a707aa
commit 566b6c5474
2 changed files with 91 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
"""Disable ad banners"""
priority = 0
from smali_parser import (
find_smali_method_end,
find_smali_method_start,
get_smali_lines,
replace_smali_method_body,
)
replace = """ .locals 0
const/4 p0, 0x1
return p0
"""
def apply(config) -> bool:
path = "./decompiled/smali_classes2/com/swiftsoft/anixartd/Prefs.smali"
lines = get_smali_lines(path)
for index, line in enumerate(lines):
if line.find("IS_SPONSOR") >= 0:
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
)
with open(path, "w", encoding="utf-8") as file:
file.writelines(new_content)
return True