diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 58f8be10f..d13218d6b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,6 @@ name: Release on: + workflow_dispatch: push: branches: - main diff --git a/CHANGELOG.md b/CHANGELOG.md index 68370bce6..8485bd1ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# [1.0.0-dev.10](https://github.com/revanced/revanced-patches/compare/v1.0.0-dev.9...v1.0.0-dev.10) (2022-05-22) + + +### Bug Fixes + +* `create-button-signature` ([a173f6e](https://github.com/revanced/revanced-patches/commit/a173f6e5a7e65943657e2072e8a72a4a680e5277)) +* breaking changes by `revanced-patcher` dependency ([e12e484](https://github.com/revanced/revanced-patches/commit/e12e484e3796c5c9c8505b677838cdf8432f2e79)) +* loop in `amoled` patch ([c4c86b6](https://github.com/revanced/revanced-patches/commit/c4c86b65fd8b2463c1d86ad2e46ec9f08e60d47c)) + + +### Features + +* add `amoled` patch ([d61bac4](https://github.com/revanced/revanced-patches/commit/d61bac4f8243d0ef72ca91c7c1d5facd858d515e)) +* update patches to latest version ([bad25de](https://github.com/revanced/revanced-patches/commit/bad25dec1d73137f8b7a1bf4daaceb2279b4d48c)) + # [1.0.0-dev.9](https://github.com/revanced/revanced-patches/compare/v1.0.0-dev.8...v1.0.0-dev.9) (2022-05-13) diff --git a/gradle.properties b/gradle.properties index e01f668fc..7474e2e6f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ kotlin.code.style = official -version = 1.0.0-dev.9 +version = 1.0.0-dev.10 diff --git a/src/main/kotlin/app/revanced/extensions/Extensions.kt b/src/main/kotlin/app/revanced/extensions/Extensions.kt index b42f47a8f..be4da640b 100644 --- a/src/main/kotlin/app/revanced/extensions/Extensions.kt +++ b/src/main/kotlin/app/revanced/extensions/Extensions.kt @@ -1,6 +1,6 @@ package app.revanced.extensions -import app.revanced.patcher.smali.toInstruction +import app.revanced.patcher.util.smali.toInstruction import org.jf.dexlib2.builder.MutableMethodImplementation internal fun MutableMethodImplementation.injectHideCall( diff --git a/src/main/kotlin/app/revanced/patches/Index.kt b/src/main/kotlin/app/revanced/patches/Index.kt deleted file mode 100644 index 5c0761a82..000000000 --- a/src/main/kotlin/app/revanced/patches/Index.kt +++ /dev/null @@ -1,48 +0,0 @@ -package app.revanced.patches - -import app.revanced.patcher.data.base.Data -import app.revanced.patcher.patch.base.Patch -import app.revanced.patches.music.audio.codecs.patch.CodecsUnlockPatch -import app.revanced.patches.music.audio.exclusiveaudio.patch.ExclusiveAudioPatch -import app.revanced.patches.music.layout.tastebuilder.patch.RemoveTasteBuilderPatch -import app.revanced.patches.music.layout.upgradebutton.patch.RemoveUpgradeButtonPatch -import app.revanced.patches.music.premium.backgroundplay.patch.BackgroundPlayPatch -import app.revanced.patches.youtube.ad.home.patch.PromotionsPatch -import app.revanced.patches.youtube.ad.video.patch.VideoAdsPatch -import app.revanced.patches.youtube.interaction.seekbar.patch.EnableSeekbarTappingPatch -import app.revanced.patches.youtube.layout.createbutton.patch.CreateButtonRemoverPatch -import app.revanced.patches.youtube.layout.minimizedplayback.patch.MinimizedPlaybackPatch -import app.revanced.patches.youtube.layout.oldqualitylayout.patch.OldQualityLayoutPatch -import app.revanced.patches.youtube.layout.reels.patch.HideReelsPatch -import app.revanced.patches.youtube.layout.shorts.button.patch.ShortsButtonRemoverPatch -import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch - -/** - * Index contains all the patches. - */ -@Suppress("Unused") -object Index { - /** - * Array of patches. - * New patches should be added to the array. - */ - val patches: List<() -> Patch> = listOf( - ::IntegrationsPatch, - ::FixLocaleConfigErrorPatch, - //::HomeAdsPatch, - ::VideoAdsPatch, - ::PromotionsPatch, - ::MinimizedPlaybackPatch, - ::CreateButtonRemoverPatch, - ::ShortsButtonRemoverPatch, - ::HideReelsPatch, - ::OldQualityLayoutPatch, - ::EnableSeekbarTappingPatch, - ::ExclusiveAudioPatch, - ::RemoveUpgradeButtonPatch, - ::RemoveTasteBuilderPatch, - ::BackgroundPlayPatch, - ::CodecsUnlockPatch - ) -} 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 3e56b1cfc..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 @@ -9,7 +9,7 @@ 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 -import app.revanced.patcher.smali.toInstruction +import app.revanced.patcher.util.smali.toInstruction import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility import app.revanced.patches.music.audio.codecs.signatures.AllCodecsReferenceSignature import app.revanced.patches.music.audio.codecs.signatures.CodecsLockSignature @@ -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/audio/exclusiveaudio/patch/ExclusiveAudioPatch.kt b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/patch/ExclusiveAudioPatch.kt index 9dd091b89..e1e67f521 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/patch/ExclusiveAudioPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/patch/ExclusiveAudioPatch.kt @@ -13,7 +13,7 @@ import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.signature.implementation.method.annotation.DirectPatternScanMethod import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod -import app.revanced.patcher.smali.toInstruction +import app.revanced.patcher.util.smali.toInstruction import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility import app.revanced.patches.music.audio.exclusiveaudio.signatures.ExclusiveAudioSignature import org.jf.dexlib2.AccessFlags 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 ceca65740..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 @@ -9,7 +9,7 @@ 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 -import app.revanced.patcher.smali.toInstructions +import app.revanced.patcher.util.smali.toInstructions import app.revanced.patches.music.layout.tastebuilder.annotations.RemoveTasteBuilderCompatibility import app.revanced.patches.music.layout.tastebuilder.signatures.TasteBuilderConstructorSignature import org.jf.dexlib2.iface.instruction.formats.Instruction22c @@ -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 7013c37d7..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 @@ -9,7 +9,7 @@ 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 -import app.revanced.patcher.smali.toInstructions +import app.revanced.patcher.util.smali.toInstructions import app.revanced.patches.music.layout.upgradebutton.annotations.RemoveUpgradeButtonCompatibility import app.revanced.patches.music.layout.upgradebutton.signatures.PivotBarConstructorSignature import org.jf.dexlib2.Opcode @@ -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/music/premium/backgroundplay/patch/BackgroundPlayPatch.kt b/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/patch/BackgroundPlayPatch.kt index 350eb824f..84fe9a09f 100644 --- a/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/patch/BackgroundPlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/patch/BackgroundPlayPatch.kt @@ -9,7 +9,7 @@ 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 -import app.revanced.patcher.smali.toInstructions +import app.revanced.patcher.util.smali.toInstructions import app.revanced.patches.music.premium.backgroundplay.annotations.BackgroundPlayCompatibility import app.revanced.patches.music.premium.backgroundplay.signatures.BackgroundPlaybackDisableSignature 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/patch/PromotionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/home/patch/PromotionsPatch.kt index fabd5675a..c8d397c50 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/home/patch/PromotionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/home/patch/PromotionsPatch.kt @@ -12,10 +12,10 @@ import app.revanced.patcher.patch.implementation.BytecodePatch 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.proxy.mutableTypes.MutableMethod import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.signature.implementation.method.annotation.DirectPatternScanMethod import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod +import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.youtube.ad.home.annotation.PromotionsCompatibility import app.revanced.patches.youtube.ad.home.signatures.PromotedDiscoveryActionParentSignature import app.revanced.patches.youtube.ad.home.signatures.PromotedDiscoveryAppParentSignature 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/patch/VideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/video/patch/VideoAdsPatch.kt index 663a02594..ef1f5272f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/video/patch/VideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/video/patch/VideoAdsPatch.kt @@ -14,7 +14,7 @@ import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.signature.implementation.method.annotation.DirectPatternScanMethod import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod -import app.revanced.patcher.smali.toInstructions +import app.revanced.patcher.util.smali.toInstructions import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility import app.revanced.patches.youtube.ad.video.signatures.ShowVideoAdsConstructorSignature import org.jf.dexlib2.AccessFlags 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 6ebb17e41..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 @@ -10,7 +10,7 @@ import app.revanced.patcher.patch.implementation.BytecodePatch 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.smali.toInstructions +import app.revanced.patcher.util.smali.toInstructions import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility import app.revanced.patches.youtube.interaction.seekbar.signatures.SeekbarTappingParentSignature import app.revanced.patches.youtube.interaction.seekbar.signatures.SeekbarTappingSignature @@ -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 new file mode 100644 index 000000000..8e8d96ff2 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/annotations/AmoledCompatibility.kt @@ -0,0 +1,13 @@ +package app.revanced.patches.youtube.layout.amoled.annotations + +import app.revanced.patcher.annotation.Compatibility +import app.revanced.patcher.annotation.Package + +@Compatibility( + [Package( + "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36") + )] +) +@Target(AnnotationTarget.CLASS) +@Retention(AnnotationRetention.RUNTIME) +internal annotation class AmoledCompatibility 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 new file mode 100644 index 000000000..99538a54d --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/patch/AmoledPatch.kt @@ -0,0 +1,40 @@ +package app.revanced.patches.youtube.layout.amoled.patch + +import app.revanced.patcher.annotation.Description +import app.revanced.patcher.annotation.Name +import app.revanced.patcher.annotation.Version +import app.revanced.patcher.data.implementation.ResourceData +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patcher.patch.implementation.ResourcePatch +import app.revanced.patcher.patch.implementation.misc.PatchResult +import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess +import app.revanced.patches.youtube.layout.amoled.annotations.AmoledCompatibility +import org.w3c.dom.Element +import java.io.File + +@Patch +@Name("amoled") +@Description("Enables pure black theme.") +@AmoledCompatibility +@Version("0.0.1") +class AmoledPatch : ResourcePatch() { + override fun execute(data: ResourceData): PatchResult { + data.getXmlEditor("res${File.separator}values${File.separator}colors.xml").use { editor -> + val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element + + for (i in 0 until resourcesNode.childNodes.length) { + val node = resourcesNode.childNodes.item(i) + if (node !is Element) continue + + 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 + } + } + } + + return PatchResultSuccess() + } +} 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 098c08d05..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 @@ -9,16 +9,16 @@ import app.revanced.patcher.patch.implementation.BytecodePatch 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.smali.toInstruction +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/patch/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/minimizedplayback/patch/MinimizedPlaybackPatch.kt index 73ae42efd..8cd9c79b3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/minimizedplayback/patch/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/minimizedplayback/patch/MinimizedPlaybackPatch.kt @@ -9,7 +9,7 @@ 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 -import app.revanced.patcher.smali.toInstructions +import app.revanced.patcher.util.smali.toInstructions import app.revanced.patches.youtube.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility import app.revanced.patches.youtube.layout.minimizedplayback.signatures.MinimizedPlaybackManagerSignature 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 d0cad30e9..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 @@ -14,7 +14,7 @@ import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess 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.patcher.smali.toInstructions +import app.revanced.patcher.util.smali.toInstructions import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility import app.revanced.patches.youtube.layout.oldqualitylayout.signatures.OldQualityParentSignature import org.jf.dexlib2.AccessFlags @@ -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 b9d18b7f2..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,15 +4,14 @@ 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 -import app.revanced.patcher.smali.toInstruction +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 86fb91bf6..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 @@ -8,7 +8,7 @@ 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 -import app.revanced.patcher.smali.toInstruction +import app.revanced.patcher.util.smali.toInstruction import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonTabenumSignature import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonsViewSignature @@ -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 8896c37f2..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 @@ -10,8 +10,8 @@ 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 -import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable -import app.revanced.patcher.smali.toInstructions +import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable +import app.revanced.patcher.util.smali.toInstructions import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility import app.revanced.patches.youtube.misc.integrations.signatures.InitSignature import org.jf.dexlib2.AccessFlags @@ -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