diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt index 84167225fc..ef10af3a7f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt @@ -24,15 +24,16 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c ], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", - [ + "com.google.android.youtube", [ "18.32.39", "18.37.36", "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt index 9ec7fa8c95..097125eebb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt @@ -25,8 +25,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt index 370e99575f..b338686dc0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt @@ -29,8 +29,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt index 659b2ff154..c1fc4765c2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt @@ -17,15 +17,10 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch ], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", - [ - "18.32.39", - "18.37.36", - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.41", - "18.45.43" + "com.google.android.youtube", [ + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/ExternalDownloadsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/ExternalDownloadsBytecodePatch.kt index 015aeba130..0564d57d38 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/ExternalDownloadsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/ExternalDownloadsBytecodePatch.kt @@ -17,15 +17,10 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch ], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", - [ - "18.32.39", - "18.37.36", - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.41", - "18.45.43" + "com.google.android.youtube", [ + "18.48.39", + "18.49.37", + "19.01.34" ] ), ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt index df7761633a..0e9892d714 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt @@ -27,8 +27,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt index 5d0816a6b4..41f58f72ab 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt @@ -29,8 +29,10 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference [ "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt index 79f7d20d52..364e96554a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt @@ -25,8 +25,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction [ "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt index 6db26ca89e..c1a4f6447f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt @@ -1,7 +1,5 @@ package app.revanced.patches.youtube.interaction.swipecontrols -import app.revanced.util.transformMethods -import app.revanced.util.traverseClassHierarchy import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage @@ -10,7 +8,9 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMu import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.SwipeControlsHostActivityFingerprint import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch -import app.revanced.patches.youtube.shared.fingerprints.WatchWhileActivityFingerprint +import app.revanced.patches.youtube.shared.fingerprints.MainActivityFingerprint +import app.revanced.util.transformMethods +import app.revanced.util.traverseClassHierarchy import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.immutable.ImmutableMethod @@ -31,8 +31,10 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] @@ -40,19 +42,19 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod @Suppress("unused") object SwipeControlsBytecodePatch : BytecodePatch( setOf( - WatchWhileActivityFingerprint, + MainActivityFingerprint, SwipeControlsHostActivityFingerprint ) ) { override fun execute(context: BytecodeContext) { val wrapperClass = SwipeControlsHostActivityFingerprint.result!!.mutableClass - val targetClass = WatchWhileActivityFingerprint.result!!.mutableClass + val targetClass = MainActivityFingerprint.result!!.mutableClass - // inject the wrapper class from integrations into the class hierarchy of WatchWhileActivity + // Inject the wrapper class from integrations into the class hierarchy of MainActivity. wrapperClass.setSuperClass(targetClass.superclass) targetClass.setSuperClass(wrapperClass.type) - // ensure all classes and methods in the hierarchy are non-final, so we can override them in integrations + // Ensure all classes and methods in the hierarchy are non-final, so we can override them in integrations. context.traverseClassHierarchy(targetClass) { accessFlags = accessFlags and AccessFlags.FINAL.value.inv() transformMethods { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt index dec88bf046..19b93d79b1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt @@ -29,8 +29,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt index 7f88b2b7fb..c3b070651c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt @@ -27,8 +27,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt index 4e3ab1d1d4..4b53c34219 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt @@ -37,8 +37,10 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt index a3114d603e..ffbd4347aa 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt @@ -28,8 +28,10 @@ import com.android.tools.smali.dexlib2.Opcode "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt index ceb78d6cc7..abcad73de0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt @@ -34,8 +34,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt index dc64b9392d..afe026ad13 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt @@ -32,8 +32,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt index ae2d3c40f5..689e89cf81 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt @@ -27,8 +27,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt index 7fb2202fc9..067bfa44cf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt @@ -27,8 +27,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt index dd81aa1975..777c9c36e0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt @@ -26,8 +26,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt index f01894d08f..9b01f063c8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt @@ -27,8 +27,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt index c85e63808a..0ed39df9d7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt @@ -30,8 +30,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt index 940cb4ca2d..0cf334c7c2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt @@ -27,8 +27,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt index dd98a8ae69..06ee7d0471 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt @@ -23,8 +23,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt index 60a2264de7..dd8f3900f7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt @@ -23,8 +23,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt index d4a58b1df2..2d45795b07 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt @@ -37,8 +37,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt index d49c32e43a..cf9f08d35a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt @@ -34,8 +34,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt index fdd2fc1e79..076c4b7881 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt @@ -23,8 +23,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/personalinformation/HideEmailAddressPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/personalinformation/HideEmailAddressPatch.kt index d505f2c9a8..a8c8157d7b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/personalinformation/HideEmailAddressPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/personalinformation/HideEmailAddressPatch.kt @@ -23,8 +23,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt index df8387a91a..074416c1f1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt @@ -20,15 +20,20 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch SettingsPatch::class ], compatiblePackages = [ - CompatiblePackage("com.google.android.youtube", [ - "18.32.39", - "18.37.36", - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.41", - "18.45.43" - ]) + CompatiblePackage( + "com.google.android.youtube", [ + "18.32.39", + "18.37.36", + "18.38.44", + "18.43.45", + "18.44.41", + "18.45.41", + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" + ] + ) ] ) @Suppress("unused") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt index 169741ca24..4bac142096 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt @@ -25,8 +25,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "com.google.android.youtube", [ "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt index ef8853b340..3a62fd8859 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt @@ -31,8 +31,10 @@ import app.revanced.patches.youtube.shared.fingerprints.SeekbarOnDrawFingerprint "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt index ddd7c735cf..429c6f620d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt @@ -35,8 +35,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt index 0715c65cb9..02994d5e65 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt @@ -22,8 +22,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt index 39e1f6ff19..a298db24bf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt @@ -19,13 +19,14 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch compatiblePackages = [ CompatiblePackage( "com.google.android.youtube", [ - "18.32.39", "18.37.36", "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt index 602bf6a311..5c46ca2bba 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt @@ -24,8 +24,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt index b083a0288c..c16e76da27 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt @@ -18,8 +18,10 @@ import org.w3c.dom.Element "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt index 76e58255d5..2e0f4ba587 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt @@ -5,7 +5,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.getInstruction -import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchException @@ -18,7 +17,7 @@ import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.Lik import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.RemoveLikeFingerprint import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.RollingNumberMeasureAnimatedTextFingerprint import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.RollingNumberMeasureStaticLabelFingerprint -import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.RollingNumberMeasureTextParentFingerprint +import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.RollingNumberMeasureStaticLabelParentFingerprint import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.RollingNumberSetterFingerprint import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.RollingNumberTextViewFingerprint import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.ShortsTextViewFingerprint @@ -55,11 +54,8 @@ import com.android.tools.smali.dexlib2.iface.reference.TypeReference compatiblePackages = [ CompatiblePackage( "com.google.android.youtube", [ - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.41", - "18.45.43" + "18.49.37", + "19.01.34" ] ) ] @@ -76,7 +72,8 @@ object ReturnYouTubeDislikePatch : BytecodePatch( DislikeFingerprint, RemoveLikeFingerprint, RollingNumberSetterFingerprint, - RollingNumberMeasureTextParentFingerprint, + RollingNumberMeasureStaticLabelParentFingerprint, + RollingNumberMeasureAnimatedTextFingerprint, RollingNumberTextViewFingerprint, RollingNumberTextViewAnimationUpdateFingerprint ) @@ -276,37 +273,30 @@ object ReturnYouTubeDislikePatch : BytecodePatch( // Rolling Number text views use the measured width of the raw string for layout. // Modify the measure text calculation to include the left drawable separator if needed. - RollingNumberMeasureAnimatedTextFingerprint.also { - if (!it.resolve(context, RollingNumberMeasureTextParentFingerprint.result!!.classDef)) - throw it.exception - }.result?.also { + RollingNumberMeasureAnimatedTextFingerprint.result?.also { + val scanResult = it.scanResult.patternScanResult!! + // Additional check to verify the opcodes are at the start of the method + if (scanResult.startIndex != 0) throw PatchException("Unexpected opcode location") + val endIndex = scanResult.endIndex it.mutableMethod.apply { - val returnInstructionIndex = it.scanResult.patternScanResult!!.endIndex - val measuredTextWidthRegister = - getInstruction(returnInstructionIndex).registerA + val measuredTextWidthRegister = getInstruction(endIndex).registerA - replaceInstruction( // Replace instruction to preserve control flow label. - returnInstructionIndex, - "invoke-static {p1, v$measuredTextWidthRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onRollingNumberMeasured(Ljava/lang/String;F)F" - ) addInstructions( - returnInstructionIndex + 1, - """ - move-result v$measuredTextWidthRegister - return v$measuredTextWidthRegister + endIndex + 1, """ + invoke-static {p1, v$measuredTextWidthRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onRollingNumberMeasured(Ljava/lang/String;F)F + move-result v$measuredTextWidthRegister + """ ) } } ?: throw RollingNumberMeasureAnimatedTextFingerprint.exception // Additional text measurement method. Used if YouTube decides not to animate the likes count // and sometimes used for initial video load. - RollingNumberMeasureStaticLabelFingerprint.also { - if (!it.resolve(context, RollingNumberMeasureTextParentFingerprint.result!!.classDef)) - throw it.exception - }.result?.also { + RollingNumberMeasureStaticLabelFingerprint.resolve(context, RollingNumberMeasureStaticLabelParentFingerprint.resultOrThrow().classDef) + RollingNumberMeasureStaticLabelFingerprint.result?.also { + val measureTextIndex = it.scanResult.patternScanResult!!.startIndex + 1 it.mutableMethod.apply { - val measureTextIndex = it.scanResult.patternScanResult!!.startIndex + 1 val freeRegister = getInstruction(0).registerA addInstructions( diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureAnimatedTextFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureAnimatedTextFingerprint.kt index 717131ff59..69d0168129 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureAnimatedTextFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureAnimatedTextFingerprint.kt @@ -5,19 +5,24 @@ import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode -/** - * Resolves to class found in [RollingNumberMeasureTextParentFingerprint]. - */ internal object RollingNumberMeasureAnimatedTextFingerprint : MethodFingerprint( - returnType = "F", - accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - parameters = listOf("Ljava/lang/String;"), + returnType = "Lj\$/util/Optional;", + accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, + parameters = listOf( + "L", + "Ljava/lang/String;", + "L" + ), opcodes = listOf( - Opcode.INVOKE_VIRTUAL, + Opcode.IGET, // First instruction of method + Opcode.IGET_OBJECT, + Opcode.IGET_OBJECT, + Opcode.CONST_HIGH16, + Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT, - Opcode.ADD_FLOAT_2ADDR, - Opcode.ADD_INT_LIT8, - Opcode.GOTO, - Opcode.RETURN + Opcode.CONST_4, + Opcode.AGET, + Opcode.CONST_4, + Opcode.CONST_4, // Measured text width ) ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelFingerprint.kt index 612b711d7d..d16b580b4b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelFingerprint.kt @@ -6,7 +6,7 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode /** - * Resolves to class found in [RollingNumberMeasureTextParentFingerprint]. + * Resolves to class found in [RollingNumberMeasureStaticLabelParentFingerprint]. */ internal object RollingNumberMeasureStaticLabelFingerprint : MethodFingerprint( returnType = "F", diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureTextParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelParentFingerprint.kt similarity index 82% rename from src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureTextParentFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelParentFingerprint.kt index 319605bebf..aa5229e996 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureTextParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelParentFingerprint.kt @@ -4,7 +4,7 @@ import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags -internal object RollingNumberMeasureTextParentFingerprint : MethodFingerprint( +internal object RollingNumberMeasureStaticLabelParentFingerprint : MethodFingerprint( returnType = "Ljava/lang/String;", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf(), diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt index 3bbe66fa68..d5ea7bce96 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt @@ -26,8 +26,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "18.37.36", "18.38.44", "18.43.45", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt index 1df0b13971..779652d137 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt @@ -23,8 +23,10 @@ import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt index 6199e0076f..c15d55c8e7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt @@ -38,13 +38,9 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference compatiblePackages = [ CompatiblePackage( "com.google.android.youtube", [ - "18.32.39", - "18.37.36", - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.41", - "18.45.43" + "18.48.39", + "18.49.37", + "19.01.34" ] ) ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt index 6336df4082..b1a46448b8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt @@ -28,8 +28,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt index 9518cc557f..cd9f5343e9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt @@ -24,8 +24,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt index e85cd94042..c73dcb7afd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt @@ -32,8 +32,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ) ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt index afd6e6cb1e..bffa7f80a1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt @@ -35,8 +35,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt index 70b9ba1bbf..535682137b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt @@ -40,8 +40,10 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt index 2ca8b8934b..703aa79e8c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt @@ -10,7 +10,7 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.shared.settings.preference.impl.SwitchPreference import app.revanced.patches.youtube.misc.settings.SettingsPatch -import app.revanced.patches.youtube.shared.fingerprints.WatchWhileActivityFingerprint +import app.revanced.patches.youtube.shared.fingerprints.MainActivityFingerprint import com.android.tools.smali.dexlib2.Opcode @Patch( @@ -21,15 +21,15 @@ import com.android.tools.smali.dexlib2.Opcode ) @Suppress("unused") object AnnouncementsPatch : BytecodePatch( - setOf(WatchWhileActivityFingerprint) + setOf(MainActivityFingerprint) ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/announcements/AnnouncementsPatch;" override fun execute(context: BytecodeContext) { - val onCreateMethod = WatchWhileActivityFingerprint.result?.let { + val onCreateMethod = MainActivityFingerprint.result?.let { it.mutableClass.methods.find { method -> method.name == "onCreate" } - } ?: throw WatchWhileActivityFingerprint.exception + } ?: throw MainActivityFingerprint.exception val superCallIndex = onCreateMethod.getInstructions().indexOfFirst { it.opcode == Opcode.INVOKE_SUPER_RANGE } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt index 86f38ec8e4..387a9c2554 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt @@ -28,8 +28,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt index 9bada89958..e521e7570f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt @@ -23,12 +23,15 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] ) +@Suppress("unused") object SpoofDeviceDimensionsPatch : BytecodePatch( setOf(DeviceDimensionsModelToStringFingerprint) ) { diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt index 663299b926..bdd3d49690 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.misc.fix.backtoexitgesture -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.fingerprint.MethodFingerprint @@ -10,6 +9,7 @@ import app.revanced.patches.youtube.misc.fix.backtoexitgesture.fingerprints.OnBa import app.revanced.patches.youtube.misc.fix.backtoexitgesture.fingerprints.RecyclerViewScrollingFingerprint import app.revanced.patches.youtube.misc.fix.backtoexitgesture.fingerprints.RecyclerViewTopScrollingFingerprint import app.revanced.patches.youtube.misc.fix.backtoexitgesture.fingerprints.RecyclerViewTopScrollingParentFingerprint +import app.revanced.util.exception @Patch(description = "Fixes the swipe back to exit gesture.") @Suppress("unused") @@ -37,7 +37,7 @@ internal object FixBackToExitGesturePatch : BytecodePatch( methodName = "onScrollingViews" ), OnBackPressedFingerprint to IntegrationsMethod( - "p0", "onBackPressed", "Lcom/google/android/apps/youtube/app/watchwhile/WatchWhileActivity;" + "p0", "onBackPressed", "Landroid/app/Activity;" ) ).forEach { (fingerprint, target) -> fingerprint.injectCall(target) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/OnBackPressedFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/OnBackPressedFingerprint.kt index d44ddfe794..282122b84f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/OnBackPressedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/OnBackPressedFingerprint.kt @@ -12,7 +12,9 @@ internal object OnBackPressedFingerprint : MethodFingerprint( Opcode.RETURN_VOID ), customFingerprint = { methodDef, _ -> - methodDef.definingClass.endsWith("WatchWhileActivity;") + (methodDef.definingClass.endsWith("MainActivity;") || + // Old versions of YouTube called this class "WatchWhileActivity" instead. + methodDef.definingClass.endsWith("WatchWhileActivity;")) && methodDef.name == "onBackPressed" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch.kt index 243bad27e1..7e6f710ca1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch.kt @@ -10,22 +10,16 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.misc.fix.playback.fingerprints.UserAgentHeaderBuilderFingerprint import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction - @Patch( name = "Client spoof", description = "Adds options to spoof the client to allow video playback.", dependencies = [SpoofSignaturePatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", - [ - "18.32.39", - "18.37.36", - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.41", - "18.45.43" + "com.google.android.youtube", [ + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt index d7d344cce6..9f02600887 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt @@ -33,13 +33,9 @@ object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch( compatiblePackages = setOf( CompatiblePackage( "com.google.android.youtube", setOf( - "18.32.39", - "18.37.36", - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.41", - "18.45.43" + "18.48.39", + "18.49.37", + "19.01.34" ) ) ), diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt index 38bb63535d..bf94b60a33 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt @@ -25,12 +25,15 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction [ "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] ) +@Suppress("unused") object BypassURLRedirectsPatch : BytecodePatch( setOf(ABUriParserFingerprint, HTTPUriParserFingerprint) ) { diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt index 4aae45df6d..a81078f6e3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt @@ -28,8 +28,10 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt index a4cbad5131..b40b3c32c7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt @@ -34,13 +34,9 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference CompatiblePackage( "com.google.android.youtube", [ - "18.32.39", - "18.37.36", - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.41", - "18.45.43" + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt index 53cd733d16..3e3b69b345 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt @@ -30,8 +30,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction [ "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/WatchWhileActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/MainActivityFingerprint.kt similarity index 55% rename from src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/WatchWhileActivityFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/MainActivityFingerprint.kt index b7567b5692..f7573bd5de 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/WatchWhileActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/MainActivityFingerprint.kt @@ -4,10 +4,12 @@ import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags -internal object WatchWhileActivityFingerprint : MethodFingerprint( +internal object MainActivityFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, parameters = listOf(), customFingerprint = { methodDef, _ -> - methodDef.definingClass.endsWith("WatchWhileActivity;") + methodDef.definingClass.endsWith("MainActivity;") + // Old versions of YouTube called this class "WatchWhileActivity" instead. + || methodDef.definingClass.endsWith("WatchWhileActivity;") } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/HDRBrightnessPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/HDRBrightnessPatch.kt index 8d94373bb1..0c072bbe14 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/HDRBrightnessPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/HDRBrightnessPatch.kt @@ -26,8 +26,10 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt index 353edcbdbe..4883700944 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.video.information -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions @@ -14,6 +13,7 @@ import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.video.information.fingerprints.* import app.revanced.patches.youtube.video.playerresponse.PlayerResponseMethodHookPatch import app.revanced.patches.youtube.video.videoid.VideoIdPatch +import app.revanced.util.exception import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.builder.BuilderInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt index 3811b761fd..135779eec2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt @@ -18,29 +18,44 @@ object PlayerResponseMethodHookPatch : BytecodePatch(setOf(PlayerParameterBuilderFingerprint)), Closeable, MutableSet by mutableSetOf() { - private const val VIDEO_ID_PARAMETER = 1 - private const val IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER = 11 - private const val PROTO_BUFFER_PARAMETER_PARAMETER = 3 + + // Parameter numbers of the patched method. + private const val PARAMETER_VIDEO_ID = 1 + private const val PARAMETER_PROTO_BUFFER = 3 + private const val PARAMETER_IS_SHORT_AND_OPENING_OR_PLAYING = 11 + + // Temporary 4-bit registers used to pass the parameters to integrations. + private const val REGISTER_VIDEO_ID = 0 + private const val REGISTER_PROTO_BUFFER = 1 + private const val REGISTER_IS_SHORT_AND_OPENING_OR_PLAYING = 2 private lateinit var playerResponseMethod: MutableMethod + private var numberOfInstructionsAdded = 0 + override fun execute(context: BytecodeContext) { playerResponseMethod = PlayerParameterBuilderFingerprint.result?.mutableMethod ?: throw PlayerParameterBuilderFingerprint.exception } override fun close() { - fun hookVideoId(hook: Hook) = playerResponseMethod.addInstruction( - 0, "invoke-static {p$VIDEO_ID_PARAMETER, p$IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER}, $hook" - ) + fun hookVideoId(hook: Hook) { + playerResponseMethod.addInstruction( + 0, "invoke-static {v$REGISTER_VIDEO_ID, v$REGISTER_IS_SHORT_AND_OPENING_OR_PLAYING}, $hook" + ) + numberOfInstructionsAdded++ + } - fun hookProtoBufferParameter(hook: Hook) = playerResponseMethod.addInstructions( - 0, - """ - invoke-static {p$PROTO_BUFFER_PARAMETER_PARAMETER, p$IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER}, $hook - move-result-object p$PROTO_BUFFER_PARAMETER_PARAMETER + fun hookProtoBufferParameter(hook: Hook) { + playerResponseMethod.addInstructions( + 0, + """ + invoke-static {v$REGISTER_PROTO_BUFFER, v$REGISTER_IS_SHORT_AND_OPENING_OR_PLAYING}, $hook + move-result-object v$REGISTER_PROTO_BUFFER """ - ) + ) + numberOfInstructionsAdded += 2 + } // Reverse the order in order to preserve insertion order of the hooks. val beforeVideoIdHooks = filterIsInstance().asReversed() @@ -51,6 +66,23 @@ object PlayerResponseMethodHookPatch : afterVideoIdHooks.forEach(::hookProtoBufferParameter) videoIdHooks.forEach(::hookVideoId) beforeVideoIdHooks.forEach(::hookProtoBufferParameter) + + // On some app targets the method has too many registers pushing the parameters past v15. + // Move the parameters to 4-bit registers so they can be passed to integrations. + playerResponseMethod.addInstructions( + 0, """ + move-object/from16 v$REGISTER_VIDEO_ID, p$PARAMETER_VIDEO_ID + move-object/from16 v$REGISTER_PROTO_BUFFER, p$PARAMETER_PROTO_BUFFER + move/from16 v$REGISTER_IS_SHORT_AND_OPENING_OR_PLAYING, p$PARAMETER_IS_SHORT_AND_OPENING_OR_PLAYING + """, + ) + numberOfInstructionsAdded += 3 + + // Move the modified register back. + playerResponseMethod.addInstruction( + numberOfInstructionsAdded, + "move-object/from16 p$PARAMETER_PROTO_BUFFER, v$REGISTER_PROTO_BUFFER" + ) } internal abstract class Hook(private val methodDescriptor: String) { diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt index 49a578e92f..ef4d7e3c81 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt @@ -31,13 +31,9 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference compatiblePackages = [ CompatiblePackage( "com.google.android.youtube", [ - "18.32.39", - "18.37.36", - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.41", - "18.45.43" + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt index 244e89558b..29f3d2805a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt @@ -14,13 +14,9 @@ import app.revanced.patches.youtube.video.speed.remember.RememberPlaybackSpeedPa compatiblePackages = [ CompatiblePackage( "com.google.android.youtube", [ - "18.32.39", - "18.37.36", - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.41", - "18.45.43" + "18.48.39", + "18.49.37", + "19.01.34" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt index 2e5afea580..a7ba8df2b5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt @@ -29,7 +29,13 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableField @Patch( description = "Adds custom playback speed options.", - dependencies = [IntegrationsPatch::class, LithoFilterPatch::class, SettingsPatch::class, RecyclerViewTreeHookPatch::class] + dependencies = [ + IntegrationsPatch::class, + LithoFilterPatch::class, + SettingsPatch::class, + RecyclerViewTreeHookPatch::class, + CustomPlaybackSpeedResourcePatch::class + ] ) object CustomPlaybackSpeedPatch : BytecodePatch( setOf( diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt new file mode 100644 index 0000000000..93aaf552af --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt @@ -0,0 +1,15 @@ +package app.revanced.patches.youtube.video.speed.custom + +import app.revanced.patcher.data.ResourceContext +import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch + +internal object CustomPlaybackSpeedResourcePatch : ResourcePatch() { + var speedUnavailableId: Long = -1 + + override fun execute(context: ResourceContext) { + speedUnavailableId = ResourceMappingPatch.resourceMappings.single { + it.type == "string" && it.name == "varispeed_unavailable_message" + }.id + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuFingerprint.kt index 4df113decc..f893eb9043 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuFingerprint.kt @@ -1,7 +1,10 @@ package app.revanced.patches.youtube.video.speed.custom.fingerprints -import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patches.youtube.video.speed.custom.CustomPlaybackSpeedResourcePatch +import app.revanced.util.patch.LiteralValueFingerprint -internal object ShowOldPlaybackSpeedMenuFingerprint : MethodFingerprint( - strings = listOf("PLAYBACK_RATE_MENU_BOTTOM_SHEET_FRAGMENT") +internal object ShowOldPlaybackSpeedMenuFingerprint : LiteralValueFingerprint( + literalSupplier = { + CustomPlaybackSpeedResourcePatch.speedUnavailableId + } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt index 63295cb8f5..efe99d7afd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.video.videoid -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -13,6 +12,7 @@ import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch import app.revanced.patches.youtube.video.playerresponse.PlayerResponseMethodHookPatch import app.revanced.patches.youtube.video.videoid.fingerprint.VideoIdFingerprint import app.revanced.patches.youtube.video.videoid.fingerprint.VideoIdFingerprintBackgroundPlay +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( @@ -49,7 +49,7 @@ object VideoIdPatch : BytecodePatch( consumer(it, insertIndex, videoIdRegister) } - } ?: throw VideoIdFingerprint.exception + } ?: throw exception VideoIdFingerprint.setFields { method, index, register -> videoIdMethod = method diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprint.kt index dfc90619c5..a01b2ebdcc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprint.kt @@ -10,19 +10,13 @@ internal object VideoIdFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("L"), opcodes = listOf( - Opcode.MOVE_RESULT_OBJECT, - Opcode.IF_EQZ, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, - Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT, Opcode.IF_EQZ, Opcode.IGET_OBJECT, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, + Opcode.IGET_OBJECT, Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_INTERFACE, - Opcode.MOVE_RESULT_OBJECT + Opcode.MOVE_RESULT_OBJECT, ) ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprintBackgroundPlay.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprintBackgroundPlay.kt index 8a265c915f..5bc5d4fd3b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprintBackgroundPlay.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprintBackgroundPlay.kt @@ -10,18 +10,10 @@ internal object VideoIdFingerprintBackgroundPlay : MethodFingerprint( accessFlags = AccessFlags.DECLARED_SYNCHRONIZED or AccessFlags.FINAL or AccessFlags.PUBLIC, parameters = listOf("L"), opcodes = listOf( - Opcode.MONITOR_EXIT, - Opcode.RETURN_VOID, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, - Opcode.NEW_ARRAY, - Opcode.SGET_OBJECT, - Opcode.APUT_OBJECT, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, Opcode.IF_EQZ, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, + Opcode.IGET_OBJECT, Opcode.IF_EQZ, Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT, diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt index 86f7db13a2..bb864b2fba 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt @@ -30,8 +30,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "18.38.44", "18.43.45", "18.44.41", - "18.45.41", - "18.45.43" + "18.45.43", + "18.48.39", + "18.49.37", + "19.01.34" ] ) ]