Compare commits
12 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42409ece7d | ||
|
|
77098b2c05 | ||
|
|
4a36d1ab56 | ||
|
|
49ee19ac7d | ||
|
|
292728a8ba | ||
|
|
6cbef5a48a | ||
|
|
cf22240c10 | ||
|
|
f4b2545742 | ||
|
|
bfa94c9463 | ||
|
|
8f54a7c5a0 | ||
|
|
b1ae92cddd | ||
|
|
a9aeb325de |
86 changed files with 196 additions and 271 deletions
30
CHANGELOG.md
30
CHANGELOG.md
|
|
@ -1,3 +1,33 @@
|
||||||
|
## [6.1.1-dev.4](https://github.com/ReVanced/revanced-patches/compare/v6.1.1-dev.3...v6.1.1-dev.4) (2026-03-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Instagram - Disable signature check:** Set correct return type ([#6918](https://github.com/ReVanced/revanced-patches/issues/6918)) ([4a36d1a](https://github.com/ReVanced/revanced-patches/commit/4a36d1ab569201316ee3b83be9f5ab9539c3336d))
|
||||||
|
* **YouTube - Announcements:** Parse announcement correctly by using `Instant` instead of `LocalDateTime` for `archived_at` ([#6889](https://github.com/ReVanced/revanced-patches/issues/6889)) ([77098b2](https://github.com/ReVanced/revanced-patches/commit/77098b2c057e53f375bca8dffd369e801fdaed52))
|
||||||
|
|
||||||
|
## [6.1.1-dev.3](https://github.com/ReVanced/revanced-patches/compare/v6.1.1-dev.2...v6.1.1-dev.3) (2026-03-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **GmsCore support:** Correct option name ([6cbef5a](https://github.com/ReVanced/revanced-patches/commit/6cbef5a48a83e4a74de578e7d20f7d71a8b1de8e))
|
||||||
|
* **GmsCore support:** Correct package name for custom vendor group id ([292728a](https://github.com/ReVanced/revanced-patches/commit/292728a8baddbca87993590db4a8bab60b564432))
|
||||||
|
|
||||||
|
## [6.1.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v6.1.1-dev.1...v6.1.1-dev.2) (2026-03-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Twitter:** Correct extension path to fix crashes ([f4b2545](https://github.com/ReVanced/revanced-patches/commit/f4b2545742e0501ab252c70654993a4e4414319e))
|
||||||
|
|
||||||
|
## [6.1.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v6.1.0...v6.1.1-dev.1) (2026-03-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **YouTube - Spoof video streams:** Set `ANDROID_REEL` client as default ([#6878](https://github.com/ReVanced/revanced-patches/issues/6878)) ([a9aeb32](https://github.com/ReVanced/revanced-patches/commit/a9aeb325de1160262c4db9b4b60c6c5e39730620))
|
||||||
|
|
||||||
# [6.1.0](https://github.com/ReVanced/revanced-patches/compare/v6.0.1...v6.1.0) (2026-03-18)
|
# [6.1.0](https://github.com/ReVanced/revanced-patches/compare/v6.0.1...v6.1.0) (2026-03-18)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ Some of the features the patches provide are:
|
||||||
export activities, etc.
|
export activities, etc.
|
||||||
* ✨ **And much more!**
|
* ✨ **And much more!**
|
||||||
|
|
||||||
For a complete list of all available patches, visit [revanced.app/patches](https://revanced.app/patches).
|
For a complete list of all available patches, see [this](https://github.com/ReVanced/revanced-documentation/blob/main/docs/revanced-resources/questions.md#5-which-patches-are-available).
|
||||||
|
|
||||||
## 🚀 How to get started
|
## 🚀 How to get started
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ public class GmsCoreSupport {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
UNKNOWN(getGmsCoreVendorGroupId(), getGmsCoreVendorGroupId() + "android.gms", () -> null);
|
UNKNOWN(getGmsCoreVendorGroupId(), getGmsCoreVendorGroupId() + ".android.gms", () -> null);
|
||||||
|
|
||||||
private static final String DONT_KILL_MY_APP_URL
|
private static final String DONT_KILL_MY_APP_URL
|
||||||
= "https://dontkillmyapp.com/";
|
= "https://dontkillmyapp.com/";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package app.revanced.twitter.patches.links;
|
package app.revanced.extension.twitter.patches.links;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public final class ChangeLinkSharingDomainPatch {
|
public final class ChangeLinkSharingDomainPatch {
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package app.revanced.twitter.patches.links;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
|
|
||||||
import app.revanced.extension.shared.Logger;
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public final class OpenLinksWithAppChooserPatch {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Injection point.
|
|
||||||
*/
|
|
||||||
public static void openWithChooser(final Context context, final Intent intent) {
|
|
||||||
Logger.printInfo(() -> "Opening intent with chooser: " + intent);
|
|
||||||
|
|
||||||
intent.setAction("android.intent.action.VIEW");
|
|
||||||
|
|
||||||
context.startActivity(Intent.createChooser(intent, null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -20,7 +20,7 @@ import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.time.LocalDateTime;
|
import java.time.Instant;
|
||||||
|
|
||||||
import app.revanced.extension.shared.Logger;
|
import app.revanced.extension.shared.Logger;
|
||||||
import app.revanced.extension.shared.Utils;
|
import app.revanced.extension.shared.Utils;
|
||||||
|
|
@ -116,7 +116,7 @@ public final class AnnouncementsPatch {
|
||||||
int id = Settings.ANNOUNCEMENT_LAST_ID.defaultValue;
|
int id = Settings.ANNOUNCEMENT_LAST_ID.defaultValue;
|
||||||
String title;
|
String title;
|
||||||
String message;
|
String message;
|
||||||
LocalDateTime archivedAt = LocalDateTime.MAX;
|
Instant archivedAt = Instant.MAX;
|
||||||
Level level = Level.INFO;
|
Level level = Level.INFO;
|
||||||
try {
|
try {
|
||||||
final var announcements = new JSONArray(jsonString);
|
final var announcements = new JSONArray(jsonString);
|
||||||
|
|
@ -140,20 +140,20 @@ public final class AnnouncementsPatch {
|
||||||
title = announcement.getString("title");
|
title = announcement.getString("title");
|
||||||
message = announcement.getString("content");
|
message = announcement.getString("content");
|
||||||
if (!announcement.isNull("archived_at")) {
|
if (!announcement.isNull("archived_at")) {
|
||||||
archivedAt = LocalDateTime.parse(announcement.getString("archived_at"));
|
archivedAt = Instant.parse(announcement.getString("archived_at"));
|
||||||
}
|
}
|
||||||
if (!announcement.isNull("level")) {
|
if (!announcement.isNull("level")) {
|
||||||
level = Level.fromInt(announcement.getInt("level"));
|
level = Level.fromInt(announcement.getInt("level"));
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Logger.printException(() -> "Failed to parse announcement. Fall-backing to raw string", ex);
|
Logger.printException(() -> "Failed to parse announcement. Falling back to raw string", ex);
|
||||||
|
|
||||||
title = "Announcement";
|
title = "Announcement";
|
||||||
message = jsonString;
|
message = jsonString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the announcement is archived, do not show it.
|
// If the announcement is archived, do not show it.
|
||||||
if (archivedAt.isBefore(LocalDateTime.now())) {
|
if (archivedAt.isBefore(Instant.now())) {
|
||||||
Settings.ANNOUNCEMENT_LAST_ID.save(id);
|
Settings.ANNOUNCEMENT_LAST_ID.save(id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -391,7 +391,7 @@ public class Settings extends YouTubeAndMusicSettings {
|
||||||
public static final BooleanSetting EXTERNAL_BROWSER = new BooleanSetting("revanced_external_browser", TRUE, true);
|
public static final BooleanSetting EXTERNAL_BROWSER = new BooleanSetting("revanced_external_browser", TRUE, true);
|
||||||
public static final BooleanSetting SPOOF_DEVICE_DIMENSIONS = new BooleanSetting("revanced_spoof_device_dimensions", FALSE, true,
|
public static final BooleanSetting SPOOF_DEVICE_DIMENSIONS = new BooleanSetting("revanced_spoof_device_dimensions", FALSE, true,
|
||||||
"revanced_spoof_device_dimensions_user_dialog_message");
|
"revanced_spoof_device_dimensions_user_dialog_message");
|
||||||
public static final EnumSetting<ClientType> SPOOF_VIDEO_STREAMS_CLIENT_TYPE = new EnumSetting<>("revanced_spoof_video_streams_client_type", ClientType.ANDROID_VR_1_43_32, true, parent(SPOOF_VIDEO_STREAMS));
|
public static final EnumSetting<ClientType> SPOOF_VIDEO_STREAMS_CLIENT_TYPE = new EnumSetting<>("revanced_spoof_video_streams_client_type", ClientType.ANDROID_REEL, true, parent(SPOOF_VIDEO_STREAMS));
|
||||||
public static final BooleanSetting SPOOF_VIDEO_STREAMS_AV1 = new BooleanSetting("revanced_spoof_video_streams_av1", FALSE, true,
|
public static final BooleanSetting SPOOF_VIDEO_STREAMS_AV1 = new BooleanSetting("revanced_spoof_video_streams_av1", FALSE, true,
|
||||||
"revanced_spoof_video_streams_av1_user_dialog_message", new SpoofClientAv1Availability());
|
"revanced_spoof_video_streams_av1_user_dialog_message", new SpoofClientAv1Availability());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,4 @@ org.gradle.parallel = true
|
||||||
android.useAndroidX = true
|
android.useAndroidX = true
|
||||||
android.uniquePackageNames = false
|
android.uniquePackageNames = false
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 6.1.0
|
version = 6.1.1-dev.4
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
package app.revanced.patches.all.misc.adb
|
package app.revanced.patches.all.misc.adb
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
|
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
|
||||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||||
|
|
||||||
|
|
@ -44,7 +43,7 @@ val hideADBStatusPatch = bytecodePatch(
|
||||||
filterMap = filterMap@{ classDef, method, instruction, instructionIndex ->
|
filterMap = filterMap@{ classDef, method, instruction, instructionIndex ->
|
||||||
val reference = instruction
|
val reference = instruction
|
||||||
.takeIf { it.opcode == Opcode.INVOKE_STATIC }
|
.takeIf { it.opcode == Opcode.INVOKE_STATIC }
|
||||||
?.getReference<MethodReference>()
|
?.methodReference
|
||||||
?.takeIf { reference ->
|
?.takeIf { reference ->
|
||||||
getIntMethodReferences.any { MethodUtil.methodSignaturesMatch(it, reference) }
|
getIntMethodReferences.any { MethodUtil.methodSignaturesMatch(it, reference) }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
package app.revanced.patches.all.misc.build
|
package app.revanced.patches.all.misc.build
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
|
|
||||||
private const val BUILD_CLASS_DESCRIPTOR = "Landroid/os/Build;"
|
private const val BUILD_CLASS_DESCRIPTOR = "Landroid/os/Build;"
|
||||||
|
|
||||||
|
|
@ -75,7 +74,7 @@ fun baseSpoofBuildInfoPatch(buildInfoSupplier: () -> BuildInfo) = bytecodePatch
|
||||||
dependsOn(
|
dependsOn(
|
||||||
transformInstructionsPatch(
|
transformInstructionsPatch(
|
||||||
filterMap = filterMap@{ _, _, instruction, instructionIndex ->
|
filterMap = filterMap@{ _, _, instruction, instructionIndex ->
|
||||||
val reference = instruction.getReference<FieldReference>() ?: return@filterMap null
|
val reference = instruction.fieldReference ?: return@filterMap null
|
||||||
if (reference.definingClass != BUILD_CLASS_DESCRIPTOR) return@filterMap null
|
if (reference.definingClass != BUILD_CLASS_DESCRIPTOR) return@filterMap null
|
||||||
|
|
||||||
return@filterMap replacements[reference.name]?.let { instructionIndex to it }
|
return@filterMap replacements[reference.name]?.let { instructionIndex to it }
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
package app.revanced.patches.all.misc.connectivity.location.hide
|
package app.revanced.patches.all.misc.connectivity.location.hide
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.transformation.IMethodCall
|
import app.revanced.patches.all.misc.transformation.IMethodCall
|
||||||
import app.revanced.patches.all.misc.transformation.fromMethodReference
|
import app.revanced.patches.all.misc.transformation.fromMethodReference
|
||||||
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val hideMockLocationPatch = bytecodePatch(
|
val hideMockLocationPatch = bytecodePatch(
|
||||||
|
|
@ -18,7 +17,7 @@ val hideMockLocationPatch = bytecodePatch(
|
||||||
dependsOn(
|
dependsOn(
|
||||||
transformInstructionsPatch(
|
transformInstructionsPatch(
|
||||||
filterMap = filter@{ _, _, instruction, instructionIndex ->
|
filterMap = filter@{ _, _, instruction, instructionIndex ->
|
||||||
val reference = instruction.getReference<MethodReference>() ?: return@filter null
|
val reference = instruction.methodReference ?: return@filter null
|
||||||
if (fromMethodReference<MethodCall>(reference) == null) return@filter null
|
if (fromMethodReference<MethodCall>(reference) == null) return@filter null
|
||||||
|
|
||||||
instruction to instructionIndex
|
instruction to instructionIndex
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
package app.revanced.patches.all.misc.play
|
package app.revanced.patches.all.misc.play
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
|
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
|
||||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||||
|
|
||||||
|
|
@ -30,7 +29,7 @@ val disablePlayIntegrityPatch = bytecodePatch(
|
||||||
transformInstructionsPatch(
|
transformInstructionsPatch(
|
||||||
filterMap = filterMap@{ classDef, method, instruction, instructionIndex ->
|
filterMap = filterMap@{ classDef, method, instruction, instructionIndex ->
|
||||||
val reference = instruction
|
val reference = instruction
|
||||||
.getReference<MethodReference>()
|
.methodReference
|
||||||
?.takeIf {
|
?.takeIf {
|
||||||
MethodUtil.methodSignaturesMatch(CONTEXT_BIND_SERVICE_METHOD_REFERENCE, it)
|
MethodUtil.methodSignaturesMatch(CONTEXT_BIND_SERVICE_METHOD_REFERENCE, it)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,12 @@ package app.revanced.patches.all.misc.play
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.removeInstructions
|
import app.revanced.patcher.extensions.removeInstructions
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patcher.patch.intOption
|
import app.revanced.patcher.patch.intOption
|
||||||
import app.revanced.patcher.patch.option
|
|
||||||
import app.revanced.util.forEachInstructionAsSequence
|
import app.revanced.util.forEachInstructionAsSequence
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
|
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
|
||||||
|
|
||||||
|
|
@ -46,7 +44,7 @@ val spoofPlayAgeSignalsPatch = bytecodePatch(
|
||||||
if (classDef.type.startsWith("Lcom/google/android/play/agesignals/")) return@forEachInstructionAsSequence null
|
if (classDef.type.startsWith("Lcom/google/android/play/agesignals/")) return@forEachInstructionAsSequence null
|
||||||
|
|
||||||
// Keep method calls only.
|
// Keep method calls only.
|
||||||
val reference = instruction.getReference<MethodReference>()
|
val reference = instruction.methodReference
|
||||||
?: return@forEachInstructionAsSequence null
|
?: return@forEachInstructionAsSequence null
|
||||||
|
|
||||||
val match = MethodCall.entries.firstOrNull {
|
val match = MethodCall.entries.firstOrNull {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
package app.revanced.patches.all.misc.screenshot
|
package app.revanced.patches.all.misc.screenshot
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
import app.revanced.patcher.extensions.removeInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
|
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
|
||||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||||
|
|
||||||
|
|
@ -39,7 +38,7 @@ val preventScreenshotDetectionPatch = bytecodePatch(
|
||||||
filterMap = { _, _, instruction, instructionIndex ->
|
filterMap = { _, _, instruction, instructionIndex ->
|
||||||
if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return@transformInstructionsPatch null
|
if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return@transformInstructionsPatch null
|
||||||
|
|
||||||
val reference = instruction.getReference<MethodReference>() ?: return@transformInstructionsPatch null
|
val reference = instruction.methodReference ?: return@transformInstructionsPatch null
|
||||||
|
|
||||||
instructionIndex.takeIf {
|
instructionIndex.takeIf {
|
||||||
MethodUtil.methodSignaturesMatch(reference, registerScreenCaptureCallbackMethodReference) ||
|
MethodUtil.methodSignaturesMatch(reference, registerScreenCaptureCallbackMethodReference) ||
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
package app.revanced.patches.cricbuzz.ads
|
package app.revanced.patches.cricbuzz.ads
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.cricbuzz.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.cricbuzz.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.returnEarly
|
import app.revanced.util.returnEarly
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/cricbuzz/ads/HideAdsPatch;"
|
"Lapp/revanced/extension/cricbuzz/ads/HideAdsPatch;"
|
||||||
|
|
@ -27,7 +26,7 @@ val hideAdsPatch = bytecodePatch("Hide ads") {
|
||||||
cb11ConstructorMethod.addInstruction(0, "const/4 p7, 0x0")
|
cb11ConstructorMethod.addInstruction(0, "const/4 p7, 0x0")
|
||||||
getBottomBarMethod.apply {
|
getBottomBarMethod.apply {
|
||||||
val getIndex = indexOfFirstInstructionOrThrow {
|
val getIndex = indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.IGET_OBJECT && getReference<FieldReference>()?.name == "bottomBar"
|
opcode == Opcode.IGET_OBJECT && fieldReference?.name == "bottomBar"
|
||||||
}
|
}
|
||||||
val getRegister = getInstruction<TwoRegisterInstruction>(getIndex).registerA
|
val getRegister = getInstruction<TwoRegisterInstruction>(getIndex).registerA
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
package app.revanced.patches.crunchyroll.ads
|
package app.revanced.patches.crunchyroll.ads
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstruction
|
import app.revanced.util.indexOfFirstInstruction
|
||||||
import app.revanced.util.removeFlags
|
import app.revanced.util.removeFlags
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val hideAdsPatch = bytecodePatch("Hide ads") {
|
val hideAdsPatch = bytecodePatch("Hide ads") {
|
||||||
|
|
@ -22,7 +21,7 @@ val hideAdsPatch = bytecodePatch("Hide ads") {
|
||||||
val stringIndex = videoUrlReadyToStringMethodMatch[-1]
|
val stringIndex = videoUrlReadyToStringMethodMatch[-1]
|
||||||
val fieldIndex = it.indexOfFirstInstruction(stringIndex, Opcode.IGET_BOOLEAN)
|
val fieldIndex = it.indexOfFirstInstruction(stringIndex, Opcode.IGET_BOOLEAN)
|
||||||
|
|
||||||
it.getInstruction<ReferenceInstruction>(fieldIndex).getReference<FieldReference>()!!
|
it.getInstruction<ReferenceInstruction>(fieldIndex).fieldReference!!
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove final access flag on field.
|
// Remove final access flag on field.
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,20 @@ package app.revanced.patches.googlenews.misc.extension.hooks
|
||||||
|
|
||||||
import app.revanced.patcher.definingClass
|
import app.revanced.patcher.definingClass
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
import app.revanced.patcher.instructions
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.invoke
|
|
||||||
import app.revanced.patcher.name
|
import app.revanced.patcher.name
|
||||||
import app.revanced.patcher.opcodes
|
import app.revanced.patcher.opcodes
|
||||||
import app.revanced.patches.shared.misc.extension.extensionHook
|
import app.revanced.patches.shared.misc.extension.extensionHook
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private var getApplicationContextIndex = -1
|
private var getApplicationContextIndex = -1
|
||||||
|
|
||||||
internal val startActivityInitHook = extensionHook(
|
internal val startActivityInitHook = extensionHook(
|
||||||
getInsertIndex = {
|
getInsertIndex = {
|
||||||
getApplicationContextIndex = indexOfFirstInstructionOrThrow {
|
getApplicationContextIndex = indexOfFirstInstructionOrThrow {
|
||||||
getReference<MethodReference>()?.name == "getApplicationContext"
|
methodReference?.name == "getApplicationContext"
|
||||||
}
|
}
|
||||||
|
|
||||||
getApplicationContextIndex + 2 // Below the move-result-object instruction.
|
getApplicationContextIndex + 2 // Below the move-result-object instruction.
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,20 @@ package app.revanced.patches.googlephotos.misc.extension
|
||||||
|
|
||||||
import app.revanced.patcher.definingClass
|
import app.revanced.patcher.definingClass
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
import app.revanced.patcher.instructions
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.invoke
|
|
||||||
import app.revanced.patcher.name
|
import app.revanced.patcher.name
|
||||||
import app.revanced.patcher.opcodes
|
import app.revanced.patcher.opcodes
|
||||||
import app.revanced.patches.shared.misc.extension.extensionHook
|
import app.revanced.patches.shared.misc.extension.extensionHook
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private var getApplicationContextIndex = -1
|
private var getApplicationContextIndex = -1
|
||||||
|
|
||||||
internal val homeActivityInitHook = extensionHook(
|
internal val homeActivityInitHook = extensionHook(
|
||||||
getInsertIndex = {
|
getInsertIndex = {
|
||||||
getApplicationContextIndex = indexOfFirstInstructionOrThrow {
|
getApplicationContextIndex = indexOfFirstInstructionOrThrow {
|
||||||
getReference<MethodReference>()?.name == "getApplicationContext"
|
methodReference?.name == "getApplicationContext"
|
||||||
}
|
}
|
||||||
|
|
||||||
getApplicationContextIndex + 2 // Below the move-result-object instruction.
|
getApplicationContextIndex + 2 // Below the move-result-object instruction.
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,11 @@ package app.revanced.patches.googlephotos.misc.features
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.extensions.stringReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patcher.patch.stringsOption
|
import app.revanced.patcher.patch.stringsOption
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val spoofFeaturesPatch = bytecodePatch(
|
val spoofFeaturesPatch = bytecodePatch(
|
||||||
|
|
@ -62,7 +61,7 @@ val spoofFeaturesPatch = bytecodePatch(
|
||||||
|
|
||||||
initializeFeaturesEnumMethod.apply {
|
initializeFeaturesEnumMethod.apply {
|
||||||
instructions.filter { it.opcode == Opcode.CONST_STRING }.forEach {
|
instructions.filter { it.opcode == Opcode.CONST_STRING }.forEach {
|
||||||
val feature = it.getReference<StringReference>()!!.string
|
val feature = it.stringReference!!.string
|
||||||
|
|
||||||
val spoofedFeature = when (feature) {
|
val spoofedFeature = when (feature) {
|
||||||
in featuresToEnable -> "android.hardware.wifi"
|
in featuresToEnable -> "android.hardware.wifi"
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,6 @@ import app.revanced.patches.googlephotos.misc.extension.extensionPatch
|
||||||
import app.revanced.patches.googlephotos.misc.gms.Constants.PHOTOS_PACKAGE_NAME
|
import app.revanced.patches.googlephotos.misc.gms.Constants.PHOTOS_PACKAGE_NAME
|
||||||
import app.revanced.patches.googlephotos.misc.gms.Constants.REVANCED_PHOTOS_PACKAGE_NAME
|
import app.revanced.patches.googlephotos.misc.gms.Constants.REVANCED_PHOTOS_PACKAGE_NAME
|
||||||
import app.revanced.patches.shared.misc.gms.gmsCoreSupportPatch
|
import app.revanced.patches.shared.misc.gms.gmsCoreSupportPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,8 @@ import app.revanced.patcher.immutableClassDef
|
||||||
import app.revanced.patcher.name
|
import app.revanced.patcher.name
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
|
|
||||||
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/instagram/feed/LimitFeedToFollowedProfiles;"
|
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/instagram/feed/LimitFeedToFollowedProfiles;"
|
||||||
|
|
||||||
|
|
@ -40,7 +38,7 @@ val limitFeedToFollowedProfilesPatch = bytecodePatch(
|
||||||
reference?.type == "Ljava/util/Map;" &&
|
reference?.type == "Ljava/util/Map;" &&
|
||||||
reference.definingClass == mainFeedRequestClassMethod.classDef.type
|
reference.definingClass == mainFeedRequestClassMethod.classDef.type
|
||||||
}.let { instructionIndex ->
|
}.let { instructionIndex ->
|
||||||
getInstruction(instructionIndex).getReference<FieldReference>()!!.name
|
getInstruction(instructionIndex).fieldReference!!.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,7 +47,7 @@ val limitFeedToFollowedProfilesPatch = bytecodePatch(
|
||||||
}.apply {
|
}.apply {
|
||||||
// Finds the instruction where the map is being initialized in the constructor
|
// Finds the instruction where the map is being initialized in the constructor
|
||||||
val getHeaderIndex = indexOfFirstInstructionOrThrow {
|
val getHeaderIndex = indexOfFirstInstructionOrThrow {
|
||||||
getReference<FieldReference>().let {
|
fieldReference.let {
|
||||||
it?.name == mainFeedRequestHeaderFieldName
|
it?.name == mainFeedRequestHeaderFieldName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package app.revanced.patches.instagram.hide.navigation
|
package app.revanced.patches.instagram.hide.navigation
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.firstMethodDeclaratively
|
import app.revanced.patcher.firstMethodDeclaratively
|
||||||
import app.revanced.patcher.immutableClassDef
|
import app.revanced.patcher.immutableClassDef
|
||||||
|
|
@ -9,12 +10,10 @@ import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.addInstructionsAtControlFlowLabel
|
import app.revanced.util.addInstructionsAtControlFlowLabel
|
||||||
import app.revanced.util.findFreeRegister
|
import app.revanced.util.findFreeRegister
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
|
|
@ -82,7 +81,7 @@ val hideNavigationButtonsPatch = bytecodePatch(
|
||||||
opcode == Opcode.IPUT_OBJECT &&
|
opcode == Opcode.IPUT_OBJECT &&
|
||||||
(this as TwoRegisterInstruction).registerA == 2 // p2 register.
|
(this as TwoRegisterInstruction).registerA == 2 // p2 register.
|
||||||
}.let {
|
}.let {
|
||||||
method.getInstruction(it).getReference<FieldReference>()!!.name
|
method.getInstruction(it).fieldReference!!.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,6 @@ val disableSignatureCheckPatch = bytecodePatch(
|
||||||
compatibleWith("com.instagram.android")
|
compatibleWith("com.instagram.android")
|
||||||
|
|
||||||
apply {
|
apply {
|
||||||
isValidSignatureMethodMethod.immutableClassDef.getIsValidSignatureClassMethod().returnEarly(true)
|
isValidSignatureMethodMethod.immutableClassDef.getIsValidSignatureClassMethod().returnEarly()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package app.revanced.patches.music.layout.branding
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.typeReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.patches.music.misc.gms.Constants.MUSIC_MAIN_ACTIVITY_NAME
|
import app.revanced.patches.music.misc.gms.Constants.MUSIC_MAIN_ACTIVITY_NAME
|
||||||
|
|
@ -12,12 +13,10 @@ import app.revanced.patches.shared.layout.branding.EXTENSION_CLASS_DESCRIPTOR
|
||||||
import app.revanced.patches.shared.layout.branding.baseCustomBrandingPatch
|
import app.revanced.patches.shared.layout.branding.baseCustomBrandingPatch
|
||||||
import app.revanced.patches.shared.misc.mapping.ResourceType
|
import app.revanced.patches.shared.misc.mapping.ResourceType
|
||||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
|
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.TypeReference
|
|
||||||
|
|
||||||
private val disableSplashAnimationPatch = bytecodePatch {
|
private val disableSplashAnimationPatch = bytecodePatch {
|
||||||
|
|
||||||
|
|
@ -37,7 +36,7 @@ private val disableSplashAnimationPatch = bytecodePatch {
|
||||||
)
|
)
|
||||||
val checkCastIndex = indexOfFirstInstructionOrThrow(literalIndex) {
|
val checkCastIndex = indexOfFirstInstructionOrThrow(literalIndex) {
|
||||||
opcode == Opcode.CHECK_CAST &&
|
opcode == Opcode.CHECK_CAST &&
|
||||||
getReference<TypeReference>()?.type == "Lcom/airbnb/lottie/LottieAnimationView;"
|
typeReference?.type == "Lcom/airbnb/lottie/LottieAnimationView;"
|
||||||
}
|
}
|
||||||
val register = getInstruction<OneRegisterInstruction>(checkCastIndex).registerA
|
val register = getInstruction<OneRegisterInstruction>(checkCastIndex).registerA
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ package app.revanced.patches.music.layout.miniplayercolor
|
||||||
|
|
||||||
import app.revanced.patcher.accessFlags
|
import app.revanced.patcher.accessFlags
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.firstMethodDeclaratively
|
import app.revanced.patcher.firstMethodDeclaratively
|
||||||
import app.revanced.patcher.parameterTypes
|
import app.revanced.patcher.parameterTypes
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
|
@ -20,7 +21,6 @@ import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/music/patches/ChangeMiniplayerColorPatch;"
|
"Lapp/revanced/extension/music/patches/ChangeMiniplayerColorPatch;"
|
||||||
|
|
@ -72,7 +72,7 @@ val changeMiniplayerColorPatch = bytecodePatch(
|
||||||
|
|
||||||
val colorGreyIndex =
|
val colorGreyIndex =
|
||||||
miniPlayerConstructorMethodMatch.immutableMethod.indexOfFirstInstructionReversedOrThrow {
|
miniPlayerConstructorMethodMatch.immutableMethod.indexOfFirstInstructionReversedOrThrow {
|
||||||
getReference<MethodReference>()?.name == "getColor"
|
methodReference?.name == "getColor"
|
||||||
}
|
}
|
||||||
val iPutIndex =
|
val iPutIndex =
|
||||||
miniPlayerConstructorMethodMatch.immutableMethod.indexOfFirstInstructionOrThrow(
|
miniPlayerConstructorMethodMatch.immutableMethod.indexOfFirstInstructionOrThrow(
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
package app.revanced.patches.openinghours.misc.fix.crash
|
package app.revanced.patches.openinghours.misc.fix.crash
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.newLabel
|
import app.revanced.patcher.extensions.newLabel
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21t
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21t
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val fixCrashPatch = bytecodePatch(
|
val fixCrashPatch = bytecodePatch(
|
||||||
|
|
@ -78,7 +77,7 @@ val fixCrashPatch = bytecodePatch(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isInvokeInstruction(instruction: Instruction, className: String, methodName: String): Boolean {
|
private fun isInvokeInstruction(instruction: Instruction, className: String, methodName: String): Boolean {
|
||||||
val methodRef = instruction.getReference<MethodReference>() ?: return false
|
val methodRef = instruction.methodReference ?: return false
|
||||||
return methodRef.definingClass == className && methodRef.name == methodName
|
return methodRef.definingClass == className && methodRef.name == methodName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,10 @@ package app.revanced.patches.piccomafr.tracking
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.extensions.stringReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val disableTrackingPatch = bytecodePatch(
|
val disableTrackingPatch = bytecodePatch(
|
||||||
|
|
@ -48,7 +47,7 @@ val disableTrackingPatch = bytecodePatch(
|
||||||
firebaseInstallMethod.instructions.filter {
|
firebaseInstallMethod.instructions.filter {
|
||||||
it.opcode == Opcode.CONST_STRING
|
it.opcode == Opcode.CONST_STRING
|
||||||
}.filter {
|
}.filter {
|
||||||
it.getReference<StringReference>()?.string == "firebaseinstallations.googleapis.com"
|
it.stringReference?.string == "firebaseinstallations.googleapis.com"
|
||||||
}.forEach { instruction ->
|
}.forEach { instruction ->
|
||||||
instruction as OneRegisterInstruction
|
instruction as OneRegisterInstruction
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,13 @@ package app.revanced.patches.primevideo.ads
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.primevideo.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.primevideo.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val skipAdsPatch = bytecodePatch(
|
val skipAdsPatch = bytecodePatch(
|
||||||
|
|
@ -32,7 +31,7 @@ val skipAdsPatch = bytecodePatch(
|
||||||
// move-result-object { playerRegister }
|
// move-result-object { playerRegister }
|
||||||
val getPlayerIndex = indexOfFirstInstructionOrThrow {
|
val getPlayerIndex = indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.INVOKE_VIRTUAL &&
|
opcode == Opcode.INVOKE_VIRTUAL &&
|
||||||
getReference<MethodReference>()?.name == "getPrimaryPlayer"
|
methodReference?.name == "getPrimaryPlayer"
|
||||||
}
|
}
|
||||||
|
|
||||||
val playerRegister = getInstruction<OneRegisterInstruction>(getPlayerIndex + 1).registerA
|
val playerRegister = getInstruction<OneRegisterInstruction>(getPlayerIndex + 1).registerA
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
package app.revanced.patches.primevideo.video.speed
|
package app.revanced.patches.primevideo.video.speed
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.primevideo.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.primevideo.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/primevideo/videoplayer/PlaybackSpeedPatch;"
|
"Lapp/revanced/extension/primevideo/videoplayer/PlaybackSpeedPatch;"
|
||||||
|
|
@ -30,7 +29,7 @@ val playbackSpeedPatch = bytecodePatch(
|
||||||
playbackUserControlsInitializeMethod.apply {
|
playbackUserControlsInitializeMethod.apply {
|
||||||
val getIndex = indexOfFirstInstructionOrThrow {
|
val getIndex = indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.IPUT_OBJECT &&
|
opcode == Opcode.IPUT_OBJECT &&
|
||||||
getReference<FieldReference>()?.name == "mUserControls"
|
fieldReference?.name == "mUserControls"
|
||||||
}
|
}
|
||||||
|
|
||||||
val getRegister = getInstruction<OneRegisterInstruction>(getIndex).registerA
|
val getRegister = getInstruction<OneRegisterInstruction>(getIndex).registerA
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
package app.revanced.patches.protonvpn.splittunneling
|
package app.revanced.patches.protonvpn.splittunneling
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
import app.revanced.patcher.extensions.removeInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val unlockSplitTunnelingPatch = bytecodePatch("Unlock split tunneling") {
|
val unlockSplitTunnelingPatch = bytecodePatch("Unlock split tunneling") {
|
||||||
|
|
@ -22,7 +21,7 @@ val unlockSplitTunnelingPatch = bytecodePatch("Unlock split tunneling") {
|
||||||
|
|
||||||
initializeSplitTunnelingSettingsUIMethod.apply {
|
initializeSplitTunnelingSettingsUIMethod.apply {
|
||||||
val initSettingsIndex = indexOfFirstInstructionOrThrow {
|
val initSettingsIndex = indexOfFirstInstructionOrThrow {
|
||||||
getReference<MethodReference>()?.name == "getSplitTunneling"
|
methodReference?.name == "getSplitTunneling"
|
||||||
}
|
}
|
||||||
removeInstruction(initSettingsIndex - 1)
|
removeInstruction(initSettingsIndex - 1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
package app.revanced.patches.reddit.ad.general
|
package app.revanced.patches.reddit.ad.general
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
import app.revanced.patcher.extensions.removeInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.reddit.ad.comments.hideCommentAdsPatch
|
import app.revanced.patches.reddit.ad.comments.hideCommentAdsPatch
|
||||||
import app.revanced.patches.reddit.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.reddit.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstruction
|
import app.revanced.util.indexOfFirstInstruction
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c
|
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val hideAdsPatch = bytecodePatch("Hide ads") {
|
val hideAdsPatch = bytecodePatch("Hide ads") {
|
||||||
|
|
@ -57,7 +56,7 @@ val hideAdsPatch = bytecodePatch("Hide ads") {
|
||||||
// By removing the appending instruction no ad posts gets appended to the feed.
|
// By removing the appending instruction no ad posts gets appended to the feed.
|
||||||
|
|
||||||
val index = newAdPostMethod.indexOfFirstInstruction {
|
val index = newAdPostMethod.indexOfFirstInstruction {
|
||||||
val reference = getReference<MethodReference>() ?: return@indexOfFirstInstruction false
|
val reference = methodReference ?: return@indexOfFirstInstruction false
|
||||||
|
|
||||||
reference.name == "add" && reference.definingClass == "Ljava/util/ArrayList;"
|
reference.name == "add" && reference.definingClass == "Ljava/util/ArrayList;"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
package app.revanced.patches.reddit.customclients.baconreader.fix.redgifs
|
package app.revanced.patches.reddit.customclients.baconreader.fix.redgifs
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.removeInstructions
|
import app.revanced.patcher.extensions.removeInstructions
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.extensions.typeReference
|
import app.revanced.patcher.extensions.typeReference
|
||||||
import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD
|
import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD
|
||||||
import app.revanced.patches.reddit.customclients.baconreader.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.reddit.customclients.baconreader.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.patches.reddit.customclients.fixRedgifsApiPatch
|
import app.revanced.patches.reddit.customclients.fixRedgifsApiPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/baconreader/FixRedgifsApiPatch;"
|
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/baconreader/FixRedgifsApiPatch;"
|
||||||
|
|
||||||
|
|
@ -34,7 +33,7 @@ val fixRedgifsApi = fixRedgifsApiPatch(
|
||||||
getOkHttpClientMethod.removeInstructions(originalInterceptorInstallIndex, 5)
|
getOkHttpClientMethod.removeInstructions(originalInterceptorInstallIndex, 5)
|
||||||
|
|
||||||
val index = getOkHttpClientMethod.indexOfFirstInstructionOrThrow {
|
val index = getOkHttpClientMethod.indexOfFirstInstructionOrThrow {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.name == "build" && reference.definingClass == $$"Lokhttp3/OkHttpClient$Builder;"
|
reference?.name == "build" && reference.definingClass == $$"Lokhttp3/OkHttpClient$Builder;"
|
||||||
}
|
}
|
||||||
val register = getOkHttpClientMethod.getInstruction<FiveRegisterInstruction>(index).registerC
|
val register = getOkHttpClientMethod.getInstruction<FiveRegisterInstruction>(index).registerC
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,12 @@ package app.revanced.patches.reddit.customclients.boostforreddit.api
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.extensions.stringReference
|
||||||
import app.revanced.patches.reddit.customclients.spoofClientPatch
|
import app.revanced.patches.reddit.customclients.spoofClientPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.returnEarly
|
import app.revanced.util.returnEarly
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val spoofClientPatch = spoofClientPatch(redirectUri = "http://rubenmayayo.com") { clientIdOption ->
|
val spoofClientPatch = spoofClientPatch(redirectUri = "http://rubenmayayo.com") { clientIdOption ->
|
||||||
|
|
@ -30,7 +29,7 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "http://rubenmayayo.com")
|
||||||
val userAgent = "$randomName:app.revanced.$randomName:v1.0.0 (by /u/revanced)"
|
val userAgent = "$randomName:app.revanced.$randomName:v1.0.0 (by /u/revanced)"
|
||||||
|
|
||||||
val userAgentTemplateIndex = buildUserAgentMethod.indexOfFirstInstructionOrThrow {
|
val userAgentTemplateIndex = buildUserAgentMethod.indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.CONST_STRING && getReference<StringReference>()?.string == "%s:%s:%s (by /u/%s)"
|
opcode == Opcode.CONST_STRING && stringReference?.string == "%s:%s:%s (by /u/%s)"
|
||||||
}
|
}
|
||||||
val register = buildUserAgentMethod.getInstruction<OneRegisterInstruction>(userAgentTemplateIndex).registerA
|
val register = buildUserAgentMethod.getInstruction<OneRegisterInstruction>(userAgentTemplateIndex).registerA
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,11 @@ package app.revanced.patches.reddit.customclients.redditisfun.api
|
||||||
import app.revanced.patcher.CompositeMatch
|
import app.revanced.patcher.CompositeMatch
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.extensions.stringReference
|
||||||
import app.revanced.patches.reddit.customclients.spoofClientPatch
|
import app.revanced.patches.reddit.customclients.spoofClientPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.returnEarly
|
import app.revanced.util.returnEarly
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val spoofClientPatch = spoofClientPatch(redirectUri = "redditisfun://auth") { clientIdOption ->
|
val spoofClientPatch = spoofClientPatch(redirectUri = "redditisfun://auth") { clientIdOption ->
|
||||||
|
|
@ -64,7 +63,7 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "redditisfun://auth") { cl
|
||||||
// Replace old.reddit.com with www.reddit.com to fix this.
|
// Replace old.reddit.com with www.reddit.com to fix this.
|
||||||
buildAuthorizationStringMethodMatch.method.apply {
|
buildAuthorizationStringMethodMatch.method.apply {
|
||||||
val index = indexOfFirstInstructionOrThrow {
|
val index = indexOfFirstInstructionOrThrow {
|
||||||
getReference<StringReference>()?.contains("old.reddit.com") == true
|
stringReference?.contains("old.reddit.com") == true
|
||||||
}
|
}
|
||||||
|
|
||||||
val targetRegister = getInstruction<OneRegisterInstruction>(index).registerA
|
val targetRegister = getInstruction<OneRegisterInstruction>(index).registerA
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,13 @@ package app.revanced.patches.reddit.customclients.sync.syncforreddit.fix.redgifs
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD
|
import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD
|
||||||
import app.revanced.patches.reddit.customclients.fixRedgifsApiPatch
|
import app.revanced.patches.reddit.customclients.fixRedgifsApiPatch
|
||||||
import app.revanced.patches.reddit.customclients.sync.syncforreddit.extension.sharedExtensionPatch
|
import app.revanced.patches.reddit.customclients.sync.syncforreddit.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/syncforreddit/FixRedgifsApiPatch;"
|
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/syncforreddit/FixRedgifsApiPatch;"
|
||||||
|
|
||||||
|
|
@ -27,7 +26,7 @@ val fixRedgifsApi = fixRedgifsApiPatch(
|
||||||
// region Patch Redgifs OkHttp3 client.
|
// region Patch Redgifs OkHttp3 client.
|
||||||
|
|
||||||
val index = createOkHttpClientMethod.indexOfFirstInstructionOrThrow {
|
val index = createOkHttpClientMethod.indexOfFirstInstructionOrThrow {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.name == "build" && reference.definingClass == $$"Lokhttp3/OkHttpClient$Builder;"
|
reference?.name == "build" && reference.definingClass == $$"Lokhttp3/OkHttpClient$Builder;"
|
||||||
}
|
}
|
||||||
val register = createOkHttpClientMethod.getInstruction<FiveRegisterInstruction>(index).registerC
|
val register = createOkHttpClientMethod.getInstruction<FiveRegisterInstruction>(index).registerC
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,11 @@ package app.revanced.patches.samsung.radio.restrictions.device
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.removeInstructions
|
import app.revanced.patcher.extensions.removeInstructions
|
||||||
|
import app.revanced.patcher.extensions.stringReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.util.findFreeRegister
|
import app.revanced.util.findFreeRegister
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/samsung/radio/restrictions/device/BypassDeviceChecksPatch;"
|
"Lapp/revanced/extension/samsung/radio/restrictions/device/BypassDeviceChecksPatch;"
|
||||||
|
|
@ -25,7 +24,7 @@ val bypassDeviceChecksPatch = bytecodePatch(
|
||||||
// Find the first string that start with "SM-", that's the list of incompatible devices.
|
// Find the first string that start with "SM-", that's the list of incompatible devices.
|
||||||
val firstStringIndex = checkDeviceMethod.indexOfFirstInstructionOrThrow {
|
val firstStringIndex = checkDeviceMethod.indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.CONST_STRING &&
|
opcode == Opcode.CONST_STRING &&
|
||||||
getReference<StringReference>()?.string?.startsWith("SM-") == true
|
stringReference?.string?.startsWith("SM-") == true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the following filled-new-array (or filled-new-array/range) instruction.
|
// Find the following filled-new-array (or filled-new-array/range) instruction.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ package app.revanced.patches.shared.layout.branding
|
||||||
|
|
||||||
import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod
|
import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.typeReference
|
||||||
import app.revanced.patcher.patch.*
|
import app.revanced.patcher.patch.*
|
||||||
import app.revanced.patches.all.misc.packagename.setOrGetFallbackPackageName
|
import app.revanced.patches.all.misc.packagename.setOrGetFallbackPackageName
|
||||||
import app.revanced.patches.all.misc.resources.addResources
|
import app.revanced.patches.all.misc.resources.addResources
|
||||||
|
|
@ -14,8 +16,6 @@ import app.revanced.util.*
|
||||||
import app.revanced.util.Utils.trimIndentMultiline
|
import app.revanced.util.Utils.trimIndentMultiline
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.TypeReference
|
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
import org.w3c.dom.NodeList
|
import org.w3c.dom.NodeList
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
@ -125,22 +125,22 @@ internal fun baseCustomBrandingPatch(
|
||||||
val getBuilderIndex = if (isYouTubeMusic) {
|
val getBuilderIndex = if (isYouTubeMusic) {
|
||||||
// YT Music the field is not a plain object type.
|
// YT Music the field is not a plain object type.
|
||||||
indexOfFirstInstructionOrThrow {
|
indexOfFirstInstructionOrThrow {
|
||||||
getReference<FieldReference>()?.type == $$"Landroid/app/Notification$Builder;"
|
fieldReference?.type == $$"Landroid/app/Notification$Builder;"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Find the field name of the notification builder. Field is an Object type.
|
// Find the field name of the notification builder. Field is an Object type.
|
||||||
val builderCastIndex = indexOfFirstInstructionOrThrow {
|
val builderCastIndex = indexOfFirstInstructionOrThrow {
|
||||||
val reference = getReference<TypeReference>()
|
val reference = typeReference
|
||||||
opcode == Opcode.CHECK_CAST &&
|
opcode == Opcode.CHECK_CAST &&
|
||||||
reference?.type == $$"Landroid/app/Notification$Builder;"
|
reference?.type == $$"Landroid/app/Notification$Builder;"
|
||||||
}
|
}
|
||||||
indexOfFirstInstructionReversedOrThrow(builderCastIndex) {
|
indexOfFirstInstructionReversedOrThrow(builderCastIndex) {
|
||||||
getReference<FieldReference>()?.type == "Ljava/lang/Object;"
|
fieldReference?.type == "Ljava/lang/Object;"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val builderFieldName = getInstruction<ReferenceInstruction>(getBuilderIndex)
|
val builderFieldName = getInstruction<ReferenceInstruction>(getBuilderIndex)
|
||||||
.getReference<FieldReference>()
|
.fieldReference
|
||||||
|
|
||||||
findInstructionIndicesReversedOrThrow(
|
findInstructionIndicesReversedOrThrow(
|
||||||
Opcode.RETURN_VOID,
|
Opcode.RETURN_VOID,
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,9 @@ fun gmsCoreSupportPatch(
|
||||||
"using a GmsCore instead of Google Play Services.",
|
"using a GmsCore instead of Google Play Services.",
|
||||||
) {
|
) {
|
||||||
val gmsCoreVendorGroupIdOption = stringOption(
|
val gmsCoreVendorGroupIdOption = stringOption(
|
||||||
key = "gmsCoreVendorGroupId",
|
name = "GmsCore vendor group ID",
|
||||||
default = "app.revanced",
|
default = "app.revanced",
|
||||||
values = mapOf("ReVanced" to "app.revanced"),
|
values = mapOf("ReVanced" to "app.revanced"),
|
||||||
title = "GmsCore vendor group ID",
|
|
||||||
description = "The vendor's group ID for GmsCore.",
|
description = "The vendor's group ID for GmsCore.",
|
||||||
required = true,
|
required = true,
|
||||||
) { it!!.matches(Regex(PACKAGE_NAME_REGEX_PATTERN)) }
|
) { it!!.matches(Regex(PACKAGE_NAME_REGEX_PATTERN)) }
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
||||||
|
|
||||||
|
|
@ -123,7 +122,7 @@ internal fun spoofVideoStreamsPatch(
|
||||||
val resultMethodType = createStreamingDataMethodMatch.classDef.type
|
val resultMethodType = createStreamingDataMethodMatch.classDef.type
|
||||||
val videoDetailsIndex = createStreamingDataMethodMatch[-1]
|
val videoDetailsIndex = createStreamingDataMethodMatch[-1]
|
||||||
val videoDetailsRegister = getInstruction<TwoRegisterInstruction>(videoDetailsIndex).registerA
|
val videoDetailsRegister = getInstruction<TwoRegisterInstruction>(videoDetailsIndex).registerA
|
||||||
val videoDetailsClass = getInstruction(videoDetailsIndex).getReference<FieldReference>()!!.type
|
val videoDetailsClass = getInstruction(videoDetailsIndex).fieldReference!!.type
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
videoDetailsIndex + 1,
|
videoDetailsIndex + 1,
|
||||||
|
|
@ -135,15 +134,15 @@ internal fun spoofVideoStreamsPatch(
|
||||||
val setStreamingDataIndex = createStreamingDataMethodMatch[0]
|
val setStreamingDataIndex = createStreamingDataMethodMatch[0]
|
||||||
|
|
||||||
val playerProtoClass = getInstruction(setStreamingDataIndex + 1)
|
val playerProtoClass = getInstruction(setStreamingDataIndex + 1)
|
||||||
.getReference<FieldReference>()!!.definingClass
|
.fieldReference!!.definingClass
|
||||||
|
|
||||||
val setStreamingDataField = getInstruction(setStreamingDataIndex).getReference<FieldReference>()
|
val setStreamingDataField = getInstruction(setStreamingDataIndex).fieldReference
|
||||||
|
|
||||||
val getStreamingDataField = getInstruction(
|
val getStreamingDataField = getInstruction(
|
||||||
indexOfFirstInstructionOrThrow {
|
indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.IGET_OBJECT && getReference<FieldReference>()?.definingClass == playerProtoClass
|
opcode == Opcode.IGET_OBJECT && fieldReference?.definingClass == playerProtoClass
|
||||||
},
|
},
|
||||||
).getReference<FieldReference>()
|
).fieldReference
|
||||||
|
|
||||||
// Use a helper method to avoid the need of picking out multiple free registers from the hooked code.
|
// Use a helper method to avoid the need of picking out multiple free registers from the hooked code.
|
||||||
createStreamingDataMethodMatch.classDef.methods.add(
|
createStreamingDataMethodMatch.classDef.methods.add(
|
||||||
|
|
@ -275,7 +274,7 @@ internal fun spoofVideoStreamsPatch(
|
||||||
val mediaFetchEnumClass = definingClass
|
val mediaFetchEnumClass = definingClass
|
||||||
val sabrFieldIndex = indexOfFirstInstructionOrThrow(disabledBySABRStreamingUrlString) {
|
val sabrFieldIndex = indexOfFirstInstructionOrThrow(disabledBySABRStreamingUrlString) {
|
||||||
opcode == Opcode.SPUT_OBJECT &&
|
opcode == Opcode.SPUT_OBJECT &&
|
||||||
getReference<FieldReference>()?.type == mediaFetchEnumClass
|
fieldReference?.type == mediaFetchEnumClass
|
||||||
}
|
}
|
||||||
|
|
||||||
Pair(
|
Pair(
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
package app.revanced.patches.shared.misc.spoof
|
package app.revanced.patches.shared.misc.spoof
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.extensions.stringReference
|
||||||
import app.revanced.patches.all.misc.transformation.IMethodCall
|
import app.revanced.patches.all.misc.transformation.IMethodCall
|
||||||
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
|
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
|
||||||
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstruction
|
import app.revanced.util.indexOfFirstInstruction
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
|
||||||
|
|
||||||
private const val USER_AGENT_STRING_BUILDER_APPEND_METHOD_REFERENCE =
|
private const val USER_AGENT_STRING_BUILDER_APPEND_METHOD_REFERENCE =
|
||||||
"Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;"
|
"Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;"
|
||||||
|
|
@ -37,7 +36,7 @@ fun userAgentClientSpoofPatch(originalPackageName: String) = transformInstructio
|
||||||
|
|
||||||
// IndexOutOfBoundsException is technically possible here,
|
// IndexOutOfBoundsException is technically possible here,
|
||||||
// but no such occurrences are present in the app.
|
// but no such occurrences are present in the app.
|
||||||
val referee = getInstruction(instructionIndex + 2).getReference<MethodReference>()?.toString()
|
val referee = getInstruction(instructionIndex + 2).methodReference?.toString()
|
||||||
|
|
||||||
// Only replace string builder usage.
|
// Only replace string builder usage.
|
||||||
if (referee != USER_AGENT_STRING_BUILDER_APPEND_METHOD_REFERENCE) {
|
if (referee != USER_AGENT_STRING_BUILDER_APPEND_METHOD_REFERENCE) {
|
||||||
|
|
@ -48,7 +47,7 @@ fun userAgentClientSpoofPatch(originalPackageName: String) = transformInstructio
|
||||||
// Changing these package names will result in playback limitations,
|
// Changing these package names will result in playback limitations,
|
||||||
// particularly Android VR background audio only playback.
|
// particularly Android VR background audio only playback.
|
||||||
val resourceOrGmsStringInstructionIndex = indexOfFirstInstruction {
|
val resourceOrGmsStringInstructionIndex = indexOfFirstInstruction {
|
||||||
val reference = getReference<StringReference>()
|
val reference = stringReference
|
||||||
opcode == Opcode.CONST_STRING &&
|
opcode == Opcode.CONST_STRING &&
|
||||||
(reference?.string == "android.resource://" || reference?.string == "gcore_")
|
(reference?.string == "android.resource://" || reference?.string == "gcore_")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
package app.revanced.patches.shared.misc.string
|
package app.revanced.patches.shared.misc.string
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.extensions.stringReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.ReferenceType
|
import com.android.tools.smali.dexlib2.ReferenceType
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
|
||||||
import kotlin.text.contains
|
import kotlin.text.contains
|
||||||
|
|
||||||
fun replaceStringPatch(
|
fun replaceStringPatch(
|
||||||
|
|
@ -20,7 +19,7 @@ fun replaceStringPatch(
|
||||||
filterMap = filterMap@{ _, _, instruction, instructionIndex ->
|
filterMap = filterMap@{ _, _, instruction, instructionIndex ->
|
||||||
if (instruction.opcode.referenceType != ReferenceType.STRING) return@filterMap null
|
if (instruction.opcode.referenceType != ReferenceType.STRING) return@filterMap null
|
||||||
|
|
||||||
val stringReference = instruction.getReference<StringReference>()!!.string
|
val stringReference = instruction.stringReference!!.string
|
||||||
if (from !in stringReference) return@filterMap null
|
if (from !in stringReference) return@filterMap null
|
||||||
|
|
||||||
Triple(instructionIndex, instruction as OneRegisterInstruction, stringReference)
|
Triple(instructionIndex, instruction as OneRegisterInstruction, stringReference)
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,8 @@ package app.revanced.patches.soundcloud.offlinesync
|
||||||
import app.revanced.patcher.extensions.*
|
import app.revanced.patcher.extensions.*
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.soundcloud.shared.featureConstructorMethod
|
import app.revanced.patches.soundcloud.shared.featureConstructorMethod
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val enableOfflineSyncPatch = bytecodePatch("Enable offline sync") {
|
val enableOfflineSyncPatch = bytecodePatch("Enable offline sync") {
|
||||||
|
|
@ -40,7 +38,7 @@ val enableOfflineSyncPatch = bytecodePatch("Enable offline sync") {
|
||||||
val getEndpointsEnumFieldInstruction = getInstruction<OneRegisterInstruction>(getEndpointsEnumFieldIndex)
|
val getEndpointsEnumFieldInstruction = getInstruction<OneRegisterInstruction>(getEndpointsEnumFieldIndex)
|
||||||
|
|
||||||
val targetRegister = getEndpointsEnumFieldInstruction.registerA
|
val targetRegister = getEndpointsEnumFieldInstruction.registerA
|
||||||
val endpointsType = getEndpointsEnumFieldInstruction.getReference<FieldReference>()!!.type
|
val endpointsType = getEndpointsEnumFieldInstruction.fieldReference!!.type
|
||||||
|
|
||||||
replaceInstruction(
|
replaceInstruction(
|
||||||
getEndpointsEnumFieldIndex,
|
getEndpointsEnumFieldIndex,
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,15 @@ package app.revanced.patches.spotify.layout.theme
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.immutableClassDef
|
import app.revanced.patcher.immutableClassDef
|
||||||
import app.revanced.patcher.patch.booleanOption
|
import app.revanced.patcher.patch.booleanOption
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patcher.patch.resourcePatch
|
import app.revanced.patcher.patch.resourcePatch
|
||||||
import app.revanced.patcher.patch.stringOption
|
import app.revanced.patcher.patch.stringOption
|
||||||
import app.revanced.patches.spotify.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.spotify.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/spotify/layout/theme/CustomThemePatch;"
|
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/spotify/layout/theme/CustomThemePatch;"
|
||||||
|
|
@ -39,7 +38,7 @@ private val customThemeBytecodePatch = bytecodePatch {
|
||||||
// including the solid color of it.
|
// including the solid color of it.
|
||||||
parseLottieJsonMethod.apply {
|
parseLottieJsonMethod.apply {
|
||||||
val invokeParseColorIndex = indexOfFirstInstructionOrThrow {
|
val invokeParseColorIndex = indexOfFirstInstructionOrThrow {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.definingClass == "Landroid/graphics/Color;" &&
|
reference?.definingClass == "Landroid/graphics/Color;" &&
|
||||||
reference.name == "parseColor"
|
reference.name == "parseColor"
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +59,7 @@ private val customThemeBytecodePatch = bytecodePatch {
|
||||||
// Lottie animated color parser.
|
// Lottie animated color parser.
|
||||||
parseAnimatedColorMethod.apply {
|
parseAnimatedColorMethod.apply {
|
||||||
val invokeArgbIndex = indexOfFirstInstructionOrThrow {
|
val invokeArgbIndex = indexOfFirstInstructionOrThrow {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.definingClass == "Landroid/graphics/Color;" &&
|
reference?.definingClass == "Landroid/graphics/Color;" &&
|
||||||
reference.name == "argb"
|
reference.name == "argb"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
package app.revanced.patches.spotify.misc.extension
|
package app.revanced.patches.spotify.misc.extension
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.string
|
import app.revanced.patcher.extensions.string
|
||||||
import app.revanced.patcher.instructions
|
import app.revanced.patcher.instructions
|
||||||
import app.revanced.patcher.invoke
|
import app.revanced.patcher.invoke
|
||||||
import app.revanced.patches.shared.misc.extension.activityOnCreateExtensionHook
|
import app.revanced.patches.shared.misc.extension.activityOnCreateExtensionHook
|
||||||
import app.revanced.patches.shared.misc.extension.extensionHook
|
import app.revanced.patches.shared.misc.extension.extensionHook
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstruction
|
import app.revanced.util.indexOfFirstInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
|
|
||||||
internal val mainActivityOnCreateHook = activityOnCreateExtensionHook(
|
internal val mainActivityOnCreateHook = activityOnCreateExtensionHook(
|
||||||
"Lcom/spotify/music/SpotifyMainActivity;"
|
"Lcom/spotify/music/SpotifyMainActivity;"
|
||||||
|
|
@ -25,7 +24,7 @@ internal val loadOrbitLibraryHook = extensionHook(
|
||||||
},
|
},
|
||||||
getContextRegister = {
|
getContextRegister = {
|
||||||
contextReferenceIndex = indexOfFirstInstruction {
|
contextReferenceIndex = indexOfFirstInstruction {
|
||||||
getReference<FieldReference>()?.type == "Landroid/content/Context;"
|
fieldReference?.type == "Landroid/content/Context;"
|
||||||
}
|
}
|
||||||
val contextRegister =
|
val contextRegister =
|
||||||
getInstruction<TwoRegisterInstruction>(contextReferenceIndex).registerA
|
getInstruction<TwoRegisterInstruction>(contextReferenceIndex).registerA
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod
|
||||||
import app.revanced.patcher.classDef
|
import app.revanced.patcher.classDef
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.firstMethodDeclaratively
|
import app.revanced.patcher.firstMethodDeclaratively
|
||||||
import app.revanced.patcher.instructions
|
import app.revanced.patcher.instructions
|
||||||
|
|
@ -12,13 +13,10 @@ import app.revanced.patcher.parameterTypes
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patcher.patch.stringOption
|
import app.revanced.patcher.patch.stringOption
|
||||||
import app.revanced.patcher.returnType
|
import app.revanced.patcher.returnType
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstruction
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction35c
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction35c
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
|
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
|
||||||
import java.net.InetAddress
|
import java.net.InetAddress
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
|
@ -70,10 +68,10 @@ val changeLyricsProviderPatch = bytecodePatch(
|
||||||
|
|
||||||
val patchedHttpClientBuilderMethod = with(httpClientBuilderMethod) {
|
val patchedHttpClientBuilderMethod = with(httpClientBuilderMethod) {
|
||||||
val invokeBuildUrlIndex = indexOfFirstInstructionOrThrow {
|
val invokeBuildUrlIndex = indexOfFirstInstructionOrThrow {
|
||||||
getReference<MethodReference>()?.returnType == "Lokhttp3/HttpUrl;"
|
methodReference?.returnType == "Lokhttp3/HttpUrl;"
|
||||||
}
|
}
|
||||||
val setUrlBuilderHostIndex = indexOfFirstInstructionReversedOrThrow(invokeBuildUrlIndex) {
|
val setUrlBuilderHostIndex = indexOfFirstInstructionReversedOrThrow(invokeBuildUrlIndex) {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.definingClass == "Lokhttp3/HttpUrl${"$"}Builder;" &&
|
reference?.definingClass == "Lokhttp3/HttpUrl${"$"}Builder;" &&
|
||||||
reference.parameterTypes.firstOrNull() == "Ljava/lang/String;"
|
reference.parameterTypes.firstOrNull() == "Ljava/lang/String;"
|
||||||
}
|
}
|
||||||
|
|
@ -103,7 +101,7 @@ val changeLyricsProviderPatch = bytecodePatch(
|
||||||
|
|
||||||
getLyricsHttpClientMethod.apply {
|
getLyricsHttpClientMethod.apply {
|
||||||
val getLyricsHttpClientIndex = indexOfFirstInstructionOrThrow {
|
val getLyricsHttpClientIndex = indexOfFirstInstructionOrThrow {
|
||||||
getReference<MethodReference>() == httpClientBuilderMethod
|
methodReference == httpClientBuilderMethod
|
||||||
}
|
}
|
||||||
val getLyricsHttpClientInstruction = getInstruction<BuilderInstruction35c>(getLyricsHttpClientIndex)
|
val getLyricsHttpClientInstruction = getInstruction<BuilderInstruction35c>(getLyricsHttpClientIndex)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,7 @@
|
||||||
package app.revanced.patches.spotify.misc.lyrics
|
package app.revanced.patches.spotify.misc.lyrics
|
||||||
|
|
||||||
import app.revanced.patcher.gettingFirstImmutableMethod
|
import app.revanced.patcher.gettingFirstImmutableMethod
|
||||||
import app.revanced.patcher.gettingFirstImmutableMethodDeclaratively
|
|
||||||
import app.revanced.patcher.parameterTypes
|
|
||||||
import app.revanced.patcher.patch.BytecodePatchContext
|
import app.revanced.patcher.patch.BytecodePatchContext
|
||||||
import app.revanced.patcher.returnType
|
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstruction
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
internal val BytecodePatchContext.httpClientBuilderMethod by gettingFirstImmutableMethod("client == null", "scheduler == null")
|
internal val BytecodePatchContext.httpClientBuilderMethod by gettingFirstImmutableMethod("client == null", "scheduler == null")
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Compan
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
|
import app.revanced.patcher.extensions.typeReference
|
||||||
import app.revanced.patcher.immutableClassDef
|
import app.revanced.patcher.immutableClassDef
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patcher.patch.resourcePatch
|
import app.revanced.patcher.patch.resourcePatch
|
||||||
import app.revanced.util.childElementsSequence
|
import app.revanced.util.childElementsSequence
|
||||||
import app.revanced.util.findElementByAttributeValueOrThrow
|
import app.revanced.util.findElementByAttributeValueOrThrow
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags.*
|
import com.android.tools.smali.dexlib2.AccessFlags.*
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||||
|
|
@ -18,7 +18,6 @@ import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
|
||||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction31i
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction31i
|
||||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction35c
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction35c
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.NarrowLiteralInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.TypeReference
|
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableClassDef
|
import com.android.tools.smali.dexlib2.immutable.ImmutableClassDef
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableField
|
import com.android.tools.smali.dexlib2.immutable.ImmutableField
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
|
|
@ -115,7 +114,7 @@ val addGiveGroupKudosButtonToGroupActivityPatch = bytecodePatch(
|
||||||
val checkCastButtonInstruction =
|
val checkCastButtonInstruction =
|
||||||
getInstruction<BuilderInstruction21c>(constLeaveIdInstruction.location.index + 3)
|
getInstruction<BuilderInstruction21c>(constLeaveIdInstruction.location.index + 3)
|
||||||
|
|
||||||
val buttonClassName = checkCastButtonInstruction.getReference<TypeReference>()!!.type
|
val buttonClassName = checkCastButtonInstruction.typeReference!!.type
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
constLeaveIdInstruction.location.index,
|
constLeaveIdInstruction.location.index,
|
||||||
|
|
|
||||||
|
|
@ -4,19 +4,18 @@ import app.revanced.patcher.extensions.ExternalLabel
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
|
import app.revanced.patcher.extensions.typeReference
|
||||||
import app.revanced.patcher.firstImmutableClassDef
|
import app.revanced.patcher.firstImmutableClassDef
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.shared.misc.mapping.ResourceType
|
import app.revanced.patches.shared.misc.mapping.ResourceType
|
||||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||||
import app.revanced.patches.strava.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.strava.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.writeRegister
|
import app.revanced.util.writeRegister
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22c
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22c
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.TypeReference
|
|
||||||
|
|
||||||
private const val ACTION_CLASS_DESCRIPTOR = "Lcom/strava/bottomsheet/Action;"
|
private const val ACTION_CLASS_DESCRIPTOR = "Lcom/strava/bottomsheet/Action;"
|
||||||
private const val MEDIA_CLASS_DESCRIPTOR = "Lcom/strava/photos/data/Media;"
|
private const val MEDIA_CLASS_DESCRIPTOR = "Lcom/strava/photos/data/Media;"
|
||||||
|
|
@ -45,7 +44,7 @@ val addMediaDownloadPatch = bytecodePatch(
|
||||||
}
|
}
|
||||||
val actionRegistrarRegister = getInstruction<BuilderInstruction22c>(setTrueIndex).registerB
|
val actionRegistrarRegister = getInstruction<BuilderInstruction22c>(setTrueIndex).registerB
|
||||||
val actionRegister = instructions.first { instruction ->
|
val actionRegister = instructions.first { instruction ->
|
||||||
instruction.getReference<TypeReference>()?.type == ACTION_CLASS_DESCRIPTOR
|
instruction.typeReference?.type == ACTION_CLASS_DESCRIPTOR
|
||||||
}.writeRegister!!
|
}.writeRegister!!
|
||||||
|
|
||||||
fun addMenuItem(actionId: String, string: String, color: String, drawable: String) = addInstructions(
|
fun addMenuItem(actionId: String, string: String, color: String, drawable: String) = addInstructions(
|
||||||
|
|
@ -74,7 +73,7 @@ val addMediaDownloadPatch = bytecodePatch(
|
||||||
|
|
||||||
// Move media to last parameter of `Action` constructor.
|
// Move media to last parameter of `Action` constructor.
|
||||||
val getMediaInstruction = instructions.first { instruction ->
|
val getMediaInstruction = instructions.first { instruction ->
|
||||||
instruction.getReference<FieldReference>()?.type == MEDIA_CLASS_DESCRIPTOR
|
instruction.fieldReference?.type == MEDIA_CLASS_DESCRIPTOR
|
||||||
}
|
}
|
||||||
addInstruction(
|
addInstruction(
|
||||||
getMediaInstruction.location.index + 1,
|
getMediaInstruction.location.index + 1,
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,9 @@ import app.revanced.patches.tiktok.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.patches.tiktok.misc.settings.settingsPatch
|
import app.revanced.patches.tiktok.misc.settings.settingsPatch
|
||||||
import app.revanced.patches.tiktok.misc.settings.settingsStatusLoadMethod
|
import app.revanced.patches.tiktok.misc.settings.settingsStatusLoadMethod
|
||||||
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.returnEarly
|
import app.revanced.util.returnEarly
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/tiktok/download/DownloadsPatch;"
|
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/tiktok/download/DownloadsPatch;"
|
||||||
|
|
||||||
|
|
@ -50,7 +48,7 @@ val downloadsPatch = bytecodePatch(
|
||||||
// Change the download path patch.
|
// Change the download path patch.
|
||||||
downloadUriMethod.apply {
|
downloadUriMethod.apply {
|
||||||
findInstructionIndicesReversedOrThrow {
|
findInstructionIndicesReversedOrThrow {
|
||||||
getReference<FieldReference>().let {
|
fieldReference.let {
|
||||||
it?.definingClass == "Landroid/os/Environment;" && it.name.startsWith("DIRECTORY_")
|
it?.definingClass == "Landroid/os/Environment;" && it.name.startsWith("DIRECTORY_")
|
||||||
}
|
}
|
||||||
}.forEach { fieldIndex ->
|
}.forEach { fieldIndex ->
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,13 @@ import app.revanced.patcher.classDef
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.firstClassDef
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.tiktok.shared.getEnterFromMethod
|
import app.revanced.patches.tiktok.shared.getEnterFromMethod
|
||||||
import app.revanced.patches.tiktok.shared.onRenderFirstFrameMethod
|
import app.revanced.patches.tiktok.shared.onRenderFirstFrameMethod
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.returnEarly
|
import app.revanced.util.returnEarly
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction11x
|
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction11x
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val playbackSpeedPatch = bytecodePatch(
|
val playbackSpeedPatch = bytecodePatch(
|
||||||
|
|
@ -28,7 +26,7 @@ val playbackSpeedPatch = bytecodePatch(
|
||||||
apply {
|
apply {
|
||||||
getSpeedMethod.apply {
|
getSpeedMethod.apply {
|
||||||
val injectIndex =
|
val injectIndex =
|
||||||
indexOfFirstInstructionOrThrow { getReference<MethodReference>()?.returnType == "F" } + 2
|
indexOfFirstInstructionOrThrow { methodReference?.returnType == "F" } + 2
|
||||||
val register = getInstruction<Instruction11x>(injectIndex - 1).registerA
|
val register = getInstruction<Instruction11x>(injectIndex - 1).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@ package app.revanced.patches.tiktok.misc.share
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.tiktok.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.tiktok.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.findFreeRegister
|
import app.revanced.util.findFreeRegister
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
@ -30,7 +30,7 @@ val sanitizeSharingLinksPatch = bytecodePatch(
|
||||||
apply {
|
apply {
|
||||||
urlShorteningMethod.apply {
|
urlShorteningMethod.apply {
|
||||||
val invokeIndex = indexOfFirstInstructionOrThrow {
|
val invokeIndex = indexOfFirstInstructionOrThrow {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.name == "LIZ" && reference.definingClass.startsWith("LX/")
|
reference?.name == "LIZ" && reference.definingClass.startsWith("LX/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ val sanitizeSharingLinksPatch = bytecodePatch(
|
||||||
.reference.toString()
|
.reference.toString()
|
||||||
|
|
||||||
val observableFactoryIndex = indexOfFirstInstructionOrThrow {
|
val observableFactoryIndex = indexOfFirstInstructionOrThrow {
|
||||||
val ref = getReference<MethodReference>()
|
val ref = methodReference
|
||||||
ref?.name == "LJ" && ref.definingClass.startsWith("LX/")
|
ref?.name == "LJ" && ref.definingClass.startsWith("LX/")
|
||||||
}
|
}
|
||||||
val observableFactoryRef = getInstruction<ReferenceInstruction>(observableFactoryIndex)
|
val observableFactoryRef = getInstruction<ReferenceInstruction>(observableFactoryIndex)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import java.net.InetAddress
|
||||||
import java.net.UnknownHostException
|
import java.net.UnknownHostException
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
|
|
||||||
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/twitter/patches/links/ChangeLinkSharingDomainPatch;"
|
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/twitter/patches/links/ChangeLinkSharingDomainPatch;"
|
||||||
|
|
||||||
internal val domainNameOption = stringOption(
|
internal val domainNameOption = stringOption(
|
||||||
default = "fxtwitter.com",
|
default = "fxtwitter.com",
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,8 @@ import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||||
import app.revanced.util.findInstructionIndicesReversed
|
import app.revanced.util.findInstructionIndicesReversed
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/SlideToSeekPatch;"
|
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/SlideToSeekPatch;"
|
||||||
|
|
||||||
|
|
@ -45,7 +43,7 @@ val enableSlideToSeekPatch = bytecodePatch(
|
||||||
|
|
||||||
val checkIndex = slideToSeekMethodMatch[0]
|
val checkIndex = slideToSeekMethodMatch[0]
|
||||||
val checkReference = slideToSeekMethodMatch.method.getInstruction(checkIndex)
|
val checkReference = slideToSeekMethodMatch.method.getInstruction(checkIndex)
|
||||||
.getReference<MethodReference>()!!
|
.methodReference!!
|
||||||
|
|
||||||
val extensionMethodDescriptor = "$EXTENSION_CLASS_DESCRIPTOR->isSlideToSeekDisabled(Z)Z"
|
val extensionMethodDescriptor = "$EXTENSION_CLASS_DESCRIPTOR->isSlideToSeekDisabled(Z)Z"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package app.revanced.patches.youtube.interaction.seekbar
|
||||||
import app.revanced.patcher.extensions.ExternalLabel
|
import app.revanced.patcher.extensions.ExternalLabel
|
||||||
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.resources.addResources
|
import app.revanced.patches.all.misc.resources.addResources
|
||||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||||
|
|
@ -12,8 +13,6 @@ import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||||
import app.revanced.util.findFreeRegister
|
import app.revanced.util.findFreeRegister
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/TapToSeekPatch;"
|
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/TapToSeekPatch;"
|
||||||
|
|
||||||
|
|
@ -35,8 +34,7 @@ val enableTapToSeekPatch = bytecodePatch(
|
||||||
|
|
||||||
// Find the required methods to tap the seekbar.
|
// Find the required methods to tap the seekbar.
|
||||||
val tapToSeekMethods = onTouchEventHandlerMethodMatch.let {
|
val tapToSeekMethods = onTouchEventHandlerMethodMatch.let {
|
||||||
fun getReference(index: Int) = it.method.getInstruction<ReferenceInstruction>(index)
|
fun getReference(index: Int) = it.method.getInstruction(index).methodReference!!
|
||||||
.reference as MethodReference
|
|
||||||
|
|
||||||
listOf(
|
listOf(
|
||||||
getReference(it[0]),
|
getReference(it[0]),
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,11 @@ import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||||
import app.revanced.util.addInstructionsAtControlFlowLabel
|
import app.revanced.util.addInstructionsAtControlFlowLabel
|
||||||
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.insertLiteralOverride
|
import app.revanced.util.insertLiteralOverride
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import kotlin.collections.plusAssign
|
import kotlin.collections.plusAssign
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
|
|
@ -235,7 +233,7 @@ val navigationBarPatch = bytecodePatch(
|
||||||
// Fix missing left padding when using wide searchbar.
|
// Fix missing left padding when using wide searchbar.
|
||||||
wideSearchbarLayoutMethod.apply {
|
wideSearchbarLayoutMethod.apply {
|
||||||
findInstructionIndicesReversedOrThrow {
|
findInstructionIndicesReversedOrThrow {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.definingClass == "Landroid/view/LayoutInflater;" && reference.name == "inflate"
|
reference?.definingClass == "Landroid/view/LayoutInflater;" && reference.name == "inflate"
|
||||||
}.forEach { inflateIndex ->
|
}.forEach { inflateIndex ->
|
||||||
val register =
|
val register =
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,11 @@ import app.revanced.util.*
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/youtube/patches/HidePlayerOverlayButtonsPatch;"
|
"Lapp/revanced/extension/youtube/patches/HidePlayerOverlayButtonsPatch;"
|
||||||
|
|
||||||
@Suppress("ObjectPropertyName")
|
@Suppress("unused")
|
||||||
val hidePlayerOverlayButtonsPatch = bytecodePatch(
|
val hidePlayerOverlayButtonsPatch = bytecodePatch(
|
||||||
name = "Hide player overlay buttons",
|
name = "Hide player overlay buttons",
|
||||||
description = "Adds options to hide the player Cast, Autoplay, Captions, Previous & Next buttons, and the player " +
|
description = "Adds options to hide the player Cast, Autoplay, Captions, Previous & Next buttons, and the player " +
|
||||||
|
|
@ -121,7 +120,7 @@ val hidePlayerOverlayButtonsPatch = bytecodePatch(
|
||||||
|
|
||||||
// Add a conditional branch around the code that inflates and adds the auto-repeat button.
|
// Add a conditional branch around the code that inflates and adds the auto-repeat button.
|
||||||
val gotoIndex = indexOfFirstInstructionOrThrow(constIndex) {
|
val gotoIndex = indexOfFirstInstructionOrThrow(constIndex) {
|
||||||
val parameterTypes = getReference<MethodReference>()?.parameterTypes
|
val parameterTypes = methodReference?.parameterTypes
|
||||||
opcode == Opcode.INVOKE_VIRTUAL &&
|
opcode == Opcode.INVOKE_VIRTUAL &&
|
||||||
parameterTypes?.size == 2 &&
|
parameterTypes?.size == 2 &&
|
||||||
parameterTypes.first() == "Landroid/view/ViewStub;"
|
parameterTypes.first() == "Landroid/view/ViewStub;"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package app.revanced.patches.youtube.layout.hide.fullscreenambientmode
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.resources.addResources
|
import app.revanced.patches.all.misc.resources.addResources
|
||||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||||
|
|
@ -9,10 +10,8 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/youtube/patches/DisableFullscreenAmbientModePatch;"
|
"Lapp/revanced/extension/youtube/patches/DisableFullscreenAmbientModePatch;"
|
||||||
|
|
@ -51,7 +50,7 @@ val disableFullscreenAmbientModePatch = bytecodePatch(
|
||||||
|
|
||||||
setFullScreenBackgroundColorMethod.apply {
|
setFullScreenBackgroundColorMethod.apply {
|
||||||
val insertIndex = indexOfFirstInstructionReversedOrThrow {
|
val insertIndex = indexOfFirstInstructionReversedOrThrow {
|
||||||
getReference<MethodReference>()?.name == "setBackgroundColor"
|
methodReference?.name == "setBackgroundColor"
|
||||||
}
|
}
|
||||||
val register = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
val register = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||||
import app.revanced.util.findFreeRegister
|
import app.revanced.util.findFreeRegister
|
||||||
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
@ -31,7 +30,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
||||||
|
|
||||||
|
|
@ -489,7 +487,7 @@ val hideLayoutComponentsPatch = hideLayoutComponentsPatch(
|
||||||
|
|
||||||
yoodlesImageViewMethod.apply {
|
yoodlesImageViewMethod.apply {
|
||||||
findInstructionIndicesReversedOrThrow {
|
findInstructionIndicesReversedOrThrow {
|
||||||
getReference<MethodReference>()?.name == "setImageDrawable"
|
methodReference?.name == "setImageDrawable"
|
||||||
}.forEach { insertIndex ->
|
}.forEach { insertIndex ->
|
||||||
val drawableRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
val drawableRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||||
val imageViewRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerC
|
val imageViewRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerC
|
||||||
|
|
@ -512,7 +510,7 @@ val hideLayoutComponentsPatch = hideLayoutComponentsPatch(
|
||||||
|
|
||||||
// Find the instruction where the text dimension is retrieved.
|
// Find the instruction where the text dimension is retrieved.
|
||||||
val applyDimensionIndex = indexOfFirstInstructionReversedOrThrow {
|
val applyDimensionIndex = indexOfFirstInstructionReversedOrThrow {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
opcode == Opcode.INVOKE_STATIC &&
|
opcode == Opcode.INVOKE_STATIC &&
|
||||||
reference?.definingClass == "Landroid/util/TypedValue;" &&
|
reference?.definingClass == "Landroid/util/TypedValue;" &&
|
||||||
reference.returnType == "F" &&
|
reference.returnType == "F" &&
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Compan
|
||||||
import app.revanced.patcher.classDef
|
import app.revanced.patcher.classDef
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.immutableClassDef
|
import app.revanced.patcher.immutableClassDef
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
|
@ -29,8 +31,6 @@ import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
import com.android.tools.smali.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
||||||
|
|
||||||
|
|
@ -269,7 +269,7 @@ val miniplayerPatch = bytecodePatch(
|
||||||
it.apply {
|
it.apply {
|
||||||
if (AccessFlags.CONSTRUCTOR.isSet(accessFlags)) {
|
if (AccessFlags.CONSTRUCTOR.isSet(accessFlags)) {
|
||||||
val iPutIndex = indexOfFirstInstructionOrThrow {
|
val iPutIndex = indexOfFirstInstructionOrThrow {
|
||||||
this.opcode == Opcode.IPUT && this.getReference<FieldReference>()?.type == "I"
|
this.opcode == Opcode.IPUT && this.fieldReference?.type == "I"
|
||||||
}
|
}
|
||||||
|
|
||||||
insertModernMiniplayerTypeOverride(iPutIndex)
|
insertModernMiniplayerTypeOverride(iPutIndex)
|
||||||
|
|
@ -394,7 +394,7 @@ val miniplayerPatch = bytecodePatch(
|
||||||
if (is_20_31_or_greater) {
|
if (is_20_31_or_greater) {
|
||||||
miniplayerSetIconsMethod.apply {
|
miniplayerSetIconsMethod.apply {
|
||||||
findInstructionIndicesReversedOrThrow {
|
findInstructionIndicesReversedOrThrow {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
opcode == Opcode.INVOKE_INTERFACE &&
|
opcode == Opcode.INVOKE_INTERFACE &&
|
||||||
reference?.returnType == "Z" && reference.parameterTypes.isEmpty()
|
reference?.returnType == "Z" && reference.parameterTypes.isEmpty()
|
||||||
}.forEach { index ->
|
}.forEach { index ->
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Compan
|
||||||
import app.revanced.patcher.*
|
import app.revanced.patcher.*
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.shared.layout.theme.lithoColorHookPatch
|
import app.revanced.patches.shared.layout.theme.lithoColorHookPatch
|
||||||
|
|
@ -18,14 +19,12 @@ import app.revanced.patches.youtube.misc.playservice.is_21_02_or_greater
|
||||||
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
|
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
|
||||||
import app.revanced.patches.youtube.shared.mainActivityOnCreateMethod
|
import app.revanced.patches.youtube.shared.mainActivityOnCreateMethod
|
||||||
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.insertLiteralOverride
|
import app.revanced.util.insertLiteralOverride
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
||||||
|
|
||||||
|
|
@ -158,7 +157,7 @@ val seekbarColorPatch = bytecodePatch(
|
||||||
val setAnimationIntMethodName = lottieAnimationViewSetAnimationIntMethod.name
|
val setAnimationIntMethodName = lottieAnimationViewSetAnimationIntMethod.name
|
||||||
|
|
||||||
findInstructionIndicesReversedOrThrow {
|
findInstructionIndicesReversedOrThrow {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.definingClass == LOTTIE_ANIMATION_VIEW_CLASS_TYPE &&
|
reference?.definingClass == LOTTIE_ANIMATION_VIEW_CLASS_TYPE &&
|
||||||
reference.name == setAnimationIntMethodName
|
reference.name == setAnimationIntMethodName
|
||||||
}.forEach { index ->
|
}.forEach { index ->
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import app.revanced.patcher.classDef
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.methodReference
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.immutableClassDef
|
import app.revanced.patcher.immutableClassDef
|
||||||
|
|
@ -20,22 +21,19 @@ import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||||
import app.revanced.patches.youtube.shared.mainActivityOnCreateMethod
|
import app.revanced.patches.youtube.shared.mainActivityOnCreateMethod
|
||||||
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/youtube/patches/ShortsAutoplayPatch;"
|
"Lapp/revanced/extension/youtube/patches/ShortsAutoplayPatch;"
|
||||||
|
|
||||||
@Suppress("ObjectPropertyName")
|
@Suppress("unused")
|
||||||
val shortsAutoplayPatch = bytecodePatch(
|
val shortsAutoplayPatch = bytecodePatch(
|
||||||
name = "Shorts autoplay",
|
name = "Shorts autoplay",
|
||||||
description = "Adds options to automatically play the next Short.",
|
description = "Adds options to automatically play the next Short.",
|
||||||
|
|
@ -99,7 +97,7 @@ val shortsAutoplayPatch = bytecodePatch(
|
||||||
reelPlaybackRepeatMethod.apply {
|
reelPlaybackRepeatMethod.apply {
|
||||||
// The behavior enums are looked up from an ordinal value to an enum type.
|
// The behavior enums are looked up from an ordinal value to an enum type.
|
||||||
findInstructionIndicesReversedOrThrow {
|
findInstructionIndicesReversedOrThrow {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.definingClass == reelEnumClass &&
|
reference?.definingClass == reelEnumClass &&
|
||||||
reference.parameterTypes.firstOrNull() == "I" &&
|
reference.parameterTypes.firstOrNull() == "I" &&
|
||||||
reference.returnType == reelEnumClass
|
reference.returnType == reelEnumClass
|
||||||
|
|
@ -129,12 +127,12 @@ val shortsAutoplayPatch = bytecodePatch(
|
||||||
// Find the first call modified by extension code above.
|
// Find the first call modified by extension code above.
|
||||||
val extensionReturnResultIndex = indexOfFirstInstructionOrThrow {
|
val extensionReturnResultIndex = indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.INVOKE_STATIC &&
|
opcode == Opcode.INVOKE_STATIC &&
|
||||||
getReference<MethodReference>()?.definingClass == EXTENSION_CLASS_DESCRIPTOR
|
methodReference?.definingClass == EXTENSION_CLASS_DESCRIPTOR
|
||||||
} + 1
|
} + 1
|
||||||
val enumRegister =
|
val enumRegister =
|
||||||
getInstruction<OneRegisterInstruction>(extensionReturnResultIndex).registerA
|
getInstruction<OneRegisterInstruction>(extensionReturnResultIndex).registerA
|
||||||
val getReelSequenceControllerIndex = indexOfFirstInstructionOrThrow {
|
val getReelSequenceControllerIndex = indexOfFirstInstructionOrThrow {
|
||||||
val reference = getReference<FieldReference>()
|
val reference = fieldReference
|
||||||
opcode == Opcode.IGET_OBJECT &&
|
opcode == Opcode.IGET_OBJECT &&
|
||||||
reference?.definingClass == definingClass &&
|
reference?.definingClass == definingClass &&
|
||||||
reference.type == reelSequenceControllerMethodReference.definingClass
|
reference.type == reelSequenceControllerMethodReference.definingClass
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,11 @@ import app.revanced.patches.youtube.shared.mainActivityOnCreateMethod
|
||||||
import app.revanced.patches.youtube.video.information.playbackStartDescriptorToStringMethodMatch
|
import app.revanced.patches.youtube.video.information.playbackStartDescriptorToStringMethodMatch
|
||||||
import app.revanced.util.addInstructionsAtControlFlowLabel
|
import app.revanced.util.addInstructionsAtControlFlowLabel
|
||||||
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstruction
|
import app.revanced.util.indexOfFirstInstruction
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/youtube/patches/OpenShortsInRegularPlayerPatch;"
|
"Lapp/revanced/extension/youtube/patches/OpenShortsInRegularPlayerPatch;"
|
||||||
|
|
@ -149,14 +147,14 @@ val openShortsInRegularPlayerPatch = bytecodePatch(
|
||||||
|
|
||||||
// Method call for Activity.finish()
|
// Method call for Activity.finish()
|
||||||
val finishIndexFirst = indexOfFirstInstructionOrThrow {
|
val finishIndexFirst = indexOfFirstInstructionOrThrow {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.name == "finish"
|
reference?.name == "finish"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second Activity.finish() call. Has been present since 19.x but started
|
// Second Activity.finish() call. Has been present since 19.x but started
|
||||||
// to interfere with back to exit fullscreen around 20.47.
|
// to interfere with back to exit fullscreen around 20.47.
|
||||||
val finishIndexSecond = indexOfFirstInstruction(finishIndexFirst + 1) {
|
val finishIndexSecond = indexOfFirstInstruction(finishIndexFirst + 1) {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.name == "finish"
|
reference?.name == "finish"
|
||||||
}
|
}
|
||||||
val getBooleanFieldIndex = indexOfFirstInstructionReversedOrThrow(finishIndexSecond) {
|
val getBooleanFieldIndex = indexOfFirstInstructionReversedOrThrow(finishIndexSecond) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ package app.revanced.patches.youtube.layout.sponsorblock
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.immutableClassDef
|
import app.revanced.patcher.immutableClassDef
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patcher.patch.resourcePatch
|
import app.revanced.patcher.patch.resourcePatch
|
||||||
|
|
@ -33,7 +35,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private val sponsorBlockResourcePatch = resourcePatch {
|
private val sponsorBlockResourcePatch = resourcePatch {
|
||||||
dependsOn(
|
dependsOn(
|
||||||
|
|
@ -157,7 +158,7 @@ val sponsorBlockPatch = bytecodePatch(
|
||||||
val rectangleIndex = indexOfFirstInstructionReversedOrThrow(
|
val rectangleIndex = indexOfFirstInstructionReversedOrThrow(
|
||||||
it[0],
|
it[0],
|
||||||
) {
|
) {
|
||||||
getReference<FieldReference>()?.type == "Landroid/graphics/Rect;"
|
fieldReference?.type == "Landroid/graphics/Rect;"
|
||||||
}
|
}
|
||||||
rectangleFieldName =
|
rectangleFieldName =
|
||||||
getInstruction<ReferenceInstruction>(rectangleIndex).reference as FieldReference
|
getInstruction<ReferenceInstruction>(rectangleIndex).reference as FieldReference
|
||||||
|
|
@ -182,7 +183,7 @@ val sponsorBlockPatch = bytecodePatch(
|
||||||
|
|
||||||
// Find the drawCircle call and draw the segment before it.
|
// Find the drawCircle call and draw the segment before it.
|
||||||
val drawCircleIndex = indexOfFirstInstructionReversedOrThrow {
|
val drawCircleIndex = indexOfFirstInstructionReversedOrThrow {
|
||||||
getReference<MethodReference>()?.name == "drawCircle"
|
methodReference?.name == "drawCircle"
|
||||||
}
|
}
|
||||||
val drawCircleInstruction = getInstruction<FiveRegisterInstruction>(drawCircleIndex)
|
val drawCircleInstruction = getInstruction<FiveRegisterInstruction>(drawCircleIndex)
|
||||||
val canvasInstanceRegister = drawCircleInstruction.registerC
|
val canvasInstanceRegister = drawCircleInstruction.registerC
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package app.revanced.patches.youtube.layout.startupshortsreset
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.resources.addResources
|
import app.revanced.patches.all.misc.resources.addResources
|
||||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||||
|
|
@ -14,11 +15,9 @@ import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||||
import app.revanced.util.addInstructionsAtControlFlowLabel
|
import app.revanced.util.addInstructionsAtControlFlowLabel
|
||||||
import app.revanced.util.findFreeRegister
|
import app.revanced.util.findFreeRegister
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/youtube/patches/DisableResumingStartupShortsPlayerPatch;"
|
"Lapp/revanced/extension/youtube/patches/DisableResumingStartupShortsPlayerPatch;"
|
||||||
|
|
@ -78,8 +77,8 @@ val disableResumingShortsOnStartupPatch = bytecodePatch(
|
||||||
userWasInShortsLegacyMethod.apply {
|
userWasInShortsLegacyMethod.apply {
|
||||||
val listenableInstructionIndex = indexOfFirstInstructionOrThrow {
|
val listenableInstructionIndex = indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.INVOKE_INTERFACE &&
|
opcode == Opcode.INVOKE_INTERFACE &&
|
||||||
getReference<MethodReference>()?.definingClass == "Lcom/google/common/util/concurrent/ListenableFuture;" &&
|
methodReference?.definingClass == "Lcom/google/common/util/concurrent/ListenableFuture;" &&
|
||||||
getReference<MethodReference>()?.name == "isDone"
|
methodReference?.name == "isDone"
|
||||||
}
|
}
|
||||||
val freeRegister = findFreeRegister(listenableInstructionIndex)
|
val freeRegister = findFreeRegister(listenableInstructionIndex)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ package app.revanced.patches.youtube.layout.toolbar
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.fieldReference
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
import app.revanced.patcher.extensions.removeInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.patches.youtube.shared.getToolBarButtonMethodMatch
|
import app.revanced.patches.youtube.shared.getToolBarButtonMethodMatch
|
||||||
import app.revanced.util.findFreeRegister
|
import app.revanced.util.findFreeRegister
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstruction
|
import app.revanced.util.indexOfFirstInstruction
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||||
|
|
@ -17,7 +17,6 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/ToolbarPatch;"
|
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/ToolbarPatch;"
|
||||||
|
|
||||||
|
|
@ -33,14 +32,14 @@ val toolbarHookPatch = bytecodePatch {
|
||||||
fun indexOfGetDrawableInstruction(method: Method) =
|
fun indexOfGetDrawableInstruction(method: Method) =
|
||||||
method.indexOfFirstInstruction {
|
method.indexOfFirstInstruction {
|
||||||
opcode == Opcode.INVOKE_VIRTUAL &&
|
opcode == Opcode.INVOKE_VIRTUAL &&
|
||||||
getReference<MethodReference>()?.toString() == "Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;"
|
methodReference?.toString() == "Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;"
|
||||||
}
|
}
|
||||||
|
|
||||||
getToolBarButtonMethodMatch().method.apply {
|
getToolBarButtonMethodMatch().method.apply {
|
||||||
val getDrawableIndex = indexOfGetDrawableInstruction(this)
|
val getDrawableIndex = indexOfGetDrawableInstruction(this)
|
||||||
val enumOrdinalIndex = indexOfFirstInstructionReversedOrThrow(getDrawableIndex) {
|
val enumOrdinalIndex = indexOfFirstInstructionReversedOrThrow(getDrawableIndex) {
|
||||||
opcode == Opcode.INVOKE_INTERFACE &&
|
opcode == Opcode.INVOKE_INTERFACE &&
|
||||||
getReference<MethodReference>()?.returnType == "I"
|
methodReference?.returnType == "I"
|
||||||
}
|
}
|
||||||
val replaceReference = getInstruction<ReferenceInstruction>(enumOrdinalIndex).reference
|
val replaceReference = getInstruction<ReferenceInstruction>(enumOrdinalIndex).reference
|
||||||
val replaceRegister = getInstruction<FiveRegisterInstruction>(enumOrdinalIndex).registerC
|
val replaceRegister = getInstruction<FiveRegisterInstruction>(enumOrdinalIndex).registerC
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package app.revanced.patches.youtube.misc.backgroundplayback
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.resources.addResources
|
import app.revanced.patches.all.misc.resources.addResources
|
||||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||||
|
|
@ -20,7 +21,6 @@ import app.revanced.patches.youtube.video.information.videoInformationPatch
|
||||||
import app.revanced.util.*
|
import app.revanced.util.*
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
internal var prefBackgroundAndOfflineCategoryId = -1L
|
internal var prefBackgroundAndOfflineCategoryId = -1L
|
||||||
private set
|
private set
|
||||||
|
|
@ -86,7 +86,7 @@ val removeBackgroundPlaybackRestrictionsPatch = bytecodePatch(
|
||||||
// Enable background playback option in YouTube settings
|
// Enable background playback option in YouTube settings
|
||||||
backgroundPlaybackSettingsMethod.apply {
|
backgroundPlaybackSettingsMethod.apply {
|
||||||
val booleanCalls = instructions.withIndex().filter {
|
val booleanCalls = instructions.withIndex().filter {
|
||||||
it.value.getReference<MethodReference>()?.returnType == "Z"
|
it.value.methodReference?.returnType == "Z"
|
||||||
}
|
}
|
||||||
|
|
||||||
val settingsBooleanIndex = booleanCalls.elementAt(1).index
|
val settingsBooleanIndex = booleanCalls.elementAt(1).index
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,7 @@ import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.patches.youtube.shared.getEngagementPanelControllerMethodMatch
|
import app.revanced.patches.youtube.shared.getEngagementPanelControllerMethodMatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
package app.revanced.patches.youtube.misc.fix.backtoexitgesture
|
package app.revanced.patches.youtube.misc.fix.backtoexitgesture
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.youtube.shared.mainActivityOnBackPressedMethod
|
import app.revanced.patches.youtube.shared.mainActivityOnBackPressedMethod
|
||||||
import app.revanced.util.addInstructionsAtControlFlowLabel
|
import app.revanced.util.addInstructionsAtControlFlowLabel
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/FixBackToExitGesturePatch;"
|
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/FixBackToExitGesturePatch;"
|
||||||
|
|
||||||
|
|
@ -26,7 +25,7 @@ internal val fixBackToExitGesturePatch = bytecodePatch(
|
||||||
with(scrollPositionMethodMatch) {
|
with(scrollPositionMethodMatch) {
|
||||||
navigate(immutableMethod).to(scrollPositionMethodMatch[0] + 1).stop().apply {
|
navigate(immutableMethod).to(scrollPositionMethodMatch[0] + 1).stop().apply {
|
||||||
val index = indexOfFirstInstructionOrThrow {
|
val index = indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.INVOKE_VIRTUAL && getReference<MethodReference>()?.definingClass ==
|
opcode == Opcode.INVOKE_VIRTUAL && methodReference?.definingClass ==
|
||||||
"Landroid/support/v7/widget/RecyclerView;"
|
"Landroid/support/v7/widget/RecyclerView;"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,16 @@ package app.revanced.patches.youtube.misc.fix.playbackspeed
|
||||||
|
|
||||||
import app.revanced.patcher.accessFlags
|
import app.revanced.patcher.accessFlags
|
||||||
import app.revanced.patcher.custom
|
import app.revanced.patcher.custom
|
||||||
import app.revanced.patcher.gettingFirstImmutableMethodDeclaratively
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||||
import app.revanced.patcher.opcodes
|
import app.revanced.patcher.opcodes
|
||||||
import app.revanced.patcher.parameterTypes
|
import app.revanced.patcher.parameterTypes
|
||||||
import app.revanced.patcher.patch.BytecodePatchContext
|
import app.revanced.patcher.patch.BytecodePatchContext
|
||||||
import app.revanced.patcher.returnType
|
import app.revanced.patcher.returnType
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionReversed
|
import app.revanced.util.indexOfFirstInstructionReversed
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is usually used to set the initial speed (1.0x) when playback starts from the feed.
|
* This method is usually used to set the initial speed (1.0x) when playback starts from the feed.
|
||||||
|
|
@ -40,5 +38,5 @@ internal val BytecodePatchContext.playbackSpeedInFeedsMethod by gettingFirstMeth
|
||||||
|
|
||||||
internal fun indexOfGetPlaybackSpeedInstruction(method: Method) = method.indexOfFirstInstructionReversed {
|
internal fun indexOfGetPlaybackSpeedInstruction(method: Method) = method.indexOfFirstInstructionReversed {
|
||||||
opcode == Opcode.IGET &&
|
opcode == Opcode.IGET &&
|
||||||
getReference<FieldReference>()?.type == "F"
|
fieldReference?.type == "F"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Compan
|
||||||
import app.revanced.patcher.classDef
|
import app.revanced.patcher.classDef
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.fieldReference
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
import app.revanced.patcher.immutableClassDef
|
import app.revanced.patcher.immutableClassDef
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||||
|
|
@ -40,7 +40,7 @@ val cronetImageURLHookPatch = bytecodePatch(
|
||||||
// The URL is required for the failure callback hook, but the URL field is obfuscated.
|
// The URL is required for the failure callback hook, but the URL field is obfuscated.
|
||||||
// Add a helper get method that returns the URL field.
|
// Add a helper get method that returns the URL field.
|
||||||
val urlFieldInstruction = requestMethod.instructions.first {
|
val urlFieldInstruction = requestMethod.instructions.first {
|
||||||
val reference = it.getReference<FieldReference>()
|
val reference = it.fieldReference
|
||||||
it.opcode == Opcode.IPUT_OBJECT && reference?.type == "Ljava/lang/String;"
|
it.opcode == Opcode.IPUT_OBJECT && reference?.type == "Ljava/lang/String;"
|
||||||
} as ReferenceInstruction
|
} as ReferenceInstruction
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.reference
|
import app.revanced.patcher.extensions.reference
|
||||||
import app.revanced.patcher.immutableClassDef
|
import app.revanced.patcher.immutableClassDef
|
||||||
import app.revanced.patcher.patch.PatchException
|
import app.revanced.patcher.patch.PatchException
|
||||||
|
|
@ -20,19 +21,14 @@ import app.revanced.patches.youtube.shared.mainActivityOnBackPressedMethod
|
||||||
import app.revanced.util.ResourceGroup
|
import app.revanced.util.ResourceGroup
|
||||||
import app.revanced.util.copyResources
|
import app.revanced.util.copyResources
|
||||||
import app.revanced.util.findFreeRegister
|
import app.revanced.util.findFreeRegister
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction31i
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||||
import java.util.logging.Logger
|
|
||||||
|
|
||||||
internal const val EXTENSION_CLASS_DESCRIPTOR =
|
internal const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/youtube/shared/NavigationBar;"
|
"Lapp/revanced/extension/youtube/shared/NavigationBar;"
|
||||||
|
|
@ -84,14 +80,14 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig
|
||||||
val navigationEnumClassName = navigationEnumMethod.classDef.type
|
val navigationEnumClassName = navigationEnumMethod.classDef.type
|
||||||
addHook(NavigationHook.SET_LAST_APP_NAVIGATION_ENUM) {
|
addHook(NavigationHook.SET_LAST_APP_NAVIGATION_ENUM) {
|
||||||
opcode == Opcode.INVOKE_STATIC &&
|
opcode == Opcode.INVOKE_STATIC &&
|
||||||
getReference<MethodReference>()?.definingClass == navigationEnumClassName
|
methodReference?.definingClass == navigationEnumClassName
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook the creation of navigation tab views.
|
// Hook the creation of navigation tab views.
|
||||||
val drawableTabMethod = pivotBarButtonsCreateDrawableViewMethod
|
val drawableTabMethod = pivotBarButtonsCreateDrawableViewMethod
|
||||||
addHook(NavigationHook.NAVIGATION_TAB_LOADED) predicate@{
|
addHook(NavigationHook.NAVIGATION_TAB_LOADED) predicate@{
|
||||||
MethodUtil.methodSignaturesMatch(
|
MethodUtil.methodSignaturesMatch(
|
||||||
getReference<MethodReference>() ?: return@predicate false,
|
methodReference ?: return@predicate false,
|
||||||
drawableTabMethod,
|
drawableTabMethod,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -99,7 +95,7 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig
|
||||||
if (is_20_21_or_greater && !is_20_28_or_greater) {
|
if (is_20_21_or_greater && !is_20_28_or_greater) {
|
||||||
addHook(NavigationHook.NAVIGATION_TAB_LOADED) predicate@{
|
addHook(NavigationHook.NAVIGATION_TAB_LOADED) predicate@{
|
||||||
MethodUtil.methodSignaturesMatch(
|
MethodUtil.methodSignaturesMatch(
|
||||||
getReference<MethodReference>() ?: return@predicate false,
|
methodReference ?: return@predicate false,
|
||||||
pivotBarButtonsCreateResourceIntViewMethod,
|
pivotBarButtonsCreateResourceIntViewMethod,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -107,7 +103,7 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig
|
||||||
|
|
||||||
addHook(NavigationHook.NAVIGATION_IMAGE_RESOURCE_TAB_LOADED) predicate@{
|
addHook(NavigationHook.NAVIGATION_IMAGE_RESOURCE_TAB_LOADED) predicate@{
|
||||||
MethodUtil.methodSignaturesMatch(
|
MethodUtil.methodSignaturesMatch(
|
||||||
getReference<MethodReference>() ?: return@predicate false,
|
methodReference ?: return@predicate false,
|
||||||
pivotBarButtonsCreateResourceStyledViewMethod,
|
pivotBarButtonsCreateResourceStyledViewMethod,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package app.revanced.patches.youtube.video.codecs
|
package app.revanced.patches.youtube.video.codecs
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
||||||
|
import app.revanced.patcher.extensions.methodReference
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.resources.addResources
|
import app.revanced.patches.all.misc.resources.addResources
|
||||||
|
|
@ -10,9 +11,7 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||||
import app.revanced.util.getReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/youtube/patches/DisableVideoCodecsPatch;"
|
"Lapp/revanced/extension/youtube/patches/DisableVideoCodecsPatch;"
|
||||||
|
|
@ -35,7 +34,7 @@ val disableVideoCodecsPatch = bytecodePatch(
|
||||||
return@filterMap null
|
return@filterMap null
|
||||||
}
|
}
|
||||||
|
|
||||||
val reference = instruction.getReference<MethodReference>()
|
val reference = instruction.methodReference
|
||||||
if (reference?.definingClass == "Landroid/view/Display\$HdrCapabilities;" && reference.name == "getSupportedHdrTypes") {
|
if (reference?.definingClass == "Landroid/view/Display\$HdrCapabilities;" && reference.name == "getSupportedHdrTypes") {
|
||||||
return@filterMap instruction to instructionIndex
|
return@filterMap instruction to instructionIndex
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import app.revanced.patches.youtube.video.videoid.hookVideoId
|
||||||
import app.revanced.patches.youtube.video.videoid.videoIdPatch
|
import app.revanced.patches.youtube.video.videoid.videoIdPatch
|
||||||
import app.revanced.util.addInstructionsAtControlFlowLabel
|
import app.revanced.util.addInstructionsAtControlFlowLabel
|
||||||
import app.revanced.util.addStaticFieldToExtension
|
import app.revanced.util.addStaticFieldToExtension
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.patcher.patch.PatchException
|
import app.revanced.patcher.patch.PatchException
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
@ -105,7 +104,7 @@ val videoInformationPatch = bytecodePatch(
|
||||||
// Find the location of the first invoke-direct call
|
// Find the location of the first invoke-direct call
|
||||||
// and extract the register storing the 'this' object reference.
|
// and extract the register storing the 'this' object reference.
|
||||||
val initThisIndex = playerInitMethod.indexOfFirstInstructionOrThrow {
|
val initThisIndex = playerInitMethod.indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.INVOKE_DIRECT && getReference<MethodReference>()?.name == "<init>"
|
opcode == Opcode.INVOKE_DIRECT && methodReference?.name == "<init>"
|
||||||
}
|
}
|
||||||
playerInitInsertRegister =
|
playerInitInsertRegister =
|
||||||
playerInitMethod.getInstruction<FiveRegisterInstruction>(initThisIndex).registerC
|
playerInitMethod.getInstruction<FiveRegisterInstruction>(initThisIndex).registerC
|
||||||
|
|
@ -123,7 +122,7 @@ val videoInformationPatch = bytecodePatch(
|
||||||
mdxInitMethod = classDef.methods.first { MethodUtil.isConstructor(it) }
|
mdxInitMethod = classDef.methods.first { MethodUtil.isConstructor(it) }
|
||||||
|
|
||||||
val initThisIndex = mdxInitMethod.indexOfFirstInstructionOrThrow {
|
val initThisIndex = mdxInitMethod.indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.INVOKE_DIRECT && getReference<MethodReference>()?.name == "<init>"
|
opcode == Opcode.INVOKE_DIRECT && methodReference?.name == "<init>"
|
||||||
}
|
}
|
||||||
mdxInitInsertRegister =
|
mdxInitInsertRegister =
|
||||||
mdxInitMethod.getInstruction<FiveRegisterInstruction>(initThisIndex).registerC
|
mdxInitMethod.getInstruction<FiveRegisterInstruction>(initThisIndex).registerC
|
||||||
|
|
@ -201,7 +200,7 @@ val videoInformationPatch = bytecodePatch(
|
||||||
|
|
||||||
setPlaybackSpeedMethodReference = getInstruction<ReferenceInstruction>(
|
setPlaybackSpeedMethodReference = getInstruction<ReferenceInstruction>(
|
||||||
indexOfFirstInstructionOrThrow(speedSelectionValueInstructionIndex) {
|
indexOfFirstInstructionOrThrow(speedSelectionValueInstructionIndex) {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.parameterTypes?.size == 1 && reference.parameterTypes.first() == "F"
|
reference?.parameterTypes?.size == 1 && reference.parameterTypes.first() == "F"
|
||||||
}
|
}
|
||||||
).reference as MethodReference
|
).reference as MethodReference
|
||||||
|
|
@ -231,7 +230,7 @@ val videoInformationPatch = bytecodePatch(
|
||||||
|
|
||||||
setPlaybackSpeedClassFieldReference = getInstruction<ReferenceInstruction>(
|
setPlaybackSpeedClassFieldReference = getInstruction<ReferenceInstruction>(
|
||||||
indexOfFirstInstructionOrThrow(speedSelectionValueInstructionIndex) {
|
indexOfFirstInstructionOrThrow(speedSelectionValueInstructionIndex) {
|
||||||
getReference<FieldReference>()?.type?.startsWith("L") == true
|
fieldReference?.type?.startsWith("L") == true
|
||||||
}
|
}
|
||||||
).reference as FieldReference
|
).reference as FieldReference
|
||||||
|
|
||||||
|
|
@ -398,7 +397,6 @@ val videoInformationPatch = bytecodePatch(
|
||||||
|
|
||||||
// Detect video quality changes and override the current quality.
|
// Detect video quality changes and override the current quality.
|
||||||
videoQualitySetterMethod.immutableClassDef.getSetVideoQualityMethod().let {
|
videoQualitySetterMethod.immutableClassDef.getSetVideoQualityMethod().let {
|
||||||
it
|
|
||||||
// This instruction refers to the field with the type that contains the setQuality method.
|
// This instruction refers to the field with the type that contains the setQuality method.
|
||||||
val onItemClickListenerClassReference =
|
val onItemClickListenerClassReference =
|
||||||
it.getInstruction<ReferenceInstruction>(0).reference
|
it.getInstruction<ReferenceInstruction>(0).reference
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,7 @@ import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import com.android.tools.smali.dexlib2.iface.MethodParameter
|
import com.android.tools.smali.dexlib2.iface.MethodParameter
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.*
|
import com.android.tools.smali.dexlib2.iface.instruction.*
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.Reference
|
import com.android.tools.smali.dexlib2.iface.reference.Reference
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.value.*
|
import com.android.tools.smali.dexlib2.iface.value.*
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableField
|
import com.android.tools.smali.dexlib2.immutable.ImmutableField
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
|
|
@ -40,7 +38,7 @@ import kotlin.collections.remove
|
||||||
*/
|
*/
|
||||||
private fun Method.findInstructionIndexFromToString(fieldName: String): Int {
|
private fun Method.findInstructionIndexFromToString(fieldName: String): Int {
|
||||||
val stringIndex = indexOfFirstInstruction {
|
val stringIndex = indexOfFirstInstruction {
|
||||||
val reference = getReference<StringReference>()
|
val reference = stringReference
|
||||||
reference?.string?.contains(fieldName) == true
|
reference?.string?.contains(fieldName) == true
|
||||||
}
|
}
|
||||||
if (stringIndex < 0) {
|
if (stringIndex < 0) {
|
||||||
|
|
@ -50,7 +48,7 @@ private fun Method.findInstructionIndexFromToString(fieldName: String): Int {
|
||||||
|
|
||||||
// Find use of the string with a StringBuilder.
|
// Find use of the string with a StringBuilder.
|
||||||
val stringUsageIndex = indexOfFirstInstruction(stringIndex) {
|
val stringUsageIndex = indexOfFirstInstruction(stringIndex) {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.definingClass == "Ljava/lang/StringBuilder;" &&
|
reference?.definingClass == "Ljava/lang/StringBuilder;" &&
|
||||||
(this as? FiveRegisterInstruction)?.registerD == stringRegister
|
(this as? FiveRegisterInstruction)?.registerD == stringRegister
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +58,7 @@ private fun Method.findInstructionIndexFromToString(fieldName: String): Int {
|
||||||
|
|
||||||
// Find the next usage of StringBuilder, which should be the desired field.
|
// Find the next usage of StringBuilder, which should be the desired field.
|
||||||
val fieldUsageIndex = indexOfFirstInstruction(stringUsageIndex + 1) {
|
val fieldUsageIndex = indexOfFirstInstruction(stringUsageIndex + 1) {
|
||||||
val reference = getReference<MethodReference>()
|
val reference = methodReference
|
||||||
reference?.definingClass == "Ljava/lang/StringBuilder;" && reference.name == "append"
|
reference?.definingClass == "Ljava/lang/StringBuilder;" && reference.name == "append"
|
||||||
}
|
}
|
||||||
if (fieldUsageIndex < 0) {
|
if (fieldUsageIndex < 0) {
|
||||||
|
|
@ -104,7 +102,7 @@ internal fun Method.findMethodFromToString(fieldName: String): MutableMethod {
|
||||||
*/
|
*/
|
||||||
internal fun Method.findFieldFromToString(fieldName: String): FieldReference {
|
internal fun Method.findFieldFromToString(fieldName: String): FieldReference {
|
||||||
val methodUsageIndex = findInstructionIndexFromToString(fieldName)
|
val methodUsageIndex = findInstructionIndexFromToString(fieldName)
|
||||||
return getInstruction<ReferenceInstruction>(methodUsageIndex).getReference<FieldReference>()!!
|
return getInstruction<ReferenceInstruction>(methodUsageIndex).fieldReference!!
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -380,6 +378,8 @@ fun BytecodePatchContext.traverseClassHierarchy(targetClass: MutableClassDef, ca
|
||||||
* if the [Instruction] is not a [ReferenceInstruction] or the [Reference] is not of type [T].
|
* if the [Instruction] is not a [ReferenceInstruction] or the [Reference] is not of type [T].
|
||||||
* @see ReferenceInstruction
|
* @see ReferenceInstruction
|
||||||
*/
|
*/
|
||||||
|
@Deprecated("Instead use `methodReference`, `fieldReference`, `typeReference` or `stringReference`")
|
||||||
|
@Suppress("unused")
|
||||||
inline fun <reified T : Reference> Instruction.getReference() = (this as? ReferenceInstruction)?.reference as? T
|
inline fun <reified T : Reference> Instruction.getReference() = (this as? ReferenceInstruction)?.reference as? T
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package app.revanced.util
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.instructions
|
import app.revanced.patcher.extensions.instructions
|
||||||
|
import app.revanced.patcher.extensions.reference
|
||||||
import app.revanced.util.FreeRegisterProvider.Companion.conditionalBranchOpcodes
|
import app.revanced.util.FreeRegisterProvider.Companion.conditionalBranchOpcodes
|
||||||
import app.revanced.util.FreeRegisterProvider.Companion.logFreeRegisterSearch
|
import app.revanced.util.FreeRegisterProvider.Companion.logFreeRegisterSearch
|
||||||
import app.revanced.util.FreeRegisterProvider.Companion.returnOpcodes
|
import app.revanced.util.FreeRegisterProvider.Companion.returnOpcodes
|
||||||
|
|
@ -345,7 +346,7 @@ private fun Method.findFreeRegistersInternal(
|
||||||
// If it appears more than once, it's also read.
|
// If it appears more than once, it's also read.
|
||||||
if (occurrences <= 1) {
|
if (occurrences <= 1) {
|
||||||
if (logFreeRegisterSearch) println("Found free register at $i: $writeRegister " +
|
if (logFreeRegisterSearch) println("Found free register at $i: $writeRegister " +
|
||||||
"opcode: " + instruction.opcode + " reference: " + (instruction.getReference()))
|
"opcode: " + instruction.opcode + " reference: " + (instruction.reference))
|
||||||
freeRegisters.add(writeRegister)
|
freeRegisters.add(writeRegister)
|
||||||
// If the requested number of free registers is found and this is not a branch,
|
// If the requested number of free registers is found and this is not a branch,
|
||||||
// then no additional searching is needed.
|
// then no additional searching is needed.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue