исправление патча package_name
This commit is contained in:
Vendored
+6
-5
@@ -1,6 +1,7 @@
|
||||
decompiled/*
|
||||
modified/*
|
||||
original/*
|
||||
tools/*
|
||||
decompiled
|
||||
modified
|
||||
original
|
||||
tools
|
||||
|
||||
__pycache__/
|
||||
__pycache__
|
||||
.venv
|
||||
@@ -0,0 +1,33 @@
|
||||
"""Disable ad banners"""
|
||||
|
||||
priority = 0
|
||||
|
||||
from utils.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
|
||||
@@ -0,0 +1,39 @@
|
||||
"""Remove beta banner"""
|
||||
|
||||
priority = 0
|
||||
import os
|
||||
from tqdm import tqdm
|
||||
from lxml import etree
|
||||
|
||||
from typing import TypedDict
|
||||
|
||||
|
||||
def apply(config) -> bool:
|
||||
attributes = [
|
||||
"paddingTop",
|
||||
"paddingBottom",
|
||||
"paddingStart",
|
||||
"paddingEnd",
|
||||
"layout_width",
|
||||
"layout_height",
|
||||
"layout_marginTop",
|
||||
"layout_marginBottom",
|
||||
"layout_marginStart",
|
||||
"layout_marginEnd",
|
||||
]
|
||||
|
||||
beta_banner_xml = "./decompiled/res/layout/item_beta.xml"
|
||||
if os.path.exists(beta_banner_xml):
|
||||
parser = etree.XMLParser(remove_blank_text=True)
|
||||
tree = etree.parse(beta_banner_xml, parser)
|
||||
root = tree.getroot()
|
||||
|
||||
for attr in attributes:
|
||||
# tqdm.write(f"set {attr} = 0.0dip")
|
||||
root.set(f"{{{config["xml_ns"]['android']}}}{attr}", "0.0dip")
|
||||
|
||||
tree.write(
|
||||
beta_banner_xml, pretty_print=True, xml_declaration=True, encoding="utf-8"
|
||||
)
|
||||
|
||||
return True
|
||||
+13
-13
@@ -35,12 +35,14 @@ def apply(config: dict) -> bool:
|
||||
except:
|
||||
pass
|
||||
|
||||
if os.path.exists("./decompiled/smali/com/swiftsoft/anixartd"):
|
||||
rename_dir(
|
||||
"./decompiled/smali/com/swiftsoft/anixartd",
|
||||
os.path.join(
|
||||
"./decompiled", "smali", config["new_package_name"].replace(".", "/")
|
||||
),
|
||||
)
|
||||
if os.path.exists("./decompiled/smali_classes2/com/swiftsoft/anixartd"):
|
||||
rename_dir(
|
||||
"./decompiled/smali_classes2/com/swiftsoft/anixartd",
|
||||
os.path.join(
|
||||
@@ -49,6 +51,16 @@ def apply(config: dict) -> bool:
|
||||
config["new_package_name"].replace(".", "/"),
|
||||
),
|
||||
)
|
||||
if os.path.exists("./decompiled/smali_classes4/com/swiftsoft"):
|
||||
rename_dir(
|
||||
"./decompiled/smali_classes4/com/swiftsoft",
|
||||
os.path.join(
|
||||
"./decompiled",
|
||||
"smali_classes4",
|
||||
"/".join(config["new_package_name"].split(".")[:-1]),
|
||||
),
|
||||
)
|
||||
|
||||
# rename_dir(
|
||||
# "./decompiled/smali_classes3/com/swiftsoft/anixartd",
|
||||
# os.path.join(
|
||||
@@ -57,17 +69,7 @@ def apply(config: dict) -> bool:
|
||||
# config["new_package_name"].replace(".", "/"),
|
||||
# ),
|
||||
# )
|
||||
if not os.path.exists("./decompiled/smali_classes4/"):
|
||||
return True
|
||||
|
||||
rename_dir(
|
||||
"./decompiled/smali_classes4/com/swiftsoft/anixartd",
|
||||
os.path.join(
|
||||
"./decompiled",
|
||||
"smali_classes4",
|
||||
config["new_package_name"].replace(".", "/"),
|
||||
),
|
||||
)
|
||||
for root, dirs, files in os.walk("./decompiled/smali_classes4/"):
|
||||
for filename in files:
|
||||
file_path = os.path.join(root, filename)
|
||||
@@ -77,7 +79,7 @@ def apply(config: dict) -> bool:
|
||||
with open(file_path, "r", encoding="utf-8") as file:
|
||||
file_contents = file.read()
|
||||
|
||||
new_contents = new_contents.replace(
|
||||
new_contents = file_contents.replace(
|
||||
"com/swiftsoft",
|
||||
"/".join(config["new_package_name"].split(".")[:-1]),
|
||||
)
|
||||
@@ -86,8 +88,6 @@ def apply(config: dict) -> bool:
|
||||
except:
|
||||
pass
|
||||
|
||||
os.rmdir("./decompiled/smali_classes2/com/swiftsoft")
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/res/layout/monetization_ads_internal_rewarded_close_verification.xml
|
||||
❯ diff a.txt b.txt
|
||||
4c4
|
||||
< android:background="@drawable/monetization_ads_internal_rewarded_close_verification_button_close_background"
|
||||
---
|
||||
> android:background="@drawable/draw030e"
|
||||
16c16
|
||||
< android:background="@drawable/monetization_ads_internal_rewarded_close_verification_button_dismiss_background"
|
||||
---
|
||||
> android:background="@drawable/draw030f"
|
||||
@@ -0,0 +1,27 @@
|
||||
/res/layout/release_info.xml
|
||||
<TextView android:textColor="@color/light_md_blue_500" android:id="@id/note" android:background="@drawable/bg_release_note" android:paddingTop="12.0dip" android:paddingBottom="12.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textIsSelectable="true" android:paddingStart="16.0dip" android:paddingEnd="16.0dip" style="?textAppearanceBodyMedium" />
|
||||
</FrameLayout>
|
||||
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
|
||||
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/countryLayout" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
|
||||
<androidx.appcompat.widget.AppCompatImageView android:id="@id/iconCountry" android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@drawable/ic_flag_japan" />
|
||||
<TextView android:textColor="?primaryTextColor" android:textColorLink="?primaryTextColor" android:gravity="center_vertical" android:linksClickable="true" android:id="@id/tvCountry" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textIsSelectable="true" android:layout_marginStart="8.0dip" style="?textAppearanceBodyMedium" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/episodesLayout" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginTop="2.0dip">
|
||||
<androidx.appcompat.widget.AppCompatImageView android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@drawable/ic_episodes" />
|
||||
<TextView android:textColor="?primaryTextColor" android:textColorLink="?primaryTextColor" android:gravity="center_vertical" android:linksClickable="true" android:id="@id/tvEpisodes" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textIsSelectable="true" android:layout_marginStart="8.0dip" style="?textAppearanceBodyMedium" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/scheduleLayout" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginTop="2.0dip">
|
||||
<androidx.appcompat.widget.AppCompatImageView android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@drawable/ic_schedule" />
|
||||
<TextView android:textColor="?primaryTextColor" android:textColorLink="?primaryTextColor" android:gravity="center_vertical" android:linksClickable="true" android:id="@id/tvSchedule" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textIsSelectable="true" android:layout_marginStart="8.0dip" style="?textAppearanceBodyMedium" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/sourceLayout" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginTop="2.0dip">
|
||||
<androidx.appcompat.widget.AppCompatImageView android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@drawable/ic_source" />
|
||||
<TextView android:textColor="?primaryTextColor" android:textColorLink="?primaryTextColor" android:gravity="center_vertical" android:linksClickable="true" android:id="@id/tvSource" android:layout_width="fill_parent" android:layout_height="wrap_content" android:lineSpacingExtra="4.0sp" android:textIsSelectable="true" android:layout_marginStart="8.0dip" style="?textAppearanceBodyMedium" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:orientation="horizontal" android:id="@id/studioLayout" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="2.0dip">
|
||||
<androidx.appcompat.widget.AppCompatImageView android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@drawable/ic_studio" />
|
||||
<TextView android:textColor="?primaryTextColor" android:textColorLink="?primaryTextColor" android:gravity="center_vertical" android:linksClickable="true" android:id="@id/tvStudio" android:layout_width="fill_parent" android:layout_height="wrap_content" android:lineSpacingExtra="4.0sp" android:textIsSelectable="true" android:layout_marginStart="8.0dip" style="?textAppearanceBodyMedium" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<TextView android:textColor="?primaryTextColor" android:textColorLink="?primaryTextColor" android:linksClickable="true" android:id="@id/tvGenres" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="16.0dip" android:layout_marginBottom="2.0dip" android:lineSpacingExtra="4.0sp" android:textIsSelectable="true" style="?textAppearanceBodyMedium" />
|
||||
<at.blogc.android.views.ExpandableTextView android:textColor="?primaryTextColor" android:id="@id/description" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="8.0dip" android:layout_marginBottom="8.0dip" android:maxLines="5" android:lineSpacingExtra="4.0sp" android:textIsSelectable="true" app:animation_duration="225" style="?textAppearanceBodyMedium" />
|
||||
@@ -0,0 +1,2 @@
|
||||
/res/menu/bottom.xml
|
||||
replace lines
|
||||
@@ -0,0 +1 @@
|
||||
<color name="ic_launcher_background">#ff000000</color>
|
||||
@@ -0,0 +1,58 @@
|
||||
def get_smali_lines(file: str) -> list[str]:
|
||||
lines = []
|
||||
with open(file, "r", encoding="utf-8") as smali:
|
||||
lines = smali.readlines()
|
||||
return lines
|
||||
|
||||
def find_smali_method_start(lines: list[str], index: int) -> int:
|
||||
while True:
|
||||
index -= 1
|
||||
if lines[index].find(".method") >= 0:
|
||||
return index
|
||||
|
||||
def find_smali_method_end(lines: list[str], index: int) -> int:
|
||||
while True:
|
||||
index += 1
|
||||
if lines[index].find(".end method") >= 0:
|
||||
return index
|
||||
|
||||
def debug_print_smali_method(lines: list[str], start: int, end: int) -> None:
|
||||
while start != (end + 1):
|
||||
print(start, lines[start])
|
||||
start += 1
|
||||
|
||||
def replace_smali_method_body(lines: list[str], start: int, end: int, new_lines: list[str]) -> list[str]:
|
||||
new_content = []
|
||||
index = 0
|
||||
skip = end - start - 1
|
||||
|
||||
while index != (start + 1):
|
||||
new_content.append(lines[index])
|
||||
index += 1
|
||||
|
||||
for line in new_lines:
|
||||
new_content.append(line)
|
||||
|
||||
index += skip
|
||||
while index < len(lines):
|
||||
new_content.append(lines[index])
|
||||
index += 1
|
||||
|
||||
|
||||
return new_content
|
||||
|
||||
# example i guess
|
||||
# if __name__ == "__main__":
|
||||
# lines = get_smali_lines("./decompiled/smali_classes2/com/radiquum/anixart/Prefs.smali")
|
||||
|
||||
# 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, c)
|
||||
|
||||
# with open("./help/Prefs_orig.smali", "w", encoding="utf-8") as file:
|
||||
# file.writelines(lines)
|
||||
# with open("./help/Prefs_modified.smali", "w", encoding="utf-8") as file:
|
||||
# file.writelines(new_content)
|
||||
|
||||
Reference in New Issue
Block a user