diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt index f981e31e0..b3bc0a593 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt @@ -26,6 +26,7 @@ import app.revanced.patches.youtube.misc.recyclerviewtree.hook.recyclerViewTreeH import app.revanced.patches.youtube.misc.settings.settingsPatch import app.revanced.patches.youtube.video.speed.settingsMenuVideoSpeedGroup import app.revanced.util.indexOfFirstLiteralInstructionOrThrow +import app.revanced.util.returnEarly import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.immutable.ImmutableField @@ -33,7 +34,7 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableField private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/components/PlaybackSpeedMenuFilter;" -internal const val EXTENSION_CLASS_DESCRIPTOR = +private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/playback/speed/CustomPlaybackSpeedPatch;" internal val customPlaybackSpeedPatch = bytecodePatch( @@ -59,7 +60,7 @@ internal val customPlaybackSpeedPatch = bytecodePatch( TextPreference( "revanced_custom_playback_speeds", inputType = InputType.TEXT_MULTI_LINE - ), + ) ) ) @@ -82,6 +83,11 @@ internal val customPlaybackSpeedPatch = bytecodePatch( replaceInstruction(limitMaxIndex, "const/high16 v$limitMaxRegister, 8.0f") } + // Turn off client side flag that use server provided min/max speeds. + if (is_20_34_or_greater) { + serverSideMaxSpeedFeatureFlagFingerprint.method.returnEarly(false) + } + // region Force old video quality menu. // Replace the speeds float array with custom speeds. @@ -173,9 +179,9 @@ internal val customPlaybackSpeedPatch = bytecodePatch( addInstructions( index + 1, """ - invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->tapAndHoldSpeed()F - move-result v$register - """ + invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->tapAndHoldSpeed()F + move-result v$register + """ ) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/Fingerprints.kt index 657bd1162..cbdd2730b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/Fingerprints.kt @@ -28,6 +28,14 @@ internal val showOldPlaybackSpeedMenuExtensionFingerprint = fingerprint { custom { method, _ -> method.name == "showOldPlaybackSpeedMenu" } } +internal val serverSideMaxSpeedFeatureFlagFingerprint = fingerprint { + accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) + returns("Z") + instructions( + literal(45719140L) + ) +} + internal val speedArrayGeneratorFingerprint = fingerprint { accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC) returns("[L")