Compare commits

...

7 Commits

4 changed files with 20 additions and 12 deletions

View File

@ -2,7 +2,7 @@
#### Toolchain setup #### Toolchain setup
- Get apktool (due to 2 bugs present in v2.3.4, you're strongly recommended to use v2.4.0 or higher, I compile latest from source). - Get apktool (use [this self-built version](//f001.backblazeb2.com/file/avepub/apktool-cli-all.jar) which is master + [this pr](https://github.com/iBotPeaches/Apktool/pull/2463)).
- Get a keystore, see [here](https://stackoverflow.com/a/14994354/3286892), step 1. - Get a keystore, see [here](https://stackoverflow.com/a/14994354/3286892), step 1.
- Get apksigner, it's part of android build tools. - Get apksigner, it's part of android build tools.
- If you want Mutant Standard emoji patches, get 72x72 PNG copies of latest version of mutant standard emojis with codepoints. I have a zip [here](https://mutant.lavatech.top/72x72.zip). - If you want Mutant Standard emoji patches, get 72x72 PNG copies of latest version of mutant standard emojis with codepoints. I have a zip [here](https://mutant.lavatech.top/72x72.zip).

View File

@ -69,7 +69,7 @@ if DO_GITPULL:
# Extract the APK if it's not already extracted to base cache # Extract the APK if it's not already extracted to base cache
if not os.path.exists(BASE_APK_PATH): if not os.path.exists(BASE_APK_PATH):
subprocess.run(f"{APKTOOL_BIN} d {INPUT_FILE} -o {BASE_APK_PATH} -f", subprocess.run(f"{APKTOOL_BIN} d --no-dummy {INPUT_FILE} -o {BASE_APK_PATH} -f",
shell=True, shell=True,
cwd=WORK_FOLDER) cwd=WORK_FOLDER)

View File

@ -469,13 +469,13 @@ diff -crB from/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$setO
+ invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings; + invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings;
+ +
+ move-result-object v0 + move-result-object v2
+ +
+ invoke-virtual {v0}, Lcom/discord/stores/StoreUserSettings;->getShowTyping()Z + invoke-virtual {v2}, Lcom/discord/stores/StoreUserSettings;->getShowTyping()Z
+ +
+ move-result v0 + move-result v2
+ +
+ if-eqz v0, :cond_1 + if-eqz v2, :cond_1
+ +
.line 5 .line 5
iget-boolean v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputEditText$setOnTextChangedListener$1;->empty:Z iget-boolean v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputEditText$setOnTextChangedListener$1;->empty:Z

View File

@ -54,23 +54,25 @@ def fix_offset(patch_contents):
for line in patch_lines: for line in patch_lines:
if "diff -crB" in line: if "diff -crB" in line:
patch_target = line.split(" ")[2].replace("from/", "") patch_target = line.split(" ")[2].replace("from/", "")
if not os.path.exists(os.path.join(apk_folder, patch_target)):
return False
os.makedirs(os.path.dirname(os.path.join(tmp_folder, patch_target)), exist_ok=True) os.makedirs(os.path.dirname(os.path.join(tmp_folder, patch_target)), exist_ok=True)
shutil.copy(os.path.join(apk_folder, patch_target), os.path.join(tmp_folder, patch_target)) shutil.copy(os.path.join(apk_folder, patch_target), os.path.join(tmp_folder, patch_target))
#shutil.copytree(apk_folder, tmp_folder) # shutil.copytree(apk_folder, tmp_folder)
subprocess.run("patch -p1 --no-backup-if-mismatch --force", subprocess.run("patch -p1 --no-backup-if-mismatch --force",
shell=True, input=patch_contents, text=True, shell=True, input=patch_contents, text=True,
cwd=tmp_folder, capture_output=True) cwd=tmp_folder, capture_output=True)
out = subprocess.run(f"diff -crB {apk_folder} {tmp_folder}", out = subprocess.run(f"diff -crB {apk_folder} {tmp_folder}",
shell=True, input=patch_contents, text=True, shell=True, input=patch_contents, text=True,
cwd=tmp_folder, capture_output=True) cwd=tmp_folder, capture_output=True)
shutil.rmtree(tmp_folder, ignore_errors=True) shutil.rmtree(tmp_folder, ignore_errors=True)
actual_difflines = [] actual_difflines = []
for line in out.stdout.splitlines(): for line in out.stdout.splitlines():
if line[0:4] != "Only": if line[0:4] != "Only":
actual_difflines.append(line) actual_difflines.append(line)
patch_out = ("\n".join(actual_difflines)+"\n").replace(apk_folder, "from").replace(tmp_folder, "to") patch_out = ("\n".join(actual_difflines)+"\n").replace(apk_folder, "from").replace(tmp_folder, "to")
return patch_out return patch_out
@ -199,13 +201,19 @@ for patch in os.listdir(os.path.join(cutthecord_folder, "patches")):
capture_output=True) capture_output=True)
# Check for issues # Check for issues
if "FAILED" in out.stdout: if "FAILED" in out.stdout or "can't find file to patch" in out.stdout:
print(f"FAILED: {patch} failed, please fix by hand.") print(f"FAILED: {patch} failed, please fix by hand.")
failures.append(patch) failures.append(patch)
out_path += "-failed" out_path += "-failed"
elif "offset" in out.stdout: elif "offset" in out.stdout:
patch_contents = fix_offset(patch_contents) temp_patch_contents = fix_offset(patch_contents)
print(f"WARNING: {patch} has offsets which were auto corrected.") if temp_patch_contents:
patch_contents = temp_patch_contents
print(f"WARNING: {patch} has offsets which were auto corrected.")
else:
print(f"FAILED: {patch} is missing files, please fix by hand.")
failures.append(patch)
out_path += "-failed"
if debug: if debug:
print(out.stdout) print(out.stdout)