mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-03 20:32:54 +01:00
feat(youtube): support version 18.23.35
(#2461)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
eeb3d80525
commit
d20fde1e57
@ -3,7 +3,7 @@ package app.revanced.patches.youtube.ad.general.annotation
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideAdsCompatibility
|
internal annotation class HideAdsCompatibility
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.ad.getpremium.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideGetPremiumCompatibility
|
internal annotation class HideGetPremiumCompatibility
|
||||||
|
@ -3,7 +3,7 @@ package app.revanced.patches.youtube.ad.video.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class VideoAdsCompatibility
|
internal annotation class VideoAdsCompatibility
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.interaction.copyvideourl.annotation
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class CopyVideoUrlCompatibility
|
internal annotation class CopyVideoUrlCompatibility
|
@ -3,7 +3,7 @@ package app.revanced.patches.youtube.interaction.downloads.annotation
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class ExternalDownloadsCompatibility
|
internal annotation class ExternalDownloadsCompatibility
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package app.revanced.patches.youtube.interaction.seekbar.annotation
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class SeekbarTappingCompatibility
|
internal annotation class SeekbarTappingCompatibility
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.interaction.swipecontrols.annotation
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class SwipeControlsCompatibility
|
internal annotation class SwipeControlsCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.autocaptions.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class AutoCaptionsCompatibility
|
internal annotation class AutoCaptionsCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.action.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideButtonsCompatibility
|
internal annotation class HideButtonsCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.autoplay.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class AutoplayButtonCompatibility
|
internal annotation class AutoplayButtonCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.captions.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideCaptionsButtonCompatibility
|
internal annotation class HideCaptionsButtonCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.navigation.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class NavigationButtonsCompatibility
|
internal annotation class NavigationButtonsCompatibility
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.player.hide.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HidePlayerButtonsCompatibility
|
internal annotation class HidePlayerButtonsCompatibility
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.albumcards.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class AlbumCardsCompatibility
|
internal annotation class AlbumCardsCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.breakingnews.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class BreakingNewsCompatibility
|
internal annotation class BreakingNewsCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.comments.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideCommentsCompatibility
|
internal annotation class HideCommentsCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.crowdfundingbox.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class CrowdfundingBoxCompatibility
|
internal annotation class CrowdfundingBoxCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.endscreencards.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideEndscreenCardsCompatibility
|
internal annotation class HideEndscreenCardsCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.filterbar.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideFilterBar
|
internal annotation class HideFilterBar
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.floatingmicrophone.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideFloatingMicrophoneButtonCompatibility
|
internal annotation class HideFloatingMicrophoneButtonCompatibility
|
||||||
|
@ -3,7 +3,7 @@ package app.revanced.patches.youtube.layout.hide.general.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideLayoutComponentsCompatibility
|
internal annotation class HideLayoutComponentsCompatibility
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.infocards.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideInfocardsCompatibility
|
internal annotation class HideInfocardsCompatibility
|
||||||
|
@ -3,7 +3,7 @@ package app.revanced.patches.youtube.layout.hide.loadmorebutton.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideLoadMoreButtonCompatibility
|
internal annotation class HideLoadMoreButtonCompatibility
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.personalinformation.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideEmailAddressCompatibility
|
internal annotation class HideEmailAddressCompatibility
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.player.overlay.bytecode.fingerprints
|
package app.revanced.patches.youtube.layout.hide.player.overlay.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.extensions.containsConstantInstructionValue
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.util.patch.LiteralValueFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch.HidePlayerOverlayResourcePatch
|
import app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch.HidePlayerOverlayResourcePatch
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object CreatePlayerOverviewFingerprint : LiteralValueFingerprint(
|
object CreatePlayerOverviewFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@ -15,5 +16,8 @@ object CreatePlayerOverviewFingerprint : LiteralValueFingerprint(
|
|||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.CHECK_CAST
|
Opcode.CHECK_CAST
|
||||||
),
|
),
|
||||||
literal = HidePlayerOverlayResourcePatch.scrimOverlayId
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.definingClass.endsWith("YouTubeControlsOverlay;")
|
||||||
|
&& methodDef.containsConstantInstructionValue(HidePlayerOverlayResourcePatch.scrimOverlayId)
|
||||||
|
}
|
||||||
)
|
)
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.seekbar.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideSeekbarCompatibility
|
internal annotation class HideSeekbarCompatibility
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.shorts.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideShortsComponentsCompatibility
|
internal annotation class HideShortsComponentsCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.time.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideTimeCompatibility
|
internal annotation class HideTimeCompatibility
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.watchinvr.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class WatchInVRCompatibility
|
internal annotation class WatchInVRCompatibility
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.watermark.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HideWatermarkCompatibility
|
internal annotation class HideWatermarkCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.panels.fullscreen.remove.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class FullscreenPanelsCompatibility
|
internal annotation class FullscreenPanelsCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.panels.popup.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class PlayerPopupPanelsCompatibility
|
internal annotation class PlayerPopupPanelsCompatibility
|
||||||
|
@ -2,6 +2,6 @@ package app.revanced.patches.youtube.layout.player.background.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class PlayerControlsBackgroundCompatibility
|
internal annotation class PlayerControlsBackgroundCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.returnyoutubedislike.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class ReturnYouTubeDislikeCompatibility
|
internal annotation class ReturnYouTubeDislikeCompatibility
|
@ -21,14 +21,11 @@ object TextComponentAtomicReferenceFingerprint : MethodFingerprint(
|
|||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.CHECK_CAST,
|
Opcode.CHECK_CAST,
|
||||||
Opcode.MOVE_OBJECT, // CharSequence reference, and control flow label. Insert code here.
|
Opcode.MOVE_OBJECT, // CharSequence reference, and control flow label. Insert code here.
|
||||||
Opcode.INVOKE_VIRTUAL,
|
null, // invoke-interface or invoke-virtual
|
||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
Opcode.IF_EQZ,
|
Opcode.IF_EQZ,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
null, // invoke-interface or invoke-virtual
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.GOTO,
|
Opcode.GOTO,
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.INVOKE_VIRTUAL_RANGE,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves against the same method that [TextComponentContextFingerprint] resolves to.
|
* Resolves against the same class that [TextComponentConstructorFingerprint] resolves to.
|
||||||
*/
|
*/
|
||||||
object TextComponentContextFingerprint : MethodFingerprint(
|
object TextComponentContextFingerprint : MethodFingerprint(
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.searchbar.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class WideSearchbarCompatibility
|
internal annotation class WideSearchbarCompatibility
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.sponsorblock.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class SponsorBlockCompatibility
|
internal annotation class SponsorBlockCompatibility
|
@ -3,7 +3,7 @@ package app.revanced.patches.youtube.layout.spoofappversion.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class SpoofAppVersionCompatibility
|
internal annotation class SpoofAppVersionCompatibility
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.startupshortsreset.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class StartupShortsResetCompatibility
|
internal annotation class StartupShortsResetCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.tabletminiplayer.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class TabletMiniPlayerCompatibility
|
internal annotation class TabletMiniPlayerCompatibility
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object MiniPlayerOverrideFingerprint : MethodFingerprint(
|
object MiniPlayerOverrideFingerprint : MethodFingerprint(
|
||||||
"Z", AccessFlags.STATIC or AccessFlags.PUBLIC,
|
"Z", AccessFlags.STATIC or AccessFlags.PUBLIC,
|
||||||
listOf("L"),
|
listOf("Landroid/content/Context;"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_STATIC,
|
||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
|
@ -3,5 +3,5 @@ package app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints
|
|||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
object MiniPlayerOverrideParentFingerprint : MethodFingerprint(
|
object MiniPlayerOverrideParentFingerprint : MethodFingerprint(
|
||||||
strings = listOf("Possible Context wrapper loop - chain of wrappers larger than 10000")
|
strings = listOf("Unset or unknown Input OneOf case for dynamic input")
|
||||||
)
|
)
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.misc.autorepeat.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class AutoRepeatCompatibility
|
internal annotation class AutoRepeatCompatibility
|
@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.bottomsheet.hook.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patches.youtube.video.videoqualitymenu.patch.OldVideoQualityMenuResourcePatch
|
||||||
|
import app.revanced.util.patch.LiteralValueFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object CreateBottomSheetFingerprint : LiteralValueFingerprint(
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
returnType = "Landroid/widget/LinearLayout;",
|
||||||
|
literal = OldVideoQualityMenuResourcePatch.bottomSheetMargins
|
||||||
|
)
|
@ -0,0 +1,43 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.bottomsheet.hook.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.youtube.misc.bottomsheet.hook.fingerprints.CreateBottomSheetFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@DependsOn([IntegrationsPatch::class])
|
||||||
|
class BottomSheetHookPatch : BytecodePatch(
|
||||||
|
listOf(CreateBottomSheetFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
CreateBottomSheetFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val returnLinearLayoutIndex = implementation!!.instructions.lastIndex
|
||||||
|
val linearLayoutRegister = getInstruction<OneRegisterInstruction>(returnLinearLayoutIndex).registerA
|
||||||
|
|
||||||
|
addHook = { classDescriptor ->
|
||||||
|
addInstruction(
|
||||||
|
returnLinearLayoutIndex,
|
||||||
|
"invoke-static { v$linearLayoutRegister }, " +
|
||||||
|
"${classDescriptor}->" +
|
||||||
|
"onFlyoutMenuCreate(Landroid/widget/LinearLayout;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ?: return CreateBottomSheetFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal companion object {
|
||||||
|
internal lateinit var addHook: (String) -> Unit
|
||||||
|
private set
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.misc.fix.backtoexitgesture.annotation
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class FixBackToExitGestureCompatibility
|
internal annotation class FixBackToExitGestureCompatibility
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.misc.fix.playback.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class ClientSpoofCompatibility
|
internal annotation class ClientSpoofCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.misc.integrations.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class IntegrationsCompatibility
|
internal annotation class IntegrationsCompatibility
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.misc.links.open.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class OpenLinksExternallyCompatibility
|
internal annotation class OpenLinksExternallyCompatibility
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.litho.filter.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object ProtobufBufferFingerprint : MethodFingerprint(
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.IGET_OBJECT, // References the field required below.
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
Opcode.IF_NEZ,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.CHECK_CAST, // Casts the referenced field to a specific type that stores the protobuf buffer.
|
|
||||||
Opcode.INVOKE_VIRTUAL
|
|
||||||
)
|
|
||||||
)
|
|
@ -0,0 +1,18 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.litho.filter.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object ProtobufBufferReferenceFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("I", "Ljava/nio/ByteBuffer;"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IPUT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.SUB_INT_2ADDR
|
||||||
|
)
|
||||||
|
)
|
@ -4,50 +4,110 @@ import app.revanced.extensions.toErrorResult
|
|||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.litho.filter.fingerprints.*
|
import app.revanced.patches.youtube.misc.litho.filter.fingerprints.*
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.Instruction
|
import org.jf.dexlib2.iface.instruction.Instruction
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
import org.jf.dexlib2.immutable.ImmutableField
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
|
|
||||||
@DependsOn([IntegrationsPatch::class])
|
@DependsOn([IntegrationsPatch::class])
|
||||||
@Description("Hooks the method which parses the bytes into a ComponentContext to filter components.")
|
@Description("Hooks the method which parses the bytes into a ComponentContext to filter components.")
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class LithoFilterPatch : BytecodePatch(
|
class LithoFilterPatch : BytecodePatch(
|
||||||
listOf(ComponentContextParserFingerprint, LithoFilterFingerprint)
|
listOf(ComponentContextParserFingerprint, LithoFilterFingerprint, ProtobufBufferReferenceFingerprint)
|
||||||
), Closeable {
|
), Closeable {
|
||||||
|
/**
|
||||||
|
* The following patch inserts a hook into the method that parses the bytes into a ComponentContext.
|
||||||
|
* This method contains a StringBuilder object that represents the pathBuilder of the component.
|
||||||
|
* The pathBuilder is used to filter components by their path.
|
||||||
|
*
|
||||||
|
* Additionally, the method contains a reference to the components identifier.
|
||||||
|
* The identifier is used to filter components by their identifier.
|
||||||
|
*
|
||||||
|
* In addition to that, a static field is added to the class of this method. (See protobufBufferField).
|
||||||
|
* This field holds a reference to the protobuf buffer object.
|
||||||
|
* The field is being set in another method that holds a reference to the protobuf buffer object.
|
||||||
|
* The object contains a large byte array that represents the component tree.
|
||||||
|
* This byte array is searched for strings that indicate the current component.
|
||||||
|
*
|
||||||
|
* The following pseudo code shows how the patch works:
|
||||||
|
*
|
||||||
|
* class ComponentContextParser {
|
||||||
|
* public static ByteBuffer buffer; // Inserted by this patch.
|
||||||
|
*
|
||||||
|
* public ComponentContext parseBytesToComponentContext(...) {
|
||||||
|
* ...
|
||||||
|
* if (filter(identifier, pathBuilder, buffer)); // Inserted by this patch.
|
||||||
|
* return emptyComponent;
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class SomeOtherClass {
|
||||||
|
* // Called before ComponentContextParser.parseBytesToComponentContext method.
|
||||||
|
* public void someOtherMethod(ByteBuffer byteBuffer) {
|
||||||
|
* ComponentContextParser.buffer = byteBuffer; // Inserted by this patch.
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
ComponentContextParserFingerprint.result?.also {
|
ComponentContextParserFingerprint.result?.also {
|
||||||
arrayOf(
|
arrayOf(
|
||||||
EmptyComponentBuilderFingerprint,
|
EmptyComponentBuilderFingerprint,
|
||||||
ReadComponentIdentifierFingerprint,
|
ReadComponentIdentifierFingerprint
|
||||||
ProtobufBufferFingerprint
|
|
||||||
).forEach { fingerprint ->
|
).forEach { fingerprint ->
|
||||||
if (fingerprint.resolve(context, it.mutableMethod, it.mutableClass)) return@forEach
|
if (fingerprint.resolve(context, it.mutableMethod, it.mutableClass)) return@forEach
|
||||||
return fingerprint.toErrorResult()
|
return fingerprint.toErrorResult()
|
||||||
}
|
}
|
||||||
}?.let { result ->
|
}?.let { bytesToComponentContextMethod ->
|
||||||
|
// region Add a static field that holds a reference to the protobuf buffer object.
|
||||||
|
val protobufBufferField = ImmutableField(
|
||||||
|
bytesToComponentContextMethod.mutableClass.type,
|
||||||
|
"buffer",
|
||||||
|
"Ljava/nio/ByteBuffer;",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
).toMutable()
|
||||||
|
bytesToComponentContextMethod.mutableClass.staticFields.add(protobufBufferField)
|
||||||
|
|
||||||
|
// Set the field with the reference to the protobuf buffer object.
|
||||||
|
ProtobufBufferReferenceFingerprint.result
|
||||||
|
?.mutableMethod?.addInstruction(0, "sput-object p2, $protobufBufferField")
|
||||||
|
?: return ProtobufBufferReferenceFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region Hook the method that parses bytes into a ComponentContext.
|
||||||
|
|
||||||
val builderMethodIndex = EmptyComponentBuilderFingerprint.patternScanEndIndex
|
val builderMethodIndex = EmptyComponentBuilderFingerprint.patternScanEndIndex
|
||||||
val emptyComponentFieldIndex = builderMethodIndex + 2
|
val emptyComponentFieldIndex = builderMethodIndex + 2
|
||||||
|
|
||||||
result.mutableMethod.apply {
|
bytesToComponentContextMethod.mutableMethod.apply {
|
||||||
val insertHookIndex = result.scanResult.patternScanResult!!.endIndex
|
val insertHookIndex = bytesToComponentContextMethod.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
// region Get free registers that this patch uses
|
// region Get free registers that this patch uses.
|
||||||
// Registers are overwritten right after they are used in this patch, therefore free to clobber.
|
// Registers are overwritten right after they are used in this patch, therefore free to clobber.
|
||||||
|
|
||||||
val freeRegistersInstruction = getInstruction<FiveRegisterInstruction>(insertHookIndex - 2)
|
val freeRegistersInstruction = getInstruction<FiveRegisterInstruction>(insertHookIndex - 2)
|
||||||
@ -64,7 +124,7 @@ class LithoFilterPatch : BytecodePatch(
|
|||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Get references that this patch needs
|
// region Get references that this patch needs.
|
||||||
|
|
||||||
val builderMethodDescriptor = getInstruction(builderMethodIndex).descriptor
|
val builderMethodDescriptor = getInstruction(builderMethodIndex).descriptor
|
||||||
val emptyComponentFieldDescriptor = getInstruction(emptyComponentFieldIndex).descriptor
|
val emptyComponentFieldDescriptor = getInstruction(emptyComponentFieldIndex).descriptor
|
||||||
@ -72,34 +132,18 @@ class LithoFilterPatch : BytecodePatch(
|
|||||||
val identifierRegister =
|
val identifierRegister =
|
||||||
getInstruction<OneRegisterInstruction>(ReadComponentIdentifierFingerprint.patternScanEndIndex).registerA
|
getInstruction<OneRegisterInstruction>(ReadComponentIdentifierFingerprint.patternScanEndIndex).registerA
|
||||||
|
|
||||||
// Parameter that holds a ref to a type with a field that ref the protobuf buffer object.
|
|
||||||
val protobufParameterNumber = 3
|
|
||||||
|
|
||||||
// Get the field that stores an protobuf buffer required below.
|
|
||||||
val protobufBufferRefTypeRefFieldDescriptor =
|
|
||||||
getInstruction(ProtobufBufferFingerprint.patternScanStartIndex).descriptor
|
|
||||||
val protobufBufferRefTypeDescriptor =
|
|
||||||
getInstruction(ProtobufBufferFingerprint.patternScanEndIndex - 1).descriptor
|
|
||||||
val protobufBufferFieldDescriptor = "$protobufBufferRefTypeDescriptor->b:Ljava/nio/ByteBuffer;"
|
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Patch the method
|
// region Patch the method.
|
||||||
|
|
||||||
// Insert the instructions that are responsible
|
// Insert the instructions that are responsible
|
||||||
// to return an EmptyComponent instead of the original component if the filter method returns false.
|
// to return an EmptyComponent instead of the original component if the filter method returns false.
|
||||||
addInstructionsWithLabels(
|
addInstructionsWithLabels(
|
||||||
insertHookIndex,
|
insertHookIndex,
|
||||||
"""
|
"""
|
||||||
# Get the protobuf buffer object.
|
# Register "free1" holds the protobuf buffer object
|
||||||
|
|
||||||
move-object/from16 v$free1, p$protobufParameterNumber
|
sget-object v$free1, $protobufBufferField
|
||||||
iget-object v$free1, v$free1, $protobufBufferRefTypeRefFieldDescriptor
|
|
||||||
check-cast v$free1, $protobufBufferRefTypeDescriptor
|
|
||||||
|
|
||||||
# Register "free" now holds the protobuf buffer object
|
|
||||||
|
|
||||||
iget-object v$free1, v$free1, $protobufBufferFieldDescriptor
|
|
||||||
|
|
||||||
# Invoke the filter method.
|
# Invoke the filter method.
|
||||||
|
|
||||||
@ -119,6 +163,8 @@ class LithoFilterPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
// endregion
|
// endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// endregion
|
||||||
} ?: return ComponentContextParserFingerprint.toErrorResult()
|
} ?: return ComponentContextParserFingerprint.toErrorResult()
|
||||||
|
|
||||||
LithoFilterFingerprint.result?.mutableMethod?.apply {
|
LithoFilterFingerprint.result?.mutableMethod?.apply {
|
||||||
@ -150,9 +196,6 @@ class LithoFilterPatch : BytecodePatch(
|
|||||||
private val MethodFingerprint.patternScanEndIndex
|
private val MethodFingerprint.patternScanEndIndex
|
||||||
get() = patternScanResult.endIndex
|
get() = patternScanResult.endIndex
|
||||||
|
|
||||||
private val MethodFingerprint.patternScanStartIndex
|
|
||||||
get() = patternScanResult.startIndex
|
|
||||||
|
|
||||||
private val Instruction.descriptor
|
private val Instruction.descriptor
|
||||||
get() = (this as ReferenceInstruction).reference.toString()
|
get() = (this as ReferenceInstruction).reference.toString()
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.misc.microg.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class MicroGPatchCompatibility
|
internal annotation class MicroGPatchCompatibility
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.misc.minimizedplayback.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class MinimizedPlaybackCompatibility
|
internal annotation class MinimizedPlaybackCompatibility
|
@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object MinimizedPlaybackSettingsFingerprint : MethodFingerprint(
|
object MinimizedPlaybackSettingsFingerprint : MethodFingerprint(
|
||||||
returnType = "L",
|
returnType = "Ljava/lang/String;",
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
|
@ -8,7 +8,8 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
* Class fingerprint for [MinimizedPlaybackSettingsFingerprint]
|
* Class fingerprint for [MinimizedPlaybackSettingsFingerprint]
|
||||||
*/
|
*/
|
||||||
object MinimizedPlaybackSettingsParentFingerprint : MethodFingerprint(
|
object MinimizedPlaybackSettingsParentFingerprint : MethodFingerprint(
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||||
parameters = listOf("Landroid/content/Context;", "Landroid/support/v4/media/session/MediaSessionCompat"),
|
returnType = "I",
|
||||||
strings = listOf("sessionToken must not be null")
|
parameters = listOf(),
|
||||||
|
strings = listOf("BiometricManager", "Failure in canAuthenticate(). FingerprintManager was null.")
|
||||||
)
|
)
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.misc.playercontrols.annotation
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class PlayerControlsCompatibility
|
internal annotation class PlayerControlsCompatibility
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.misc.playeroverlay.annotation
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class PlayerOverlaysHookCompatibility
|
internal annotation class PlayerOverlaysHookCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.misc.playertype.annotation
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class PlayerTypeHookCompatibility
|
internal annotation class PlayerTypeHookCompatibility
|
||||||
|
@ -4,6 +4,6 @@ import app.revanced.patcher.annotation.Compatibility
|
|||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
// TODO: delete this
|
// TODO: delete this
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class CustomVideoBufferCompatibility
|
internal annotation class CustomVideoBufferCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.video.hdrbrightness.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HDRBrightnessCompatibility
|
internal annotation class HDRBrightnessCompatibility
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.video.information.annotation
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class VideoInformationCompatibility
|
internal annotation class VideoInformationCompatibility
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.video.oldqualitylayout.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
|
||||||
import app.revanced.patches.youtube.video.oldqualitylayout.annotations.OldQualityLayoutCompatibility
|
|
||||||
import app.revanced.patches.youtube.video.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
|
|
||||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@DependsOn([IntegrationsPatch::class, OldQualityLayoutResourcePatch::class])
|
|
||||||
@Name("old-quality-layout")
|
|
||||||
@Description("Enables the original video quality flyout in the video player settings.")
|
|
||||||
@OldQualityLayoutCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class OldQualityLayoutPatch : BytecodePatch(listOf(QualityMenuViewInflateFingerprint)) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
val inflateFingerprintResult = QualityMenuViewInflateFingerprint.result!!
|
|
||||||
val method = inflateFingerprintResult.mutableMethod
|
|
||||||
val instructions = method.implementation!!.instructions
|
|
||||||
|
|
||||||
// at this index the listener is added to the list view
|
|
||||||
val listenerInvokeRegister = instructions.size - 1 - 1
|
|
||||||
|
|
||||||
// get the register which stores the quality menu list view
|
|
||||||
val onItemClickViewRegister = (instructions[listenerInvokeRegister] as FiveRegisterInstruction).registerC
|
|
||||||
|
|
||||||
// insert the integrations method
|
|
||||||
method.addInstruction(
|
|
||||||
listenerInvokeRegister, // insert the integrations instructions right before the listener
|
|
||||||
"invoke-static { v$onItemClickViewRegister }, Lapp/revanced/integrations/patches/playback/quality/OldQualityLayoutPatch;->showOldQualityMenu(Landroid/widget/ListView;)V"
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.video.oldqualitylayout.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
|
||||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
|
||||||
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.bytecode.patch.SettingsPatch
|
|
||||||
|
|
||||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
|
||||||
class OldQualityLayoutResourcePatch : ResourcePatch {
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
|
||||||
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
|
|
||||||
SwitchPreference(
|
|
||||||
"revanced_show_old_video_menu",
|
|
||||||
StringResource("revanced_show_old_video_menu_title", "Use old video quality player menu"),
|
|
||||||
StringResource("revanced_show_old_video_menu_summary_on", "Old video quality menu is used"),
|
|
||||||
StringResource("revanced_show_old_video_menu_summary_off", "Old video quality menu is not used")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
videoQualityBottomSheetListFragmentTitle =
|
|
||||||
ResourceMappingPatch.resourceMappings.find { it.name == "video_quality_bottom_sheet_list_fragment_title" }
|
|
||||||
?.id ?: return PatchResultError("Could not find resource")
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
internal companion object {
|
|
||||||
var videoQualityBottomSheetListFragmentTitle = -1L
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.video.quality.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class RememberVideoQualityCompatibility
|
internal annotation class RememberVideoQualityCompatibility
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
package app.revanced.patches.youtube.video.quality.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object NewVideoQualityChangedFingerprint : MethodFingerprint(
|
||||||
|
returnType = "L",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IGET, // Video resolution (human readable).
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IGET_BOOLEAN,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.GOTO,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.IF_NE,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IGET,
|
||||||
|
)
|
||||||
|
)
|
@ -3,6 +3,9 @@ package app.revanced.patches.youtube.video.quality.fingerprints
|
|||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves with the class found in [VideoQualitySetterFingerprint].
|
||||||
|
*/
|
||||||
object SetQualityByIndexMethodClassFieldReferenceFingerprint : MethodFingerprint(
|
object SetQualityByIndexMethodClassFieldReferenceFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
|
@ -7,6 +7,7 @@ import app.revanced.patcher.annotation.Version
|
|||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@ -22,10 +23,12 @@ import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
|||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
||||||
import app.revanced.patches.youtube.video.quality.annotations.RememberVideoQualityCompatibility
|
import app.revanced.patches.youtube.video.quality.annotations.RememberVideoQualityCompatibility
|
||||||
|
import app.revanced.patches.youtube.video.quality.fingerprints.NewVideoQualityChangedFingerprint
|
||||||
import app.revanced.patches.youtube.video.quality.fingerprints.SetQualityByIndexMethodClassFieldReferenceFingerprint
|
import app.revanced.patches.youtube.video.quality.fingerprints.SetQualityByIndexMethodClassFieldReferenceFingerprint
|
||||||
import app.revanced.patches.youtube.video.quality.fingerprints.VideoQualityItemOnClickParentFingerprint
|
import app.revanced.patches.youtube.video.quality.fingerprints.VideoQualityItemOnClickParentFingerprint
|
||||||
import app.revanced.patches.youtube.video.quality.fingerprints.VideoQualitySetterFingerprint
|
import app.revanced.patches.youtube.video.quality.fingerprints.VideoQualitySetterFingerprint
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
import org.jf.dexlib2.iface.reference.FieldReference
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@ -37,7 +40,8 @@ import org.jf.dexlib2.iface.reference.FieldReference
|
|||||||
class RememberVideoQualityPatch : BytecodePatch(
|
class RememberVideoQualityPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
VideoQualitySetterFingerprint,
|
VideoQualitySetterFingerprint,
|
||||||
VideoQualityItemOnClickParentFingerprint
|
VideoQualityItemOnClickParentFingerprint,
|
||||||
|
NewVideoQualityChangedFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
@ -113,6 +117,7 @@ class RememberVideoQualityPatch : BytecodePatch(
|
|||||||
|
|
||||||
VideoInformationPatch.onCreateHook(INTEGRATIONS_CLASS_DESCRIPTOR, "newVideoStarted")
|
VideoInformationPatch.onCreateHook(INTEGRATIONS_CLASS_DESCRIPTOR, "newVideoStarted")
|
||||||
|
|
||||||
|
|
||||||
// Inject a call to set the remembered quality once a video loads.
|
// Inject a call to set the remembered quality once a video loads.
|
||||||
VideoQualitySetterFingerprint.result?.also {
|
VideoQualitySetterFingerprint.result?.also {
|
||||||
if (!SetQualityByIndexMethodClassFieldReferenceFingerprint.resolve(context, it.classDef))
|
if (!SetQualityByIndexMethodClassFieldReferenceFingerprint.resolve(context, it.classDef))
|
||||||
@ -159,6 +164,7 @@ class RememberVideoQualityPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
} ?: return VideoQualitySetterFingerprint.toErrorResult()
|
} ?: return VideoQualitySetterFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
|
||||||
// Inject a call to remember the selected quality.
|
// Inject a call to remember the selected quality.
|
||||||
VideoQualityItemOnClickParentFingerprint.result?.let {
|
VideoQualityItemOnClickParentFingerprint.result?.let {
|
||||||
val onItemClickMethod = it.mutableClass.methods.find { method -> method.name == "onItemClick" }
|
val onItemClickMethod = it.mutableClass.methods.find { method -> method.name == "onItemClick" }
|
||||||
@ -172,6 +178,22 @@ class RememberVideoQualityPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
} ?: return PatchResultError("Failed to find onItemClick method")
|
} ?: return PatchResultError("Failed to find onItemClick method")
|
||||||
} ?: return VideoQualityItemOnClickParentFingerprint.toErrorResult()
|
} ?: return VideoQualityItemOnClickParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
|
||||||
|
// Remember video quality if not using old layout menu.
|
||||||
|
NewVideoQualityChangedFingerprint.result?.apply {
|
||||||
|
mutableMethod.apply {
|
||||||
|
val index = scanResult.patternScanResult!!.startIndex
|
||||||
|
val qualityRegister = getInstruction<TwoRegisterInstruction>(index).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
index + 1,
|
||||||
|
"invoke-static {v$qualityRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->userChangedQualityInNewFlyout(I)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return NewVideoQualityChangedFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,9 +19,7 @@ import app.revanced.patches.youtube.video.speed.remember.patch.RememberPlaybackS
|
|||||||
@VideoSpeedCompatibility
|
@VideoSpeedCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class VideoSpeed : BytecodePatch() {
|
class VideoSpeed : BytecodePatch() {
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
return PatchResultSuccess() // All patches this patch depends on succeed.
|
return PatchResultSuccess() // All patches this patch depends on succeed.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.video.speed
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class VideoSpeedCompatibility
|
internal annotation class VideoSpeedCompatibility
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
package app.revanced.patches.youtube.video.speed.custom.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
object GetOldVideoSpeedsFingerprint : MethodFingerprint(
|
||||||
|
parameters = listOf("[L", "I"),
|
||||||
|
strings = listOf("menu_item_playback_speed")
|
||||||
|
)
|
@ -0,0 +1,7 @@
|
|||||||
|
package app.revanced.patches.youtube.video.speed.custom.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
object ShowOldVideoSpeedMenuFingerprint : MethodFingerprint(
|
||||||
|
strings = listOf("PLAYBACK_RATE_MENU_BOTTOM_SHEET_FRAGMENT")
|
||||||
|
)
|
@ -0,0 +1,7 @@
|
|||||||
|
package app.revanced.patches.youtube.video.speed.custom.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
object ShowOldVideoSpeedMenuIntegrationsFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { method, _ -> method.name == "showOldVideoSpeedMenu" }
|
||||||
|
)
|
@ -1,36 +1,46 @@
|
|||||||
package app.revanced.patches.youtube.video.speed.custom.patch
|
package app.revanced.patches.youtube.video.speed.custom.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patches.shared.settings.preference.impl.InputType
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.*
|
||||||
import app.revanced.patches.shared.settings.preference.impl.TextPreference
|
import app.revanced.patches.youtube.misc.bottomsheet.hook.patch.BottomSheetHookPatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.video.speed.custom.fingerprints.SpeedArrayGeneratorFingerprint
|
import app.revanced.patches.youtube.video.speed.custom.fingerprints.*
|
||||||
import app.revanced.patches.youtube.video.speed.custom.fingerprints.SpeedLimiterFingerprint
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
import org.jf.dexlib2.iface.reference.FieldReference
|
||||||
import org.jf.dexlib2.iface.reference.MethodReference
|
import org.jf.dexlib2.iface.reference.MethodReference
|
||||||
|
import org.jf.dexlib2.immutable.ImmutableField
|
||||||
|
|
||||||
@Name("custom-video-speed")
|
@Name("custom-video-speed")
|
||||||
@Description("Adds custom video speed options.")
|
@Description("Adds custom video speed options.")
|
||||||
@DependsOn([IntegrationsPatch::class])
|
@DependsOn([IntegrationsPatch::class, LithoFilterPatch::class, SettingsPatch::class, BottomSheetHookPatch::class])
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class CustomVideoSpeedPatch : BytecodePatch(
|
class CustomVideoSpeedPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
SpeedArrayGeneratorFingerprint, SpeedLimiterFingerprint
|
SpeedArrayGeneratorFingerprint,
|
||||||
|
SpeedLimiterFingerprint,
|
||||||
|
GetOldVideoSpeedsFingerprint,
|
||||||
|
ShowOldVideoSpeedMenuIntegrationsFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@ -45,7 +55,7 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
|||||||
inputType = InputType.TEXT_MULTI_LINE,
|
inputType = InputType.TEXT_MULTI_LINE,
|
||||||
summary = StringResource(
|
summary = StringResource(
|
||||||
"revanced_custom_playback_speeds_summary",
|
"revanced_custom_playback_speeds_summary",
|
||||||
"Add or change the video speeds available"
|
"Add or change the available playback speeds"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -71,7 +81,7 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
|||||||
|
|
||||||
val arrayLengthConstDestination = (arrayLengthConst as OneRegisterInstruction).registerA
|
val arrayLengthConstDestination = (arrayLengthConst as OneRegisterInstruction).registerA
|
||||||
|
|
||||||
val videoSpeedsArrayType = "Lapp/revanced/integrations/patches/playback/speed/CustomVideoSpeedPatch;->customVideoSpeeds:[F"
|
val videoSpeedsArrayType = "$INTEGRATIONS_CLASS_DESCRIPTOR->customVideoSpeeds:[F"
|
||||||
|
|
||||||
arrayGenMethod.addInstructions(
|
arrayGenMethod.addInstructions(
|
||||||
arrayLengthConstIndex + 1,
|
arrayLengthConstIndex + 1,
|
||||||
@ -111,14 +121,72 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
|||||||
// edit: alternatively this might work by overriding with fixed values such as 0.1x and 10x
|
// edit: alternatively this might work by overriding with fixed values such as 0.1x and 10x
|
||||||
limiterMethod.replaceInstruction(
|
limiterMethod.replaceInstruction(
|
||||||
limiterMinConstIndex,
|
limiterMinConstIndex,
|
||||||
"sget v$limiterMinConstDestination, Lapp/revanced/integrations/patches/playback/speed/CustomVideoSpeedPatch;->minVideoSpeed:F"
|
"sget v$limiterMinConstDestination, $INTEGRATIONS_CLASS_DESCRIPTOR->minVideoSpeed:F"
|
||||||
)
|
)
|
||||||
limiterMethod.replaceInstruction(
|
limiterMethod.replaceInstruction(
|
||||||
limiterMaxConstIndex,
|
limiterMaxConstIndex,
|
||||||
"sget v$limiterMaxConstDestination, Lapp/revanced/integrations/patches/playback/speed/CustomVideoSpeedPatch;->maxVideoSpeed:F"
|
"sget v$limiterMaxConstDestination, $INTEGRATIONS_CLASS_DESCRIPTOR->maxVideoSpeed:F"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// region Force old video quality menu.
|
||||||
|
// This is necessary, because there is no known way of adding custom video speeds to the new menu.
|
||||||
|
|
||||||
|
BottomSheetHookPatch.addHook(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||||
|
|
||||||
|
// Required to check if the video speed menu is currently shown.
|
||||||
|
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||||
|
|
||||||
|
GetOldVideoSpeedsFingerprint.result?.let { result ->
|
||||||
|
// Add a static INSTANCE field to the class.
|
||||||
|
// This is later used to call "showOldVideoSpeedMenu" on the instance.
|
||||||
|
val instanceField = ImmutableField(
|
||||||
|
result.classDef.type,
|
||||||
|
"INSTANCE",
|
||||||
|
result.classDef.type,
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
).toMutable()
|
||||||
|
|
||||||
|
result.mutableClass.staticFields.add(instanceField)
|
||||||
|
// Set the INSTANCE field to the instance of the class.
|
||||||
|
// In order to prevent a conflict with another patch, add the instruction at index 1.
|
||||||
|
result.mutableMethod.addInstruction(1, "sput-object p0, $instanceField")
|
||||||
|
|
||||||
|
// Get the "showOldVideoSpeedMenu" method.
|
||||||
|
// This is later called on the field INSTANCE.
|
||||||
|
val showOldVideoSpeedMenuMethod = ShowOldVideoSpeedMenuFingerprint.also {
|
||||||
|
if (!it.resolve(context, result.classDef))
|
||||||
|
throw ShowOldVideoSpeedMenuFingerprint.toErrorResult()
|
||||||
|
}.result!!.method.toString()
|
||||||
|
|
||||||
|
// Insert the call to the "showOldVideoSpeedMenu" method on the field INSTANCE.
|
||||||
|
ShowOldVideoSpeedMenuIntegrationsFingerprint.result?.mutableMethod?.apply {
|
||||||
|
addInstructionsWithLabels(
|
||||||
|
implementation!!.instructions.lastIndex,
|
||||||
|
"""
|
||||||
|
sget-object v0, $instanceField
|
||||||
|
if-nez v0, :not_null
|
||||||
|
return-void
|
||||||
|
:not_null
|
||||||
|
invoke-virtual { v0 }, $showOldVideoSpeedMenuMethod
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
} ?: return ShowOldVideoSpeedMenuIntegrationsFingerprint.toErrorResult()
|
||||||
|
} ?: return GetOldVideoSpeedsFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
private const val FILTER_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/patches/components/VideoSpeedMenuFilterPatch;"
|
||||||
|
|
||||||
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/patches/playback/speed/CustomVideoSpeedPatch;"
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,6 @@ package app.revanced.patches.youtube.video.videoid.annotation
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class VideoIdCompatibility
|
internal annotation class VideoIdCompatibility
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patches.youtube.video.oldqualitylayout.annotations
|
package app.revanced.patches.youtube.video.videoqualitymenu.annotations
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.20.39", "18.23.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class OldQualityLayoutCompatibility
|
internal annotation class OldVideoQualityMenuCompatibility
|
@ -1,12 +1,12 @@
|
|||||||
package app.revanced.patches.youtube.video.oldqualitylayout.fingerprints
|
package app.revanced.patches.youtube.video.videoqualitymenu.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patches.youtube.video.videoqualitymenu.patch.OldVideoQualityMenuResourcePatch
|
||||||
import app.revanced.util.patch.LiteralValueFingerprint
|
import app.revanced.util.patch.LiteralValueFingerprint
|
||||||
import app.revanced.patches.youtube.video.oldqualitylayout.patch.OldQualityLayoutResourcePatch
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object QualityMenuViewInflateFingerprint : LiteralValueFingerprint(
|
object VideoQualityMenuViewInflateFingerprint : LiteralValueFingerprint(
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("L", "L", "L"),
|
parameters = listOf("L", "L", "L"),
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
@ -26,5 +26,5 @@ object QualityMenuViewInflateFingerprint : LiteralValueFingerprint(
|
|||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.CHECK_CAST
|
Opcode.CHECK_CAST
|
||||||
),
|
),
|
||||||
literal = OldQualityLayoutResourcePatch.videoQualityBottomSheetListFragmentTitle
|
literal = OldVideoQualityMenuResourcePatch.videoQualityBottomSheetListFragmentTitle
|
||||||
)
|
)
|
@ -0,0 +1,73 @@
|
|||||||
|
package app.revanced.patches.youtube.video.videoqualitymenu.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.youtube.misc.bottomsheet.hook.patch.BottomSheetHookPatch
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
|
||||||
|
import app.revanced.patches.youtube.video.videoqualitymenu.annotations.OldVideoQualityMenuCompatibility
|
||||||
|
import app.revanced.patches.youtube.video.videoqualitymenu.fingerprints.VideoQualityMenuViewInflateFingerprint
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([
|
||||||
|
IntegrationsPatch::class,
|
||||||
|
OldVideoQualityMenuResourcePatch::class,
|
||||||
|
LithoFilterPatch::class,
|
||||||
|
BottomSheetHookPatch::class
|
||||||
|
])
|
||||||
|
@Name("old-video-quality-menu")
|
||||||
|
@Description("Shows the old video quality with the advanced video quality options instead of the new one.")
|
||||||
|
@OldVideoQualityMenuCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class OldVideoQualityMenuPatch : BytecodePatch(
|
||||||
|
listOf(VideoQualityMenuViewInflateFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
// region Patch for the old type of the video quality menu.
|
||||||
|
|
||||||
|
VideoQualityMenuViewInflateFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val checkCastIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
val listViewRegister = getInstruction<OneRegisterInstruction>(checkCastIndex).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
checkCastIndex + 1,
|
||||||
|
"invoke-static { v$listViewRegister }, " +
|
||||||
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->" +
|
||||||
|
"showOldVideoQualityMenu(Landroid/widget/ListView;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region Patch for the new type of the video quality menu.
|
||||||
|
|
||||||
|
BottomSheetHookPatch.addHook(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||||
|
|
||||||
|
// Required to check if the video quality menu is currently shown in order to click on the "Advanced" item.
|
||||||
|
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
private const val FILTER_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/patches/components/VideoQualityMenuFilterPatch;"
|
||||||
|
|
||||||
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/patches/playback/quality/OldVideoQualityMenuPatch;"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package app.revanced.patches.youtube.video.videoqualitymenu.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
|
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.bytecode.patch.SettingsPatch
|
||||||
|
|
||||||
|
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
|
class OldVideoQualityMenuResourcePatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_show_old_video_quality_menu",
|
||||||
|
StringResource("revanced_show_old_video_quality_menu_title", "Show old video quality menu"),
|
||||||
|
StringResource("revanced_show_old_video_quality_menu_summary_on", "Old video quality menu is shown"),
|
||||||
|
StringResource("revanced_show_old_video_quality_menu_summary_off", "New video quality menu is hidden")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
fun findResource(name: String) = ResourceMappingPatch.resourceMappings.find { it.name == name }?.id
|
||||||
|
?: throw PatchResultError("Could not find resource")
|
||||||
|
|
||||||
|
// Used for the old type of the video quality menu.
|
||||||
|
videoQualityBottomSheetListFragmentTitle = findResource("video_quality_bottom_sheet_list_fragment_title")
|
||||||
|
|
||||||
|
// Used for the new type of the video quality menu.
|
||||||
|
bottomSheetMargins = findResource("bottom_sheet_margins")
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal companion object {
|
||||||
|
var videoQualityBottomSheetListFragmentTitle = -1L
|
||||||
|
var bottomSheetMargins = -1L
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user