mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-07 18:03:55 +01:00
Compare commits
17 Commits
v4.4.0-dev
...
v4.4.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60ace80cbd | ||
|
|
e6a468cf7a | ||
|
|
38392de4a1 | ||
|
|
bc8bc8c798 | ||
|
|
76805e4f31 | ||
|
|
d18719c59c | ||
|
|
743a02f983 | ||
|
|
8306f70fd1 | ||
|
|
5d71f23471 | ||
|
|
122ef68a4b | ||
|
|
b2a7a65bc0 | ||
|
|
32139f151b | ||
|
|
e55364ca87 | ||
|
|
5cca42121a | ||
|
|
7b0365360e | ||
|
|
7f8b7c08b2 | ||
|
|
058acff28c |
56
CHANGELOG.md
56
CHANGELOG.md
@@ -1,3 +1,59 @@
|
||||
# [4.4.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v4.4.0-dev.8...v4.4.0-dev.9) (2024-03-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **TikTok:** Hook application context earlier to prevent crash ([#2893](https://github.com/ReVanced/revanced-patches/issues/2893)) ([395ccda](https://github.com/ReVanced/revanced-patches/commit/395ccda7b9218c522c7ca0f99f75a12036d3e3f3))
|
||||
|
||||
# [4.4.0-dev.8](https://github.com/ReVanced/revanced-patches/compare/v4.4.0-dev.7...v4.4.0-dev.8) (2024-03-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - Downloads:** Use external downloader when selecting 'Download' in home feed flyout menu ([#2881](https://github.com/ReVanced/revanced-patches/issues/2881)) ([10afc8c](https://github.com/ReVanced/revanced-patches/commit/10afc8cc71ff29fea4937fb12fd3d1edf9c581f5))
|
||||
|
||||
# [4.4.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v4.4.0-dev.6...v4.4.0-dev.7) (2024-03-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Client spoof:** Spoof all user agents ([44a8a13](https://github.com/ReVanced/revanced-patches/commit/44a8a1399897caaff3ff45db8549ddedb2f01b68))
|
||||
|
||||
# [4.4.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v4.4.0-dev.5...v4.4.0-dev.6) (2024-03-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Instagram - Hide timeline ads:** Make compatible with latest versions ([a212f29](https://github.com/ReVanced/revanced-patches/commit/a212f29bd33bb5e10f024e058d26e20ee926190b))
|
||||
|
||||
# [4.4.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v4.4.0-dev.4...v4.4.0-dev.5) (2024-03-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube:** Support version `19.05`, `19.06`, `19.07`, `19.08` and `19.09` ([#2862](https://github.com/ReVanced/revanced-patches/issues/2862)) ([f044dde](https://github.com/ReVanced/revanced-patches/commit/f044dde054861ff16846a6be6287f86fa3afb3d8))
|
||||
|
||||
# [4.4.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v4.4.0-dev.3...v4.4.0-dev.4) (2024-03-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube :** Remove `HDR auto brightness` patch ([#2863](https://github.com/ReVanced/revanced-patches/issues/2863)) ([b4c7bf4](https://github.com/ReVanced/revanced-patches/commit/b4c7bf48084184e5f031f7f5139a9a29341d8ebf))
|
||||
|
||||
# [4.4.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v4.4.0-dev.2...v4.4.0-dev.3) (2024-03-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Downloads:** Use new task context ([#2841](https://github.com/ReVanced/revanced-patches/issues/2841)) ([6d88cb4](https://github.com/ReVanced/revanced-patches/commit/6d88cb49ec739700866290babcba5fb3032dbced))
|
||||
|
||||
# [4.4.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v4.4.0-dev.1...v4.4.0-dev.2) (2024-03-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - External downloader:** Add ability to use in-app download button ([d900011](https://github.com/ReVanced/revanced-patches/commit/d9000113a905c14f8409aa75008f1ef6a1aecd0c))
|
||||
|
||||
# [4.4.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.3.0...v4.4.0-dev.1) (2024-03-04)
|
||||
|
||||
|
||||
|
||||
@@ -628,9 +628,19 @@ public abstract class app/revanced/patches/shared/misc/integrations/BaseIntegrat
|
||||
public fun <init> ()V
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)V
|
||||
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
|
||||
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun invoke (Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public abstract interface class app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch$IntegrationsFingerprint$IHookInsertIndexResolver : kotlin/jvm/functions/Function1 {
|
||||
public abstract fun invoke (Lcom/android/tools/smali/dexlib2/iface/Method;)Ljava/lang/Integer;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch$IntegrationsFingerprint$IHookInsertIndexResolver$DefaultImpls {
|
||||
public static fun invoke (Lapp/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch$IntegrationsFingerprint$IHookInsertIndexResolver;Lcom/android/tools/smali/dexlib2/iface/Method;)Ljava/lang/Integer;
|
||||
}
|
||||
|
||||
public abstract interface class app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch$IntegrationsFingerprint$IRegisterResolver : kotlin/jvm/functions/Function1 {
|
||||
public abstract fun invoke (Lcom/android/tools/smali/dexlib2/iface/Method;)Ljava/lang/Integer;
|
||||
}
|
||||
@@ -1194,8 +1204,8 @@ public final class app/revanced/patches/youtube/interaction/dialog/RemoveViewerD
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/interaction/downloads/ExternalDownloadsBytecodePatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/interaction/downloads/ExternalDownloadsBytecodePatch;
|
||||
public final class app/revanced/patches/youtube/interaction/downloads/DownloadsPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/interaction/downloads/DownloadsPatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
@@ -1514,10 +1524,12 @@ public final class app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDevic
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public final class app/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch : app/revanced/patches/all/misc/transformation/BaseTransformInstructionsPatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
public synthetic fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Ljava/lang/Object;
|
||||
public fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Lkotlin/Triple;
|
||||
public synthetic fun transform (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Ljava/lang/Object;)V
|
||||
public fun transform (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Lkotlin/Triple;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/fix/playback/SpoofSignaturePatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
@@ -1748,6 +1760,7 @@ public final class app/revanced/util/BytecodeUtilsKt {
|
||||
public static final fun indexOfFirstInstruction (Lcom/android/tools/smali/dexlib2/iface/Method;Lkotlin/jvm/functions/Function1;)I
|
||||
public static final fun indexOfFirstWideLiteralInstructionValue (Lcom/android/tools/smali/dexlib2/iface/Method;J)I
|
||||
public static final fun injectHideViewCall (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;IILjava/lang/String;Ljava/lang/String;)V
|
||||
public static final fun resultOrThrow (Lapp/revanced/patcher/fingerprint/MethodFingerprint;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult;
|
||||
public static final fun returnEarly (Ljava/util/List;Z)V
|
||||
public static synthetic fun returnEarly$default (Ljava/util/List;ZILjava/lang/Object;)V
|
||||
public static final fun transformMethods (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;Lkotlin/jvm/functions/Function1;)V
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import org.gradle.kotlin.dsl.support.listFilesOrdered
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin)
|
||||
@@ -33,7 +34,13 @@ dependencies {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(11)
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_11)
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 4.4.0-dev.1
|
||||
version = 4.4.0-dev.9
|
||||
|
||||
@@ -1,102 +1,63 @@
|
||||
package app.revanced.patches.instagram.patches.ads.timeline
|
||||
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.MediaFingerprint
|
||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.IsAdCheckOneFingerprint
|
||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.IsAdCheckTwoFingerprint
|
||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ShowAdFingerprint
|
||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.GenericMediaAdFingerprint
|
||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.MediaAdFingerprint
|
||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.PaidPartnershipAdFingerprint
|
||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.ShoppingAdFingerprint
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Hide timeline ads",
|
||||
description = "Removes ads from the timeline.",
|
||||
compatiblePackages = [CompatiblePackage("com.instagram.android", ["275.0.0.27.98"])]
|
||||
compatiblePackages = [CompatiblePackage("com.instagram.android")],
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideTimelineAdsPatch : BytecodePatch(
|
||||
setOf(
|
||||
ShowAdFingerprint,
|
||||
MediaFingerprint,
|
||||
PaidPartnershipAdFingerprint // Unlike the other ads this one is resolved from all classes.
|
||||
)
|
||||
IsAdCheckOneFingerprint,
|
||||
IsAdCheckTwoFingerprint,
|
||||
),
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// region Resolve required methods to check for ads.
|
||||
// The exact function of the following methods is unknown.
|
||||
// They are used to check if a post is an ad.
|
||||
val isAdCheckOneMethod = IsAdCheckOneFingerprint.result?.method ?: throw IsAdCheckOneFingerprint.exception
|
||||
val isAdCheckTwoMethod = IsAdCheckTwoFingerprint.result?.method ?: throw IsAdCheckTwoFingerprint.exception
|
||||
|
||||
ShowAdFingerprint.result ?: throw ShowAdFingerprint.exception
|
||||
ShowAdFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
// The register that holds the post object.
|
||||
val postRegister = getInstruction<FiveRegisterInstruction>(1).registerC
|
||||
|
||||
PaidPartnershipAdFingerprint.result ?: throw PaidPartnershipAdFingerprint.exception
|
||||
// At this index the check for an ad can be performed.
|
||||
val checkIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
MediaFingerprint.result?.let {
|
||||
GenericMediaAdFingerprint.resolve(context, it.classDef)
|
||||
ShoppingAdFingerprint.resolve(context, it.classDef)
|
||||
|
||||
return@let
|
||||
} ?: throw MediaFingerprint.exception
|
||||
|
||||
// endregion
|
||||
|
||||
ShowAdFingerprint.result!!.apply {
|
||||
// region Create instructions.
|
||||
|
||||
val scanStart = scanResult.patternScanResult!!.startIndex
|
||||
val jumpIndex = scanStart - 1
|
||||
|
||||
val mediaInstanceRegister = mutableMethod.getInstruction<FiveRegisterInstruction>(scanStart).registerC
|
||||
val freeRegister = mutableMethod.getInstruction<OneRegisterInstruction>(jumpIndex).registerA
|
||||
|
||||
val returnFalseLabel = "an_ad"
|
||||
|
||||
val checkForAdInstructions =
|
||||
listOf(GenericMediaAdFingerprint, PaidPartnershipAdFingerprint, ShoppingAdFingerprint)
|
||||
.map(MediaAdFingerprint::toString)
|
||||
.joinToString("\n") {
|
||||
"""
|
||||
invoke-virtual {v$mediaInstanceRegister}, $it
|
||||
move-result v$freeRegister
|
||||
if-nez v$freeRegister, :$returnFalseLabel
|
||||
""".trimIndent()
|
||||
}.let { "$it\nconst/4 v0, 0x1\nreturn v0" }
|
||||
|
||||
// endregion
|
||||
|
||||
// region Patch.
|
||||
|
||||
val insertIndex = scanStart + 3
|
||||
|
||||
mutableMethod.addInstructionsWithLabels(
|
||||
insertIndex,
|
||||
checkForAdInstructions,
|
||||
ExternalLabel(
|
||||
returnFalseLabel,
|
||||
mutableMethod.getInstruction(mutableMethod.implementation!!.instructions.size - 2 /* return false = ad */)
|
||||
)
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
||||
// region Jump to checks for ads from previous patch.
|
||||
|
||||
mutableMethod.apply {
|
||||
// If either check returns true, the post is an ad and is hidden by returning false.
|
||||
addInstructionsWithLabels(
|
||||
jumpIndex + 1,
|
||||
"if-nez v$freeRegister, :start_check",
|
||||
ExternalLabel("start_check", getInstruction(insertIndex))
|
||||
checkIndex,
|
||||
"""
|
||||
invoke-virtual { v$postRegister }, $isAdCheckOneMethod
|
||||
move-result v0
|
||||
if-nez v0, :hide_ad
|
||||
|
||||
invoke-static { v$postRegister }, $isAdCheckTwoMethod
|
||||
move-result v0
|
||||
if-eqz v0, :not_an_ad
|
||||
|
||||
:hide_ad
|
||||
const/4 v0, 0x0 # Returning false to hide the ad.
|
||||
return v0
|
||||
""",
|
||||
ExternalLabel("not_an_ad", getInstruction(checkIndex)),
|
||||
)
|
||||
}.removeInstruction(jumpIndex)
|
||||
|
||||
// endregion
|
||||
}
|
||||
}
|
||||
} ?: throw ShowAdFingerprint.exception
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal object IsAdCheckOneFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
opcodes = listOf(
|
||||
Opcode.XOR_INT_LIT8,
|
||||
Opcode.IF_NE,
|
||||
Opcode.RETURN,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
),
|
||||
)
|
||||
@@ -1,8 +1,14 @@
|
||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
|
||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal object GenericMediaAdFingerprint : MediaAdFingerprint(
|
||||
internal object IsAdCheckTwoFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
@@ -12,7 +18,5 @@ internal object GenericMediaAdFingerprint : MediaAdFingerprint(
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.CONST_4,
|
||||
Opcode.RETURN,
|
||||
)
|
||||
) {
|
||||
override fun toString() = result!!.method.toString()
|
||||
}
|
||||
),
|
||||
)
|
||||
@@ -1,7 +0,0 @@
|
||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
internal object MediaFingerprint : MethodFingerprint(
|
||||
strings = listOf("force_overlay", "Media#updateFields", "live_reels_metadata")
|
||||
)
|
||||
@@ -10,16 +10,12 @@ internal object ShowAdFingerprint : MethodFingerprint(
|
||||
AccessFlags.PUBLIC or AccessFlags.STATIC or AccessFlags.FINAL,
|
||||
listOf("L", "L", "Z", "Z"),
|
||||
opcodes = listOf(
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.IF_NE,
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.RETURN,
|
||||
Opcode.CONST_4,
|
||||
Opcode.GOTO,
|
||||
Opcode.CONST_4,
|
||||
Opcode.GOTO,
|
||||
Opcode.CONST_4,
|
||||
Opcode.GOTO,
|
||||
Opcode.CONST_4,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||
import com.android.tools.smali.dexlib2.iface.Method
|
||||
|
||||
internal abstract class MediaAdFingerprint(
|
||||
returnType: String? = "Z",
|
||||
accessFlags: Int? = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters: Iterable<String>? = listOf(),
|
||||
opcodes: Iterable<Opcode>?,
|
||||
customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null
|
||||
) : MethodFingerprint(
|
||||
returnType,
|
||||
accessFlags,
|
||||
parameters,
|
||||
opcodes,
|
||||
customFingerprint = customFingerprint
|
||||
) {
|
||||
abstract override fun toString(): String
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
|
||||
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
internal object PaidPartnershipAdFingerprint : MediaAdFingerprint(
|
||||
"V",
|
||||
null,
|
||||
listOf("L", "L"),
|
||||
listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IPUT_BOOLEAN,
|
||||
Opcode.IPUT_BOOLEAN
|
||||
),
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("ClipsEditMetadataController;")
|
||||
}
|
||||
) {
|
||||
override fun toString() = result!!.let {
|
||||
val adCheckIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val adCheckInstruction = it.method.implementation!!.instructions.elementAt(adCheckIndex)
|
||||
|
||||
val adCheckMethod = (adCheckInstruction as ReferenceInstruction).reference as MethodReference
|
||||
|
||||
adCheckMethod.toString()
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
|
||||
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal object ShoppingAdFingerprint : MediaAdFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.XOR_INT_LIT8,
|
||||
Opcode.IF_EQZ,
|
||||
)
|
||||
) {
|
||||
override fun toString() = result!!.method.toString()
|
||||
}
|
||||
@@ -49,7 +49,8 @@ abstract class BaseIntegrationsPatch(
|
||||
opcodes: Iterable<Opcode?>? = null,
|
||||
strings: Iterable<String>? = null,
|
||||
customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null,
|
||||
private val contextRegisterResolver: (Method) -> Int = object : IRegisterResolver {},
|
||||
private val insertIndexResolver: ((Method) -> Int) = object : IHookInsertIndexResolver {},
|
||||
private val contextRegisterResolver: (Method) -> Int = object : IRegisterResolver {}
|
||||
) : MethodFingerprint(
|
||||
returnType,
|
||||
accessFlags,
|
||||
@@ -58,18 +59,45 @@ abstract class BaseIntegrationsPatch(
|
||||
strings,
|
||||
customFingerprint,
|
||||
) {
|
||||
@Deprecated("Previous constructor that is missing the insert index." +
|
||||
"Here only for binary compatibility, " +
|
||||
"and this can be removed after the next major version update.")
|
||||
constructor(
|
||||
returnType: String? = null,
|
||||
accessFlags: Int? = null,
|
||||
parameters: Iterable<String>? = null,
|
||||
opcodes: Iterable<Opcode?>? = null,
|
||||
strings: Iterable<String>? = null,
|
||||
customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null,
|
||||
contextRegisterResolver: (Method) -> Int = object : IRegisterResolver {}
|
||||
) : this(
|
||||
returnType,
|
||||
accessFlags,
|
||||
parameters,
|
||||
opcodes,
|
||||
strings,
|
||||
customFingerprint,
|
||||
object : IHookInsertIndexResolver {},
|
||||
contextRegisterResolver
|
||||
)
|
||||
|
||||
fun invoke(integrationsDescriptor: String) {
|
||||
result?.mutableMethod?.let { method ->
|
||||
val insertIndex = insertIndexResolver(method)
|
||||
val contextRegister = contextRegisterResolver(method)
|
||||
|
||||
method.addInstruction(
|
||||
0,
|
||||
"sput-object v$contextRegister, " +
|
||||
"$integrationsDescriptor->context:Landroid/content/Context;",
|
||||
insertIndex,
|
||||
"invoke-static/range { v$contextRegister .. v$contextRegister }, " +
|
||||
"$integrationsDescriptor->setContext(Landroid/content/Context;)V",
|
||||
)
|
||||
} ?: throw PatchException("Could not find hook target fingerprint.")
|
||||
}
|
||||
|
||||
interface IHookInsertIndexResolver : (Method) -> Int {
|
||||
override operator fun invoke(method: Method) = 0
|
||||
}
|
||||
|
||||
interface IRegisterResolver : (Method) -> Int {
|
||||
override operator fun invoke(method: Method) = method.implementation!!.registerCount - 1
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package app.revanced.patches.tiktok.misc.integrations.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.IntegrationsFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object InitFingerprint : IntegrationsFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("/AwemeHostApplication;") &&
|
||||
methodDef.name == "onCreate"
|
||||
}
|
||||
methodDef.name == "<init>"
|
||||
},
|
||||
insertIndexResolver = { 1 } // Insert after call to super class.
|
||||
)
|
||||
@@ -36,9 +36,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37",
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -30,9 +30,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -35,9 +35,13 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -23,9 +23,13 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37",
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -39,7 +43,6 @@ object CopyVideoUrlBytecodePatch : BytecodePatch(emptySet()) {
|
||||
)
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// Initialize buttons and inject visibility control
|
||||
BUTTONS_DESCRIPTORS.forEach { descriptor ->
|
||||
PlayerControlsBytecodePatch.initializeControl("$descriptor->initializeButton(Landroid/view/View;)V")
|
||||
PlayerControlsBytecodePatch.injectVisibilityCheckCall("$descriptor->changeVisibility(Z)V")
|
||||
|
||||
@@ -32,9 +32,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package app.revanced.patches.youtube.interaction.downloads
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.interaction.downloads.fingerprints.OfflineVideoEndpointFingerprint
|
||||
import app.revanced.patches.youtube.misc.playercontrols.PlayerControlsBytecodePatch
|
||||
import app.revanced.patches.youtube.shared.fingerprints.MainActivityFingerprint
|
||||
import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
import app.revanced.util.resultOrThrow
|
||||
|
||||
@Patch(
|
||||
name = "Downloads",
|
||||
description = "Adds support to download videos with an external downloader app" +
|
||||
"using the in-app download button or a video player action button.",
|
||||
dependencies = [
|
||||
DownloadsResourcePatch::class,
|
||||
PlayerControlsBytecodePatch::class,
|
||||
VideoInformationPatch::class,
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.48.39",
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.36",
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
@Suppress("unused")
|
||||
object DownloadsPatch : BytecodePatch(
|
||||
setOf(
|
||||
OfflineVideoEndpointFingerprint,
|
||||
MainActivityFingerprint
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/DownloadsPatch;"
|
||||
private const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/youtube/videoplayer/ExternalDownloadButton;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
PlayerControlsBytecodePatch.initializeControl("$BUTTON_DESCRIPTOR->initializeButton(Landroid/view/View;)V")
|
||||
PlayerControlsBytecodePatch.injectVisibilityCheckCall("$BUTTON_DESCRIPTOR->changeVisibility(Z)V")
|
||||
|
||||
// Main activity is used to launch downloader intent.
|
||||
MainActivityFingerprint.resultOrThrow().mutableMethod.apply {
|
||||
addInstruction(
|
||||
implementation!!.instructions.lastIndex,
|
||||
"invoke-static { p0 }, $INTEGRATIONS_CLASS_DESCRIPTOR->activityCreated(Landroid/app/Activity;)V"
|
||||
)
|
||||
}
|
||||
|
||||
OfflineVideoEndpointFingerprint.resultOrThrow().mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static/range {p3 .. p3}, $INTEGRATIONS_CLASS_DESCRIPTOR->inAppDownloadButtonOnClick(Ljava/lang/String;)Z
|
||||
move-result v0
|
||||
if-eqz v0, :show_native_downloader
|
||||
return-void
|
||||
:show_native_downloader
|
||||
nop
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import app.revanced.util.copyResources
|
||||
AddResourcesPatch::class,
|
||||
],
|
||||
)
|
||||
internal object ExternalDownloadsResourcePatch : ResourcePatch() {
|
||||
internal object DownloadsResourcePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
AddResourcesPatch(this::class)
|
||||
|
||||
@@ -31,6 +31,7 @@ internal object ExternalDownloadsResourcePatch : ResourcePatch() {
|
||||
sorting = Sorting.UNSORTED,
|
||||
preferences = setOf(
|
||||
SwitchPreference("revanced_external_downloader"),
|
||||
SwitchPreference("revanced_external_downloader_action_button"),
|
||||
TextPreference("revanced_external_downloader_name", inputType = InputType.TEXT),
|
||||
),
|
||||
),
|
||||
@@ -1,54 +0,0 @@
|
||||
package app.revanced.patches.youtube.interaction.downloads
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.misc.playercontrols.PlayerControlsBytecodePatch
|
||||
import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
|
||||
@Patch(
|
||||
name = "External downloads",
|
||||
description = "Adds support to download and save YouTube videos using an external downloader app.",
|
||||
dependencies = [
|
||||
ExternalDownloadsResourcePatch::class,
|
||||
PlayerControlsBytecodePatch::class,
|
||||
VideoInformationPatch::class,
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.48.39",
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37",
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
@Suppress("unused")
|
||||
object ExternalDownloadsBytecodePatch : BytecodePatch(emptySet()) {
|
||||
private const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/youtube/videoplayer/ExternalDownloadButton;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
/*
|
||||
initialize the control
|
||||
*/
|
||||
|
||||
PlayerControlsBytecodePatch.initializeControl(
|
||||
"$BUTTON_DESCRIPTOR->initializeButton(Landroid/view/View;)V",
|
||||
)
|
||||
|
||||
/*
|
||||
add code to change the visibility of the control
|
||||
*/
|
||||
|
||||
PlayerControlsBytecodePatch.injectVisibilityCheckCall(
|
||||
"$BUTTON_DESCRIPTOR->changeVisibility(Z)V",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.revanced.patches.youtube.interaction.downloads.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object OfflineVideoEndpointFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
returnType = "V",
|
||||
parameters = listOf(
|
||||
"Ljava/util/Map;",
|
||||
"L",
|
||||
"Ljava/lang/String", // VideoId
|
||||
"L"),
|
||||
strings = listOf("Object is not an offlineable video: ")
|
||||
)
|
||||
@@ -32,9 +32,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -34,9 +34,13 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -30,9 +30,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
],
|
||||
|
||||
@@ -36,9 +36,13 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -34,9 +34,13 @@ import app.revanced.util.exception
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
],
|
||||
|
||||
@@ -33,9 +33,13 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -43,9 +43,13 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -34,9 +34,13 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -41,9 +41,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37",
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -38,9 +38,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -32,9 +32,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -32,9 +32,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -32,9 +32,13 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -32,9 +32,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -35,9 +35,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -32,9 +32,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -28,9 +28,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -28,9 +28,13 @@ import app.revanced.util.exception
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -48,9 +48,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37",
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -39,9 +39,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -28,9 +28,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -33,9 +33,13 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -30,9 +30,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -35,9 +35,13 @@ import app.revanced.patches.youtube.shared.fingerprints.SeekbarOnDrawFingerprint
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -40,9 +40,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -27,9 +27,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -28,9 +28,13 @@ import app.revanced.util.exception
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -29,9 +29,13 @@ import app.revanced.util.exception
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -24,9 +24,13 @@ import org.w3c.dom.Element
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37",
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -32,6 +32,7 @@ import app.revanced.patches.youtube.video.videoid.VideoIdPatch
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import app.revanced.util.resultOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@@ -57,9 +58,13 @@ import com.android.tools.smali.dexlib2.iface.reference.TypeReference
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
@@ -88,8 +93,6 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/youtube/patches/components/ReturnYouTubeDislikeFilterPatch;"
|
||||
|
||||
private fun MethodFingerprint.resultOrThrow() = result ?: throw exception
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// region Inject newVideoLoaded event handler to update dislikes when a new video is loaded.
|
||||
|
||||
|
||||
@@ -33,9 +33,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -29,9 +29,13 @@ import app.revanced.util.exception
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -42,9 +42,13 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
],
|
||||
|
||||
@@ -32,9 +32,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -38,9 +38,13 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -37,9 +37,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
)
|
||||
)
|
||||
]
|
||||
|
||||
@@ -41,9 +41,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -23,7 +23,7 @@ import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.reques
|
||||
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback.OnSucceededFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.resultOrThrow
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||
@@ -53,9 +53,13 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37",
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -144,11 +148,8 @@ object AlternativeThumbnailsPatch : BytecodePatch(
|
||||
NonInteractivePreference("revanced_alt_thumbnail_stills_about"),
|
||||
)
|
||||
|
||||
fun MethodFingerprint.getResultOrThrow() =
|
||||
result ?: throw exception
|
||||
|
||||
fun MethodFingerprint.alsoResolve(fingerprint: MethodFingerprint) =
|
||||
also { resolve(context, fingerprint.getResultOrThrow().classDef) }.getResultOrThrow()
|
||||
also { resolve(context, fingerprint.resultOrThrow().classDef) }.resultOrThrow()
|
||||
|
||||
fun MethodFingerprint.resolveAndLetMutableMethod(
|
||||
fingerprint: MethodFingerprint,
|
||||
@@ -172,7 +173,7 @@ object AlternativeThumbnailsPatch : BytecodePatch(
|
||||
|
||||
// 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.
|
||||
RequestFingerprint.getResultOrThrow().apply {
|
||||
RequestFingerprint.resultOrThrow().apply {
|
||||
// The url is the only string field that is set inside the constructor.
|
||||
val urlFieldInstruction = mutableMethod.getInstructions().first {
|
||||
if (it.opcode != Opcode.IPUT_OBJECT) return@first false
|
||||
|
||||
@@ -33,9 +33,13 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -28,9 +28,13 @@ import app.revanced.util.exception
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -1,47 +1,87 @@
|
||||
package app.revanced.patches.youtube.misc.fix.playback
|
||||
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.UserAgentHeaderBuilderFingerprint
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.all.misc.transformation.BaseTransformInstructionsPatch
|
||||
import app.revanced.patches.all.misc.transformation.IMethodCall
|
||||
import app.revanced.patches.all.misc.transformation.Instruction35cInfo
|
||||
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
|
||||
import app.revanced.util.getReference
|
||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||
import com.android.tools.smali.dexlib2.iface.Method
|
||||
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.reference.MethodReference
|
||||
|
||||
@Patch(
|
||||
name = "Client spoof",
|
||||
description = "Adds options to spoof the client to allow video playback.",
|
||||
dependencies = [SpoofSignaturePatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"18.48.39",
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
CompatiblePackage("com.google.android.youtube"),
|
||||
],
|
||||
)
|
||||
object ClientSpoofPatch : BytecodePatch(
|
||||
setOf(UserAgentHeaderBuilderFingerprint)
|
||||
) {
|
||||
object ClientSpoofPatch : BaseTransformInstructionsPatch<Instruction35cInfo>() {
|
||||
private const val ORIGINAL_PACKAGE_NAME = "com.google.android.youtube"
|
||||
private const val USER_AGENT_STRING_BUILDER_APPEND_METHOD_REFERENCE =
|
||||
"Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
UserAgentHeaderBuilderFingerprint.result?.let { result ->
|
||||
val insertIndex = result.scanResult.patternScanResult!!.endIndex
|
||||
result.mutableMethod.apply {
|
||||
val packageNameRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||
override fun filterMap(
|
||||
classDef: ClassDef,
|
||||
method: Method,
|
||||
instruction: Instruction,
|
||||
instructionIndex: Int,
|
||||
) = filterMapInstruction35c<MethodCall>(
|
||||
"Lapp/revanced/integrations",
|
||||
classDef,
|
||||
instruction,
|
||||
instructionIndex,
|
||||
)
|
||||
|
||||
addInstruction(insertIndex, "const-string v$packageNameRegister, \"$ORIGINAL_PACKAGE_NAME\"")
|
||||
}
|
||||
override fun transform(mutableMethod: MutableMethod, entry: Instruction35cInfo) {
|
||||
val (_, _, instructionIndex) = entry
|
||||
|
||||
} ?: throw UserAgentHeaderBuilderFingerprint.exception
|
||||
// Replace the result of context.getPackageName(), if it is used in a user agent string.
|
||||
mutableMethod.apply {
|
||||
// After context.getPackageName() the result is moved to a register.
|
||||
val targetRegister = (
|
||||
getInstruction(instructionIndex + 1)
|
||||
as? OneRegisterInstruction ?: return
|
||||
).registerA
|
||||
|
||||
// IndexOutOfBoundsException is not possible here,
|
||||
// but no such occurrences are present in the app.
|
||||
val referee = getInstruction(instructionIndex + 2).getReference<MethodReference>()?.toString()
|
||||
|
||||
// This can technically also match non-user agent string builder append methods,
|
||||
// but no such occurrences are present in the app.
|
||||
if (referee != USER_AGENT_STRING_BUILDER_APPEND_METHOD_REFERENCE) {
|
||||
return
|
||||
}
|
||||
|
||||
// Overwrite the result of context.getPackageName() with the original package name.
|
||||
replaceInstruction(
|
||||
instructionIndex + 1,
|
||||
"const-string v$targetRegister, \"${ORIGINAL_PACKAGE_NAME}\"",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
private enum class MethodCall(
|
||||
override val definedClassName: String,
|
||||
override val methodName: String,
|
||||
override val methodParams: Array<String>,
|
||||
override val returnType: String,
|
||||
) : IMethodCall {
|
||||
GetPackageName(
|
||||
"Landroid/content/Context;",
|
||||
"getPackageName",
|
||||
emptyArray(),
|
||||
"Ljava/lang/String;",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package app.revanced.patches.youtube.misc.fix.playback.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal object UserAgentHeaderBuilderFingerprint : MethodFingerprint(
|
||||
parameters = listOf("L", "L", "L"),
|
||||
opcodes = listOf(Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_VIRTUAL),
|
||||
strings = listOf("(Linux; U; Android "),
|
||||
)
|
||||
@@ -38,9 +38,13 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
@@ -30,9 +30,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -34,9 +34,13 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -10,14 +10,20 @@ import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.litho.filter.fingerprints.*
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
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.OneRegisterInstruction
|
||||
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 java.io.Closeable
|
||||
|
||||
@Patch(
|
||||
@@ -102,7 +108,11 @@ object LithoFilterPatch : BytecodePatch(
|
||||
val emptyComponentFieldIndex = builderMethodIndex + 2
|
||||
|
||||
bytesToComponentContextMethod.mutableMethod.apply {
|
||||
val insertHookIndex = bytesToComponentContextMethod.scanResult.patternScanResult!!.endIndex + 1
|
||||
val insertHookIndex = indexOfFirstInstruction {
|
||||
opcode == Opcode.IPUT_OBJECT &&
|
||||
getReference<FieldReference>()?.type == "Ljava/lang/StringBuilder;"
|
||||
} + 1
|
||||
if (insertHookIndex <= 0) throw PatchException("Could not find insert index")
|
||||
|
||||
// region Get free registers that this patch uses.
|
||||
// Registers are overwritten right after they are used in this patch, therefore free to clobber.
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
package app.revanced.patches.youtube.misc.litho.filter.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal object ComponentContextParserFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IPUT_OBJECT,
|
||||
),
|
||||
strings = listOf("Component was not found %s because it was removed due to duplicate converter bindings.")
|
||||
)
|
||||
@@ -39,9 +39,13 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -3,30 +3,31 @@ package app.revanced.patches.youtube.misc.playeroverlay
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.playeroverlay.fingerprint.PlayerOverlaysOnFinishInflateFingerprint
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
description = "Hook for adding custom overlays to the video player.",
|
||||
description = "Hook for the video player overlay",
|
||||
dependencies = [IntegrationsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.google.android.youtube", [
|
||||
"18.32.39"
|
||||
])
|
||||
]
|
||||
)
|
||||
|
||||
/**
|
||||
* Edit: This patch is not in use and may not work.
|
||||
*/
|
||||
@Suppress("unused")
|
||||
object PlayerOverlaysHookPatch : BytecodePatch( // TODO: delete this unused outdated patch and its integration code.
|
||||
object PlayerOverlaysHookPatch : BytecodePatch(
|
||||
setOf(PlayerOverlaysOnFinishInflateFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/PlayerOverlaysHookPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// hook YouTubePlayerOverlaysLayout.onFinishInflate()
|
||||
val method = PlayerOverlaysOnFinishInflateFingerprint.result!!.mutableMethod
|
||||
method.addInstruction(
|
||||
method.implementation!!.instructions.size - 2,
|
||||
"invoke-static { p0 }, Lapp/revanced/integrations/youtube/patches/PlayerOverlaysHookPatch;->YouTubePlayerOverlaysLayout_onFinishInflateHook(Ljava/lang/Object;)V"
|
||||
)
|
||||
PlayerOverlaysOnFinishInflateFingerprint.result?.mutableMethod?.apply {
|
||||
addInstruction(
|
||||
implementation!!.instructions.lastIndex,
|
||||
"invoke-static { p0 }, $INTEGRATIONS_CLASS_DESCRIPTOR->playerOverlayInflated(Landroid/view/ViewGroup;)V"
|
||||
)
|
||||
} ?: throw PlayerOverlaysOnFinishInflateFingerprint.exception
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
package app.revanced.patches.youtube.misc.playeroverlay.fingerprint
|
||||
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object PlayerOverlaysOnFinishInflateFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
returnType = "V",
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("YouTubePlayerOverlaysLayout;") && methodDef.name == "onFinishInflate"
|
||||
}
|
||||
methodDef.definingClass.endsWith("/YouTubePlayerOverlaysLayout;")
|
||||
&& methodDef.name == "onFinishInflate"
|
||||
},
|
||||
)
|
||||
|
||||
@@ -35,9 +35,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -10,17 +10,19 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.hdrbrightness.fingerprints.HDRBrightnessFingerprint
|
||||
import app.revanced.util.exception
|
||||
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.reference.FieldReference
|
||||
|
||||
@Deprecated("Patch is obsolete and the hooked code is no longer present in 19.09+")
|
||||
@Patch(
|
||||
name = "HDR auto brightness",
|
||||
description = "Adds an option to make the brightness of HDR videos follow the system default.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.32.39",
|
||||
"18.37.36",
|
||||
"18.38.44",
|
||||
@@ -31,41 +33,49 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
// 19.09+ is dramatically different and the patched code is not present.
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HDRBrightnessPatch : BytecodePatch(
|
||||
setOf(HDRBrightnessFingerprint)
|
||||
setOf(HDRBrightnessFingerprint),
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
AddResourcesPatch(this::class)
|
||||
|
||||
if (HDRBrightnessFingerprint.result == null) throw HDRBrightnessFingerprint.exception
|
||||
|
||||
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
|
||||
SwitchPreference("revanced_hdr_auto_brightness")
|
||||
SwitchPreference("revanced_hdr_auto_brightness"),
|
||||
)
|
||||
|
||||
val method = HDRBrightnessFingerprint.result!!.mutableMethod
|
||||
|
||||
method.implementation!!.instructions.filter { instruction ->
|
||||
val fieldReference = (instruction as? ReferenceInstruction)?.reference as? FieldReference
|
||||
fieldReference?.let { it.name == "screenBrightness" } == true
|
||||
}.forEach { instruction ->
|
||||
val brightnessRegisterIndex = method.implementation!!.instructions.indexOf(instruction)
|
||||
val register = (instruction as TwoRegisterInstruction).registerA
|
||||
|
||||
val insertIndex = brightnessRegisterIndex + 1
|
||||
method.addInstructions(
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static {v$register}, Lapp/revanced/integrations/youtube/patches/HDRAutoBrightnessPatch;->getHDRBrightness(F)F
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
// FIXME
|
||||
// One of the changes made here effectively does nothing:
|
||||
// It calls getHDRBrightness() and ignores the results.
|
||||
HDRBrightnessFingerprint.result?.mutableMethod?.apply {
|
||||
implementation!!.instructions.filter { instruction ->
|
||||
((instruction as? ReferenceInstruction)?.reference as? FieldReference)
|
||||
?.name == "screenBrightness"
|
||||
}.forEach { instruction ->
|
||||
val brightnessRegisterIndex = implementation!!.instructions.indexOf(instruction)
|
||||
val register = (instruction as TwoRegisterInstruction).registerA
|
||||
val insertIndex = brightnessRegisterIndex + 1
|
||||
addInstructions(
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static {v$register}, Lapp/revanced/integrations/youtube/patches/HDRAutoBrightnessPatch;->getHDRBrightness(F)F
|
||||
move-result v$register
|
||||
""",
|
||||
)
|
||||
}
|
||||
} ?: throw HDRBrightnessFingerprint.exception
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,13 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -19,9 +19,13 @@ import app.revanced.patches.youtube.video.speed.remember.RememberPlaybackSpeedPa
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37",
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -35,9 +35,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.49.37",
|
||||
"19.01.34",
|
||||
"19.02.39",
|
||||
"19.03.35",
|
||||
"19.03.36",
|
||||
"19.04.37"
|
||||
"19.04.38",
|
||||
"19.05.36",
|
||||
"19.06.39",
|
||||
"19.07.40",
|
||||
"19.08.36",
|
||||
"19.09.37"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -15,6 +15,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.Reference
|
||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||
|
||||
|
||||
fun MethodFingerprint.resultOrThrow() = result ?: throw exception
|
||||
|
||||
/**
|
||||
* The [PatchException] of failing to resolve a [MethodFingerprint].
|
||||
*
|
||||
|
||||
@@ -226,12 +226,15 @@
|
||||
<string name="revanced_remove_viewer_discretion_dialog_summary_off">Dialog will be shown</string>
|
||||
<string name="revanced_remove_viewer_discretion_dialog_user_dialog_message">This does not bypass the age restriction. It just accepts it automatically.</string>
|
||||
</patch>
|
||||
<patch id="interaction.downloads.ExternalDownloadsResourcePatch">
|
||||
<patch id="interaction.downloads.DownloadsResourcePatch">
|
||||
<string name="revanced_external_downloader_screen_title">External downloads</string>
|
||||
<string name="revanced_external_downloader_screen_summary">Settings for using an external downloader</string>
|
||||
<string name="revanced_external_downloader_title">Show external download button</string>
|
||||
<string name="revanced_external_downloader_summary_on">Download button shown in player</string>
|
||||
<string name="revanced_external_downloader_summary_off">Download button not shown in player</string>
|
||||
<string name="revanced_external_downloader_action_button_title">Override download action button</string>
|
||||
<string name="revanced_external_downloader_action_button_summary_on">Download button opens your external downloader</string>
|
||||
<string name="revanced_external_downloader_action_button_summary_off">Download button opens the native in-app downloader</string>
|
||||
<string name="revanced_external_downloader_name_title">Downloader package name</string>
|
||||
<string name="revanced_external_downloader_name_summary">Package name of your installed external downloader app, such as NewPipe or Seal</string>
|
||||
<string name="revanced_external_downloader_not_installed_warning">%s is not installed. Please install it.</string>
|
||||
|
||||
Reference in New Issue
Block a user