From bad25dec1d73137f8b7a1bf4daaceb2279b4d48c Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 May 2022 17:11:34 +0200 Subject: [PATCH] feat: update patches to latest version Signed-off-by: oSumAtrIX --- .../audio/codecs/patch/CodecsUnlockPatch.kt | 4 +- .../patch/RemoveTasteBuilderPatch.kt | 2 +- .../patch/RemoveUpgradeButtonPatch.kt | 10 +-- .../annotation/PromotionsCompatibility.kt | 2 +- .../youtube/ad/home/patch/HomeAdsPatch.kt | 2 +- .../PromotedDiscoveryActionParentSignature.kt | 6 +- .../PromotedDiscoveryAppParentSignature.kt | 8 +-- .../annotations/VideoAdsCompatibility.kt | 2 +- .../ShowVideoAdsConstructorSignature.kt | 6 +- .../annotation/SeekbarTappingCompatibility.kt | 2 +- .../patch/EnableSeekbarTappingPatch.kt | 10 +-- .../SeekbarTappingParentSignature.kt | 2 +- .../signatures/SeekbarTappingSignature.kt | 2 +- .../amoled/annotations/AmoledCompatibility.kt | 2 +- .../layout/amoled/patch/AmoledPatch.kt | 19 +++--- .../annotations/CreateButtonCompatibility.kt | 2 +- .../patch/CreateButtonRemoverPatch.kt | 8 +-- .../signatures/CreateButtonSignature.kt | 2 +- .../MinimizedPlaybackCompatibility.kt | 2 +- .../MinimizedPlaybackManagerSignature.kt | 2 +- .../OldQualityLayoutCompatibility.kt | 2 +- .../patch/OldQualityLayoutPatch.kt | 2 +- .../layout/reels/patch/HideReelsPatch.kt | 5 +- .../reels/signatures/HideReelsSignature.kt | 40 +----------- .../annotations/ShortsButtonCompatibility.kt | 2 +- .../button/patch/ShortsButtonRemoverPatch.kt | 8 +-- .../PivotBarButtonTabenumSignature.kt | 2 +- .../PivotBarButtonsViewSignature.kt | 2 +- .../annotations/IntegrationsCompatibility.kt | 2 +- .../integrations/patch/IntegrationsPatch.kt | 2 +- .../integrations/signatures/InitSignature.kt | 45 +------------- .../FixLocaleConfigErrorCompatibility.kt | 2 +- .../app/revanced/patches/SignatureChecker.kt | 62 ------------------- 33 files changed, 64 insertions(+), 207 deletions(-) delete mode 100644 src/test/kotlin/app/revanced/patches/SignatureChecker.kt diff --git a/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt b/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt index 4f178a6e9..a30729d12 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt @@ -29,10 +29,10 @@ class CodecsUnlockPatch : BytecodePatch( val implementation = result.method.implementation!! - val instructionIndex = result.scanData.startIndex + val instructionIndex = result.scanResult.startIndex result = signatures.last().result!! - val codecMethod = data.toMethodWalker(result.immutableMethod).walk(result.scanData.startIndex).getMethod() + val codecMethod = data.toMethodWalker(result.immutableMethod).walk(result.scanResult.startIndex).getMethod() implementation.replaceInstruction( instructionIndex, diff --git a/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/patch/RemoveTasteBuilderPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/patch/RemoveTasteBuilderPatch.kt index 81dac406f..b1be2a17c 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/patch/RemoveTasteBuilderPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/patch/RemoveTasteBuilderPatch.kt @@ -28,7 +28,7 @@ class RemoveTasteBuilderPatch : BytecodePatch( val result = signatures.first().result!! val implementation = result.method.implementation!! - val insertIndex = result.scanData.endIndex - 8 + val insertIndex = result.scanResult.endIndex - 8 val register = (implementation.instructions[insertIndex] as Instruction22c).registerA diff --git a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/patch/RemoveUpgradeButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/patch/RemoveUpgradeButtonPatch.kt index 9a2813d6d..98119f9b3 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/patch/RemoveUpgradeButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/patch/RemoveUpgradeButtonPatch.kt @@ -33,7 +33,7 @@ class RemoveUpgradeButtonPatch : BytecodePatch( val implementation = result.method.implementation!! val pivotBarElementFieldRef = - (implementation.instructions[result.scanData.endIndex - 1] as Instruction22c).reference + (implementation.instructions[result.scanResult.endIndex - 1] as Instruction22c).reference val register = (implementation.instructions.first() as Instruction35c).registerC // first compile all the needed instructions @@ -48,14 +48,14 @@ class RemoveUpgradeButtonPatch : BytecodePatch( // replace the instruction to retain the label at given index implementation.replaceInstruction( - result.scanData.endIndex - 1, instructionList[0] // invoke-interface + result.scanResult.endIndex - 1, instructionList[0] // invoke-interface ) // do not forget to remove this instruction since we added it already instructionList.removeFirst() val exitInstruction = instructionList.last() // iput-object implementation.addInstruction( - result.scanData.endIndex, exitInstruction + result.scanResult.endIndex, exitInstruction ) // do not forget to remove this instruction since we added it already instructionList.removeLast() @@ -64,12 +64,12 @@ class RemoveUpgradeButtonPatch : BytecodePatch( instructionList.add( 2, // if-le BuilderInstruction22t( - Opcode.IF_LE, 1, 2, implementation.newLabelForIndex(result.scanData.endIndex) + Opcode.IF_LE, 1, 2, implementation.newLabelForIndex(result.scanResult.endIndex) ) ) implementation.addInstructions( - result.scanData.endIndex, instructionList + result.scanResult.endIndex, instructionList ) return PatchResultSuccess() } diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/home/annotation/PromotionsCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/home/annotation/PromotionsCompatibility.kt index 367d4bc6b..ca6021f35 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/home/annotation/PromotionsCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/home/annotation/PromotionsCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34") + "com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34", "17.19.36") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/home/patch/HomeAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/home/patch/HomeAdsPatch.kt index 6b22b16e1..bd4d5a156 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/home/patch/HomeAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/home/patch/HomeAdsPatch.kt @@ -1697,7 +1697,7 @@ for (i in 0 until signatures.count()) { val signature = signatures.elementAt(i) val result = signature.result!! val implementation = result.method.implementation!! -val index = result.scanData.startIndex +val index = result.scanResult.startIndex val instructions = implementation.instructions val register = (instructions[index + (if (i < 2) -1 else 1)] as Instruction11x).registerA diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/home/signatures/PromotedDiscoveryActionParentSignature.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/home/signatures/PromotedDiscoveryActionParentSignature.kt index c3c8d73ee..87647362a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/home/signatures/PromotedDiscoveryActionParentSignature.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/home/signatures/PromotedDiscoveryActionParentSignature.kt @@ -6,16 +6,16 @@ import app.revanced.patcher.extensions.or import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod -import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility +import app.revanced.patches.youtube.ad.home.annotation.PromotionsCompatibility import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode @Name("promoted-discovery-app-parent-signature") @MatchingMethod( - "Ljre;", "lP" + "Ljqb;", "lG" ) @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. -@SeekbarTappingCompatibility +@PromotionsCompatibility @Version("0.0.1") object PromotedDiscoveryActionParentSignature : MethodSignature( "V", diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/home/signatures/PromotedDiscoveryAppParentSignature.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/home/signatures/PromotedDiscoveryAppParentSignature.kt index 7c3ad070b..9d4b9a084 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/home/signatures/PromotedDiscoveryAppParentSignature.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/home/signatures/PromotedDiscoveryAppParentSignature.kt @@ -6,17 +6,17 @@ import app.revanced.patcher.extensions.or import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod -import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility +import app.revanced.patches.youtube.ad.home.annotation.PromotionsCompatibility import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode @Name("promoted-discovery-action-parent-signature") @MatchingMethod( - "Ljqv;", - "lP" + "Ljqj;", + "lG" ) @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. -@SeekbarTappingCompatibility +@PromotionsCompatibility @Version("0.0.1") object PromotedDiscoveryAppParentSignature : MethodSignature( diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/video/annotations/VideoAdsCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/video/annotations/VideoAdsCompatibility.kt index 1e6a92ac1..1ac74ca16 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/video/annotations/VideoAdsCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/video/annotations/VideoAdsCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.youtube", arrayOf("17.14.35", "17.17.34") + "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/video/signatures/ShowVideoAdsConstructorSignature.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/video/signatures/ShowVideoAdsConstructorSignature.kt index ca0ae3453..912bc6bba 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/video/signatures/ShowVideoAdsConstructorSignature.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/video/signatures/ShowVideoAdsConstructorSignature.kt @@ -6,17 +6,17 @@ import app.revanced.patcher.extensions.or import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod -import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility +import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode @Name("show-video-ads-constructor-signature") @MatchingMethod( - "Laadb", + "Laair", "", ) @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. -@SeekbarTappingCompatibility +@VideoAdsCompatibility @Version("0.0.1") object ShowVideoAdsConstructorSignature : MethodSignature( "V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L"), listOf( diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/annotation/SeekbarTappingCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/annotation/SeekbarTappingCompatibility.kt index 8287b9070..e159dbcf9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/annotation/SeekbarTappingCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/annotation/SeekbarTappingCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.youtube", arrayOf("17.17.34") + "com.google.android.youtube", arrayOf("17.17.34", "17.19.36") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt index 3670d72cb..37d1f4ef5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt @@ -66,25 +66,25 @@ class EnableSeekbarTappingPatch : BytecodePatch( val oMethod = tapSeekMethods["O"]!! // get the required register - val instruction = implementation.instructions[result.scanData.endIndex] + val instruction = implementation.instructions[result.scanResult.endIndex] if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return PatchResultError("Could not find the correct register") val register = (instruction as Instruction35c).registerC // the instructions are written in reverse order. implementation.addInstructions( - result.scanData.endIndex + 1, """ + result.scanResult.endIndex + 1, """ invoke-virtual { v$register, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V invoke-virtual { v$register, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V """.trimIndent().toInstructions() ) // if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label - val elseLabel = implementation.newLabelForIndex(result.scanData.endIndex + 1) + val elseLabel = implementation.newLabelForIndex(result.scanResult.endIndex + 1) implementation.addInstruction( - result.scanData.endIndex + 1, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel) + result.scanResult.endIndex + 1, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel) ) implementation.addInstructions( - result.scanData.endIndex + 1, """ + result.scanResult.endIndex + 1, """ invoke-static { }, Lfi/razerman/youtube/preferences/BooleanPreferences;->isTapSeekingEnabled()Z move-result v0 """.trimIndent().toInstructions() diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/signatures/SeekbarTappingParentSignature.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/signatures/SeekbarTappingParentSignature.kt index 554b41464..c35be408d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/signatures/SeekbarTappingParentSignature.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/signatures/SeekbarTappingParentSignature.kt @@ -11,7 +11,7 @@ import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode @Name("enable-seekbar-tapping-parent") -@MatchingMethod("Lzhj;", "J") +@MatchingMethod("Lzmx;", "I") @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @SeekbarTappingCompatibility @Version("0.0.1") diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/signatures/SeekbarTappingSignature.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/signatures/SeekbarTappingSignature.kt index 7b471c070..f649b2670 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/signatures/SeekbarTappingSignature.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/signatures/SeekbarTappingSignature.kt @@ -11,7 +11,7 @@ import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode @Name("enable-seekbar-tapping-signature") -@MatchingMethod("Lfao;", "onTouchEvent") +@MatchingMethod("Lfbl;", "onTouchEvent") @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @SeekbarTappingCompatibility @Version("0.0.1") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/annotations/AmoledCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/annotations/AmoledCompatibility.kt index 4465aecfa..8e8d96ff2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/annotations/AmoledCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/annotations/AmoledCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.youtube", arrayOf("17.14.35", "17.17.34") + "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/patch/AmoledPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/patch/AmoledPatch.kt index e9d950ea1..99538a54d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/patch/AmoledPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/patch/AmoledPatch.kt @@ -14,7 +14,7 @@ import java.io.File @Patch @Name("amoled") -@Description("Enables black theme (amoled mode)") +@Description("Enables pure black theme.") @AmoledCompatibility @Version("0.0.1") class AmoledPatch : ResourcePatch() { @@ -23,18 +23,13 @@ class AmoledPatch : ResourcePatch() { val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element for (i in 0 until resourcesNode.childNodes.length) { - val node = resourcesNode.childNodes.item(i) as Element + val node = resourcesNode.childNodes.item(i) + if (node !is Element) continue - node.nodeValue = when (node.getAttribute("name")) { - "yt_black1", - "yt_black1_opacity95", - "yt_black2", - "yt_black3", - "yt_black4", - "yt_status_bar_background_dark" - -> "@android:color/black" - "yt_selected_nav_label_dark" - -> "#ffdf0000" + val element = resourcesNode.childNodes.item(i) as Element + element.textContent = when (element.getAttribute("name")) { + "yt_black1", "yt_black1_opacity95", "yt_black2", "yt_black3", "yt_black4", "yt_status_bar_background_dark" -> "@android:color/black" + "yt_selected_nav_label_dark" -> "#ffdf0000" else -> continue } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/annotations/CreateButtonCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/annotations/CreateButtonCompatibility.kt index c00fa9aec..9c57fe47b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/annotations/CreateButtonCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/annotations/CreateButtonCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.youtube", arrayOf("17.14.35", "17.17.34") + "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/patch/CreateButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/patch/CreateButtonRemoverPatch.kt index 288d04810..42b75c40c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/patch/CreateButtonRemoverPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/patch/CreateButtonRemoverPatch.kt @@ -10,15 +10,15 @@ import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResultError import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.util.smali.toInstruction +import app.revanced.patches.youtube.layout.createbutton.annotations.CreateButtonCompatibility import app.revanced.patches.youtube.layout.createbutton.signatures.CreateButtonSignature -import app.revanced.patches.youtube.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.Instruction35c @Patch @Name("disable-create-button") @Description("Disable the create button.") -@MinimizedPlaybackCompatibility +@CreateButtonCompatibility @Version("0.0.1") class CreateButtonRemoverPatch : BytecodePatch( listOf( @@ -30,14 +30,14 @@ class CreateButtonRemoverPatch : BytecodePatch( // Get the required register which holds the view object we need to pass to the method hideCreateButton val implementation = result.method.implementation!! - val instruction = implementation.instructions[result.scanData.endIndex + 1] + val instruction = implementation.instructions[result.scanResult.endIndex + 1] if (instruction.opcode != Opcode.INVOKE_STATIC) return PatchResultError("Could not find the correct register") val register = (instruction as Instruction35c).registerC // Hide the button view via proxy by passing it to the hideCreateButton method implementation.addInstruction( - result.scanData.endIndex + 1, + result.scanResult.endIndex + 1, "invoke-static { v$register }, Lfi/razerman/youtube/XAdRemover;->hideCreateButton(Landroid/view/View;)V".toInstruction() ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/signatures/CreateButtonSignature.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/signatures/CreateButtonSignature.kt index 45e3c4295..6f1a91e52 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/signatures/CreateButtonSignature.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/signatures/CreateButtonSignature.kt @@ -12,7 +12,7 @@ import org.jf.dexlib2.Opcode @Name("create-button-signature") @MatchingMethod( - "Lkne", "z" + "Lknw", "z" ) @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @CreateButtonCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/minimizedplayback/annotations/MinimizedPlaybackCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/minimizedplayback/annotations/MinimizedPlaybackCompatibility.kt index 07fbe86df..574c90c87 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/minimizedplayback/annotations/MinimizedPlaybackCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/minimizedplayback/annotations/MinimizedPlaybackCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.youtube", arrayOf("17.14.35", "17.17.34") + "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/minimizedplayback/signatures/MinimizedPlaybackManagerSignature.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/minimizedplayback/signatures/MinimizedPlaybackManagerSignature.kt index 934737768..097d0dc82 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/minimizedplayback/signatures/MinimizedPlaybackManagerSignature.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/minimizedplayback/signatures/MinimizedPlaybackManagerSignature.kt @@ -12,7 +12,7 @@ import org.jf.dexlib2.Opcode @Name("minimized-playback-manager-signature") @MatchingMethod( - "Lype", "j" + "Lyuf", "n" ) @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @MinimizedPlaybackCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/annotations/OldQualityLayoutCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/annotations/OldQualityLayoutCompatibility.kt index 8992bf9ec..3a883458f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/annotations/OldQualityLayoutCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/annotations/OldQualityLayoutCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.youtube", arrayOf("17.17.34") + "com.google.android.youtube", arrayOf("17.17.34", "17.19.36") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt index 927dd43cc..88b397cc9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt @@ -51,7 +51,7 @@ class OldQualityLayoutPatch : BytecodePatch( // if useOldStyleQualitySettings == true, jump over all instructions val jmpInstruction = BuilderInstruction21t( - Opcode.IF_NEZ, 0, implementation.instructions[result.scanData.endIndex].location.labels.first() + Opcode.IF_NEZ, 0, implementation.instructions[result.scanResult.endIndex].location.labels.first() ) implementation.addInstruction(5, jmpInstruction) implementation.addInstructions( diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/reels/patch/HideReelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/reels/patch/HideReelsPatch.kt index 8b5e14f76..7f0fb2c39 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/reels/patch/HideReelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/reels/patch/HideReelsPatch.kt @@ -4,7 +4,6 @@ import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.implementation.BytecodeData -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess @@ -12,7 +11,7 @@ import app.revanced.patcher.util.smali.toInstruction import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility import app.revanced.patches.youtube.layout.reels.signatures.HideReelsSignature -@Patch +//@Patch TODO: converted to litho @Name("hide-reels") @Description("Hide reels on the page.") @HideReelsCompatibility @@ -29,7 +28,7 @@ class HideReelsPatch : BytecodePatch( // HideReel will hide the reel view before it is being used, // so we pass the view to the HideReel method implementation.addInstruction( - result.scanData.endIndex, + result.scanResult.endIndex, "invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->HideReel(Landroid/view/View;)V".toInstruction() ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/reels/signatures/HideReelsSignature.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/reels/signatures/HideReelsSignature.kt index 44baac54e..61353b272 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/reels/signatures/HideReelsSignature.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/reels/signatures/HideReelsSignature.kt @@ -8,7 +8,6 @@ import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatt import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility import org.jf.dexlib2.AccessFlags -import org.jf.dexlib2.Opcode @Name("hide-reels-signature") @MatchingMethod( @@ -18,41 +17,6 @@ import org.jf.dexlib2.Opcode @HideReelsCompatibility @Version("0.0.1") object HideReelsSignature : MethodSignature( - "V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf( - "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "[B", "[B", "[B", "[B", "[B", "[B" - ), listOf( - Opcode.MOVE_OBJECT, - Opcode.MOVE_OBJECT, - Opcode.INVOKE_DIRECT, - Opcode.MOVE_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.MOVE_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.MOVE_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.MOVE_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.MOVE_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.MOVE_OBJECT_FROM16, - Opcode.IPUT_OBJECT, - Opcode.MOVE_OBJECT_FROM16, - Opcode.IPUT_OBJECT, - Opcode.NEW_INSTANCE, - Opcode.INVOKE_DIRECT, - Opcode.IPUT_OBJECT, - Opcode.NEW_INSTANCE, - Opcode.INVOKE_DIRECT, - Opcode.IPUT_OBJECT, - Opcode.MOVE_OBJECT_FROM16, - Opcode.IPUT_OBJECT, - Opcode.INVOKE_STATIC, - Opcode.MOVE_RESULT_OBJECT, - Opcode.CONST, - Opcode.CONST_4, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, - Opcode.IPUT_OBJECT - ) + null, AccessFlags.PROTECTED or AccessFlags.FINAL, listOf("L", "L"), null, + listOf("multiReelDismissalCallback", "reelItemRenderers", "reelDismissalInfo") ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/annotations/ShortsButtonCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/annotations/ShortsButtonCompatibility.kt index d55ca4904..f8bf1c64c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/annotations/ShortsButtonCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/annotations/ShortsButtonCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.youtube", arrayOf("17.14.35", "17.17.34") + "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/patch/ShortsButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/patch/ShortsButtonRemoverPatch.kt index 63571bef2..60a24861b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/patch/ShortsButtonRemoverPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/patch/ShortsButtonRemoverPatch.kt @@ -27,24 +27,24 @@ class ShortsButtonRemoverPatch : BytecodePatch( override fun execute(data: BytecodeData): PatchResult { val result1 = signatures.first().result!! val implementation1 = result1.method.implementation!! - val moveEnumInstruction = implementation1.instructions[result1.scanData.endIndex] + val moveEnumInstruction = implementation1.instructions[result1.scanResult.endIndex] val enumRegister = (moveEnumInstruction as Instruction11x).registerA val result2 = signatures.last().result!! val implementation2 = result2.method.implementation!! - val moveViewInstruction = implementation2.instructions[result2.scanData.endIndex] + val moveViewInstruction = implementation2.instructions[result2.scanResult.endIndex] val viewRegister = (moveViewInstruction as Instruction11x).registerA // Save the tab enum in XGlobals to avoid smali/register workarounds implementation1.addInstruction( - result1.scanData.endIndex + 1, + result1.scanResult.endIndex + 1, "sput-object v$enumRegister, Lfi/razerman/youtube/XGlobals;->lastPivotTab:Ljava/lang/Enum;".toInstruction() ) // Hide the button view via proxy by passing it to the hideShortsButton method // It only hides it if the last tab name is "TAB_SHORTS" implementation2.addInstruction( - result2.scanData.endIndex + 2, + result2.scanResult.endIndex + 2, "invoke-static { v$viewRegister }, Lfi/razerman/youtube/XAdRemover;->hideShortsButton(Landroid/view/View;)V".toInstruction() ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/signatures/PivotBarButtonTabenumSignature.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/signatures/PivotBarButtonTabenumSignature.kt index ea37ba632..6e88d2b45 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/signatures/PivotBarButtonTabenumSignature.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/signatures/PivotBarButtonTabenumSignature.kt @@ -12,7 +12,7 @@ import org.jf.dexlib2.Opcode @Name("pivotbar-buttons-tabenum-signature") @MatchingMethod( - "Lkne", "z" + "Lknw", "z" ) @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @ShortsButtonCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/signatures/PivotBarButtonsViewSignature.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/signatures/PivotBarButtonsViewSignature.kt index b3140fe7f..cfde6a334 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/signatures/PivotBarButtonsViewSignature.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/signatures/PivotBarButtonsViewSignature.kt @@ -12,7 +12,7 @@ import org.jf.dexlib2.Opcode @Name("pivotbar-buttons-view-signature") @MatchingMethod( - "Lkne", "z" + "Lknw", "z" ) @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @ShortsButtonCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/annotations/IntegrationsCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/annotations/IntegrationsCompatibility.kt index 318ea09da..e8e111394 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/annotations/IntegrationsCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/annotations/IntegrationsCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34") + "com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34", "17.19.36") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt index 538da04d3..25bfe66e2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt @@ -35,7 +35,7 @@ class IntegrationsPatch : BytecodePatch( val count = implementation.registerCount - 1 implementation.addInstructions( - result.scanData.endIndex + 1, """ + result.scanResult.endIndex + 1, """ invoke-static {v$count}, Lpl/jakubweg/StringRef;->setContext(Landroid/content/Context;)V sput-object v$count, Lapp/revanced/integrations/Globals;->context:Landroid/content/Context; """.trimIndent().toInstructions() diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/signatures/InitSignature.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/signatures/InitSignature.kt index 390fd033a..450b7570d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/signatures/InitSignature.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/signatures/InitSignature.kt @@ -3,55 +3,16 @@ package app.revanced.patches.youtube.misc.integrations.signatures import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.signature.implementation.method.MethodSignature -import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility -import org.jf.dexlib2.AccessFlags -import org.jf.dexlib2.Opcode @Name("init-signature") @MatchingMethod( - "Lacnx", "onCreate" + "Lacuu", "onCreate" ) -@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @IntegrationsCompatibility @Version("0.0.1") object InitSignature : MethodSignature( - "V", - AccessFlags.PUBLIC.value, - listOf(), - listOf( - Opcode.SGET_OBJECT, - Opcode.NEW_INSTANCE, - Opcode.INVOKE_DIRECT, - Opcode.IGET_OBJECT, - Opcode.CONST_STRING, - Opcode.IF_NEZ, - Opcode.IGET_OBJECT, - Opcode.IGET_OBJECT, - Opcode.IGET_OBJECT, - Opcode.IGET_OBJECT, - Opcode.MOVE_OBJECT, - Opcode.CHECK_CAST, - Opcode.MOVE_OBJECT, - Opcode.CHECK_CAST, - Opcode.CONST_4, - Opcode.CONST_STRING, - Opcode.INVOKE_INTERFACE_RANGE, - Opcode.MOVE_RESULT_OBJECT, - Opcode.INVOKE_STATIC, - Opcode.MOVE_RESULT_OBJECT, - Opcode.SPUT_OBJECT, - Opcode.SGET_OBJECT, - Opcode.INVOKE_STATIC, - Opcode.INVOKE_STATIC, - Opcode.MOVE_RESULT_OBJECT, - Opcode.IGET_OBJECT, - Opcode.INVOKE_INTERFACE, - Opcode.MOVE_RESULT_OBJECT, - Opcode.CHECK_CAST, - Opcode.INVOKE_VIRTUAL, - Opcode.INVOKE_SUPER, - Opcode.INVOKE_VIRTUAL - ) + null, null, null, null, + listOf("Application creation") ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/manifest/annotations/FixLocaleConfigErrorCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/manifest/annotations/FixLocaleConfigErrorCompatibility.kt index a04be9849..61da5c010 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/manifest/annotations/FixLocaleConfigErrorCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/manifest/annotations/FixLocaleConfigErrorCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.youtube", arrayOf("17.14.35", "17.17.34") + "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/test/kotlin/app/revanced/patches/SignatureChecker.kt b/src/test/kotlin/app/revanced/patches/SignatureChecker.kt deleted file mode 100644 index ffa80f2c0..000000000 --- a/src/test/kotlin/app/revanced/patches/SignatureChecker.kt +++ /dev/null @@ -1,62 +0,0 @@ -package app.revanced.patches - -import app.revanced.patcher.Patcher -import app.revanced.patcher.annotation.Name -import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod -import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod -import app.revanced.patcher.signature.implementation.method.annotation.PatternScanMethod -import org.jf.dexlib2.iface.Method -import org.junit.Test -import java.io.File - -internal class SignatureChecker { - @Test - fun checkMethodSignatures() { - - // FIXME: instead of having this as a test, it should be turned into a task which can be ran manually - val file = File("stock.apk") - if (!file.exists()) { - throw IllegalStateException("Missing $file! To run this test, please place stock.apk here: ${file.absolutePath}") - } - val patcher = Patcher(file, "signatureCheckerCache", false) - patcher.addPatches(Index.patches.map { it() }) - val unresolved = mutableListOf() - for (signature in patcher.resolveSignatures()) { - val signatureAnnotations = signature::class.annotations - - val nameAnnotation = signatureAnnotations.find { it is Name } as Name - if (!signature.resolved) { - unresolved.add(nameAnnotation.name) - continue - } - - val patternScanMethod = - signatureAnnotations.find { it::class.annotations.any { method -> method is PatternScanMethod } } - if (patternScanMethod is FuzzyPatternScanMethod) { - val warnings = signature.result!!.scanData.warnings!! - val method = signature.result!!.method - - val methodFromMetadata = - signatureAnnotations.find { it is MatchingMethod } as MatchingMethod? ?: MatchingMethod() - - println("Signature: ${nameAnnotation}.\nMethod: ${methodFromMetadata.definingClass}->${methodFromMetadata.name} (Signature matches: ${method.definingClass}->${method.toStr()})\nWarnings: ${warnings.count()}") - for (warning in warnings) { - println("${warning.instructionIndex} / ${warning.patternIndex}: ${warning.wrongOpcode} (expected: ${warning.correctOpcode})") - } - - println("=".repeat(20)) - } - } - if (unresolved.isNotEmpty()) { - val base = Exception("${unresolved.size} signatures were not resolved.") - for (name in unresolved) { - base.addSuppressed(Exception("Signature $name was not resolved!")) - } - throw base - } - } - - private fun Method.toStr(): String { - return "${this.name}(${this.parameterTypes.joinToString("")})${this.returnType}" - } -} \ No newline at end of file