From 68d35eafc15513c23cd5220260023e7ec5b7978a Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 1 Jun 2024 00:59:02 +0400 Subject: [PATCH 01/14] feat(YouTube - Hide layout components): Disable like / subscribe button glow animation (#3265) --- .../youtube/layout/hide/general/HideLayoutComponentsPatch.kt | 1 + src/main/resources/addresources/values/strings.xml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt index d9827600..240f2c56 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt @@ -102,6 +102,7 @@ object HideLayoutComponentsPatch : BytecodePatch( SwitchPreference("revanced_hide_expandable_chip"), SwitchPreference("revanced_hide_info_panels"), SwitchPreference("revanced_hide_join_membership_button"), + SwitchPreference("revanced_disable_like_subscribe_glow"), SwitchPreference("revanced_hide_medical_panels"), SwitchPreference("revanced_hide_quick_actions"), SwitchPreference("revanced_hide_related_videos"), diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index 26670cf6..fb45208e 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -91,6 +91,9 @@ Turning off error toasts hides all ReVanced error notifications.\n\nYou will not be notified of any unexpected events. + Disable like / subscribe button glow + Like and subscribe button will not glow when mentioned + Like and subscribe button will glow when mentioned Hide gray separator Gray separators are hidden Gray separators are shown From 0a11584a7ac69f0a1cea27b5b39fde4a6a7c4760 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 31 May 2024 21:01:00 +0000 Subject: [PATCH 02/14] chore(release): 4.9.0-dev.1 [skip ci] # [4.9.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.8.3...v4.9.0-dev.1) (2024-05-31) ### Features * **YouTube - Hide layout components:** Disable like / subscribe button glow animation ([#3265](https://github.com/ReVanced/revanced-patches/issues/3265)) ([68d35ea](https://github.com/ReVanced/revanced-patches/commit/68d35eafc15513c23cd5220260023e7ec5b7978a)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b0fc18..6ecfb1b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [4.9.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.8.3...v4.9.0-dev.1) (2024-05-31) + + +### Features + +* **YouTube - Hide layout components:** Disable like / subscribe button glow animation ([#3265](https://github.com/ReVanced/revanced-patches/issues/3265)) ([68d35ea](https://github.com/ReVanced/revanced-patches/commit/68d35eafc15513c23cd5220260023e7ec5b7978a)) + ## [4.8.3](https://github.com/ReVanced/revanced-patches/compare/v4.8.2...v4.8.3) (2024-05-31) diff --git a/gradle.properties b/gradle.properties index b85e8c44..b5433d05 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 4.8.3 +version = 4.9.0-dev.1 From 5114900b1b5572c04ba6759eedab77f0a934b058 Mon Sep 17 00:00:00 2001 From: KAZI MMT <82371061+kazimmt@users.noreply.github.com> Date: Sat, 1 Jun 2024 15:29:24 +0600 Subject: [PATCH 03/14] fix(YouTube - Spoof client): Allow swipe gestures to enter/exit fullscreen when spoofing with `Android VR` client (#3259) --- .../misc/fix/playback/SpoofClientPatch.kt | 33 ++++++++++++ ...PlayerGestureConfigSyntheticFingerprint.kt | 51 +++++++++++++++++++ .../resources/addresources/values/strings.xml | 2 +- 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerGestureConfigSyntheticFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt index b812a90a..a70f61e5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt @@ -10,6 +10,7 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patches.all.misc.resources.AddResourcesPatch import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen @@ -19,6 +20,7 @@ import app.revanced.patches.youtube.misc.fix.playback.fingerprints.BuildInitPlay import app.revanced.patches.youtube.misc.fix.playback.fingerprints.BuildPlayerRequestURIFingerprint import app.revanced.patches.youtube.misc.fix.playback.fingerprints.CreatePlayerRequestBodyFingerprint import app.revanced.patches.youtube.misc.fix.playback.fingerprints.CreatePlayerRequestBodyWithModelFingerprint +import app.revanced.patches.youtube.misc.fix.playback.fingerprints.PlayerGestureConfigSyntheticFingerprint import app.revanced.patches.youtube.misc.fix.playback.fingerprints.SetPlayerRequestClientTypeFingerprint import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.util.getReference @@ -69,11 +71,15 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter ) object SpoofClientPatch : BytecodePatch( setOf( + // Client type spoof. BuildInitPlaybackRequestFingerprint, BuildPlayerRequestURIFingerprint, SetPlayerRequestClientTypeFingerprint, CreatePlayerRequestBodyFingerprint, CreatePlayerRequestBodyWithModelFingerprint, + + // Player gesture config. + PlayerGestureConfigSyntheticFingerprint, ), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = @@ -115,6 +121,33 @@ object SpoofClientPatch : BytecodePatch( // endregion + // region fix player gesture. + + PlayerGestureConfigSyntheticFingerprint.resultOrThrow().let { + val endIndex = it.scanResult.patternScanResult!!.endIndex + + arrayOf(3, 9).forEach { offSet -> + (context.toMethodWalker(it.mutableMethod) + .nextMethod(endIndex - offSet, true) + .getMethod() as MutableMethod) + .apply { + + val index = implementation!!.instructions.lastIndex + val register = getInstruction(index).registerA + + addInstructions( + index, + """ + invoke-static {v$register}, $INTEGRATIONS_CLASS_DESCRIPTOR->enablePlayerGesture(Z)Z + move-result v$register + """ + ) + } + } + } + + // endregion + // region Block /get_watch requests to fall back to /player requests. BuildPlayerRequestURIFingerprint.resultOrThrow().let { diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerGestureConfigSyntheticFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerGestureConfigSyntheticFingerprint.kt new file mode 100644 index 00000000..bbf66cb3 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerGestureConfigSyntheticFingerprint.kt @@ -0,0 +1,51 @@ +package app.revanced.patches.youtube.misc.fix.playback.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod +import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patches.youtube.misc.fix.playback.fingerprints.PlayerGestureConfigSyntheticFingerprint.indexOfDownAndOutAllowedInstruction +import app.revanced.util.getReference +import app.revanced.util.indexOfFirstInstruction +import com.android.tools.smali.dexlib2.AccessFlags +import com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.iface.Method +import com.android.tools.smali.dexlib2.iface.reference.MethodReference + +internal object PlayerGestureConfigSyntheticFingerprint : MethodFingerprint( + returnType = "V", + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + parameters = listOf("Ljava/lang/Object;"), + opcodes = listOf( + Opcode.SGET_OBJECT, + Opcode.INVOKE_VIRTUAL, + Opcode.MOVE_RESULT, + Opcode.IF_EQZ, + Opcode.IF_EQZ, + Opcode.IGET_OBJECT, + Opcode.INVOKE_INTERFACE, + Opcode.MOVE_RESULT_OBJECT, + Opcode.INVOKE_VIRTUAL, // playerGestureConfig.downAndOutLandscapeAllowed + Opcode.MOVE_RESULT, + Opcode.CHECK_CAST, + Opcode.IPUT_BOOLEAN, + Opcode.INVOKE_INTERFACE, + Opcode.MOVE_RESULT_OBJECT, + Opcode.INVOKE_VIRTUAL, // playerGestureConfig.downAndOutPortraitAllowed + Opcode.MOVE_RESULT, + Opcode.IPUT_BOOLEAN, + Opcode.RETURN_VOID, + ), + customFingerprint = { methodDef, classDef -> + // This method is always called "a" because this kind of class always has a single method. + methodDef.name == "a" && classDef.methods.count() == 2 && + indexOfDownAndOutAllowedInstruction(methodDef) >= 0 + } +) { + fun indexOfDownAndOutAllowedInstruction(methodDef: Method) = + methodDef.indexOfFirstInstruction { + val reference = getReference() + reference?.definingClass == "Lcom/google/android/libraries/youtube/innertube/model/media/PlayerConfigModel;" && + reference.parameterTypes.isEmpty() && + reference.returnType == "Z" + } +} \ No newline at end of file diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index fb45208e..cae84e50 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1097,7 +1097,7 @@ Turning off this setting may cause video playback issues. Spoof client to iOS Client is currently spoofed to iOS\n\nSide effects include:\n• No HDR video\n• Speed menu is missing\n• Watch history may not work\n• Live streams cannot play as audio only\n• Live streams not available on older devices - Client is currently spoofed to Android VR\n\nSide effects include:\n• No HDR video\n• Swipe to enter/exit fullscreen does not work\n• Kids videos do not playback\n• Paused videos can randomly resume + Client is currently spoofed to Android VR\n\nSide effects include:\n• No HDR video\n• Kids videos do not playback\n• Paused videos can randomly resume Spoof client thumbnails not available (API timed out) Spoof client thumbnails temporarily not available: %s From fcd7e94c1bc8d4cad789e6fa347f5195d7f7826f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 1 Jun 2024 09:31:24 +0000 Subject: [PATCH 04/14] chore(release): 4.9.0-dev.2 [skip ci] # [4.9.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.1...v4.9.0-dev.2) (2024-06-01) ### Bug Fixes * **YouTube - Spoof client:** Allow swipe gestures to enter/exit fullscreen when spoofing with `Android VR` client ([#3259](https://github.com/ReVanced/revanced-patches/issues/3259)) ([5114900](https://github.com/ReVanced/revanced-patches/commit/5114900b1b5572c04ba6759eedab77f0a934b058)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ecfb1b7..49633f50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [4.9.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.1...v4.9.0-dev.2) (2024-06-01) + + +### Bug Fixes + +* **YouTube - Spoof client:** Allow swipe gestures to enter/exit fullscreen when spoofing with `Android VR` client ([#3259](https://github.com/ReVanced/revanced-patches/issues/3259)) ([5114900](https://github.com/ReVanced/revanced-patches/commit/5114900b1b5572c04ba6759eedab77f0a934b058)) + # [4.9.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.8.3...v4.9.0-dev.1) (2024-05-31) diff --git a/gradle.properties b/gradle.properties index b5433d05..a4543f86 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 4.9.0-dev.1 +version = 4.9.0-dev.2 From d1ceca39984f7933b28d81802d04bb3ead327595 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 1 Jun 2024 19:52:43 +0400 Subject: [PATCH 05/14] feat(YouTube Music): Support version `7.03` (#3272) --- .../patches/music/ad/video/HideMusicVideoAds.kt | 13 ++++++++++++- .../music/audio/codecs/CodecsUnlockPatch.kt | 13 ++++++++++++- .../EnableExclusiveAudioPlayback.kt | 13 ++++++++++++- .../permanentrepeat/PermanentRepeatPatch.kt | 15 +++++++++++++-- .../fingerprints/RepeatTrackFingerprint.kt | 13 ++++++------- .../permanentshuffle/PermanentShufflePatch.kt | 13 ++++++++++++- .../music/layout/compactheader/HideCategoryBar.kt | 13 ++++++++++++- .../minimizedplayback/MinimizedPlaybackPatch.kt | 13 ++++++++++++- .../music/layout/premium/HideGetPremiumPatch.kt | 13 ++++++++++++- .../upgradebutton/RemoveUpgradeButtonPatch.kt | 13 ++++++++++++- .../androidauto/BypassCertificateChecksPatch.kt | 13 ++++++++++++- .../patches/music/misc/gms/GmsCoreSupportPatch.kt | 13 ++++++++++++- 12 files changed, 139 insertions(+), 19 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/music/ad/video/HideMusicVideoAds.kt b/src/main/kotlin/app/revanced/patches/music/ad/video/HideMusicVideoAds.kt index 6f533c2f..eddec5b9 100644 --- a/src/main/kotlin/app/revanced/patches/music/ad/video/HideMusicVideoAds.kt +++ b/src/main/kotlin/app/revanced/patches/music/ad/video/HideMusicVideoAds.kt @@ -11,7 +11,18 @@ import app.revanced.util.exception @Patch( name = "Hide music video ads", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ], ) @Suppress("unused") object HideMusicVideoAds : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt b/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt index 0c1cbebc..8559376c 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt @@ -11,7 +11,18 @@ import com.android.tools.smali.dexlib2.Opcode @Patch( description = "Adds more audio codec options. The new audio codecs usually result in better audio quality.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Deprecated("This patch is no longer needed as the feature is now enabled by default.") object CodecsUnlockPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt index 79f3fc0f..3b3a7637 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt @@ -11,7 +11,18 @@ import app.revanced.util.exception @Patch( name = "Enable exclusive audio playback", description = "Enables the option to play audio without video.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Suppress("unused") object EnableExclusiveAudioPlayback : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt index 257f43ee..73e7c458 100644 --- a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt @@ -13,7 +13,18 @@ import app.revanced.patches.music.interaction.permanentrepeat.fingerprints.Repea @Patch( name = "Permanent repeat", description = "Permanently remember your repeating preference even if the playlist ends or another track is played.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ], use = false ) @Suppress("unused") @@ -23,7 +34,7 @@ object PermanentRepeatPatch : BytecodePatch( override fun execute(context: BytecodeContext) { RepeatTrackFingerprint.result?.let { val startIndex = it.scanResult.patternScanResult!!.endIndex - val repeatIndex = startIndex + 3 + val repeatIndex = startIndex + 1 it.mutableMethod.apply { addInstructionsWithLabels( diff --git a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt index 4567f0fe..8d71fa62 100644 --- a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt @@ -6,17 +6,16 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode internal object RepeatTrackFingerprint : MethodFingerprint( - "V", - AccessFlags.PUBLIC or AccessFlags.FINAL, - listOf("L", "L"), - listOf( - Opcode.CHECK_CAST, - Opcode.INVOKE_INTERFACE, + returnType = "V", + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + parameters = listOf("L", "L"), + opcodes = listOf( Opcode.IGET_OBJECT, Opcode.IGET_OBJECT, Opcode.SGET_OBJECT, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, Opcode.IF_NEZ - ) + ), + strings = listOf("w_st") ) diff --git a/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt b/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt index 88dff320..72ac52dd 100644 --- a/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt @@ -12,7 +12,18 @@ import app.revanced.util.exception name = "Permanent shuffle", description = "Permanently remember your shuffle preference " + "even if the playlist ends or another track is played.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ], use = false, ) @Suppress("unused") diff --git a/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt b/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt index 0cc8e949..9db0a9ca 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt @@ -13,7 +13,18 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( name = "Hide category bar", description = "Hides the category bar at the top of the homepage.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ], use = false, ) @Suppress("unused") diff --git a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt index f2ec3352..918e08f2 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt @@ -13,7 +13,18 @@ import app.revanced.util.exception @Patch( name = "Minimized playback", description = "Unlocks options for picture-in-picture and background playback.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Suppress("unused") object MinimizedPlaybackPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt index 4475dafc..50fc512c 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt @@ -16,7 +16,18 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction @Patch( name = "Hide 'Get Music Premium' label", description = "Hides the \"Get Music Premium\" label from the account menu and settings.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Suppress("unused") object HideGetPremiumPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt index fed2cc6d..feca2a3b 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt @@ -22,7 +22,18 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference @Patch( name = "Remove upgrade button", description = "Removes the upgrade tab from the pivot bar.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Suppress("unused") object RemoveUpgradeButtonPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt index a06203de..d0905539 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt @@ -12,7 +12,18 @@ import app.revanced.patches.music.misc.androidauto.fingerprints.CheckCertificate @Patch( name = "Bypass certificate checks", description = "Bypasses certificate checks which prevent YouTube Music from working on Android Auto.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Suppress("unused") object BypassCertificateChecksPatch : BytecodePatch(setOf(CheckCertificateFingerprint)) { diff --git a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt index 3c99992f..311aeb11 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt @@ -23,7 +23,18 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch( mainActivityOnCreateFingerprint = MusicActivityOnCreateFingerprint, integrationsPatchDependency = IntegrationsPatch::class, gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch, - compatiblePackages = setOf(CompatiblePackage("com.google.android.apps.youtube.music")), + compatiblePackages = setOf( + CompatiblePackage( + "com.google.android.apps.youtube.music", + setOf( + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ) + ) + ), fingerprints = setOf( ServiceCheckFingerprint, GooglePlayUtilityFingerprint, From 3ad59fb84cc782903f04eb3bbad565b86d8eaa1f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 1 Jun 2024 15:54:45 +0000 Subject: [PATCH 06/14] chore(release): 4.9.0-dev.3 [skip ci] # [4.9.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.2...v4.9.0-dev.3) (2024-06-01) ### Features * **YouTube Music:** Support version `7.03` ([#3272](https://github.com/ReVanced/revanced-patches/issues/3272)) ([d1ceca3](https://github.com/ReVanced/revanced-patches/commit/d1ceca39984f7933b28d81802d04bb3ead327595)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49633f50..c81cd7e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [4.9.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.2...v4.9.0-dev.3) (2024-06-01) + + +### Features + +* **YouTube Music:** Support version `7.03` ([#3272](https://github.com/ReVanced/revanced-patches/issues/3272)) ([d1ceca3](https://github.com/ReVanced/revanced-patches/commit/d1ceca39984f7933b28d81802d04bb3ead327595)) + # [4.9.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.1...v4.9.0-dev.2) (2024-06-01) diff --git a/gradle.properties b/gradle.properties index a4543f86..024f3058 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 4.9.0-dev.2 +version = 4.9.0-dev.3 From 24e4ebd77ad0f349b479926bf3983b72c2683496 Mon Sep 17 00:00:00 2001 From: seaque Date: Sat, 1 Jun 2024 20:25:14 +0300 Subject: [PATCH 07/14] feat(Messenger): Add `Hide inbox subtabs` patch (#3163) Co-authored-by: oSumAtrIX --- api/revanced-patches.api | 18 +++++++++----- .../patch => inbox}/HideInboxAdsPatch.kt | 11 ++++----- .../messenger/inbox/HideInboxSubtabsPatch.kt | 24 +++++++++++++++++++ .../CreateInboxSubTabsFingerprint.kt | 23 ++++++++++++++++++ .../fingerprints/LoadInboxAdsFingerprint.kt | 7 +++--- .../DisableSwitchingEmojiToStickerPatch.kt | 10 ++++---- .../DisableTypingIndicatorPatch.kt | 10 ++++---- 7 files changed, 77 insertions(+), 26 deletions(-) rename src/main/kotlin/app/revanced/patches/messenger/{ads/inbox/patch => inbox}/HideInboxAdsPatch.kt (81%) create mode 100644 src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch.kt create mode 100644 src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/CreateInboxSubTabsFingerprint.kt rename src/main/kotlin/app/revanced/patches/messenger/{ads => }/inbox/fingerprints/LoadInboxAdsFingerprint.kt (84%) rename src/main/kotlin/app/revanced/patches/messenger/inputfield/{patch => }/DisableSwitchingEmojiToStickerPatch.kt (92%) rename src/main/kotlin/app/revanced/patches/messenger/inputfield/{patch => }/DisableTypingIndicatorPatch.kt (89%) diff --git a/api/revanced-patches.api b/api/revanced-patches.api index 79cdad29..ee5fa6ff 100644 --- a/api/revanced-patches.api +++ b/api/revanced-patches.api @@ -277,20 +277,26 @@ public final class app/revanced/patches/memegenerator/misc/pro/UnlockProVersionP public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } -public final class app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch : app/revanced/patcher/patch/BytecodePatch { - public static final field INSTANCE Lapp/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch; +public final class app/revanced/patches/messenger/inbox/HideInboxAdsPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/messenger/inbox/HideInboxAdsPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } -public final class app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch : app/revanced/patcher/patch/BytecodePatch { - public static final field INSTANCE Lapp/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch; +public final class app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/messenger/inbox/HideInboxSubtabsPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } -public final class app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch : app/revanced/patcher/patch/BytecodePatch { - public static final field INSTANCE Lapp/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch; +public final class app/revanced/patches/messenger/inputfield/DisableSwitchingEmojiToStickerPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/messenger/inputfield/DisableSwitchingEmojiToStickerPatch; + public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V + public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V +} + +public final class app/revanced/patches/messenger/inputfield/DisableTypingIndicatorPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/messenger/inputfield/DisableTypingIndicatorPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } diff --git a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch.kt b/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxAdsPatch.kt similarity index 81% rename from src/main/kotlin/app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch.kt rename to src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxAdsPatch.kt index c512ca98..3ce2f74b 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxAdsPatch.kt @@ -1,21 +1,21 @@ -package app.revanced.patches.messenger.ads.inbox.patch +package app.revanced.patches.messenger.inbox -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.messenger.ads.inbox.fingerprints.LoadInboxAdsFingerprint +import app.revanced.patches.messenger.inbox.fingerprints.LoadInboxAdsFingerprint +import app.revanced.util.exception @Patch( name = "Hide inbox ads", description = "Hides ads in inbox.", - compatiblePackages = [CompatiblePackage("com.facebook.orca")] + compatiblePackages = [CompatiblePackage("com.facebook.orca")], ) @Suppress("unused") object HideInboxAdsPatch : BytecodePatch( - setOf(LoadInboxAdsFingerprint) + setOf(LoadInboxAdsFingerprint), ) { override fun execute(context: BytecodeContext) { LoadInboxAdsFingerprint.result?.mutableMethod?.apply { @@ -23,4 +23,3 @@ object HideInboxAdsPatch : BytecodePatch( } ?: throw LoadInboxAdsFingerprint.exception } } - diff --git a/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch.kt b/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch.kt new file mode 100644 index 00000000..f9fa2846 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch.kt @@ -0,0 +1,24 @@ +package app.revanced.patches.messenger.inbox + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.messenger.inbox.fingerprints.CreateInboxSubTabsFingerprint +import app.revanced.util.exception + +@Patch( + name = "Hide inbox subtabs", + description = "Hides Home and Channels tabs between active now tray and chats.", + compatiblePackages = [CompatiblePackage("com.facebook.orca")], +) +@Suppress("unused") +object HideInboxSubtabsPatch : BytecodePatch( + setOf(CreateInboxSubTabsFingerprint), +) { + // Set InboxSubtabsItemSupplierImplementation boolean attribute to false. + override fun execute(context: BytecodeContext) = CreateInboxSubTabsFingerprint.result?.mutableMethod + ?.replaceInstruction(2, "const/4 v0, 0x0") + ?: throw CreateInboxSubTabsFingerprint.exception +} diff --git a/src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/CreateInboxSubTabsFingerprint.kt b/src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/CreateInboxSubTabsFingerprint.kt new file mode 100644 index 00000000..ebed20e8 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/CreateInboxSubTabsFingerprint.kt @@ -0,0 +1,23 @@ +package app.revanced.patches.messenger.inbox.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags +import com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.iface.value.StringEncodedValue + +internal object CreateInboxSubTabsFingerprint : MethodFingerprint( + returnType = "V", + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + opcodes = listOf( + Opcode.CONST_4, + Opcode.INVOKE_VIRTUAL, + Opcode.RETURN_VOID, + ), + customFingerprint = { methodDef, classDef -> + methodDef.name == "run" && classDef.fields.any any@{ field -> + if (field.name != "__redex_internal_original_name") return@any false + (field.initialValue as? StringEncodedValue)?.value == "InboxSubtabsItemSupplierImplementation\$onSubscribe\$1" + } + }, +) diff --git a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/fingerprints/LoadInboxAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/LoadInboxAdsFingerprint.kt similarity index 84% rename from src/main/kotlin/app/revanced/patches/messenger/ads/inbox/fingerprints/LoadInboxAdsFingerprint.kt rename to src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/LoadInboxAdsFingerprint.kt index 9c45dc97..b94c5e61 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/fingerprints/LoadInboxAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/LoadInboxAdsFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.messenger.ads.inbox.fingerprints +package app.revanced.patches.messenger.inbox.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint @@ -8,11 +8,10 @@ internal object LoadInboxAdsFingerprint : MethodFingerprint( returnType = "V", strings = listOf( "ads_load_begin", - "inbox_ads_fetch_start" + "inbox_ads_fetch_start", ), accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lcom/facebook/messaging/business/inboxads/plugins/inboxads/itemsupplier/InboxAdsItemSupplierImplementation;" - } + }, ) - diff --git a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch.kt b/src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableSwitchingEmojiToStickerPatch.kt similarity index 92% rename from src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch.kt rename to src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableSwitchingEmojiToStickerPatch.kt index 19e445fd..5da83e87 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableSwitchingEmojiToStickerPatch.kt @@ -1,6 +1,5 @@ -package app.revanced.patches.messenger.inputfield.patch +package app.revanced.patches.messenger.inputfield -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction @@ -8,16 +7,17 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.messenger.inputfield.fingerprints.SwitchMessangeInputEmojiButtonFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( name = "Disable switching emoji to sticker", description = "Disables switching from emoji to sticker search mode in message input field.", - compatiblePackages = [CompatiblePackage("com.facebook.orca")] + compatiblePackages = [CompatiblePackage("com.facebook.orca")], ) @Suppress("unused") object DisableSwitchingEmojiToStickerPatch : BytecodePatch( - setOf(SwitchMessangeInputEmojiButtonFingerprint) + setOf(SwitchMessangeInputEmojiButtonFingerprint), ) { override fun execute(context: BytecodeContext) { SwitchMessangeInputEmojiButtonFingerprint.result?.let { @@ -28,7 +28,7 @@ object DisableSwitchingEmojiToStickerPatch : BytecodePatch( replaceInstruction( setStringIndex, - "const-string v$targetRegister, \"expression\"" + "const-string v$targetRegister, \"expression\"", ) } } ?: throw SwitchMessangeInputEmojiButtonFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch.kt b/src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableTypingIndicatorPatch.kt similarity index 89% rename from src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch.kt rename to src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableTypingIndicatorPatch.kt index 5bdbb50c..85c744fa 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableTypingIndicatorPatch.kt @@ -1,22 +1,22 @@ -package app.revanced.patches.messenger.inputfield.patch +package app.revanced.patches.messenger.inputfield -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.messenger.inputfield.fingerprints.SendTypingIndicatorFingerprint +import app.revanced.util.exception @Patch( name = "Disable typing indicator", description = "Disables the indicator while typing a message.", - compatiblePackages = [CompatiblePackage("com.facebook.orca")] + compatiblePackages = [CompatiblePackage("com.facebook.orca")], ) @Suppress("unused") object DisableTypingIndicatorPatch : BytecodePatch( - setOf(SendTypingIndicatorFingerprint) -){ + setOf(SendTypingIndicatorFingerprint), +) { override fun execute(context: BytecodeContext) { SendTypingIndicatorFingerprint.result?.mutableMethod?.replaceInstruction(0, "return-void") ?: throw SendTypingIndicatorFingerprint.exception From 999cf733f7ec9199cad3f4e59172593d52f9ce0d Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 1 Jun 2024 17:27:18 +0000 Subject: [PATCH 08/14] chore(release): 4.9.0-dev.4 [skip ci] # [4.9.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.3...v4.9.0-dev.4) (2024-06-01) ### Features * **Messenger:** Add `Hide inbox subtabs` patch ([#3163](https://github.com/ReVanced/revanced-patches/issues/3163)) ([24e4ebd](https://github.com/ReVanced/revanced-patches/commit/24e4ebd77ad0f349b479926bf3983b72c2683496)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c81cd7e9..c61f10db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [4.9.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.3...v4.9.0-dev.4) (2024-06-01) + + +### Features + +* **Messenger:** Add `Hide inbox subtabs` patch ([#3163](https://github.com/ReVanced/revanced-patches/issues/3163)) ([24e4ebd](https://github.com/ReVanced/revanced-patches/commit/24e4ebd77ad0f349b479926bf3983b72c2683496)) + # [4.9.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.2...v4.9.0-dev.3) (2024-06-01) diff --git a/gradle.properties b/gradle.properties index 024f3058..0ff338cf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 4.9.0-dev.3 +version = 4.9.0-dev.4 From 99b07e0e18574668f36bb3c962c8d11222114be4 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 1 Jun 2024 22:03:06 +0400 Subject: [PATCH 09/14] feat(YouTube): Support version `19.12`, `19.13`, `19.14`, `19.15` and `19.16` (#3239) Co-authored-by: oSumAtrIX --- api/revanced-patches.api | 4 ++ .../redditisfun/api/SpoofClientPatch.kt | 4 +- .../cleardisplay/RememberClearModePatch.kt | 4 +- .../interaction/downloads/DownloadsPatch.kt | 8 +-- .../interaction/speed/PlaybackSpeedPatch.kt | 3 +- .../youtube/ad/general/HideAdsPatch.kt | 7 ++- .../ad/getpremium/HideGetPremiumPatch.kt | 7 ++- .../patches/youtube/ad/video/VideoAdsPatch.kt | 7 ++- .../copyvideourl/CopyVideoUrlBytecodePatch.kt | 7 ++- .../RemoveViewerDiscretionDialogPatch.kt | 7 ++- .../interaction/downloads/DownloadsPatch.kt | 7 ++- .../DisablePreciseSeekingGesturePatch.kt | 7 ++- .../seekbar/EnableSeekbarTappingPatch.kt | 7 ++- .../seekbar/EnableSlideToSeekPatch.kt | 7 ++- .../SwipeControlsBytecodePatch.kt | 10 ++-- .../layout/autocaptions/AutoCaptionsPatch.kt | 7 ++- .../layout/buttons/action/HideButtonsPatch.kt | 7 ++- .../autoplay/HideAutoplayButtonPatch.kt | 54 ++++++++++--------- .../captions/HideCaptionsButtonPatch.kt | 7 ++- .../navigation/NavigationButtonsPatch.kt | 9 +++- .../player/hide/HidePlayerButtonsPatch.kt | 7 ++- .../layout/hide/albumcards/AlbumCardsPatch.kt | 7 ++- .../layout/hide/comments/CommentsPatch.kt | 7 ++- .../crowdfundingbox/CrowdfundingBoxPatch.kt | 7 ++- .../endscreencards/HideEndscreenCardsPatch.kt | 7 ++- .../hide/filterbar/HideFilterBarPatch.kt | 7 ++- .../HideFloatingMicrophoneButtonPatch.kt | 7 ++- .../DisableFullscreenAmbientModePatch.kt | 7 ++- .../hide/general/HideLayoutComponentsPatch.kt | 25 +++++---- .../ParseElementFromBufferFingerprint.kt | 10 ++-- .../hide/infocards/HideInfoCardsPatch.kt | 7 ++- .../HidePlayerFlyoutMenuPatch.kt | 7 ++- .../DisableRollingNumberAnimationPatch.kt | 7 ++- .../layout/hide/seekbar/HideSeekbarPatch.kt | 7 ++- .../hide/shorts/HideShortsComponentsPatch.kt | 5 ++ .../DisableSuggestedVideoEndScreenPatch.kt | 7 ++- .../layout/hide/time/HideTimestampPatch.kt | 7 ++- .../panels/popup/PlayerPopupPanelsPatch.kt | 7 ++- .../PlayerControlsBackgroundPatch.kt | 7 ++- .../ReturnYouTubeDislikePatch.kt | 14 +++-- .../layout/searchbar/WideSearchbarPatch.kt | 7 ++- .../RestoreOldSeekbarThumbnailsPatch.kt | 7 ++- .../sponsorblock/SponsorBlockBytecodePatch.kt | 5 ++ .../spoofappversion/SpoofAppVersionPatch.kt | 7 ++- .../DisableResumingShortsOnStartupPatch.kt | 13 +++-- .../tabletminiplayer/TabletMiniPlayerPatch.kt | 7 ++- .../layout/theme/ThemeBytecodePatch.kt | 7 ++- .../thumbnails/AlternativeThumbnailsPatch.kt | 7 ++- .../misc/autorepeat/AutoRepeatPatch.kt | 7 ++- .../spoof/SpoofDeviceDimensionsPatch.kt | 7 ++- .../misc/fix/playback/SpoofClientPatch.kt | 19 ++++--- .../youtube/misc/gms/GmsCoreSupportPatch.kt | 5 ++ .../misc/links/BypassURLRedirectsPatch.kt | 31 ++++++----- .../misc/links/OpenLinksExternallyPatch.kt | 7 ++- .../fingerprints/ABUriParserFingerprint.kt | 16 +++--- .../misc/litho/filter/LithoFilterPatch.kt | 7 +-- .../MinimizedPlaybackPatch.kt | 16 +++--- .../MinimizedPlaybackResourcePatch.kt | 17 ++++++ .../MinimizedPlaybackSettingsFingerprint.kt | 10 ++-- ...imizedPlaybackSettingsParentFingerprint.kt | 15 ------ .../misc/navigation/NavigationBarHookPatch.kt | 4 +- .../RemoveTrackingQueryParameterPatch.kt | 7 ++- .../quality/RememberVideoQualityPatch.kt | 7 ++- .../youtube/video/speed/PlaybackSpeedPatch.kt | 7 ++- .../RestoreOldVideoQualityMenuPatch.kt | 50 +++++++++-------- .../VideoQualityMenuOptionsFingerprint.kt | 12 ++--- .../kotlin/app/revanced/util/BytecodeUtils.kt | 37 ++++++++++++- 67 files changed, 491 insertions(+), 196 deletions(-) create mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackResourcePatch.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsParentFingerprint.kt diff --git a/api/revanced-patches.api b/api/revanced-patches.api index ee5fa6ff..ac962636 100644 --- a/api/revanced-patches.api +++ b/api/revanced-patches.api @@ -1889,7 +1889,11 @@ public final class app/revanced/util/BytecodeUtilsKt { public static final fun containsWideLiteralInstructionValue (Lcom/android/tools/smali/dexlib2/iface/Method;J)Z public static final fun findMutableMethodOf (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;Lcom/android/tools/smali/dexlib2/iface/Method;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod; public static final fun getException (Lapp/revanced/patcher/fingerprint/MethodFingerprint;)Lapp/revanced/patcher/patch/PatchException; + public static final fun indexOfFirstInstruction (Lcom/android/tools/smali/dexlib2/iface/Method;ILkotlin/jvm/functions/Function1;)I public static final fun indexOfFirstInstruction (Lcom/android/tools/smali/dexlib2/iface/Method;Lkotlin/jvm/functions/Function1;)I + public static synthetic fun indexOfFirstInstruction$default (Lcom/android/tools/smali/dexlib2/iface/Method;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)I + public static final fun indexOfFirstInstructionOrThrow (Lcom/android/tools/smali/dexlib2/iface/Method;ILkotlin/jvm/functions/Function1;)I + public static synthetic fun indexOfFirstInstructionOrThrow$default (Lcom/android/tools/smali/dexlib2/iface/Method;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)I public static final fun indexOfFirstWideLiteralInstructionValue (Lcom/android/tools/smali/dexlib2/iface/Method;J)I public static final fun indexOfIdResource (Lcom/android/tools/smali/dexlib2/iface/Method;Ljava/lang/String;)I public static final fun indexOfIdResourceOrThrow (Lcom/android/tools/smali/dexlib2/iface/Method;Ljava/lang/String;)I diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt index 3d954c19..ae9374f0 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt @@ -11,7 +11,7 @@ import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.Ba import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.BuildAuthorizationStringFingerprint import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.GetUserAgentFingerprint import app.revanced.util.getReference -import app.revanced.util.indexOfFirstInstruction +import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.reference.StringReference @Suppress("unused") @@ -68,7 +68,7 @@ object SpoofClientPatch : BaseSpoofClientPatch( // Reddit messed up and does not append a redirect uri to the authorization url to old.reddit.com/login. // Replace old.reddit.com with ssl.reddit.com to fix this. BuildAuthorizationStringFingerprint.result!!.mutableMethod.apply { - val index = indexOfFirstInstruction { + val index = indexOfFirstInstructionOrThrow { getReference()?.contains("old.reddit.com") == true } diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearModePatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearModePatch.kt index 7399e0b5..701ea283 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearModePatch.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.tiktok.interaction.cleardisplay.fingerprints.OnClearDisplayEventFingerprint import app.revanced.patches.tiktok.interaction.cleardisplay.fingerprints.OnRenderFirstFrameFingerprint import app.revanced.util.exception -import app.revanced.util.indexOfFirstInstruction +import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c @@ -34,7 +34,7 @@ object RememberClearDisplayPatch : BytecodePatch( OnClearDisplayEventFingerprint.result?.mutableMethod?.let { // region Hook the "Clear display" configuration save event to remember the state of clear display. - val isEnabledIndex = it.indexOfFirstInstruction { opcode == Opcode.IGET_BOOLEAN } + 1 + val isEnabledIndex = it.indexOfFirstInstructionOrThrow { opcode == Opcode.IGET_BOOLEAN } + 1 val isEnabledRegister = it.getInstruction(isEnabledIndex - 1).registerA it.addInstructions( diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt index 59b08b0f..7b0ece8b 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt @@ -18,7 +18,7 @@ import app.revanced.patches.tiktok.misc.integrations.IntegrationsPatch import app.revanced.patches.tiktok.misc.settings.SettingsPatch import app.revanced.patches.tiktok.misc.settings.fingerprints.SettingsStatusLoadFingerprint import app.revanced.util.exception -import app.revanced.util.indexOfFirstInstruction +import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c import com.android.tools.smali.dexlib2.iface.reference.MethodReference @@ -81,16 +81,16 @@ object DownloadsPatch : BytecodePatch( }, // Change the download path patch. DownloadPathParentFingerprint to { - val targetIndex = indexOfFirstInstruction { opcode == Opcode.INVOKE_STATIC } + val targetIndex = indexOfFirstInstructionOrThrow { opcode == Opcode.INVOKE_STATIC } val downloadUriMethod = context .toMethodWalker(this) .nextMethod(targetIndex, true) .getMethod() as MutableMethod - val firstIndex = downloadUriMethod.indexOfFirstInstruction { + val firstIndex = downloadUriMethod.indexOfFirstInstructionOrThrow { opcode == Opcode.INVOKE_DIRECT && ((this as Instruction35c).reference as MethodReference).name == "" } - val secondIndex = downloadUriMethod.indexOfFirstInstruction { + val secondIndex = downloadUriMethod.indexOfFirstInstructionOrThrow { opcode == Opcode.INVOKE_STATIC && ((this as Instruction35c).reference as MethodReference).returnType.contains( "Uri" ) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt index 35c47753..ac56f8c8 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt @@ -14,6 +14,7 @@ import app.revanced.patches.tiktok.interaction.speed.fingerprints.SetSpeedFinger import app.revanced.util.exception import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstruction +import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction11x import com.android.tools.smali.dexlib2.iface.reference.MethodReference @@ -38,7 +39,7 @@ object PlaybackSpeedPatch : BytecodePatch( SetSpeedFingerprint.result?.let { onVideoSwiped -> // Remember the playback speed of the current video. GetSpeedFingerprint.result?.mutableMethod?.apply { - val injectIndex = indexOfFirstInstruction { getReference()?.returnType == "F" } + 2 + val injectIndex = indexOfFirstInstructionOrThrow { getReference()?.returnType == "F" } + 2 val register = getInstruction(injectIndex - 1).registerA addInstruction( diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt index 99d73e4c..fd6ffde4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt @@ -44,7 +44,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt index b3094ea2..a36063d3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt @@ -38,7 +38,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt index c000e089..b2df5d82 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt @@ -43,7 +43,12 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt index 87d91821..5d740aa5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt @@ -31,7 +31,12 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt index a5de50f0..83b391cb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt @@ -40,7 +40,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt index 10e1de2d..b22a1461 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt @@ -37,7 +37,12 @@ import app.revanced.util.resultOrThrow "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt index d3df068c..4923a6c4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt @@ -40,7 +40,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt index c428b249..eaae9af8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt @@ -42,7 +42,12 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt index a4c7de09..e6ed839e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt @@ -38,7 +38,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt index c49b74f5..819ea52c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt @@ -44,10 +44,12 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod "19.08.36", "19.09.38", "19.10.39", - "19.11.43", // 19.12.x has an issue with opening YT using external links, - // and the app then crashes if double tap to skip forward/back is immediately used. - // The stack trace shows a call coming from integrations SwipeController, - // but it may be a bug in YT itself as other target versions do not have this issue. + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt index 188fa14b..fabd8cc3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt @@ -42,7 +42,12 @@ import app.revanced.util.exception "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt index 20757d6e..1da88f35 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt @@ -41,7 +41,12 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt index 6eba4ff4..6446f32a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt @@ -13,11 +13,12 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.patches.youtube.shared.fingerprints.LayoutConstructorFingerprint -import app.revanced.util.exception +import app.revanced.util.getReference +import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.indexOfIdResourceOrThrow -import com.android.tools.smali.dexlib2.iface.instruction.Instruction +import app.revanced.util.resultOrThrow +import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction -import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.reference.MethodReference @Patch( @@ -52,6 +53,11 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.09.38", "19.10.39", "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], @@ -60,6 +66,10 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference object HideAutoplayButtonPatch : BytecodePatch( setOf(LayoutConstructorFingerprint), ) { + + private const val INTEGRATIONS_CLASS_DESCRIPTOR = + "Lapp/revanced/integrations/youtube/patches/HideAutoplayButtonPatch;" + override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) @@ -67,33 +77,27 @@ object HideAutoplayButtonPatch : BytecodePatch( SwitchPreference("revanced_hide_autoplay_button"), ) - LayoutConstructorFingerprint.result?.mutableMethod?.apply { - val layoutGenMethodInstructions = implementation!!.instructions + LayoutConstructorFingerprint.resultOrThrow().mutableMethod.apply { + val constIndex = indexOfIdResourceOrThrow("autonav_toggle") + val constRegister = getInstruction(constIndex).registerA - // resolve the offsets of where to insert the branch instructions and ... - val insertIndex = indexOfIdResourceOrThrow("autonav_preview_stub") - - // where to branch away - val branchIndex = - layoutGenMethodInstructions.subList(insertIndex + 1, layoutGenMethodInstructions.size - 1) - .indexOfFirst { - ((it as? ReferenceInstruction)?.reference as? MethodReference)?.name == "addOnLayoutChangeListener" - } + 2 - - val jumpInstruction = layoutGenMethodInstructions[insertIndex + branchIndex] as Instruction - - // can be clobbered because this register is overwritten after the injected code - val clobberRegister = getInstruction(insertIndex).registerA + // Add a conditional branch around the code that inflates and adds the auto repeat button. + val gotoIndex = indexOfFirstInstructionOrThrow(constIndex) { + val parameterTypes = getReference()?.parameterTypes + opcode == Opcode.INVOKE_VIRTUAL && + parameterTypes?.size == 2 && + parameterTypes.first() == "Landroid/view/ViewStub;" + } + 1 addInstructionsWithLabels( - insertIndex, + constIndex, """ - invoke-static {}, Lapp/revanced/integrations/youtube/patches/HideAutoplayButtonPatch;->isButtonShown()Z - move-result v$clobberRegister - if-eqz v$clobberRegister, :hidden + invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->hideAutoPlayButton()Z + move-result v$constRegister + if-nez v$constRegister, :hidden """, - ExternalLabel("hidden", jumpInstruction), + ExternalLabel("hidden", getInstruction(gotoIndex)), ) - } ?: throw LayoutConstructorFingerprint.exception + } } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt index 7ee8e1f3..e346945d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt @@ -42,7 +42,12 @@ import com.android.tools.smali.dexlib2.Opcode "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt index 73df8d57..10e8d360 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt @@ -19,7 +19,7 @@ import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.util.exception import app.revanced.util.getReference -import app.revanced.util.indexOfFirstInstruction +import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.reference.MethodReference @@ -56,6 +56,11 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.09.38", "19.10.39", "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], @@ -111,7 +116,7 @@ object NavigationButtonsPatch : BytecodePatch( // Hide navigation button labels. CreatePivotBarFingerprint.result?.mutableMethod?.apply { - val setTextIndex = indexOfFirstInstruction { + val setTextIndex = indexOfFirstInstructionOrThrow { getReference()?.name == "setText" } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt index 44170911..2199b05d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt @@ -46,7 +46,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt index 3877397a..782999c1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt @@ -40,7 +40,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt index 789701ba..30a77742 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt @@ -40,7 +40,12 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt index fa0f4593..938d91eb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt @@ -40,7 +40,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt index 02145fa5..396e9a8c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt @@ -43,7 +43,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt index f63a78bf..37915f48 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt @@ -40,7 +40,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt index 2ddda6f7..697b081f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt @@ -36,7 +36,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt index dcefb0d1..0d7ccb95 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt @@ -36,7 +36,12 @@ import app.revanced.util.exception "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt index 240f2c56..b1d8dbf2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt @@ -23,7 +23,6 @@ import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.Opcode -import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction @@ -59,7 +58,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], @@ -164,20 +168,21 @@ object HideLayoutComponentsPatch : BytecodePatch( // region Mix playlists ParseElementFromBufferFingerprint.resultOrThrow().let { result -> - val consumeByteBufferIndex = result.scanResult.patternScanResult!!.startIndex + val startIndex = result.scanResult.patternScanResult!!.startIndex result.mutableMethod.apply { - val conversionContextRegister = - getInstruction(consumeByteBufferIndex - 2).registerA - val byteBufferRegister = getInstruction(consumeByteBufferIndex).registerD + val freeRegister = "v0" + val byteArrayParameter = "p3" + val conversionContextRegister = getInstruction(startIndex).registerA val returnEmptyComponentInstruction = getInstructions().last { it.opcode == Opcode.INVOKE_STATIC } addInstructionsWithLabels( - consumeByteBufferIndex, + startIndex + 1, """ - invoke-static {v$conversionContextRegister, v$byteBufferRegister}, $LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR->filterMixPlaylists(Ljava/lang/Object;[B)Z - move-result v0 # Conveniently same register happens to be free. - if-nez v0, :return_empty_component + invoke-static { v$conversionContextRegister, $byteArrayParameter }, $LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR->filterMixPlaylists(Ljava/lang/Object;[B)Z + move-result $freeRegister + if-nez $freeRegister, :return_empty_component + const/4 $freeRegister, 0x0 # Restore register, required for 19.16 """, ExternalLabel("return_empty_component", returnEmptyComponentInstruction), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ParseElementFromBufferFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ParseElementFromBufferFingerprint.kt index f978acd7..70b39c1f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ParseElementFromBufferFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ParseElementFromBufferFingerprint.kt @@ -4,7 +4,11 @@ import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.Opcode internal object ParseElementFromBufferFingerprint : MethodFingerprint( - parameters = listOf("L","L","[B", "L","L"), - opcodes = listOf(Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT), - strings = listOf("Failed to parse Element") + parameters = listOf("L", "L", "[B", "L", "L"), + opcodes = listOf( + Opcode.IGET_OBJECT, + Opcode.INVOKE_INTERFACE, + Opcode.MOVE_RESULT_OBJECT + ), + strings = listOf("Failed to parse Element") // String is a partial match. ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt index cc8e1793..92b2d5a4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt @@ -47,7 +47,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt index 689df3c7..024ca2e9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt @@ -41,7 +41,12 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt index 8ee810b9..0e7b9885 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt @@ -38,7 +38,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt index 485ec104..6f369184 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt @@ -43,7 +43,12 @@ import app.revanced.patches.youtube.shared.fingerprints.SeekbarOnDrawFingerprint "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt index 1469c21d..5b817738 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt @@ -55,6 +55,11 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.09.38", "19.10.39", "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt index 68407dc6..aee5ad28 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt @@ -35,7 +35,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt index cb741ddf..1fee6435 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt @@ -36,7 +36,12 @@ import app.revanced.util.exception "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt index a50d781a..c93d718f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt @@ -37,7 +37,12 @@ import app.revanced.util.exception "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt index aa9f4b9f..eec03ff0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt @@ -32,7 +32,12 @@ import org.w3c.dom.Element "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt index 6a2a0352..8e4556a0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt @@ -31,7 +31,7 @@ import app.revanced.patches.youtube.shared.fingerprints.RollingNumberTextViewAni import app.revanced.patches.youtube.video.videoid.VideoIdPatch import app.revanced.util.exception import app.revanced.util.getReference -import app.revanced.util.indexOfFirstInstruction +import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction @@ -66,7 +66,12 @@ import com.android.tools.smali.dexlib2.iface.reference.TypeReference "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] @@ -142,11 +147,10 @@ object ReturnYouTubeDislikePatch : BytecodePatch( TextComponentLookupFingerprint.resultOrThrow().mutableMethod.apply { // Find the instruction for creating the text data object. val textDataClassType = TextComponentDataFingerprint.resultOrThrow().classDef.type - val insertIndex = indexOfFirstInstruction { + val insertIndex = indexOfFirstInstructionOrThrow { opcode == Opcode.NEW_INSTANCE && getReference()?.type == textDataClassType } - if (insertIndex < 0) throw PatchException("Could not find data creation instruction") val tempRegister = getInstruction(insertIndex).registerA // Find the instruction that sets the span to an instance field. @@ -335,7 +339,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( realTimeUpdateTextViewMethod ).forEach { insertMethod -> insertMethod.apply { - val setTextIndex = indexOfFirstInstruction { + val setTextIndex = indexOfFirstInstructionOrThrow { getReference()?.name == "setText" } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt index 0e72bdda..c8a75eb1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt @@ -41,7 +41,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt index c621a95d..3aecd97f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt @@ -37,7 +37,12 @@ import app.revanced.util.exception "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt index 8ba36ef1..e41d0e42 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt @@ -52,6 +52,11 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference "19.09.38", "19.10.39", "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt index 82557e6a..a4aa0f38 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt @@ -40,7 +40,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt index 57a4d163..30302143 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt @@ -5,7 +5,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.all.misc.resources.AddResourcesPatch @@ -15,7 +14,7 @@ import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.util.exception import app.revanced.util.getReference -import app.revanced.util.indexOfFirstInstruction +import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @@ -46,7 +45,12 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] @@ -67,12 +71,11 @@ object DisableResumingShortsOnStartupPatch : BytecodePatch( ) UserWasInShortsFingerprint.result?.mutableMethod?.apply { - val listenableInstructionIndex = indexOfFirstInstruction { + val listenableInstructionIndex = indexOfFirstInstructionOrThrow { opcode == Opcode.INVOKE_INTERFACE && getReference()?.definingClass == "Lcom/google/common/util/concurrent/ListenableFuture;" && getReference()?.name == "isDone" } - if (listenableInstructionIndex < 0) throw PatchException("Could not find instruction index") val originalInstructionRegister = getInstruction(listenableInstructionIndex).registerC val freeRegister = getInstruction(listenableInstructionIndex + 1).registerA diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt index 80297fe3..d3b4183a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt @@ -45,7 +45,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ) ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt index 04b3dc0b..3e9bfd60 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt @@ -52,7 +52,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt index b028dad8..86b7a492 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt @@ -63,7 +63,12 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt index b8c0157f..1db64983 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt @@ -41,7 +41,12 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt index 86b2967f..70e1978e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt @@ -36,7 +36,12 @@ import app.revanced.util.exception "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt index a70f61e5..36fc572c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt @@ -24,6 +24,7 @@ import app.revanced.patches.youtube.misc.fix.playback.fingerprints.PlayerGesture import app.revanced.patches.youtube.misc.fix.playback.fingerprints.SetPlayerRequestClientTypeFingerprint import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.util.getReference +import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -65,6 +66,11 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter "19.09.38", "19.10.39", "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], @@ -195,15 +201,14 @@ object SpoofClientPatch : BytecodePatch( val clientInfoClientModelField = CreatePlayerRequestBodyWithModelFingerprint.resultOrThrow().let { val getClientModelIndex = CreatePlayerRequestBodyWithModelFingerprint.indexOfBuildModelInstruction(it.method) - val instructions = it.mutableMethod.getInstructions() // The next IPUT_OBJECT instruction after getting the client model is setting the client model field. - instructions.subList( - getClientModelIndex, - instructions.size, - ).find { instruction -> - instruction.opcode == Opcode.IPUT_OBJECT - }?.getReference() ?: throw PatchException("Could not find clientInfoClientModelField") + val index = it.mutableMethod.indexOfFirstInstructionOrThrow(getClientModelIndex) { + opcode == Opcode.IPUT_OBJECT + } + + it.mutableMethod.getInstruction(index).getReference() + ?: throw PatchException("Could not find clientInfoClientModelField") } // endregion diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt index f8fe027d..3ce5a867 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt @@ -52,6 +52,11 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch( "19.09.38", "19.10.39", "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ), ), ), diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt index cafaa942..451f7742 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.links.fingerprints.ABUriParserFingerprint import app.revanced.patches.youtube.misc.links.fingerprints.HTTPUriParserFingerprint import app.revanced.patches.youtube.misc.settings.SettingsPatch -import app.revanced.util.exception +import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction @Patch( @@ -38,27 +38,32 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" - ] - ) - ] + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", + ], + ), + ], ) @Suppress("unused") object BypassURLRedirectsPatch : BytecodePatch( - setOf(ABUriParserFingerprint, HTTPUriParserFingerprint) + setOf(ABUriParserFingerprint, HTTPUriParserFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.MISC.addPreferences( - SwitchPreference("revanced_bypass_url_redirects") + SwitchPreference("revanced_bypass_url_redirects"), ) mapOf( ABUriParserFingerprint to 7, // Offset to Uri.parse. - HTTPUriParserFingerprint to 0 // Offset to Uri.parse. + HTTPUriParserFingerprint to 0, // Offset to Uri.parse. ).map { (fingerprint, offset) -> - (fingerprint.result ?: throw fingerprint.exception) to offset + fingerprint.resultOrThrow() to offset }.forEach { (result, offset) -> result.mutableMethod.apply { val insertIndex = result.scanResult.patternScanResult!!.startIndex + offset @@ -67,11 +72,11 @@ object BypassURLRedirectsPatch : BytecodePatch( replaceInstruction( insertIndex, "invoke-static {v$uriStringRegister}," + - "Lapp/revanced/integrations/youtube/patches/BypassURLRedirectsPatch;" + - "->" + - "parseRedirectUri(Ljava/lang/String;)Landroid/net/Uri;" + "Lapp/revanced/integrations/youtube/patches/BypassURLRedirectsPatch;" + + "->" + + "parseRedirectUri(Ljava/lang/String;)Landroid/net/Uri;", ) } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt index a9cf1bf8..97367d6c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt @@ -42,7 +42,12 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/ABUriParserFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/ABUriParserFingerprint.kt index 77fea68f..c2b3aa1d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/ABUriParserFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/ABUriParserFingerprint.kt @@ -20,10 +20,14 @@ internal object ABUriParserFingerprint : MethodFingerprint( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT_OBJECT, Opcode.RETURN_OBJECT, - Opcode.CHECK_CAST + Opcode.CHECK_CAST, ), - customFingerprint = { methodDef, classDef -> - // This method is always called "a" because this kind of class always has a single method. - methodDef.name == "a" && classDef.methods.count() == 3 - } -) \ No newline at end of file + customFingerprint = custom@{ methodDef, classDef -> + // This method is always called "a" because this kind of class always has a single (non synthetic) method. + + if (methodDef.name != "a") return@custom false + + val count = classDef.methods.count() + count == 2 || count == 3 + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt index 37fa28b9..4b9620a2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt @@ -10,20 +10,18 @@ import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.litho.filter.fingerprints.* import app.revanced.util.getReference -import app.revanced.util.indexOfFirstInstruction +import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.Instruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.reference.FieldReference -import com.android.tools.smali.dexlib2.iface.reference.TypeReference import java.io.Closeable @Patch( @@ -108,11 +106,10 @@ object LithoFilterPatch : BytecodePatch( val emptyComponentFieldIndex = builderMethodIndex + 2 bytesToComponentContextMethod.mutableMethod.apply { - val insertHookIndex = indexOfFirstInstruction { + val insertHookIndex = indexOfFirstInstructionOrThrow { opcode == Opcode.IPUT_OBJECT && getReference()?.type == "Ljava/lang/StringBuilder;" } + 1 - if (insertHookIndex <= 0) throw PatchException("Could not find insert index") // region Get free registers that this patch uses. // Registers are overwritten right after they are used in this patch, therefore free to clobber. diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt index b54cc4f4..c3569590 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt @@ -13,7 +13,6 @@ import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.KidsMinimizedPlaybackPolicyControllerFingerprint import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackSettingsFingerprint -import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackSettingsParentFingerprint import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.patches.youtube.video.information.VideoInformationPatch @@ -25,6 +24,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference name = "Minimized playback", description = "Unlocks options for picture-in-picture and background playback.", dependencies = [ + MinimizedPlaybackResourcePatch::class, IntegrationsPatch::class, PlayerTypeHookPatch::class, VideoInformationPatch::class, @@ -47,7 +47,12 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] @@ -56,7 +61,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference object MinimizedPlaybackPatch : BytecodePatch( setOf( MinimizedPlaybackManagerFingerprint, - MinimizedPlaybackSettingsParentFingerprint, + MinimizedPlaybackSettingsFingerprint, KidsMinimizedPlaybackPolicyControllerFingerprint ) ) { @@ -82,11 +87,6 @@ object MinimizedPlaybackPatch : BytecodePatch( } ?: throw MinimizedPlaybackManagerFingerprint.exception // Enable minimized playback option in YouTube settings - MinimizedPlaybackSettingsParentFingerprint.result ?: throw MinimizedPlaybackSettingsParentFingerprint.exception - MinimizedPlaybackSettingsFingerprint.resolve( - context, - MinimizedPlaybackSettingsParentFingerprint.result!!.classDef - ) MinimizedPlaybackSettingsFingerprint.result?.apply { val booleanCalls = method.implementation!!.instructions.withIndex() .filter { ((it.value as? ReferenceInstruction)?.reference as? MethodReference)?.returnType == "Z" } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackResourcePatch.kt new file mode 100644 index 00000000..d310d3ab --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackResourcePatch.kt @@ -0,0 +1,17 @@ +package app.revanced.patches.youtube.misc.minimizedplayback + +import app.revanced.patcher.data.ResourceContext +import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch + +@Patch( + dependencies = [ResourceMappingPatch::class], +) +internal object MinimizedPlaybackResourcePatch : ResourcePatch() { + internal var prefBackgroundAndOfflineCategoryId: Long = -1 + + override fun execute(context: ResourceContext) { + prefBackgroundAndOfflineCategoryId = ResourceMappingPatch["string", "pref_background_and_offline_category"] + } +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt index 47c311f3..8f31e017 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt @@ -1,11 +1,12 @@ package app.revanced.patches.youtube.misc.minimizedplayback.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patches.youtube.misc.minimizedplayback.MinimizedPlaybackResourcePatch +import app.revanced.util.patch.LiteralValueFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode -internal object MinimizedPlaybackSettingsFingerprint : MethodFingerprint( +internal object MinimizedPlaybackSettingsFingerprint : LiteralValueFingerprint( returnType = "Ljava/lang/String;", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf(), @@ -16,8 +17,7 @@ internal object MinimizedPlaybackSettingsFingerprint : MethodFingerprint( Opcode.MOVE_RESULT, Opcode.IF_EQZ, Opcode.IF_NEZ, - Opcode.GOTO, - Opcode.IGET_OBJECT, - Opcode.CHECK_CAST + Opcode.GOTO ), + literalSupplier = { MinimizedPlaybackResourcePatch.prefBackgroundAndOfflineCategoryId } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsParentFingerprint.kt deleted file mode 100644 index 03061183..00000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsParentFingerprint.kt +++ /dev/null @@ -1,15 +0,0 @@ -package app.revanced.patches.youtube.misc.minimizedplayback.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.MethodFingerprint -import com.android.tools.smali.dexlib2.AccessFlags - -/** - * Class fingerprint for [MinimizedPlaybackSettingsFingerprint] - */ -internal object MinimizedPlaybackSettingsParentFingerprint : MethodFingerprint( - accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, - returnType = "I", - parameters = listOf(), - strings = listOf("BiometricManager", "Failure in canAuthenticate(). FingerprintManager was null.") -) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt index eb9f31e8..ae648899 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.navigation.fingerprints.* import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch import app.revanced.util.getReference -import app.revanced.util.indexOfFirstInstruction +import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction @@ -121,7 +121,7 @@ object NavigationBarHookPatch : BytecodePatch( // Insert before the first ViewGroup method call after inflating, // so this works regardless which layout is used. ActionBarSearchResultsFingerprint.resultOrThrow().mutableMethod.apply { - val instructionIndex = indexOfFirstInstruction { + val instructionIndex = indexOfFirstInstructionOrThrow { opcode == Opcode.INVOKE_VIRTUAL && getReference()?.name == "setLayoutDirection" } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt index f1af3d56..37ccb352 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt @@ -43,7 +43,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt index 62249f84..dc89623c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt @@ -47,7 +47,12 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt index 671dff00..24444979 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt @@ -27,7 +27,12 @@ import app.revanced.patches.youtube.video.speed.remember.RememberPlaybackSpeedPa "19.08.36", "19.09.38", "19.10.39", - "19.11.43" + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt index e7297fde..5e60a699 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt @@ -2,12 +2,12 @@ package app.revanced.patches.youtube.video.videoqualitymenu import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction -import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels +import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch import app.revanced.patches.youtube.misc.recyclerviewtree.hook.RecyclerViewTreeHookPatch @@ -23,7 +23,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction IntegrationsPatch::class, RestoreOldVideoQualityMenuResourcePatch::class, LithoFilterPatch::class, - RecyclerViewTreeHookPatch::class + RecyclerViewTreeHookPatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -47,20 +47,25 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.08.36", "19.09.38", "19.10.39", - "19.11.43" - ] - ) - ] + "19.11.43", + "19.12.41", + "19.13.37", + "19.14.43", + "19.15.36", + "19.16.39", + ], + ), + ], ) @Suppress("unused") object RestoreOldVideoQualityMenuPatch : BytecodePatch( - setOf(VideoQualityMenuViewInflateFingerprint, VideoQualityMenuOptionsFingerprint) + setOf(VideoQualityMenuViewInflateFingerprint, VideoQualityMenuOptionsFingerprint), ) { private const val FILTER_CLASS_DESCRIPTOR = - "Lapp/revanced/integrations/youtube/patches/components/VideoQualityMenuFilterPatch;" + "Lapp/revanced/integrations/youtube/patches/components/VideoQualityMenuFilterPatch;" private const val INTEGRATIONS_CLASS_DESCRIPTOR = - "Lapp/revanced/integrations/youtube/patches/playback/quality/RestoreOldVideoQualityMenuPatch;" + "Lapp/revanced/integrations/youtube/patches/playback/quality/RestoreOldVideoQualityMenuPatch;" override fun execute(context: BytecodeContext) { // region Patch for the old type of the video quality menu. @@ -75,31 +80,30 @@ object RestoreOldVideoQualityMenuPatch : BytecodePatch( addInstruction( checkCastIndex + 1, "invoke-static { v$listViewRegister }, " + - "$INTEGRATIONS_CLASS_DESCRIPTOR->" + - "showOldVideoQualityMenu(Landroid/widget/ListView;)V" + "$INTEGRATIONS_CLASS_DESCRIPTOR->" + + "showOldVideoQualityMenu(Landroid/widget/ListView;)V", ) } } // Force YT to add the 'advanced' quality menu for Shorts. VideoQualityMenuOptionsFingerprint.resultOrThrow().let { - val result = it.scanResult.patternScanResult!! - val startIndex = result.startIndex - val endIndex = result.endIndex + val scanResult = it.scanResult.patternScanResult!! + val startIndex = scanResult.startIndex + if (startIndex != 0) throw PatchException("Unexpected opcode start index: $startIndex") + val insertIndex = scanResult.endIndex it.mutableMethod.apply { - val freeRegister = getInstruction(startIndex).registerA + val register = getInstruction(insertIndex).registerA // A condition controls whether to show the three or four items quality menu. // Force the four items quality menu to make the "Advanced" item visible, necessary for the patch. - addInstructionsWithLabels( - startIndex + 1, + addInstructions( + insertIndex, """ - invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->forceAdvancedVideoQualityMenuCreation()Z - move-result v$freeRegister - if-nez v$freeRegister, :includeAdvancedMenu + invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->forceAdvancedVideoQualityMenuCreation(Z)Z + move-result v$register """, - ExternalLabel("includeAdvancedMenu", getInstruction(endIndex)) ) } } @@ -115,4 +119,4 @@ object RestoreOldVideoQualityMenuPatch : BytecodePatch( // endregion } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/fingerprints/VideoQualityMenuOptionsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/fingerprints/VideoQualityMenuOptionsFingerprint.kt index 0d1a2cc6..6f72da51 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/fingerprints/VideoQualityMenuOptionsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/fingerprints/VideoQualityMenuOptionsFingerprint.kt @@ -10,13 +10,11 @@ internal object VideoQualityMenuOptionsFingerprint : LiteralValueFingerprint( parameters = listOf("Landroid/content/Context", "L", "L"), returnType = "[L", opcodes = listOf( - Opcode.IF_EQZ, // Check if advanced menu should be shown. - Opcode.NEW_ARRAY, - Opcode.APUT_OBJECT, - Opcode.APUT_OBJECT, - Opcode.APUT_OBJECT, - Opcode.RETURN_OBJECT, - Opcode.CONST_4 // Advanced menu code path. + Opcode.CONST_4, // First instruction of method. + Opcode.CONST_4, + Opcode.IF_EQZ, + Opcode.IGET_BOOLEAN, // Use the quality menu, that contains the advanced menu. + Opcode.IF_NEZ ), literalSupplier = { RestoreOldVideoQualityMenuResourcePatch.videoQualityQuickMenuAdvancedMenuDescription } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/util/BytecodeUtils.kt b/src/main/kotlin/app/revanced/util/BytecodeUtils.kt index ccd9c1b0..acc989c3 100644 --- a/src/main/kotlin/app/revanced/util/BytecodeUtils.kt +++ b/src/main/kotlin/app/revanced/util/BytecodeUtils.kt @@ -143,8 +143,41 @@ inline fun Instruction.getReference() = (this as? Refere * @param predicate The predicate to match. * @return The index of the first [Instruction] that matches the predicate. */ -fun Method.indexOfFirstInstruction(predicate: Instruction.() -> Boolean) = - this.implementation!!.instructions.indexOfFirst(predicate) +// TODO: delete this on next major release, the overloaded method with an optional start index serves the same purposes. +@Deprecated("Use the overloaded method with an optional start index.", ReplaceWith("indexOfFirstInstruction(predicate)")) +fun Method.indexOfFirstInstruction(predicate: Instruction.() -> Boolean) = indexOfFirstInstruction(0, predicate) + +/** + * Get the index of the first [Instruction] that matches the predicate, starting from [startIndex]. + * + * @param startIndex Optional starting index to start searching from. + * @return -1 if the instruction is not found. + * @see indexOfFirstInstructionOrThrow + */ +fun Method.indexOfFirstInstruction(startIndex: Int = 0, predicate: Instruction.() -> Boolean): Int { + val index = this.implementation!!.instructions.drop(startIndex).indexOfFirst(predicate) + + return if (index >= 0) { + startIndex + index + } else { + -1 + } +} + +/** + * Get the index of the first [Instruction] that matches the predicate, starting from [startIndex]. + * + * @return the index of the instruction + * @throws PatchException + * @see indexOfFirstInstruction + */ +fun Method.indexOfFirstInstructionOrThrow(startIndex: Int = 0, predicate: Instruction.() -> Boolean): Int { + val index = indexOfFirstInstruction(startIndex, predicate) + if (index < 0) { + throw PatchException("Could not find instruction index") + } + return index +} /** * Return the resolved methods of [MethodFingerprint]s early. From 48aaef50723868f6c521494ab1bb8f96fa18579a Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 1 Jun 2024 18:10:28 +0000 Subject: [PATCH 10/14] chore(release): 4.9.0-dev.5 [skip ci] # [4.9.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.4...v4.9.0-dev.5) (2024-06-01) ### Features * **YouTube:** Support version `19.12`, `19.13`, `19.14`, `19.15` and `19.16` ([#3239](https://github.com/ReVanced/revanced-patches/issues/3239)) ([99b07e0](https://github.com/ReVanced/revanced-patches/commit/99b07e0e18574668f36bb3c962c8d11222114be4)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c61f10db..524f629e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [4.9.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.4...v4.9.0-dev.5) (2024-06-01) + + +### Features + +* **YouTube:** Support version `19.12`, `19.13`, `19.14`, `19.15` and `19.16` ([#3239](https://github.com/ReVanced/revanced-patches/issues/3239)) ([99b07e0](https://github.com/ReVanced/revanced-patches/commit/99b07e0e18574668f36bb3c962c8d11222114be4)) + # [4.9.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.3...v4.9.0-dev.4) (2024-06-01) diff --git a/gradle.properties b/gradle.properties index 0ff338cf..6141dc48 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 4.9.0-dev.4 +version = 4.9.0-dev.5 From 95f290f1139cc8679beecac53c623847668f885e Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 2 Jun 2024 17:43:41 +0200 Subject: [PATCH 11/14] fix(YouTube - Spoof client): Restore playback speed menu when spoofing to an iOS client --- .../misc/fix/playback/SpoofClientPatch.kt | 91 ++++++++++++------- .../CreatePlaybackSpeedMenuItemFingerprint.kt | 22 +++++ ...PlayerGestureConfigSyntheticFingerprint.kt | 28 +++--- .../resources/addresources/values/strings.xml | 2 +- 4 files changed, 92 insertions(+), 51 deletions(-) create mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/CreatePlaybackSpeedMenuItemFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt index 36fc572c..c008f673 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt @@ -14,14 +14,8 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patches.all.misc.resources.AddResourcesPatch import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen -import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen.Sorting import app.revanced.patches.shared.misc.settings.preference.SwitchPreference -import app.revanced.patches.youtube.misc.fix.playback.fingerprints.BuildInitPlaybackRequestFingerprint -import app.revanced.patches.youtube.misc.fix.playback.fingerprints.BuildPlayerRequestURIFingerprint -import app.revanced.patches.youtube.misc.fix.playback.fingerprints.CreatePlayerRequestBodyFingerprint -import app.revanced.patches.youtube.misc.fix.playback.fingerprints.CreatePlayerRequestBodyWithModelFingerprint -import app.revanced.patches.youtube.misc.fix.playback.fingerprints.PlayerGestureConfigSyntheticFingerprint -import app.revanced.patches.youtube.misc.fix.playback.fingerprints.SetPlayerRequestClientTypeFingerprint +import app.revanced.patches.youtube.misc.fix.playback.fingerprints.* import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionOrThrow @@ -86,6 +80,9 @@ object SpoofClientPatch : BytecodePatch( // Player gesture config. PlayerGestureConfigSyntheticFingerprint, + + // Player speed menu item. + CreatePlaybackSpeedMenuItemFingerprint, ), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = @@ -99,7 +96,7 @@ object SpoofClientPatch : BytecodePatch( SettingsPatch.PreferenceScreen.MISC.addPreferences( PreferenceScreen( key = "revanced_spoof_client_screen", - sorting = Sorting.UNSORTED, + sorting = PreferenceScreen.Sorting.UNSORTED, preferences = setOf( SwitchPreference("revanced_spoof_client"), SwitchPreference("revanced_spoof_client_use_ios"), @@ -127,33 +124,6 @@ object SpoofClientPatch : BytecodePatch( // endregion - // region fix player gesture. - - PlayerGestureConfigSyntheticFingerprint.resultOrThrow().let { - val endIndex = it.scanResult.patternScanResult!!.endIndex - - arrayOf(3, 9).forEach { offSet -> - (context.toMethodWalker(it.mutableMethod) - .nextMethod(endIndex - offSet, true) - .getMethod() as MutableMethod) - .apply { - - val index = implementation!!.instructions.lastIndex - val register = getInstruction(index).registerA - - addInstructions( - index, - """ - invoke-static {v$register}, $INTEGRATIONS_CLASS_DESCRIPTOR->enablePlayerGesture(Z)Z - move-result v$register - """ - ) - } - } - } - - // endregion - // region Block /get_watch requests to fall back to /player requests. BuildPlayerRequestURIFingerprint.resultOrThrow().let { @@ -281,5 +251,56 @@ object SpoofClientPatch : BytecodePatch( // endregion + // region Fix player gesture if spoofing to iOS. + + PlayerGestureConfigSyntheticFingerprint.resultOrThrow().let { + val endIndex = it.scanResult.patternScanResult!!.endIndex + val downAndOutLandscapeAllowedIndex = endIndex - 3 + val downAndOutPortraitAllowedIndex = endIndex - 9 + + arrayOf( + downAndOutLandscapeAllowedIndex, + downAndOutPortraitAllowedIndex, + ).forEach { index -> + val gestureAllowedMethod = context.toMethodWalker(it.mutableMethod) + .nextMethod(index, true) + .getMethod() as MutableMethod + + gestureAllowedMethod.apply { + val isAllowedIndex = getInstructions().lastIndex + val isAllowed = getInstruction(isAllowedIndex).registerA + + addInstructions( + isAllowedIndex, + """ + invoke-static { v$isAllowed }, $INTEGRATIONS_CLASS_DESCRIPTOR->enablePlayerGesture(Z)Z + move-result v$isAllowed + """, + ) + } + } + } + + // endregion + + // Fix playback speed menu item if spoofing to iOS. + + CreatePlaybackSpeedMenuItemFingerprint.resultOrThrow().let { + val shouldCreateMenuIndex = it.scanResult.patternScanResult!!.endIndex + + it.mutableMethod.apply { + val shouldCreateMenuRegister = getInstruction(shouldCreateMenuIndex).registerA + + addInstructions( + shouldCreateMenuIndex, + """ + invoke-static { v$shouldCreateMenuRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->forceCreatePlaybackSpeedMenu(Z)Z + move-result v$shouldCreateMenuRegister + """, + ) + } + } + + // endregion } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/CreatePlaybackSpeedMenuItemFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/CreatePlaybackSpeedMenuItemFingerprint.kt new file mode 100644 index 00000000..389977dd --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/CreatePlaybackSpeedMenuItemFingerprint.kt @@ -0,0 +1,22 @@ +package app.revanced.patches.youtube.misc.fix.playback.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags +import com.android.tools.smali.dexlib2.Opcode + +internal object CreatePlaybackSpeedMenuItemFingerprint : MethodFingerprint( + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + returnType = "V", + parameters = listOf("[L", "F"), + opcodes = listOf( + Opcode.IGET_OBJECT, + Opcode.IGET_OBJECT, + Opcode.IGET_OBJECT, + Opcode.CONST_4, + Opcode.IF_EQZ, + Opcode.INVOKE_INTERFACE, + Opcode.MOVE_RESULT, // Return value controls the creation of the playback speed menu item. + Opcode.IF_EQZ, // If the return value is false, the playback speed menu item is not created. + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerGestureConfigSyntheticFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerGestureConfigSyntheticFingerprint.kt index bbf66cb3..d691d7cf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerGestureConfigSyntheticFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerGestureConfigSyntheticFingerprint.kt @@ -1,9 +1,7 @@ package app.revanced.patches.youtube.misc.fix.playback.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.MethodFingerprint -import app.revanced.patches.youtube.misc.fix.playback.fingerprints.PlayerGestureConfigSyntheticFingerprint.indexOfDownAndOutAllowedInstruction import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstruction import com.android.tools.smali.dexlib2.AccessFlags @@ -24,28 +22,28 @@ internal object PlayerGestureConfigSyntheticFingerprint : MethodFingerprint( Opcode.IGET_OBJECT, Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT, - Opcode.INVOKE_VIRTUAL, // playerGestureConfig.downAndOutLandscapeAllowed + Opcode.INVOKE_VIRTUAL, // playerGestureConfig.downAndOutLandscapeAllowed. Opcode.MOVE_RESULT, Opcode.CHECK_CAST, Opcode.IPUT_BOOLEAN, Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT, - Opcode.INVOKE_VIRTUAL, // playerGestureConfig.downAndOutPortraitAllowed + Opcode.INVOKE_VIRTUAL, // playerGestureConfig.downAndOutPortraitAllowed. Opcode.MOVE_RESULT, Opcode.IPUT_BOOLEAN, Opcode.RETURN_VOID, ), customFingerprint = { methodDef, classDef -> - // This method is always called "a" because this kind of class always has a single method. - methodDef.name == "a" && classDef.methods.count() == 2 && - indexOfDownAndOutAllowedInstruction(methodDef) >= 0 - } -) { - fun indexOfDownAndOutAllowedInstruction(methodDef: Method) = - methodDef.indexOfFirstInstruction { - val reference = getReference() - reference?.definingClass == "Lcom/google/android/libraries/youtube/innertube/model/media/PlayerConfigModel;" && + fun indexOfDownAndOutAllowedInstruction(methodDef: Method) = + methodDef.indexOfFirstInstruction { + val reference = getReference() + reference?.definingClass == "Lcom/google/android/libraries/youtube/innertube/model/media/PlayerConfigModel;" && reference.parameterTypes.isEmpty() && reference.returnType == "Z" - } -} \ No newline at end of file + } + + // This method is always called "a" because this kind of class always has a single method. + methodDef.name == "a" && classDef.methods.count() == 2 && + indexOfDownAndOutAllowedInstruction(methodDef) >= 0 + }, +) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index cae84e50..34b2a380 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1096,7 +1096,7 @@ Client is not spoofed\n\nVideo playback may not work Turning off this setting may cause video playback issues. Spoof client to iOS - Client is currently spoofed to iOS\n\nSide effects include:\n• No HDR video\n• Speed menu is missing\n• Watch history may not work\n• Live streams cannot play as audio only\n• Live streams not available on older devices + Client is currently spoofed to iOS\n\nSide effects include:\n• No HDR video\n• Watch history may not work\n• Live streams cannot play as audio only\n• Live streams not available on older devices Client is currently spoofed to Android VR\n\nSide effects include:\n• No HDR video\n• Kids videos do not playback\n• Paused videos can randomly resume Spoof client thumbnails not available (API timed out) Spoof client thumbnails temporarily not available: %s From 8f2359febc9bdfd3cf8b762a03c62e6294a487d0 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 2 Jun 2024 15:46:01 +0000 Subject: [PATCH 12/14] chore(release): 4.9.0-dev.6 [skip ci] # [4.9.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.5...v4.9.0-dev.6) (2024-06-02) ### Bug Fixes * **YouTube - Spoof client:** Restore playback speed menu when spoofing to an iOS client ([95f290f](https://github.com/ReVanced/revanced-patches/commit/95f290f1139cc8679beecac53c623847668f885e)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 524f629e..36cd5ca3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [4.9.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.5...v4.9.0-dev.6) (2024-06-02) + + +### Bug Fixes + +* **YouTube - Spoof client:** Restore playback speed menu when spoofing to an iOS client ([95f290f](https://github.com/ReVanced/revanced-patches/commit/95f290f1139cc8679beecac53c623847668f885e)) + # [4.9.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.4...v4.9.0-dev.5) (2024-06-01) diff --git a/gradle.properties b/gradle.properties index 6141dc48..4527f684 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 4.9.0-dev.5 +version = 4.9.0-dev.6 From ad00305ff57d5e8041de7375bea7d3ad6f18c4e2 Mon Sep 17 00:00:00 2001 From: MarcaD <152095496+MarcaDian@users.noreply.github.com> Date: Sun, 2 Jun 2024 18:48:35 +0300 Subject: [PATCH 13/14] feat(YouTube - Playback speed): Add option to show speed dialog button in video player (#3197) Co-authored-by: oSumAtrIX --- api/revanced-patches.api | 6 +++ .../youtube/video/speed/PlaybackSpeedPatch.kt | 12 ++++-- .../speed/button/PlaybackSpeedButtonPatch.kt | 38 +++++++++++++++++++ .../PlaybackSpeedButtonResourcePatch.kt | 25 ++++++++++++ .../resources/addresources/values/strings.xml | 5 +++ .../revanced_playback_speed_dialog_button.xml | 30 +++++++++++++++ .../youtube_controls_bottom_ui_container.xml | 4 ++ 7 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonPatch.kt create mode 100644 src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonResourcePatch.kt create mode 100644 src/main/resources/speedbutton/drawable/revanced_playback_speed_dialog_button.xml create mode 100644 src/main/resources/speedbutton/host/layout/youtube_controls_bottom_ui_container.xml diff --git a/api/revanced-patches.api b/api/revanced-patches.api index ac962636..75d89226 100644 --- a/api/revanced-patches.api +++ b/api/revanced-patches.api @@ -1840,6 +1840,12 @@ public final class app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch : public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } +public final class app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonPatch; + public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V + public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V +} + public final class app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch : app/revanced/patcher/patch/BytecodePatch { public static final field INSTANCE Lapp/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt index 24444979..7cdb7d06 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt @@ -4,13 +4,19 @@ import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.youtube.video.speed.button.PlaybackSpeedButtonPatch import app.revanced.patches.youtube.video.speed.custom.CustomPlaybackSpeedPatch import app.revanced.patches.youtube.video.speed.remember.RememberPlaybackSpeedPatch @Patch( name = "Playback speed", - description = "Adds options to customize available playback speeds and to remember the last playback speed selected.", - dependencies = [CustomPlaybackSpeedPatch::class, RememberPlaybackSpeedPatch::class], + description = "Adds options to customize available playback speeds, remember the last playback speed selected " + + "and show a speed dialog button to the video player.", + dependencies = [ + PlaybackSpeedButtonPatch::class, + CustomPlaybackSpeedPatch::class, + RememberPlaybackSpeedPatch::class, + ], compatiblePackages = [ CompatiblePackage( "com.google.android.youtube", @@ -42,4 +48,4 @@ object PlaybackSpeedPatch : BytecodePatch(emptySet()) { override fun execute(context: BytecodeContext) { // All patches this patch depends on succeed. } -} +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonPatch.kt new file mode 100644 index 00000000..19895fa8 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonPatch.kt @@ -0,0 +1,38 @@ +package app.revanced.patches.youtube.video.speed.button + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.all.misc.resources.AddResourcesPatch +import app.revanced.patches.shared.misc.settings.preference.SwitchPreference +import app.revanced.patches.youtube.misc.playercontrols.PlayerControlsBytecodePatch +import app.revanced.patches.youtube.misc.settings.SettingsPatch +import app.revanced.patches.youtube.video.speed.custom.CustomPlaybackSpeedPatch + +@Patch( + description = "Adds the option to display playback speed dialog button in the video player.", + dependencies = [ + PlaybackSpeedButtonResourcePatch::class, + CustomPlaybackSpeedPatch::class, + PlayerControlsBytecodePatch::class, + SettingsPatch::class, + AddResourcesPatch::class, + ], +) +@Suppress("unused") +object PlaybackSpeedButtonPatch : BytecodePatch(emptySet()) { + private const val SPEED_BUTTON_CLASS_DESCRIPTOR = + "Lapp/revanced/integrations/youtube/videoplayer/PlaybackSpeedDialogButton;" + + override fun execute(context: BytecodeContext) { + + AddResourcesPatch(this::class) + + SettingsPatch.PreferenceScreen.PLAYER.addPreferences( + SwitchPreference("revanced_playback_speed_dialog_button"), + ) + + PlayerControlsBytecodePatch.initializeControl("$SPEED_BUTTON_CLASS_DESCRIPTOR->initializeButton(Landroid/view/View;)V") + PlayerControlsBytecodePatch.injectVisibilityCheckCall("$SPEED_BUTTON_CLASS_DESCRIPTOR->changeVisibility(Z)V") + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonResourcePatch.kt new file mode 100644 index 00000000..ffc8d8f1 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonResourcePatch.kt @@ -0,0 +1,25 @@ +package app.revanced.patches.youtube.video.speed.button + +import app.revanced.patcher.data.ResourceContext +import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.youtube.misc.playercontrols.BottomControlsResourcePatch +import app.revanced.util.ResourceGroup +import app.revanced.util.copyResources + +@Patch( + dependencies = [BottomControlsResourcePatch::class], +) +internal object PlaybackSpeedButtonResourcePatch : ResourcePatch() { + override fun execute(context: ResourceContext) { + context.copyResources( + "speedbutton", + ResourceGroup( + "drawable", + "revanced_playback_speed_dialog_button.xml", + ), + ) + + BottomControlsResourcePatch.addControls("speedbutton") + } +} diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index 34b2a380..dc0f814e 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1065,6 +1065,11 @@ wifi Changed default %1$s quality to: %2$s + + Show speed dialog button + Button is shown + Button is not shown + Custom playback speeds Add or change the available playback speeds diff --git a/src/main/resources/speedbutton/drawable/revanced_playback_speed_dialog_button.xml b/src/main/resources/speedbutton/drawable/revanced_playback_speed_dialog_button.xml new file mode 100644 index 00000000..b42dd57f --- /dev/null +++ b/src/main/resources/speedbutton/drawable/revanced_playback_speed_dialog_button.xml @@ -0,0 +1,30 @@ + + + + + diff --git a/src/main/resources/speedbutton/host/layout/youtube_controls_bottom_ui_container.xml b/src/main/resources/speedbutton/host/layout/youtube_controls_bottom_ui_container.xml new file mode 100644 index 00000000..ddd8a125 --- /dev/null +++ b/src/main/resources/speedbutton/host/layout/youtube_controls_bottom_ui_container.xml @@ -0,0 +1,4 @@ + + + + From ecf6b748af57ed9adc16671f662a530ee3ff62dd Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 2 Jun 2024 15:50:45 +0000 Subject: [PATCH 14/14] chore(release): 4.9.0-dev.7 [skip ci] # [4.9.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.6...v4.9.0-dev.7) (2024-06-02) ### Features * **YouTube - Playback speed:** Add option to show speed dialog button in video player ([#3197](https://github.com/ReVanced/revanced-patches/issues/3197)) ([ad00305](https://github.com/ReVanced/revanced-patches/commit/ad00305ff57d5e8041de7375bea7d3ad6f18c4e2)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36cd5ca3..3d0383b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [4.9.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.6...v4.9.0-dev.7) (2024-06-02) + + +### Features + +* **YouTube - Playback speed:** Add option to show speed dialog button in video player ([#3197](https://github.com/ReVanced/revanced-patches/issues/3197)) ([ad00305](https://github.com/ReVanced/revanced-patches/commit/ad00305ff57d5e8041de7375bea7d3ad6f18c4e2)) + # [4.9.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v4.9.0-dev.5...v4.9.0-dev.6) (2024-06-02) diff --git a/gradle.properties b/gradle.properties index 4527f684..c76c0f2a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 4.9.0-dev.6 +version = 4.9.0-dev.7