From a938e736fa2aed1792cfdce5656efa15d0791d71 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 16 Jan 2024 19:54:06 +0100 Subject: [PATCH] feat(YouTube): Support versions `18.48.39`, `18.49.37` and `19.01.34` (#2551) Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> --- .../youtube/ad/general/HideAdsPatch.kt | 9 +-- .../ad/getpremium/HideGetPremiumPatch.kt | 6 +- .../patches/youtube/ad/video/VideoAdsPatch.kt | 6 +- .../copyvideourl/CopyVideoUrlBytecodePatch.kt | 13 ++--- .../ExternalDownloadsBytecodePatch.kt | 13 ++--- .../DisablePreciseSeekingGesturePatch.kt | 6 +- .../seekbar/EnableSeekbarTappingPatch.kt | 6 +- .../seekbar/EnableSlideToSeekPatch.kt | 6 +- .../SwipeControlsBytecodePatch.kt | 20 ++++--- .../layout/autocaptions/AutoCaptionsPatch.kt | 6 +- .../layout/buttons/action/HideButtonsPatch.kt | 6 +- .../autoplay/HideAutoplayButtonPatch.kt | 6 +- .../captions/HideCaptionsButtonPatch.kt | 6 +- .../navigation/NavigationButtonsPatch.kt | 6 +- .../player/hide/HidePlayerButtonsPatch.kt | 6 +- .../layout/hide/albumcards/AlbumCardsPatch.kt | 6 +- .../hide/breakingnews/BreakingNewsPatch.kt | 6 +- .../layout/hide/comments/CommentsPatch.kt | 6 +- .../crowdfundingbox/CrowdfundingBoxPatch.kt | 6 +- .../endscreencards/HideEndscreenCardsPatch.kt | 6 +- .../hide/filterbar/HideFilterBarPatch.kt | 6 +- .../HideFloatingMicrophoneButtonPatch.kt | 6 +- .../DisableFullscreenAmbientModePatch.kt | 6 +- .../hide/general/HideLayoutComponentsPatch.kt | 6 +- .../hide/infocards/HideInfoCardsPatch.kt | 6 +- .../loadmorebutton/HideLoadMoreButtonPatch.kt | 6 +- .../HideEmailAddressPatch.kt | 6 +- .../HidePlayerFlyoutMenuPatch.kt | 23 +++++--- .../DisableRollingNumberAnimationPatch.kt | 6 +- .../layout/hide/seekbar/HideSeekbarPatch.kt | 6 +- .../hide/shorts/HideShortsComponentsPatch.kt | 6 +- .../DisableSuggestedVideoEndScreenPatch.kt | 6 +- .../layout/hide/time/HideTimestampPatch.kt | 7 ++- .../panels/popup/PlayerPopupPanelsPatch.kt | 6 +- .../PlayerControlsBackgroundPatch.kt | 6 +- .../ReturnYouTubeDislikePatch.kt | 46 ++++++--------- ...ingNumberMeasureAnimatedTextFingerprint.kt | 27 +++++---- ...lingNumberMeasureStaticLabelFingerprint.kt | 2 +- ...berMeasureStaticLabelParentFingerprint.kt} | 2 +- .../layout/searchbar/WideSearchbarPatch.kt | 6 +- .../RestoreOldSeekbarThumbnailsPatch.kt | 6 +- .../sponsorblock/SponsorBlockBytecodePatch.kt | 10 +--- .../spoofappversion/SpoofAppVersionPatch.kt | 6 +- .../DisableResumingShortsOnStartupPatch.kt | 6 +- .../tabletminiplayer/TabletMiniPlayerPatch.kt | 6 +- .../layout/theme/ThemeBytecodePatch.kt | 6 +- .../thumbnails/AlternativeThumbnailsPatch.kt | 6 +- .../misc/announcements/AnnouncementsPatch.kt | 8 +-- .../misc/autorepeat/AutoRepeatPatch.kt | 6 +- .../spoof/SpoofDeviceDimensionsPatch.kt | 7 ++- .../FixBackToExitGesturePatch.kt | 4 +- .../fingerprints/OnBackPressedFingerprint.kt | 4 +- .../misc/fix/playback/ClientSpoofPatch.kt | 14 ++--- .../youtube/misc/gms/GmsCoreSupportPatch.kt | 10 +--- .../misc/links/BypassURLRedirectsPatch.kt | 7 ++- .../misc/links/OpenLinksExternallyPatch.kt | 6 +- .../MinimizedPlaybackPatch.kt | 10 +--- .../RemoveTrackingQueryParameterPatch.kt | 6 +- ...gerprint.kt => MainActivityFingerprint.kt} | 6 +- .../video/hdrbrightness/HDRBrightnessPatch.kt | 6 +- .../information/VideoInformationPatch.kt | 2 +- .../PlayerResponseMethodHookPatch.kt | 56 +++++++++++++++---- .../quality/RememberVideoQualityPatch.kt | 10 +--- .../youtube/video/speed/PlaybackSpeedPatch.kt | 10 +--- .../speed/custom/CustomPlaybackSpeedPatch.kt | 8 ++- .../CustomPlaybackSpeedResourcePatch.kt | 15 +++++ .../ShowOldPlaybackSpeedMenuFingerprint.kt | 9 ++- .../youtube/video/videoid/VideoIdPatch.kt | 4 +- .../videoid/fingerprint/VideoIdFingerprint.kt | 10 +--- .../VideoIdFingerprintBackgroundPlay.kt | 10 +--- .../RestoreOldVideoQualityMenuPatch.kt | 6 +- 71 files changed, 362 insertions(+), 260 deletions(-) rename src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/{RollingNumberMeasureTextParentFingerprint.kt => RollingNumberMeasureStaticLabelParentFingerprint.kt} (82%) rename src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/{WatchWhileActivityFingerprint.kt => MainActivityFingerprint.kt} (55%) create mode 100644 src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt 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 84167225..ef10af3a 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 9ec7fa8c..097125ee 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 370e9957..b338686d 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 659b2ff1..c1fc4765 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 015aeba1..0564d57d 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 df776163..0e9892d7 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 5d0816a6..41f58f72 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 79f7d20d..364e9655 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 6db26ca8..c1a4f644 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 dec88bf0..19b93d79 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 7f88b2b7..c3b07065 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 4e3ab1d1..4b53c342 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 a3114d60..ffbd4347 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 ceb78d6c..abcad73d 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 dc64b939..afe026ad 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 ae2d3c40..689e89cf 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 7fb2202f..067bfa44 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 dd81aa19..777c9c36 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 f01894d0..9b01f063 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 c85e6380..0ed39df9 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 940cb4ca..0cf334c7 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 dd98a8ae..06ee7d04 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 60a2264d..dd8f3900 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 d4a58b1d..2d45795b 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 d49c32e4..cf9f08d3 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 fdd2fc1e..076c4b78 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 d505f2c9..a8c8157d 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 df8387a9..074416c1 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 169741ca..4bac1420 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 ef8853b3..3a62fd88 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 ddd7c735..429c6f62 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 0715c65c..02994d5e 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 39e1f6ff..a298db24 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 602bf6a3..5c46ca2b 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 b083a028..c16e76da 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 76e58255..2e0f4ba5 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 717131ff..69d01681 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 612b711d..d16b580b 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 319605be..aa5229e9 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 3bbe66fa..d5ea7bce 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 1df0b139..779652d1 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 6199e007..c15d55c8 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 6336df40..b1a46448 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 9518cc55..cd9f5343 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 e85cd940..c73dcb7a 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 afd6e6cb..bffa7f80 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 70b9ba1b..53568213 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 2ca8b893..703aa79e 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 86f38ec8..387a9c25 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 9bada899..e521e757 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 663299b9..bdd3d496 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 d44ddfe7..282122b8 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 243bad27..7e6f710c 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 d7d344cc..9f026008 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 38bb6353..bf94b60a 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 4aae45df..a81078f6 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 a4cbad51..b40b3c32 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 53cd733d..3e3b69b3 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 b7567b56..f7573bd5 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 8d94373b..0c072bbe 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 353edcbd..48837009 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 3811b761..135779ee 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, + 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 """ - invoke-static {p$PROTO_BUFFER_PARAMETER_PARAMETER, p$IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER}, $hook - move-result-object p$PROTO_BUFFER_PARAMETER_PARAMETER - """ - ) + ) + 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 49a578e9..ef4d7e3c 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 244e8955..29f3d280 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 2e5afea5..a7ba8df2 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 00000000..93aaf552 --- /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 4df113de..f893eb90 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 63295cb8..efe99d7a 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 dfc90619..a01b2ebd 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 8a265c91..5bc5d4fd 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 86f7db13..bb864b2f 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" ] ) ]